blob: dbfaf534d730d75d19f15e4c0f7d990083e6bfad [file] [log] [blame]
Daniel Veillardd93f6252004-11-02 15:53:51 +00001/*
2 * testapi.c: libxml2 API tester program.
3 *
4 * Automatically generated by gentest.py from libxml2-api.xml
5 *
6 * See Copyright for the status of this software.
7 *
8 * daniel@veillard.com
9 */
10
11#include <stdio.h>
Daniel Veillardce244ad2004-11-05 10:03:46 +000012#include <string.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000013#include <libxml/xmlerror.h>
Daniel Veillard3d97e662004-11-04 10:49:00 +000014#include <libxml/relaxng.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000015
16static int testlibxml2(void);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017static int test_module(const char *module);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018
19static int generic_errors = 0;
20static int call_tests = 0;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021static int function_tests = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022
Daniel Veillard5ea30d72004-11-08 11:54:28 +000023static xmlChar chartab[1024];
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000024static int inttab[1024];
25static unsigned long longtab[1024];
Daniel Veillardce244ad2004-11-05 10:03:46 +000026
27static xmlDocPtr api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000028static xmlDtdPtr api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000029static xmlNodePtr api_root = NULL;
30static xmlAttrPtr api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000031static xmlNsPtr api_ns = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032
Daniel Veillardd93f6252004-11-02 15:53:51 +000033static void
34structured_errors(void *userData ATTRIBUTE_UNUSED,
35 xmlErrorPtr error ATTRIBUTE_UNUSED) {
36 generic_errors++;
37}
38
Daniel Veillardce244ad2004-11-05 10:03:46 +000039static void
40free_api_doc(void) {
41 xmlFreeDoc(api_doc);
42 api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000043 api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000044 api_root = NULL;
45 api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000046 api_ns = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000047}
48
49static xmlDocPtr
50get_api_doc(void) {
51 if (api_doc == NULL) {
Daniel Veillard27f20102004-11-05 11:50:11 +000052 api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0);
Daniel Veillardce244ad2004-11-05 10:03:46 +000053 api_root = NULL;
54 api_attr = NULL;
55 }
56 return(api_doc);
57}
58
Daniel Veillard27f20102004-11-05 11:50:11 +000059static xmlDtdPtr
60get_api_dtd(void) {
61 if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) {
62 get_api_doc();
63 if ((api_doc != NULL) && (api_doc->children != NULL) &&
64 (api_doc->children->type == XML_DTD_NODE))
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000065 api_dtd = (xmlDtdPtr) api_doc->children;
Daniel Veillard27f20102004-11-05 11:50:11 +000066 }
67 return(api_dtd);
68}
69
Daniel Veillardce244ad2004-11-05 10:03:46 +000070static xmlNodePtr
71get_api_root(void) {
72 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
73 get_api_doc();
74 if ((api_doc != NULL) && (api_doc->children != NULL) &&
Daniel Veillard27f20102004-11-05 11:50:11 +000075 (api_doc->children->next != NULL) &&
76 (api_doc->children->next->type == XML_ELEMENT_NODE))
77 api_root = api_doc->children->next;
Daniel Veillardce244ad2004-11-05 10:03:46 +000078 }
79 return(api_root);
80}
81
Daniel Veillard27f20102004-11-05 11:50:11 +000082static xmlNsPtr
83get_api_ns(void) {
84 get_api_root();
85 if (api_root != NULL)
86 api_ns = api_root->nsDef;
87 return(api_ns);
88}
89
Daniel Veillardce244ad2004-11-05 10:03:46 +000090static xmlAttrPtr
91get_api_attr(void) {
Daniel Veillardc8311492004-11-08 16:51:13 +000092#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000093 static int nr = 0;
94 xmlChar name[20];
Daniel Veillardc8311492004-11-08 16:51:13 +000095#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000096
97 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
98 get_api_root();
99 }
100 if (api_root == NULL)
101 return(NULL);
102 if (api_root->properties != NULL) {
103 api_attr = api_root->properties;
104 return(api_root->properties);
105 }
Daniel Veillardc8311492004-11-08 16:51:13 +0000106 api_attr = NULL;
107#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +0000108 snprintf((char *) name, 20, "foo%d", nr++);
109 api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar");
Daniel Veillardc8311492004-11-08 16:51:13 +0000110#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +0000111 return(api_attr);
112}
113
114int main(int argc, char **argv) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000115 int ret;
116 int blocks, mem;
117
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000118 memset(chartab, 0, sizeof(chartab));
Daniel Veillardc8311492004-11-08 16:51:13 +0000119 strncpy((char *) chartab, " chartab\n", 20);
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000120 memset(inttab, 0, sizeof(inttab));
121 memset(longtab, 0, sizeof(longtab));
122
Daniel Veillarda03e3652004-11-02 18:45:30 +0000123 xmlInitParser();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000124#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000125 xmlRelaxNGInitTypes();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000126#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +0000127
Daniel Veillardd93f6252004-11-02 15:53:51 +0000128 LIBXML_TEST_VERSION
129
130 xmlSetStructuredErrorFunc(NULL, structured_errors);
131
Daniel Veillardce244ad2004-11-05 10:03:46 +0000132 if (argc == 2)
133 ret = test_module(argv[1]);
134 else
135 ret = testlibxml2();
Daniel Veillardd93f6252004-11-02 15:53:51 +0000136
137 xmlCleanupParser();
138 blocks = xmlMemBlocks();
139 mem = xmlMemUsed();
140 if ((blocks != 0) || (mem != 0)) {
141 printf("testapi leaked %d bytes in %d blocks\n", mem, blocks);
142 }
143 xmlMemoryDump();
144
145 return (ret != 0);
146}
147
148#include <libxml/HTMLparser.h>
149#include <libxml/HTMLtree.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000150#include <libxml/catalog.h>
151#include <libxml/chvalid.h>
152#include <libxml/dict.h>
153#include <libxml/encoding.h>
154#include <libxml/entities.h>
155#include <libxml/hash.h>
156#include <libxml/list.h>
157#include <libxml/nanoftp.h>
158#include <libxml/nanohttp.h>
159#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +0000160#include <libxml/parserInternals.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000161#include <libxml/pattern.h>
162#include <libxml/relaxng.h>
163#include <libxml/schemasInternals.h>
164#include <libxml/tree.h>
165#include <libxml/uri.h>
166#include <libxml/valid.h>
167#include <libxml/xinclude.h>
168#include <libxml/xmlIO.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000169#include <libxml/xmlerror.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000170#include <libxml/xmlreader.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000171#include <libxml/xmlsave.h>
172#include <libxml/xmlschemas.h>
173#include <libxml/xmlschemastypes.h>
174#include <libxml/xmlstring.h>
175#include <libxml/xmlwriter.h>
176#include <libxml/xpath.h>
177#include <libxml/xpointer.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000178
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000179#define gen_nb_void_ptr 2
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000180
Daniel Veillard3d97e662004-11-04 10:49:00 +0000181static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000182 return(NULL);
183}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000184static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000185}
186
Daniel Veillardce244ad2004-11-05 10:03:46 +0000187#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000188#define gen_nb_const_void_ptr 2
189
190static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) {
191 if (no == 0) return((const void *) "immutable string");
192 return(NULL);
193}
194static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
195}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000196#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000197
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000198#define gen_nb_userdata 3
199
Daniel Veillard3d97e662004-11-04 10:49:00 +0000200static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000201 if (no == 0) return((void *) &call_tests);
202 if (no == 1) return((void *) -1);
203 return(NULL);
204}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000205static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000206}
207
208
Daniel Veillardd93f6252004-11-02 15:53:51 +0000209#define gen_nb_int 4
210
Daniel Veillard3d97e662004-11-04 10:49:00 +0000211static int gen_int(int no, int nr ATTRIBUTE_UNUSED) {
212 if (no == 0) return(0);
213 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000214 if (no == 2) return(-1);
215 if (no == 3) return(122);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000216 return(-1);
217}
218
219static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
220}
221
Daniel Veillardce244ad2004-11-05 10:03:46 +0000222#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000223#define gen_nb_long 4
224
225static long gen_long(int no, int nr ATTRIBUTE_UNUSED) {
226 if (no == 0) return(0);
227 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000228 if (no == 2) return(-1);
229 if (no == 3) return(122);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000230 return(-1);
231}
232
233static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
234}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000235#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000236
Daniel Veillard3d97e662004-11-04 10:49:00 +0000237#define gen_nb_unsigned_int 3
238
239static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000240 if (no == 0) return(0);
241 if (no == 1) return(1);
242 if (no == 2) return(122);
243 return(-1);
244}
245
Daniel Veillard3d97e662004-11-04 10:49:00 +0000246static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000247}
248
Daniel Veillard3d95c732004-11-06 22:25:14 +0000249#define gen_nb_unsigned_long 4
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000250
251static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
252 if (no == 0) return(0);
253 if (no == 1) return(1);
254 if (no == 2) return(122);
255 return(-1);
256}
257
258static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
259}
260
Daniel Veillard3d95c732004-11-06 22:25:14 +0000261#define gen_nb_double 4
262
263static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
264 if (no == 0) return(0);
265 if (no == 1) return(-1.1);
Daniel Veillardc8311492004-11-08 16:51:13 +0000266#if defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +0000267 if (no == 2) return(xmlXPathNAN);
Daniel Veillardc8311492004-11-08 16:51:13 +0000268#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000269 return(-1);
270}
271
272static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
273}
274
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000275#define gen_nb_unsigned_long_ptr 2
276
277static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
278 if (no == 0) return(&longtab[nr]);
279 return(NULL);
280}
281
282static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
283}
284
285#define gen_nb_int_ptr 2
286
287static int *gen_int_ptr(int no, int nr) {
288 if (no == 0) return(&inttab[nr]);
289 return(NULL);
290}
291
292static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
293}
294
Daniel Veillardd93f6252004-11-02 15:53:51 +0000295#define gen_nb_const_char_ptr 4
296
Daniel Veillardce682bc2004-11-05 17:22:25 +0000297static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) {
298 if (no == 0) return((char *) "foo");
299 if (no == 1) return((char *) "<foo/>");
300 if (no == 2) return((char *) "test/ent2");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000301 return(NULL);
302}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000303static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000304}
305
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000306#define gen_nb_xmlChar_ptr 2
307
Daniel Veillard3d97e662004-11-04 10:49:00 +0000308static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000309 if (no == 0) return(&chartab[0]);
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000310 return(NULL);
311}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000312static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000313}
314
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000315#define gen_nb_FILE_ptr 2
316
317static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) {
318 if (no == 0) return(fopen("test.out", "a+"));
319 return(NULL);
320}
321static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
322 if (val != NULL) fclose(val);
323}
324
Daniel Veillarda82b1822004-11-08 16:24:57 +0000325#define gen_nb_debug_FILE_ptr 2
326static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
327 return(fopen("test.out", "a+"));
328}
329static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
330 if (val != NULL) fclose(val);
331}
332
Daniel Veillardd93f6252004-11-02 15:53:51 +0000333#define gen_nb_const_xmlChar_ptr 5
334
Daniel Veillardce682bc2004-11-05 17:22:25 +0000335static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
336 if (no == 0) return((xmlChar *) "foo");
337 if (no == 1) return((xmlChar *) "<foo/>");
338 if (no == 2) return((xmlChar *) "nøne");
339 if (no == 3) return((xmlChar *) " 2ab ");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000340 return(NULL);
341}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000342static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED, const xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000343}
344
345#define gen_nb_filepath 8
346
Daniel Veillard3d97e662004-11-04 10:49:00 +0000347static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000348 if (no == 0) return("missing.xml");
349 if (no == 1) return("<foo/>");
350 if (no == 2) return("test/ent2");
351 if (no == 3) return("test/valid/REC-xml-19980210.xml");
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000352 if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000353 if (no == 5) return("http://missing.example.org/");
354 if (no == 6) return("http://missing. example.org/");
355 return(NULL);
356}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000357static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000358}
359
Daniel Veillard27f20102004-11-05 11:50:11 +0000360#define gen_nb_eaten_name 2
361
362static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000363 if (no == 0) return(xmlStrdup(BAD_CAST "eaten"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000364 return(NULL);
365}
366static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
367}
368
Daniel Veillardd93f6252004-11-02 15:53:51 +0000369#define gen_nb_fileoutput 6
370
Daniel Veillard3d97e662004-11-04 10:49:00 +0000371static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000372 if (no == 0) return("/missing.xml");
373 if (no == 1) return("<foo/>");
374 if (no == 2) return("ftp://missing.example.org/foo");
375 if (no == 3) return("http://missing.example.org/");
376 if (no == 4) return("http://missing. example.org/");
377 return(NULL);
378}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000379static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000380}
381
382#define gen_nb_xmlParserCtxtPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000383static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000384 if (no == 0) return(xmlNewParserCtxt());
385 return(NULL);
386}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000387static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000388 if (val != NULL)
389 xmlFreeParserCtxt(val);
390}
391
Daniel Veillard34099b42004-11-04 17:34:35 +0000392#define gen_nb_xmlSAXHandlerPtr 2
393static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
394 if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
395 return(NULL);
396}
397static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
398}
399
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000400#define gen_nb_xmlValidCtxtPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000401static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000402 if (no == 0) return(xmlNewValidCtxt());
403 return(NULL);
404}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000405static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000406 if (val != NULL)
407 xmlFreeValidCtxt(val);
408}
409
Daniel Veillard34099b42004-11-04 17:34:35 +0000410#define gen_nb_xmlParserInputBufferPtr 8
411
412static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
413 if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE));
414 if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE));
415 if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE));
416 if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE));
417 if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE));
418 if (no == 5) return(xmlParserInputBufferCreateFilename("http://missing.example.org/", XML_CHAR_ENCODING_NONE));
419 if (no == 6) return(xmlParserInputBufferCreateFilename("http://missing. example.org/", XML_CHAR_ENCODING_NONE));
420 return(NULL);
421}
422static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
423 xmlFreeParserInputBuffer(val);
424}
425
Daniel Veillardd93f6252004-11-02 15:53:51 +0000426#define gen_nb_xmlDocPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000427static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000428 if (no == 0) return(xmlNewDoc(BAD_CAST "1.0"));
429 if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0));
430 return(NULL);
431}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000432static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000433 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
Daniel Veillardd93f6252004-11-02 15:53:51 +0000434 xmlFreeDoc(val);
435}
436
Daniel Veillardce244ad2004-11-05 10:03:46 +0000437#define gen_nb_xmlAttrPtr 2
438static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) {
439 if (no == 0) return(get_api_attr());
440 return(NULL);
441}
442static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
443 if (no == 0) free_api_doc();
444}
445
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000446#define gen_nb_xmlDictPtr 2
447static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) {
448 if (no == 0) return(xmlDictCreate());
449 return(NULL);
450}
451static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) {
452 if (val != NULL)
453 xmlDictFree(val);
454}
455
Daniel Veillardce244ad2004-11-05 10:03:46 +0000456#define gen_nb_xmlNodePtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000457static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000458 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
Daniel Veillardce244ad2004-11-05 10:03:46 +0000459 if (no == 1) return(get_api_root());
Daniel Veillardd93f6252004-11-02 15:53:51 +0000460 return(NULL);
Daniel Veillardce244ad2004-11-05 10:03:46 +0000461/* if (no == 2) return((xmlNodePtr) get_api_doc()); */
Daniel Veillardd93f6252004-11-02 15:53:51 +0000462}
Daniel Veillard27f20102004-11-05 11:50:11 +0000463static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000464 if (no == 1) free_api_doc();
465 else if (val != NULL) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000466 xmlUnlinkNode(val);
467 xmlFreeNode(val);
468 }
469}
470
Daniel Veillard27f20102004-11-05 11:50:11 +0000471#define gen_nb_xmlDtdPtr 3
472static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000473 if (no == 0)
474 return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000475 if (no == 1) return(get_api_dtd());
476 return(NULL);
477}
478static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) {
479 if (no == 1) free_api_doc();
480 else if (val != NULL) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000481 xmlUnlinkNode((xmlNodePtr) val);
482 xmlFreeNode((xmlNodePtr) val);
Daniel Veillard27f20102004-11-05 11:50:11 +0000483 }
484}
485
486#define gen_nb_xmlNsPtr 2
487static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) {
488 if (no == 0) return(get_api_ns());
489 return(NULL);
490}
491static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
492 if (no == 0) free_api_doc();
493}
494
Daniel Veillardd93f6252004-11-02 15:53:51 +0000495#define gen_nb_xmlNodePtr_in 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000496static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000497 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
498 if (no == 0) return(xmlNewText(BAD_CAST "text"));
499 return(NULL);
500}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000501static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000502}
503
Daniel Veillardc8311492004-11-08 16:51:13 +0000504#ifdef LIBXML_WRITER_ENABLED
Daniel Veillarde43cc572004-11-03 11:50:29 +0000505#define gen_nb_xmlTextWriterPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000506static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000507 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
508 return(NULL);
509}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000510static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000511 if (val != NULL) xmlFreeTextWriter(val);
512}
Daniel Veillardc8311492004-11-08 16:51:13 +0000513#endif
Daniel Veillarde43cc572004-11-03 11:50:29 +0000514
Daniel Veillardc8311492004-11-08 16:51:13 +0000515#ifdef LIBXML_READER_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000516#define gen_nb_xmlTextReaderPtr 4
Daniel Veillard3d97e662004-11-04 10:49:00 +0000517static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000518 if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
519 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
520 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
521 return(NULL);
522}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000523static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000524 if (val != NULL) xmlFreeTextReader(val);
525}
Daniel Veillardc8311492004-11-08 16:51:13 +0000526#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000527
Daniel Veillard34099b42004-11-04 17:34:35 +0000528#define gen_nb_xmlBufferPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000529static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000530 if (no == 0) return(xmlBufferCreate());
Daniel Veillardce244ad2004-11-05 10:03:46 +0000531 if (no == 1) return(xmlBufferCreateStatic((void *)"a static buffer", 13));
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000532 return(NULL);
533}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000534static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000535 if (val != NULL) {
536 xmlBufferFree(val);
537 }
538}
539
540#define gen_nb_xmlListPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000541static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000542 if (no == 0) return(xmlListCreate(NULL, NULL));
543 return(NULL);
544}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000545static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000546 if (val != NULL) {
547 xmlListDelete(val);
548 }
549}
550
551#define gen_nb_xmlHashTablePtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000552static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000553 if (no == 0) return(xmlHashCreate(10));
554 return(NULL);
555}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000556static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000557 if (val != NULL) {
558 xmlHashFree(val, NULL);
559 }
560}
561
562#include <libxml/xpathInternals.h>
563
Daniel Veillardc8311492004-11-08 16:51:13 +0000564#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000565#define gen_nb_xmlXPathObjectPtr 5
Daniel Veillard3d97e662004-11-04 10:49:00 +0000566static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000567 if (no == 0) return(xmlXPathNewString(BAD_CAST "string object"));
568 if (no == 1) return(xmlXPathNewFloat(1.1));
569 if (no == 2) return(xmlXPathNewBoolean(1));
570 if (no == 3) return(xmlXPathNewNodeSet(NULL));
571 return(NULL);
572}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000573static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000574 if (val != NULL) {
575 xmlXPathFreeObject(val);
576 }
577}
Daniel Veillardc8311492004-11-08 16:51:13 +0000578#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000579
Daniel Veillardc8311492004-11-08 16:51:13 +0000580#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000581#define gen_nb_xmlOutputBufferPtr 2
582static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
583 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0));
584 return(NULL);
585}
586static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
587 if (val != NULL) {
588 xmlOutputBufferClose(val);
589 }
590}
Daniel Veillardc8311492004-11-08 16:51:13 +0000591#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +0000592
Daniel Veillardc8311492004-11-08 16:51:13 +0000593#ifdef LIBXML_FTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000594#define gen_nb_xmlNanoFTPCtxtPtr 4
595static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
596 if (no == 0) return(xmlNanoFTPNewCtxt("ftp://example.com/"));
597 if (no == 1) return(xmlNanoFTPNewCtxt("http://example.com/"));
598 if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
599 return(NULL);
600}
601static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
602 if (val != NULL) {
603 xmlNanoFTPFreeCtxt(val);
604 }
605}
Daniel Veillardc8311492004-11-08 16:51:13 +0000606#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000607
Daniel Veillardc8311492004-11-08 16:51:13 +0000608#ifdef LIBXML_HTTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000609#define gen_nb_xmlNanoHTTPCtxtPtr 1
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000610static void *gen_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard27f20102004-11-05 11:50:11 +0000611 return(NULL);
612}
613static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
614}
Daniel Veillardc8311492004-11-08 16:51:13 +0000615#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000616
Daniel Veillard3d97e662004-11-04 10:49:00 +0000617#define gen_nb_xmlCharEncoding 4
618static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) {
619 if (no == 0) return(XML_CHAR_ENCODING_UTF8);
620 if (no == 1) return(XML_CHAR_ENCODING_NONE);
621 if (no == 0) return(XML_CHAR_ENCODING_8859_1);
622 return(XML_CHAR_ENCODING_ERROR);
623}
624static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
625}
626
Daniel Veillard42595322004-11-08 10:52:06 +0000627#define gen_nb_xmlHashDeallocator 2
628static void
629test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) {
630}
631
632static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
633 if (no == 0) return(test_xmlHashDeallocator);
634 return(NULL);
635}
636static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
637}
638
Daniel Veillardd93f6252004-11-02 15:53:51 +0000639
640static void desret_int(int val ATTRIBUTE_UNUSED) {
641}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000642static void desret_long(long val ATTRIBUTE_UNUSED) {
643}
644static void desret_double(double val ATTRIBUTE_UNUSED) {
645}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000646static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
647}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000648#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000649static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
650}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000651#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000652static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
653}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000654static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
655}
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000656static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
657}
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000658static void desret_xmlChar_ptr(xmlChar *val) {
659 if (val != NULL)
660 xmlFree(val);
661}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000662static void desret_xmlDocPtr(xmlDocPtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000663 if (val != api_doc)
664 xmlFreeDoc(val);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000665}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000666static void desret_xmlDictPtr(xmlDictPtr val) {
667 xmlDictFree(val);
668}
Daniel Veillardc8311492004-11-08 16:51:13 +0000669#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d95c732004-11-06 22:25:14 +0000670static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
671 xmlOutputBufferClose(val);
672}
Daniel Veillardc8311492004-11-08 16:51:13 +0000673#endif
674#ifdef LIBXML_READER_ENABLED
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000675static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
676 xmlFreeTextReader(val);
677}
Daniel Veillardc8311492004-11-08 16:51:13 +0000678#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +0000679static void desret_xmlNodePtr(xmlNodePtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000680 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
681 xmlUnlinkNode(val);
682 xmlFreeNode(val);
683 }
Daniel Veillardd93f6252004-11-02 15:53:51 +0000684}
Daniel Veillard57b25162004-11-06 14:50:18 +0000685static void desret_xmlAttrPtr(xmlAttrPtr val) {
686 if (val != NULL) {
687 xmlUnlinkNode((xmlNodePtr) val);
688 xmlFreeNode((xmlNodePtr) val);
689 }
690}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000691static void desret_xmlEntityPtr(xmlEntityPtr val) {
692 if (val != NULL) {
693 xmlUnlinkNode((xmlNodePtr) val);
694 xmlFreeNode((xmlNodePtr) val);
695 }
696}
Daniel Veillard42595322004-11-08 10:52:06 +0000697static void desret_xmlElementPtr(xmlElementPtr val) {
698 if (val != NULL) {
699 xmlUnlinkNode((xmlNodePtr) val);
700 }
701}
702static void desret_xmlAttributePtr(xmlAttributePtr val) {
703 if (val != NULL) {
704 xmlUnlinkNode((xmlNodePtr) val);
705 }
706}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000707static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
708}
Daniel Veillard34099b42004-11-04 17:34:35 +0000709static void desret_xmlDtdPtr(xmlDtdPtr val) {
710 desret_xmlNodePtr((xmlNodePtr)val);
711}
Daniel Veillardc8311492004-11-08 16:51:13 +0000712#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000713static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000714 xmlXPathFreeObject(val);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000715}
Daniel Veillardc8311492004-11-08 16:51:13 +0000716#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000717static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
718 xmlFreeParserCtxt(val);
719}
720
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000721static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
722 xmlFreeParserInputBuffer(val);
723}
Daniel Veillard42595322004-11-08 10:52:06 +0000724static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
725 xmlFreeInputStream(val);
726}
Daniel Veillardc8311492004-11-08 16:51:13 +0000727#ifdef LIBXML_WRITER_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000728static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
729 xmlFreeTextWriter(val);
730}
Daniel Veillardc8311492004-11-08 16:51:13 +0000731#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000732static void desret_xmlBufferPtr(xmlBufferPtr val) {
733 xmlBufferFree(val);
734}
Daniel Veillardc8311492004-11-08 16:51:13 +0000735#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000736static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
737 xmlSchemaFreeParserCtxt(val);
738}
739static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
740}
741static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
742 xmlRelaxNGFreeParserCtxt(val);
743}
Daniel Veillardc8311492004-11-08 16:51:13 +0000744#endif
745#ifdef LIBXML_HTML_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000746static void desret_const_htmlEntityDesc_ptr(const htmlEntityDescPtr val ATTRIBUTE_UNUSED) {
747}
Daniel Veillardc8311492004-11-08 16:51:13 +0000748#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000749
750/************************************************************************
751 * *
752 * WARNING: end of the manually maintained part of the test code *
753 * do not remove or alter the CUT HERE line *
754 * *
755 ************************************************************************/
756
Daniel Veillard34099b42004-11-04 17:34:35 +0000757/* CUT HERE: everything below that line is generated */
Daniel Veillard57b25162004-11-06 14:50:18 +0000758#define gen_nb_htmlParserOption 4
759static htmlParserOption gen_htmlParserOption(int no, int nr ATTRIBUTE_UNUSED) {
760 if (no == 1) return(HTML_PARSE_NOBLANKS);
761 if (no == 2) return(HTML_PARSE_NOERROR);
762 if (no == 3) return(HTML_PARSE_NONET);
763 if (no == 4) return(HTML_PARSE_NOWARNING);
764 return(0);
765}
766static void des_htmlParserOption(int no ATTRIBUTE_UNUSED, htmlParserOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
767}
768static void desret_htmlParserOption(htmlParserOption val ATTRIBUTE_UNUSED) {
769}
770
771#define gen_nb_htmlStatus 4
772static htmlStatus gen_htmlStatus(int no, int nr ATTRIBUTE_UNUSED) {
773 if (no == 1) return(HTML_DEPRECATED);
774 if (no == 2) return(HTML_INVALID);
775 if (no == 3) return(HTML_NA);
776 if (no == 4) return(HTML_REQUIRED);
777 return(0);
778}
779static void des_htmlStatus(int no ATTRIBUTE_UNUSED, htmlStatus val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
780}
781static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
782}
783
784#define gen_nb_xlinkActuate 3
785static xlinkActuate gen_xlinkActuate(int no, int nr ATTRIBUTE_UNUSED) {
786 if (no == 1) return(XLINK_ACTUATE_AUTO);
787 if (no == 2) return(XLINK_ACTUATE_NONE);
788 if (no == 3) return(XLINK_ACTUATE_ONREQUEST);
789 return(0);
790}
791static void des_xlinkActuate(int no ATTRIBUTE_UNUSED, xlinkActuate val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
792}
793static void desret_xlinkActuate(xlinkActuate val ATTRIBUTE_UNUSED) {
794}
795
796#define gen_nb_xlinkShow 4
797static xlinkShow gen_xlinkShow(int no, int nr ATTRIBUTE_UNUSED) {
798 if (no == 1) return(XLINK_SHOW_EMBED);
799 if (no == 2) return(XLINK_SHOW_NEW);
800 if (no == 3) return(XLINK_SHOW_NONE);
801 if (no == 4) return(XLINK_SHOW_REPLACE);
802 return(0);
803}
804static void des_xlinkShow(int no ATTRIBUTE_UNUSED, xlinkShow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
805}
806static void desret_xlinkShow(xlinkShow val ATTRIBUTE_UNUSED) {
807}
808
809#define gen_nb_xlinkType 4
810static xlinkType gen_xlinkType(int no, int nr ATTRIBUTE_UNUSED) {
811 if (no == 1) return(XLINK_TYPE_EXTENDED);
812 if (no == 2) return(XLINK_TYPE_EXTENDED_SET);
813 if (no == 3) return(XLINK_TYPE_NONE);
814 if (no == 4) return(XLINK_TYPE_SIMPLE);
815 return(0);
816}
817static void des_xlinkType(int no ATTRIBUTE_UNUSED, xlinkType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
818}
819static void desret_xlinkType(xlinkType val ATTRIBUTE_UNUSED) {
820}
821
822#define gen_nb_xmlAttributeDefault 4
823static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
824 if (no == 1) return(XML_ATTRIBUTE_FIXED);
825 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
826 if (no == 3) return(XML_ATTRIBUTE_NONE);
827 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
828 return(0);
829}
830static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
831}
832static void desret_xmlAttributeDefault(xmlAttributeDefault val ATTRIBUTE_UNUSED) {
833}
834
835#define gen_nb_xmlAttributeType 4
836static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
837 if (no == 1) return(XML_ATTRIBUTE_CDATA);
838 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
839 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
840 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
841 return(0);
842}
843static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
844}
845static void desret_xmlAttributeType(xmlAttributeType val ATTRIBUTE_UNUSED) {
846}
847
848#define gen_nb_xmlBufferAllocationScheme 3
849static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
850 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
851 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
852 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
853 return(0);
854}
855static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
856}
857static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
858}
859
860#define gen_nb_xmlCatalogAllow 4
861static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
862 if (no == 1) return(XML_CATA_ALLOW_ALL);
863 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
864 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
865 if (no == 4) return(XML_CATA_ALLOW_NONE);
866 return(0);
867}
868static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
869}
870static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
871}
872
873#define gen_nb_xmlCatalogPrefer 3
874static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
875 if (no == 1) return(XML_CATA_PREFER_NONE);
876 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
877 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
878 return(0);
879}
880static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
881}
882static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
883}
884
885#define gen_nb_xmlElementContentOccur 4
886static xmlElementContentOccur gen_xmlElementContentOccur(int no, int nr ATTRIBUTE_UNUSED) {
887 if (no == 1) return(XML_ELEMENT_CONTENT_MULT);
888 if (no == 2) return(XML_ELEMENT_CONTENT_ONCE);
889 if (no == 3) return(XML_ELEMENT_CONTENT_OPT);
890 if (no == 4) return(XML_ELEMENT_CONTENT_PLUS);
891 return(0);
892}
893static void des_xmlElementContentOccur(int no ATTRIBUTE_UNUSED, xmlElementContentOccur val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
894}
895static void desret_xmlElementContentOccur(xmlElementContentOccur val ATTRIBUTE_UNUSED) {
896}
897
898#define gen_nb_xmlElementContentType 4
899static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
900 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
901 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
902 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
903 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
904 return(0);
905}
906static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
907}
908static void desret_xmlElementContentType(xmlElementContentType val ATTRIBUTE_UNUSED) {
909}
910
911#define gen_nb_xmlElementType 4
912static xmlElementType gen_xmlElementType(int no, int nr ATTRIBUTE_UNUSED) {
913 if (no == 1) return(XML_ATTRIBUTE_DECL);
914 if (no == 2) return(XML_ATTRIBUTE_NODE);
915 if (no == 3) return(XML_CDATA_SECTION_NODE);
916 if (no == 4) return(XML_COMMENT_NODE);
917 return(0);
918}
919static void des_xmlElementType(int no ATTRIBUTE_UNUSED, xmlElementType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
920}
921static void desret_xmlElementType(xmlElementType val ATTRIBUTE_UNUSED) {
922}
923
924#define gen_nb_xmlElementTypeVal 4
925static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
926 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
927 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
928 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
929 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
930 return(0);
931}
932static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
933}
934static void desret_xmlElementTypeVal(xmlElementTypeVal val ATTRIBUTE_UNUSED) {
935}
936
937#define gen_nb_xmlEntityType 4
938static xmlEntityType gen_xmlEntityType(int no, int nr ATTRIBUTE_UNUSED) {
939 if (no == 1) return(XML_EXTERNAL_GENERAL_PARSED_ENTITY);
940 if (no == 2) return(XML_EXTERNAL_GENERAL_UNPARSED_ENTITY);
941 if (no == 3) return(XML_EXTERNAL_PARAMETER_ENTITY);
942 if (no == 4) return(XML_INTERNAL_GENERAL_ENTITY);
943 return(0);
944}
945static void des_xmlEntityType(int no ATTRIBUTE_UNUSED, xmlEntityType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
946}
947static void desret_xmlEntityType(xmlEntityType val ATTRIBUTE_UNUSED) {
948}
949
950#define gen_nb_xmlErrorDomain 4
951static xmlErrorDomain gen_xmlErrorDomain(int no, int nr ATTRIBUTE_UNUSED) {
952 if (no == 1) return(XML_FROM_C14N);
953 if (no == 2) return(XML_FROM_CATALOG);
954 if (no == 3) return(XML_FROM_CHECK);
955 if (no == 4) return(XML_FROM_DATATYPE);
956 return(0);
957}
958static void des_xmlErrorDomain(int no ATTRIBUTE_UNUSED, xmlErrorDomain val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
959}
960static void desret_xmlErrorDomain(xmlErrorDomain val ATTRIBUTE_UNUSED) {
961}
962
963#define gen_nb_xmlErrorLevel 4
964static xmlErrorLevel gen_xmlErrorLevel(int no, int nr ATTRIBUTE_UNUSED) {
965 if (no == 1) return(XML_ERR_ERROR);
966 if (no == 2) return(XML_ERR_FATAL);
967 if (no == 3) return(XML_ERR_NONE);
968 if (no == 4) return(XML_ERR_WARNING);
969 return(0);
970}
971static void des_xmlErrorLevel(int no ATTRIBUTE_UNUSED, xmlErrorLevel val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
972}
973static void desret_xmlErrorLevel(xmlErrorLevel val ATTRIBUTE_UNUSED) {
974}
975
976#define gen_nb_xmlParserErrors 4
977static xmlParserErrors gen_xmlParserErrors(int no, int nr ATTRIBUTE_UNUSED) {
978 if (no == 1) return(XML_C14N_CREATE_CTXT);
979 if (no == 2) return(XML_C14N_CREATE_STACK);
980 if (no == 3) return(XML_C14N_INVALID_NODE);
981 if (no == 4) return(XML_C14N_REQUIRES_UTF8);
982 return(0);
983}
984static void des_xmlParserErrors(int no ATTRIBUTE_UNUSED, xmlParserErrors val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
985}
986static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
987}
988
989#define gen_nb_xmlParserInputState 4
990static xmlParserInputState gen_xmlParserInputState(int no, int nr ATTRIBUTE_UNUSED) {
991 if (no == 1) return(XML_PARSER_ATTRIBUTE_VALUE);
992 if (no == 2) return(XML_PARSER_CDATA_SECTION);
993 if (no == 3) return(XML_PARSER_COMMENT);
994 if (no == 4) return(XML_PARSER_CONTENT);
995 return(0);
996}
997static void des_xmlParserInputState(int no ATTRIBUTE_UNUSED, xmlParserInputState val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
998}
999static void desret_xmlParserInputState(xmlParserInputState val ATTRIBUTE_UNUSED) {
1000}
1001
1002#define gen_nb_xmlParserMode 4
1003static xmlParserMode gen_xmlParserMode(int no, int nr ATTRIBUTE_UNUSED) {
1004 if (no == 1) return(XML_PARSE_DOM);
1005 if (no == 2) return(XML_PARSE_PUSH_DOM);
1006 if (no == 3) return(XML_PARSE_PUSH_SAX);
1007 if (no == 4) return(XML_PARSE_READER);
1008 return(0);
1009}
1010static void des_xmlParserMode(int no ATTRIBUTE_UNUSED, xmlParserMode val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1011}
1012static void desret_xmlParserMode(xmlParserMode val ATTRIBUTE_UNUSED) {
1013}
1014
1015#define gen_nb_xmlParserOption 4
1016static xmlParserOption gen_xmlParserOption(int no, int nr ATTRIBUTE_UNUSED) {
1017 if (no == 1) return(XML_PARSE_DTDATTR);
1018 if (no == 2) return(XML_PARSE_DTDLOAD);
1019 if (no == 3) return(XML_PARSE_DTDVALID);
1020 if (no == 4) return(XML_PARSE_NOBLANKS);
1021 return(0);
1022}
1023static void des_xmlParserOption(int no ATTRIBUTE_UNUSED, xmlParserOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1024}
1025static void desret_xmlParserOption(xmlParserOption val ATTRIBUTE_UNUSED) {
1026}
1027
1028#define gen_nb_xmlParserProperties 4
1029static xmlParserProperties gen_xmlParserProperties(int no, int nr ATTRIBUTE_UNUSED) {
1030 if (no == 1) return(XML_PARSER_DEFAULTATTRS);
1031 if (no == 2) return(XML_PARSER_LOADDTD);
1032 if (no == 3) return(XML_PARSER_SUBST_ENTITIES);
1033 if (no == 4) return(XML_PARSER_VALIDATE);
1034 return(0);
1035}
1036static void des_xmlParserProperties(int no ATTRIBUTE_UNUSED, xmlParserProperties val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1037}
1038static void desret_xmlParserProperties(xmlParserProperties val ATTRIBUTE_UNUSED) {
1039}
1040
1041#define gen_nb_xmlParserSeverities 4
1042static xmlParserSeverities gen_xmlParserSeverities(int no, int nr ATTRIBUTE_UNUSED) {
1043 if (no == 1) return(XML_PARSER_SEVERITY_ERROR);
1044 if (no == 2) return(XML_PARSER_SEVERITY_VALIDITY_ERROR);
1045 if (no == 3) return(XML_PARSER_SEVERITY_VALIDITY_WARNING);
1046 if (no == 4) return(XML_PARSER_SEVERITY_WARNING);
1047 return(0);
1048}
1049static void des_xmlParserSeverities(int no ATTRIBUTE_UNUSED, xmlParserSeverities val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1050}
1051static void desret_xmlParserSeverities(xmlParserSeverities val ATTRIBUTE_UNUSED) {
1052}
1053
1054#define gen_nb_xmlReaderTypes 4
1055static xmlReaderTypes gen_xmlReaderTypes(int no, int nr ATTRIBUTE_UNUSED) {
1056 if (no == 1) return(XML_READER_TYPE_ATTRIBUTE);
1057 if (no == 2) return(XML_READER_TYPE_CDATA);
1058 if (no == 3) return(XML_READER_TYPE_COMMENT);
1059 if (no == 4) return(XML_READER_TYPE_DOCUMENT);
1060 return(0);
1061}
1062static void des_xmlReaderTypes(int no ATTRIBUTE_UNUSED, xmlReaderTypes val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1063}
1064static void desret_xmlReaderTypes(xmlReaderTypes val ATTRIBUTE_UNUSED) {
1065}
1066
1067#define gen_nb_xmlRelaxNGParserFlag 3
1068static xmlRelaxNGParserFlag gen_xmlRelaxNGParserFlag(int no, int nr ATTRIBUTE_UNUSED) {
1069 if (no == 1) return(XML_RELAXNGP_CRNG);
1070 if (no == 2) return(XML_RELAXNGP_FREE_DOC);
1071 if (no == 3) return(XML_RELAXNGP_NONE);
1072 return(0);
1073}
1074static void des_xmlRelaxNGParserFlag(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserFlag val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1075}
1076static void desret_xmlRelaxNGParserFlag(xmlRelaxNGParserFlag val ATTRIBUTE_UNUSED) {
1077}
1078
1079#define gen_nb_xmlRelaxNGValidErr 4
1080static xmlRelaxNGValidErr gen_xmlRelaxNGValidErr(int no, int nr ATTRIBUTE_UNUSED) {
1081 if (no == 1) return(XML_RELAXNG_ERR_ATTREXTRANS);
1082 if (no == 2) return(XML_RELAXNG_ERR_ATTRNAME);
1083 if (no == 3) return(XML_RELAXNG_ERR_ATTRNONS);
1084 if (no == 4) return(XML_RELAXNG_ERR_ATTRVALID);
1085 return(0);
1086}
1087static void des_xmlRelaxNGValidErr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidErr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1088}
1089static void desret_xmlRelaxNGValidErr(xmlRelaxNGValidErr val ATTRIBUTE_UNUSED) {
1090}
1091
1092#define gen_nb_xmlSchemaContentType 4
1093static xmlSchemaContentType gen_xmlSchemaContentType(int no, int nr ATTRIBUTE_UNUSED) {
1094 if (no == 1) return(XML_SCHEMA_CONTENT_ANY);
1095 if (no == 2) return(XML_SCHEMA_CONTENT_BASIC);
1096 if (no == 3) return(XML_SCHEMA_CONTENT_ELEMENTS);
1097 if (no == 4) return(XML_SCHEMA_CONTENT_EMPTY);
1098 return(0);
1099}
1100static void des_xmlSchemaContentType(int no ATTRIBUTE_UNUSED, xmlSchemaContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1101}
1102static void desret_xmlSchemaContentType(xmlSchemaContentType val ATTRIBUTE_UNUSED) {
1103}
1104
1105#define gen_nb_xmlSchemaTypeType 4
1106static xmlSchemaTypeType gen_xmlSchemaTypeType(int no, int nr ATTRIBUTE_UNUSED) {
1107 if (no == 1) return(XML_SCHEMA_FACET_ENUMERATION);
1108 if (no == 2) return(XML_SCHEMA_FACET_FRACTIONDIGITS);
1109 if (no == 3) return(XML_SCHEMA_FACET_LENGTH);
1110 if (no == 4) return(XML_SCHEMA_FACET_MAXEXCLUSIVE);
1111 return(0);
1112}
1113static void des_xmlSchemaTypeType(int no ATTRIBUTE_UNUSED, xmlSchemaTypeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1114}
1115static void desret_xmlSchemaTypeType(xmlSchemaTypeType val ATTRIBUTE_UNUSED) {
1116}
1117
1118#define gen_nb_xmlSchemaValType 4
1119static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1120 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1121 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1122 if (no == 3) return(XML_SCHEMAS_ANYURI);
1123 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1124 return(0);
1125}
1126static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1127}
1128static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED) {
1129}
1130
1131#define gen_nb_xmlSchemaValidError 4
1132static xmlSchemaValidError gen_xmlSchemaValidError(int no, int nr ATTRIBUTE_UNUSED) {
1133 if (no == 1) return(XML_SCHEMAS_ERR_);
1134 if (no == 2) return(XML_SCHEMAS_ERR_ATTRINVALID);
1135 if (no == 3) return(XML_SCHEMAS_ERR_ATTRUNKNOWN);
1136 if (no == 4) return(XML_SCHEMAS_ERR_CONSTRUCT);
1137 return(0);
1138}
1139static void des_xmlSchemaValidError(int no ATTRIBUTE_UNUSED, xmlSchemaValidError val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1140}
1141static void desret_xmlSchemaValidError(xmlSchemaValidError val ATTRIBUTE_UNUSED) {
1142}
1143
1144#define gen_nb_xmlSchemaValidOption 1
1145static xmlSchemaValidOption gen_xmlSchemaValidOption(int no, int nr ATTRIBUTE_UNUSED) {
1146 if (no == 1) return(XML_SCHEMA_VAL_VC_I_CREATE);
1147 return(0);
1148}
1149static void des_xmlSchemaValidOption(int no ATTRIBUTE_UNUSED, xmlSchemaValidOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1150}
1151static void desret_xmlSchemaValidOption(xmlSchemaValidOption val ATTRIBUTE_UNUSED) {
1152}
1153
1154#define gen_nb_xmlTextReaderMode 4
1155static xmlTextReaderMode gen_xmlTextReaderMode(int no, int nr ATTRIBUTE_UNUSED) {
1156 if (no == 1) return(XML_TEXTREADER_MODE_CLOSED);
1157 if (no == 2) return(XML_TEXTREADER_MODE_EOF);
1158 if (no == 3) return(XML_TEXTREADER_MODE_ERROR);
1159 if (no == 4) return(XML_TEXTREADER_MODE_INITIAL);
1160 return(0);
1161}
1162static void des_xmlTextReaderMode(int no ATTRIBUTE_UNUSED, xmlTextReaderMode val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1163}
1164static void desret_xmlTextReaderMode(xmlTextReaderMode val ATTRIBUTE_UNUSED) {
1165}
1166
1167#define gen_nb_xmlXPathError 4
1168static xmlXPathError gen_xmlXPathError(int no, int nr ATTRIBUTE_UNUSED) {
1169 if (no == 1) return(XPATH_ENCODING_ERROR);
1170 if (no == 2) return(XPATH_EXPRESSION_OK);
1171 if (no == 3) return(XPATH_EXPR_ERROR);
1172 if (no == 4) return(XPATH_INVALID_ARITY);
1173 return(0);
1174}
1175static void des_xmlXPathError(int no ATTRIBUTE_UNUSED, xmlXPathError val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1176}
1177static void desret_xmlXPathError(xmlXPathError val ATTRIBUTE_UNUSED) {
1178}
1179
1180#define gen_nb_xmlXPathObjectType 4
1181static xmlXPathObjectType gen_xmlXPathObjectType(int no, int nr ATTRIBUTE_UNUSED) {
1182 if (no == 1) return(XPATH_BOOLEAN);
1183 if (no == 2) return(XPATH_LOCATIONSET);
1184 if (no == 3) return(XPATH_NODESET);
1185 if (no == 4) return(XPATH_NUMBER);
1186 return(0);
1187}
1188static void des_xmlXPathObjectType(int no ATTRIBUTE_UNUSED, xmlXPathObjectType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1189}
1190static void desret_xmlXPathObjectType(xmlXPathObjectType val ATTRIBUTE_UNUSED) {
1191}
1192
Daniel Veillard34099b42004-11-04 17:34:35 +00001193#include <libxml/HTMLparser.h>
1194#include <libxml/HTMLtree.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001195#include <libxml/SAX2.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001196#include <libxml/c14n.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001197#include <libxml/catalog.h>
1198#include <libxml/chvalid.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001199#include <libxml/debugXML.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001200#include <libxml/dict.h>
1201#include <libxml/encoding.h>
1202#include <libxml/entities.h>
1203#include <libxml/hash.h>
1204#include <libxml/list.h>
1205#include <libxml/nanoftp.h>
1206#include <libxml/nanohttp.h>
1207#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001208#include <libxml/parserInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001209#include <libxml/pattern.h>
1210#include <libxml/relaxng.h>
1211#include <libxml/schemasInternals.h>
1212#include <libxml/tree.h>
1213#include <libxml/uri.h>
1214#include <libxml/valid.h>
1215#include <libxml/xinclude.h>
1216#include <libxml/xmlIO.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001217#include <libxml/xmlautomata.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001218#include <libxml/xmlerror.h>
1219#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001220#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001221#include <libxml/xmlsave.h>
1222#include <libxml/xmlschemas.h>
1223#include <libxml/xmlschemastypes.h>
1224#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001225#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001226#include <libxml/xmlwriter.h>
1227#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001228#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001229#include <libxml/xpointer.h>
1230static int test_HTMLparser(void);
1231static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001232static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001233static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001234static int test_catalog(void);
1235static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001236static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001237static int test_dict(void);
1238static int test_encoding(void);
1239static int test_entities(void);
1240static int test_hash(void);
1241static int test_list(void);
1242static int test_nanoftp(void);
1243static int test_nanohttp(void);
1244static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001245static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001246static int test_pattern(void);
1247static int test_relaxng(void);
1248static int test_schemasInternals(void);
1249static int test_tree(void);
1250static int test_uri(void);
1251static int test_valid(void);
1252static int test_xinclude(void);
1253static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001254static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001255static int test_xmlerror(void);
1256static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001257static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001258static int test_xmlsave(void);
1259static int test_xmlschemas(void);
1260static int test_xmlschemastypes(void);
1261static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001262static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001263static int test_xmlwriter(void);
1264static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001265static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001266static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001267
1268/**
1269 * testlibxml2:
1270 *
1271 * Main entry point of the tester for the full libxml2 module,
1272 * it calls all the tester entry point for each module.
1273 *
1274 * Returns the number of error found
1275 */
1276static int
1277testlibxml2(void)
1278{
Daniel Veillard42595322004-11-08 10:52:06 +00001279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001280
Daniel Veillard42595322004-11-08 10:52:06 +00001281 test_ret += test_HTMLparser();
1282 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001283 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001284 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001285 test_ret += test_catalog();
1286 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001287 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001288 test_ret += test_dict();
1289 test_ret += test_encoding();
1290 test_ret += test_entities();
1291 test_ret += test_hash();
1292 test_ret += test_list();
1293 test_ret += test_nanoftp();
1294 test_ret += test_nanohttp();
1295 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001296 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001297 test_ret += test_pattern();
1298 test_ret += test_relaxng();
1299 test_ret += test_schemasInternals();
1300 test_ret += test_tree();
1301 test_ret += test_uri();
1302 test_ret += test_valid();
1303 test_ret += test_xinclude();
1304 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001305 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001306 test_ret += test_xmlerror();
1307 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001308 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001309 test_ret += test_xmlsave();
1310 test_ret += test_xmlschemas();
1311 test_ret += test_xmlschemastypes();
1312 test_ret += test_xmlstring();
1313 test_ret += test_xmlunicode();
1314 test_ret += test_xmlwriter();
1315 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001316 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001317 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001318
Daniel Veillard3d97e662004-11-04 10:49:00 +00001319 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001320 function_tests, call_tests, test_ret);
1321 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001322}
1323
1324
Daniel Veillardce682bc2004-11-05 17:22:25 +00001325#define gen_nb_unsigned_char_ptr 1
1326static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1327 return(NULL);
1328}
1329static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1330}
1331
1332#define gen_nb_const_unsigned_char_ptr 1
1333static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1334 return(NULL);
1335}
1336static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1337}
1338
Daniel Veillardd93f6252004-11-02 15:53:51 +00001339static int
1340test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001341 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001342
Daniel Veillardce682bc2004-11-05 17:22:25 +00001343#ifdef LIBXML_HTML_ENABLED
1344 int mem_base;
1345 int ret_val;
1346 unsigned char * out; /* a pointer to an array of bytes to store the result */
1347 int n_out;
1348 int * outlen; /* the length of @out */
1349 int n_outlen;
1350 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1351 int n_in;
1352 int * inlen; /* the length of @in */
1353 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001354
Daniel Veillardce682bc2004-11-05 17:22:25 +00001355 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1356 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1357 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1358 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1359 mem_base = xmlMemBlocks();
1360 out = gen_unsigned_char_ptr(n_out, 0);
1361 outlen = gen_int_ptr(n_outlen, 1);
1362 in = gen_const_unsigned_char_ptr(n_in, 2);
1363 inlen = gen_int_ptr(n_inlen, 3);
1364
1365 ret_val = UTF8ToHtml(out, outlen, in, inlen);
1366 desret_int(ret_val);
1367 call_tests++;
1368 des_unsigned_char_ptr(n_out, out, 0);
1369 des_int_ptr(n_outlen, outlen, 1);
1370 des_const_unsigned_char_ptr(n_in, in, 2);
1371 des_int_ptr(n_inlen, inlen, 3);
1372 xmlResetLastError();
1373 if (mem_base != xmlMemBlocks()) {
1374 printf("Leak of %d blocks found in UTF8ToHtml",
1375 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001376 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001377 printf(" %d", n_out);
1378 printf(" %d", n_outlen);
1379 printf(" %d", n_in);
1380 printf(" %d", n_inlen);
1381 printf("\n");
1382 }
1383 }
1384 }
1385 }
1386 }
1387#endif
1388
1389 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001390 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001391}
1392
1393
Daniel Veillardce682bc2004-11-05 17:22:25 +00001394#define gen_nb_const_htmlElemDesc_ptr 1
1395static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1396 return(NULL);
1397}
1398static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1399}
1400
Daniel Veillardd93f6252004-11-02 15:53:51 +00001401static int
1402test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001404
Daniel Veillard57b25162004-11-06 14:50:18 +00001405#ifdef LIBXML_HTML_ENABLED
1406 int mem_base;
1407 htmlStatus ret_val;
1408 htmlElemDesc * elt; /* HTML element */
1409 int n_elt;
1410 xmlChar * attr; /* HTML attribute */
1411 int n_attr;
1412 int legacy; /* whether to allow deprecated attributes */
1413 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001414
Daniel Veillard57b25162004-11-06 14:50:18 +00001415 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1416 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1417 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1418 mem_base = xmlMemBlocks();
1419 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1420 attr = gen_const_xmlChar_ptr(n_attr, 1);
1421 legacy = gen_int(n_legacy, 2);
1422
1423 ret_val = htmlAttrAllowed(elt, attr, legacy);
1424 desret_htmlStatus(ret_val);
1425 call_tests++;
1426 des_const_htmlElemDesc_ptr(n_elt, elt, 0);
1427 des_const_xmlChar_ptr(n_attr, attr, 1);
1428 des_int(n_legacy, legacy, 2);
1429 xmlResetLastError();
1430 if (mem_base != xmlMemBlocks()) {
1431 printf("Leak of %d blocks found in htmlAttrAllowed",
1432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001433 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001434 printf(" %d", n_elt);
1435 printf(" %d", n_attr);
1436 printf(" %d", n_legacy);
1437 printf("\n");
1438 }
1439 }
1440 }
1441 }
1442#endif
1443
1444 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001446}
1447
1448
1449static int
1450test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001452
Daniel Veillarda03e3652004-11-02 18:45:30 +00001453#ifdef LIBXML_HTML_ENABLED
1454 int mem_base;
1455 int ret_val;
1456 htmlDocPtr doc; /* the HTML document */
1457 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001458 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001459 int n_name;
1460 htmlNodePtr elem; /* the HTML element */
1461 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001462
Daniel Veillarda03e3652004-11-02 18:45:30 +00001463 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
1464 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1465 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
1466 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001467 doc = gen_xmlDocPtr(n_doc, 0);
1468 name = gen_const_xmlChar_ptr(n_name, 1);
1469 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001470
1471 ret_val = htmlAutoCloseTag(doc, name, elem);
1472 desret_int(ret_val);
1473 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001474 des_xmlDocPtr(n_doc, doc, 0);
1475 des_const_xmlChar_ptr(n_name, name, 1);
1476 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001477 xmlResetLastError();
1478 if (mem_base != xmlMemBlocks()) {
1479 printf("Leak of %d blocks found in htmlAutoCloseTag",
1480 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001481 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001482 printf(" %d", n_doc);
1483 printf(" %d", n_name);
1484 printf(" %d", n_elem);
1485 printf("\n");
1486 }
1487 }
1488 }
1489 }
1490#endif
1491
Daniel Veillard3d97e662004-11-04 10:49:00 +00001492 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001494}
1495
1496
1497static int
1498test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001500
Daniel Veillard34099b42004-11-04 17:34:35 +00001501#ifdef LIBXML_HTML_ENABLED
1502 int mem_base;
1503 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001504 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001505 int n_buffer;
1506 int size; /* the size of the array */
1507 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001508
Daniel Veillard34099b42004-11-04 17:34:35 +00001509 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1510 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1511 mem_base = xmlMemBlocks();
1512 buffer = gen_const_char_ptr(n_buffer, 0);
1513 size = gen_int(n_size, 1);
1514
1515 ret_val = htmlCreateMemoryParserCtxt(buffer, size);
1516 desret_xmlParserCtxtPtr(ret_val);
1517 call_tests++;
1518 des_const_char_ptr(n_buffer, buffer, 0);
1519 des_int(n_size, size, 1);
1520 xmlResetLastError();
1521 if (mem_base != xmlMemBlocks()) {
1522 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1523 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001524 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001525 printf(" %d", n_buffer);
1526 printf(" %d", n_size);
1527 printf("\n");
1528 }
1529 }
1530 }
1531#endif
1532
1533 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001534 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001535}
1536
1537
Daniel Veillardce682bc2004-11-05 17:22:25 +00001538#define gen_nb_htmlSAXHandlerPtr 1
1539static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1540 return(NULL);
1541}
1542static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1543}
1544
Daniel Veillardd93f6252004-11-02 15:53:51 +00001545static int
1546test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001548
Daniel Veillardce682bc2004-11-05 17:22:25 +00001549#ifdef LIBXML_HTML_ENABLED
1550#ifdef LIBXML_PUSH_ENABLED
1551 int mem_base;
1552 htmlParserCtxtPtr ret_val;
1553 htmlSAXHandlerPtr sax; /* a SAX handler */
1554 int n_sax;
1555 void * user_data; /* The user data returned on SAX callbacks */
1556 int n_user_data;
1557 char * chunk; /* a pointer to an array of chars */
1558 int n_chunk;
1559 int size; /* number of chars in the array */
1560 int n_size;
1561 const char * filename; /* an optional file name or URI */
1562 int n_filename;
1563 xmlCharEncoding enc; /* an optional encoding */
1564 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001565
Daniel Veillardce682bc2004-11-05 17:22:25 +00001566 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1567 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1568 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1569 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001570 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001571 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1572 mem_base = xmlMemBlocks();
1573 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1574 user_data = gen_userdata(n_user_data, 1);
1575 chunk = gen_const_char_ptr(n_chunk, 2);
1576 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001577 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001578 enc = gen_xmlCharEncoding(n_enc, 5);
1579
1580 ret_val = htmlCreatePushParserCtxt(sax, user_data, chunk, size, filename, enc);
1581 desret_xmlParserCtxtPtr(ret_val);
1582 call_tests++;
1583 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1584 des_userdata(n_user_data, user_data, 1);
1585 des_const_char_ptr(n_chunk, chunk, 2);
1586 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001587 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001588 des_xmlCharEncoding(n_enc, enc, 5);
1589 xmlResetLastError();
1590 if (mem_base != xmlMemBlocks()) {
1591 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001593 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001594 printf(" %d", n_sax);
1595 printf(" %d", n_user_data);
1596 printf(" %d", n_chunk);
1597 printf(" %d", n_size);
1598 printf(" %d", n_filename);
1599 printf(" %d", n_enc);
1600 printf("\n");
1601 }
1602 }
1603 }
1604 }
1605 }
1606 }
1607 }
1608#endif
1609#endif
1610
1611 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001612 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001613}
1614
1615
1616static int
1617test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001618 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001619
Daniel Veillarda03e3652004-11-02 18:45:30 +00001620#ifdef LIBXML_HTML_ENABLED
1621 int mem_base;
1622 htmlDocPtr ret_val;
1623 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1624 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001625 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001626 int n_cur;
1627 const char * URL; /* the base URL to use for the document */
1628 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001629 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001630 int n_encoding;
1631 int options; /* a combination of htmlParserOption(s) */
1632 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001633
Daniel Veillarda03e3652004-11-02 18:45:30 +00001634 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
1635 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1636 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1637 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1638 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1639 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001640 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
1641 cur = gen_const_xmlChar_ptr(n_cur, 1);
1642 URL = gen_filepath(n_URL, 2);
1643 encoding = gen_const_char_ptr(n_encoding, 3);
1644 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001645
Daniel Veillarda03e3652004-11-02 18:45:30 +00001646 ret_val = htmlCtxtReadDoc(ctxt, cur, URL, encoding, options);
1647 desret_xmlDocPtr(ret_val);
1648 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001649 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
1650 des_const_xmlChar_ptr(n_cur, cur, 1);
1651 des_filepath(n_URL, URL, 2);
1652 des_const_char_ptr(n_encoding, encoding, 3);
1653 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001654 xmlResetLastError();
1655 if (mem_base != xmlMemBlocks()) {
1656 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001658 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001659 printf(" %d", n_ctxt);
1660 printf(" %d", n_cur);
1661 printf(" %d", n_URL);
1662 printf(" %d", n_encoding);
1663 printf(" %d", n_options);
1664 printf("\n");
1665 }
1666 }
1667 }
1668 }
1669 }
1670 }
1671#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001672
Daniel Veillard3d97e662004-11-04 10:49:00 +00001673 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001674 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001675}
1676
1677
1678static int
1679test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001680 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001681
Daniel Veillarda03e3652004-11-02 18:45:30 +00001682#ifdef LIBXML_HTML_ENABLED
1683 int mem_base;
1684 htmlDocPtr ret_val;
1685 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1686 int n_ctxt;
1687 const char * filename; /* a file or URL */
1688 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001689 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001690 int n_encoding;
1691 int options; /* a combination of htmlParserOption(s) */
1692 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001693
Daniel Veillarda03e3652004-11-02 18:45:30 +00001694 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
1695 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1696 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1697 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1698 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001699 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
1700 filename = gen_filepath(n_filename, 1);
1701 encoding = gen_const_char_ptr(n_encoding, 2);
1702 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001703
1704 ret_val = htmlCtxtReadFile(ctxt, filename, encoding, options);
1705 desret_xmlDocPtr(ret_val);
1706 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001707 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
1708 des_filepath(n_filename, filename, 1);
1709 des_const_char_ptr(n_encoding, encoding, 2);
1710 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001711 xmlResetLastError();
1712 if (mem_base != xmlMemBlocks()) {
1713 printf("Leak of %d blocks found in htmlCtxtReadFile",
1714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001715 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001716 printf(" %d", n_ctxt);
1717 printf(" %d", n_filename);
1718 printf(" %d", n_encoding);
1719 printf(" %d", n_options);
1720 printf("\n");
1721 }
1722 }
1723 }
1724 }
1725 }
1726#endif
1727
Daniel Veillard3d97e662004-11-04 10:49:00 +00001728 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001730}
1731
1732
1733static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001734test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001735 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001736
Daniel Veillarda03e3652004-11-02 18:45:30 +00001737#ifdef LIBXML_HTML_ENABLED
1738 int mem_base;
1739 htmlDocPtr ret_val;
1740 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1741 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001742 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001743 int n_buffer;
1744 int size; /* the size of the array */
1745 int n_size;
1746 const char * URL; /* the base URL to use for the document */
1747 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001748 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001749 int n_encoding;
1750 int options; /* a combination of htmlParserOption(s) */
1751 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001752
Daniel Veillarda03e3652004-11-02 18:45:30 +00001753 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
1754 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1755 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1756 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1757 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1758 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1759 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001760 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
1761 buffer = gen_const_char_ptr(n_buffer, 1);
1762 size = gen_int(n_size, 2);
1763 URL = gen_filepath(n_URL, 3);
1764 encoding = gen_const_char_ptr(n_encoding, 4);
1765 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001766
1767 ret_val = htmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options);
1768 desret_xmlDocPtr(ret_val);
1769 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001770 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
1771 des_const_char_ptr(n_buffer, buffer, 1);
1772 des_int(n_size, size, 2);
1773 des_filepath(n_URL, URL, 3);
1774 des_const_char_ptr(n_encoding, encoding, 4);
1775 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001776 xmlResetLastError();
1777 if (mem_base != xmlMemBlocks()) {
1778 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1779 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001780 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001781 printf(" %d", n_ctxt);
1782 printf(" %d", n_buffer);
1783 printf(" %d", n_size);
1784 printf(" %d", n_URL);
1785 printf(" %d", n_encoding);
1786 printf(" %d", n_options);
1787 printf("\n");
1788 }
1789 }
1790 }
1791 }
1792 }
1793 }
1794 }
1795#endif
1796
Daniel Veillard3d97e662004-11-04 10:49:00 +00001797 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001798 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001799}
1800
1801
1802static int
1803test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001804 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001805
Daniel Veillarda03e3652004-11-02 18:45:30 +00001806#ifdef LIBXML_HTML_ENABLED
1807 int mem_base;
1808 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1809 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001810
Daniel Veillarda03e3652004-11-02 18:45:30 +00001811 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
1812 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001813 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001814
1815 htmlCtxtReset(ctxt);
1816 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001817 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001818 xmlResetLastError();
1819 if (mem_base != xmlMemBlocks()) {
1820 printf("Leak of %d blocks found in htmlCtxtReset",
1821 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001822 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001823 printf(" %d", n_ctxt);
1824 printf("\n");
1825 }
1826 }
1827#endif
1828
Daniel Veillard3d97e662004-11-04 10:49:00 +00001829 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001831}
1832
1833
1834static int
1835test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001837
Daniel Veillarda03e3652004-11-02 18:45:30 +00001838#ifdef LIBXML_HTML_ENABLED
1839 int mem_base;
1840 int ret_val;
1841 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1842 int n_ctxt;
1843 int options; /* a combination of htmlParserOption(s) */
1844 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001845
Daniel Veillarda03e3652004-11-02 18:45:30 +00001846 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
1847 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1848 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001849 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
1850 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001851
1852 ret_val = htmlCtxtUseOptions(ctxt, options);
1853 desret_int(ret_val);
1854 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001855 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
1856 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001857 xmlResetLastError();
1858 if (mem_base != xmlMemBlocks()) {
1859 printf("Leak of %d blocks found in htmlCtxtUseOptions",
1860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001861 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001862 printf(" %d", n_ctxt);
1863 printf(" %d", n_options);
1864 printf("\n");
1865 }
1866 }
1867 }
1868#endif
1869
Daniel Veillard3d97e662004-11-04 10:49:00 +00001870 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001872}
1873
1874
1875static int
1876test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001878
Daniel Veillardce682bc2004-11-05 17:22:25 +00001879#ifdef LIBXML_HTML_ENABLED
1880 int mem_base;
1881 int ret_val;
1882 htmlElemDesc * parent; /* HTML parent element */
1883 int n_parent;
1884 xmlChar * elt; /* HTML element */
1885 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001886
Daniel Veillardce682bc2004-11-05 17:22:25 +00001887 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1888 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
1889 mem_base = xmlMemBlocks();
1890 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1891 elt = gen_const_xmlChar_ptr(n_elt, 1);
1892
1893 ret_val = htmlElementAllowedHere(parent, elt);
1894 desret_int(ret_val);
1895 call_tests++;
1896 des_const_htmlElemDesc_ptr(n_parent, parent, 0);
1897 des_const_xmlChar_ptr(n_elt, elt, 1);
1898 xmlResetLastError();
1899 if (mem_base != xmlMemBlocks()) {
1900 printf("Leak of %d blocks found in htmlElementAllowedHere",
1901 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001902 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001903 printf(" %d", n_parent);
1904 printf(" %d", n_elt);
1905 printf("\n");
1906 }
1907 }
1908 }
1909#endif
1910
1911 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001913}
1914
1915
1916static int
1917test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001919
Daniel Veillard57b25162004-11-06 14:50:18 +00001920#ifdef LIBXML_HTML_ENABLED
1921 int mem_base;
1922 htmlStatus ret_val;
1923 htmlElemDesc * parent; /* HTML parent element */
1924 int n_parent;
1925 htmlElemDesc * elt; /* HTML element */
1926 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001927
Daniel Veillard57b25162004-11-06 14:50:18 +00001928 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1929 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1930 mem_base = xmlMemBlocks();
1931 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1932 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1933
1934 ret_val = htmlElementStatusHere(parent, elt);
1935 desret_htmlStatus(ret_val);
1936 call_tests++;
1937 des_const_htmlElemDesc_ptr(n_parent, parent, 0);
1938 des_const_htmlElemDesc_ptr(n_elt, elt, 1);
1939 xmlResetLastError();
1940 if (mem_base != xmlMemBlocks()) {
1941 printf("Leak of %d blocks found in htmlElementStatusHere",
1942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001943 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001944 printf(" %d", n_parent);
1945 printf(" %d", n_elt);
1946 printf("\n");
1947 }
1948 }
1949 }
1950#endif
1951
1952 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001954}
1955
1956
1957static int
1958test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001960
Daniel Veillardce682bc2004-11-05 17:22:25 +00001961#ifdef LIBXML_HTML_ENABLED
1962 int mem_base;
1963 int ret_val;
1964 unsigned char * out; /* a pointer to an array of bytes to store the result */
1965 int n_out;
1966 int * outlen; /* the length of @out */
1967 int n_outlen;
1968 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1969 int n_in;
1970 int * inlen; /* the length of @in */
1971 int n_inlen;
1972 int quoteChar; /* the quote character to escape (' or ") or zero. */
1973 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001974
Daniel Veillardce682bc2004-11-05 17:22:25 +00001975 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1976 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1977 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1978 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1979 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
1980 mem_base = xmlMemBlocks();
1981 out = gen_unsigned_char_ptr(n_out, 0);
1982 outlen = gen_int_ptr(n_outlen, 1);
1983 in = gen_const_unsigned_char_ptr(n_in, 2);
1984 inlen = gen_int_ptr(n_inlen, 3);
1985 quoteChar = gen_int(n_quoteChar, 4);
1986
1987 ret_val = htmlEncodeEntities(out, outlen, in, inlen, quoteChar);
1988 desret_int(ret_val);
1989 call_tests++;
1990 des_unsigned_char_ptr(n_out, out, 0);
1991 des_int_ptr(n_outlen, outlen, 1);
1992 des_const_unsigned_char_ptr(n_in, in, 2);
1993 des_int_ptr(n_inlen, inlen, 3);
1994 des_int(n_quoteChar, quoteChar, 4);
1995 xmlResetLastError();
1996 if (mem_base != xmlMemBlocks()) {
1997 printf("Leak of %d blocks found in htmlEncodeEntities",
1998 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001999 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002000 printf(" %d", n_out);
2001 printf(" %d", n_outlen);
2002 printf(" %d", n_in);
2003 printf(" %d", n_inlen);
2004 printf(" %d", n_quoteChar);
2005 printf("\n");
2006 }
2007 }
2008 }
2009 }
2010 }
2011 }
2012#endif
2013
2014 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002015 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002016}
2017
2018
2019static int
2020test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002021 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002022
Daniel Veillard42595322004-11-08 10:52:06 +00002023#ifdef LIBXML_HTML_ENABLED
2024 int mem_base;
2025 const htmlEntityDesc * ret_val;
2026 xmlChar * name; /* the entity name */
2027 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002028
Daniel Veillard42595322004-11-08 10:52:06 +00002029 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2030 mem_base = xmlMemBlocks();
2031 name = gen_const_xmlChar_ptr(n_name, 0);
2032
2033 ret_val = htmlEntityLookup(name);
2034 desret_const_htmlEntityDesc_ptr(ret_val);
2035 call_tests++;
2036 des_const_xmlChar_ptr(n_name, name, 0);
2037 xmlResetLastError();
2038 if (mem_base != xmlMemBlocks()) {
2039 printf("Leak of %d blocks found in htmlEntityLookup",
2040 xmlMemBlocks() - mem_base);
2041 test_ret++;
2042 printf(" %d", n_name);
2043 printf("\n");
2044 }
2045 }
2046#endif
2047
2048 function_tests++;
2049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002050}
2051
2052
2053static int
2054test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002056
Daniel Veillard42595322004-11-08 10:52:06 +00002057#ifdef LIBXML_HTML_ENABLED
2058 int mem_base;
2059 const htmlEntityDesc * ret_val;
2060 unsigned int value; /* the entity's unicode value */
2061 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002062
Daniel Veillard42595322004-11-08 10:52:06 +00002063 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
2064 mem_base = xmlMemBlocks();
2065 value = gen_unsigned_int(n_value, 0);
2066
2067 ret_val = htmlEntityValueLookup(value);
2068 desret_const_htmlEntityDesc_ptr(ret_val);
2069 call_tests++;
2070 des_unsigned_int(n_value, value, 0);
2071 xmlResetLastError();
2072 if (mem_base != xmlMemBlocks()) {
2073 printf("Leak of %d blocks found in htmlEntityValueLookup",
2074 xmlMemBlocks() - mem_base);
2075 test_ret++;
2076 printf(" %d", n_value);
2077 printf("\n");
2078 }
2079 }
2080#endif
2081
2082 function_tests++;
2083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002084}
2085
2086
2087static int
2088test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002090
2091#ifdef LIBXML_HTML_ENABLED
2092 int mem_base;
2093 int ret_val;
2094 int val; /* int 0 or 1 */
2095 int n_val;
2096
2097 for (n_val = 0;n_val < gen_nb_int;n_val++) {
2098 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002099 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002100
2101 ret_val = htmlHandleOmittedElem(val);
2102 desret_int(ret_val);
2103 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002104 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002105 xmlResetLastError();
2106 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002107 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002108 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002109 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002110 printf(" %d", n_val);
2111 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002112 }
2113 }
2114#endif
2115
Daniel Veillard3d97e662004-11-04 10:49:00 +00002116 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002118}
2119
2120
2121static int
2122test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002124
Daniel Veillarda03e3652004-11-02 18:45:30 +00002125#ifdef LIBXML_HTML_ENABLED
2126 int mem_base;
2127 int ret_val;
2128 htmlDocPtr doc; /* the HTML document */
2129 int n_doc;
2130 htmlNodePtr elem; /* the HTML element */
2131 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002132
Daniel Veillarda03e3652004-11-02 18:45:30 +00002133 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
2134 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
2135 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002136 doc = gen_xmlDocPtr(n_doc, 0);
2137 elem = gen_xmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002138
2139 ret_val = htmlIsAutoClosed(doc, elem);
2140 desret_int(ret_val);
2141 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002142 des_xmlDocPtr(n_doc, doc, 0);
2143 des_xmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002144 xmlResetLastError();
2145 if (mem_base != xmlMemBlocks()) {
2146 printf("Leak of %d blocks found in htmlIsAutoClosed",
2147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002148 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002149 printf(" %d", n_doc);
2150 printf(" %d", n_elem);
2151 printf("\n");
2152 }
2153 }
2154 }
2155#endif
2156
Daniel Veillard3d97e662004-11-04 10:49:00 +00002157 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002159}
2160
2161
2162static int
2163test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002164 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002165
2166#ifdef LIBXML_HTML_ENABLED
2167 int mem_base;
2168 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002169 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002170 int n_name;
2171
2172 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2173 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002174 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002175
2176 ret_val = htmlIsScriptAttribute(name);
2177 desret_int(ret_val);
2178 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002179 des_const_xmlChar_ptr(n_name, name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002180 xmlResetLastError();
2181 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002182 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002183 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002184 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002185 printf(" %d", n_name);
2186 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002187 }
2188 }
2189#endif
2190
Daniel Veillard3d97e662004-11-04 10:49:00 +00002191 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002193}
2194
2195
Daniel Veillardce682bc2004-11-05 17:22:25 +00002196#define gen_nb_const_xmlNodePtr 1
2197static htmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2198 return(NULL);
2199}
2200static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2201}
2202
Daniel Veillardd93f6252004-11-02 15:53:51 +00002203static int
2204test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002205 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002206
Daniel Veillard57b25162004-11-06 14:50:18 +00002207#ifdef LIBXML_HTML_ENABLED
2208 int mem_base;
2209 htmlStatus ret_val;
2210 htmlNodePtr node; /* an htmlNodePtr in a tree */
2211 int n_node;
2212 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2213 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002214
Daniel Veillard57b25162004-11-06 14:50:18 +00002215 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
2216 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2217 mem_base = xmlMemBlocks();
2218 node = gen_const_xmlNodePtr(n_node, 0);
2219 legacy = gen_int(n_legacy, 1);
2220
2221 ret_val = htmlNodeStatus(node, legacy);
2222 desret_htmlStatus(ret_val);
2223 call_tests++;
2224 des_const_xmlNodePtr(n_node, node, 0);
2225 des_int(n_legacy, legacy, 1);
2226 xmlResetLastError();
2227 if (mem_base != xmlMemBlocks()) {
2228 printf("Leak of %d blocks found in htmlNodeStatus",
2229 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002230 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002231 printf(" %d", n_node);
2232 printf(" %d", n_legacy);
2233 printf("\n");
2234 }
2235 }
2236 }
2237#endif
2238
2239 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002241}
2242
2243
2244static int
2245test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002247
Daniel Veillarda03e3652004-11-02 18:45:30 +00002248#ifdef LIBXML_HTML_ENABLED
2249 int mem_base;
2250 int ret_val;
2251 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2252 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002253
Daniel Veillarda03e3652004-11-02 18:45:30 +00002254 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
2255 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002256 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002257
2258 ret_val = htmlParseCharRef(ctxt);
2259 desret_int(ret_val);
2260 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002261 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002262 xmlResetLastError();
2263 if (mem_base != xmlMemBlocks()) {
2264 printf("Leak of %d blocks found in htmlParseCharRef",
2265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002266 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002267 printf(" %d", n_ctxt);
2268 printf("\n");
2269 }
2270 }
2271#endif
2272
Daniel Veillard3d97e662004-11-04 10:49:00 +00002273 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002274 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002275}
2276
2277
2278static int
2279test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002280 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002281
Daniel Veillarda03e3652004-11-02 18:45:30 +00002282#ifdef LIBXML_HTML_ENABLED
2283#ifdef LIBXML_PUSH_ENABLED
2284 int mem_base;
2285 int ret_val;
2286 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2287 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002288 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002289 int n_chunk;
2290 int size; /* the size in byte of the chunk */
2291 int n_size;
2292 int terminate; /* last chunk indicator */
2293 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002294
Daniel Veillarda03e3652004-11-02 18:45:30 +00002295 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
2296 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2297 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2298 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2299 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002300 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
2301 chunk = gen_const_char_ptr(n_chunk, 1);
2302 size = gen_int(n_size, 2);
2303 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002304
2305 ret_val = htmlParseChunk(ctxt, chunk, size, terminate);
2306 desret_int(ret_val);
2307 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002308 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
2309 des_const_char_ptr(n_chunk, chunk, 1);
2310 des_int(n_size, size, 2);
2311 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002312 xmlResetLastError();
2313 if (mem_base != xmlMemBlocks()) {
2314 printf("Leak of %d blocks found in htmlParseChunk",
2315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002316 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002317 printf(" %d", n_ctxt);
2318 printf(" %d", n_chunk);
2319 printf(" %d", n_size);
2320 printf(" %d", n_terminate);
2321 printf("\n");
2322 }
2323 }
2324 }
2325 }
2326 }
2327#endif
2328#endif
2329
Daniel Veillard3d97e662004-11-04 10:49:00 +00002330 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002331 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002332}
2333
2334
2335static int
2336test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002337 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002338
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002339#ifdef LIBXML_HTML_ENABLED
2340 int mem_base;
2341 htmlDocPtr ret_val;
2342 xmlChar * cur; /* a pointer to an array of xmlChar */
2343 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002344 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002345 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002346
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002347 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2348 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2349 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002350 cur = gen_xmlChar_ptr(n_cur, 0);
2351 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002352
2353 ret_val = htmlParseDoc(cur, encoding);
2354 desret_xmlDocPtr(ret_val);
2355 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002356 des_xmlChar_ptr(n_cur, cur, 0);
2357 des_const_char_ptr(n_encoding, encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002358 xmlResetLastError();
2359 if (mem_base != xmlMemBlocks()) {
2360 printf("Leak of %d blocks found in htmlParseDoc",
2361 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002362 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002363 printf(" %d", n_cur);
2364 printf(" %d", n_encoding);
2365 printf("\n");
2366 }
2367 }
2368 }
2369#endif
2370
Daniel Veillard3d97e662004-11-04 10:49:00 +00002371 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002373}
2374
2375
2376static int
2377test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002379
Daniel Veillarda03e3652004-11-02 18:45:30 +00002380#ifdef LIBXML_HTML_ENABLED
2381 int mem_base;
2382 int ret_val;
2383 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2384 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002385
Daniel Veillarda03e3652004-11-02 18:45:30 +00002386 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
2387 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002388 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002389
2390 ret_val = htmlParseDocument(ctxt);
2391 desret_int(ret_val);
2392 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002393 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002394 xmlResetLastError();
2395 if (mem_base != xmlMemBlocks()) {
2396 printf("Leak of %d blocks found in htmlParseDocument",
2397 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002398 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002399 printf(" %d", n_ctxt);
2400 printf("\n");
2401 }
2402 }
2403#endif
2404
Daniel Veillard3d97e662004-11-04 10:49:00 +00002405 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002406 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002407}
2408
2409
2410static int
2411test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002412 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002413
Daniel Veillarda03e3652004-11-02 18:45:30 +00002414#ifdef LIBXML_HTML_ENABLED
2415 int mem_base;
2416 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2417 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002418
Daniel Veillarda03e3652004-11-02 18:45:30 +00002419 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
2420 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002421 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002422
2423 htmlParseElement(ctxt);
2424 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002425 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002426 xmlResetLastError();
2427 if (mem_base != xmlMemBlocks()) {
2428 printf("Leak of %d blocks found in htmlParseElement",
2429 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002430 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002431 printf(" %d", n_ctxt);
2432 printf("\n");
2433 }
2434 }
2435#endif
2436
Daniel Veillard3d97e662004-11-04 10:49:00 +00002437 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002438 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002439}
2440
2441
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002442#define gen_nb_const_xmlChar_ptr_ptr 1
2443static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2444 return(NULL);
2445}
2446static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2447}
2448
Daniel Veillardd93f6252004-11-02 15:53:51 +00002449static int
2450test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002452
Daniel Veillard42595322004-11-08 10:52:06 +00002453#ifdef LIBXML_HTML_ENABLED
2454 int mem_base;
2455 const htmlEntityDesc * ret_val;
2456 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2457 int n_ctxt;
2458 xmlChar ** str; /* location to store the entity name */
2459 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002460
Daniel Veillard42595322004-11-08 10:52:06 +00002461 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
2462 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2463 mem_base = xmlMemBlocks();
2464 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
2465 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2466
2467 ret_val = htmlParseEntityRef(ctxt, str);
2468 desret_const_htmlEntityDesc_ptr(ret_val);
2469 call_tests++;
2470 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
2471 des_const_xmlChar_ptr_ptr(n_str, str, 1);
2472 xmlResetLastError();
2473 if (mem_base != xmlMemBlocks()) {
2474 printf("Leak of %d blocks found in htmlParseEntityRef",
2475 xmlMemBlocks() - mem_base);
2476 test_ret++;
2477 printf(" %d", n_ctxt);
2478 printf(" %d", n_str);
2479 printf("\n");
2480 }
2481 }
2482 }
2483#endif
2484
2485 function_tests++;
2486 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002487}
2488
2489
2490static int
2491test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002492 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002493
Daniel Veillarda03e3652004-11-02 18:45:30 +00002494#ifdef LIBXML_HTML_ENABLED
2495 htmlDocPtr ret_val;
2496 const char * filename; /* the filename */
2497 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002498 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002499 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002500
Daniel Veillarda03e3652004-11-02 18:45:30 +00002501 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2502 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002503 filename = gen_filepath(n_filename, 0);
2504 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002505
2506 ret_val = htmlParseFile(filename, encoding);
2507 desret_xmlDocPtr(ret_val);
2508 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002509 des_filepath(n_filename, filename, 0);
2510 des_const_char_ptr(n_encoding, encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002511 xmlResetLastError();
2512 }
2513 }
2514#endif
2515
Daniel Veillard3d97e662004-11-04 10:49:00 +00002516 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002518}
2519
2520
2521static int
2522test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002524
Daniel Veillarda03e3652004-11-02 18:45:30 +00002525#ifdef LIBXML_HTML_ENABLED
2526 int mem_base;
2527 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002528 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002529 int n_cur;
2530 const char * URL; /* the base URL to use for the document */
2531 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002532 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002533 int n_encoding;
2534 int options; /* a combination of htmlParserOption(s) */
2535 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002536
Daniel Veillarda03e3652004-11-02 18:45:30 +00002537 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2538 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2539 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2540 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2541 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002542 cur = gen_const_xmlChar_ptr(n_cur, 0);
2543 URL = gen_filepath(n_URL, 1);
2544 encoding = gen_const_char_ptr(n_encoding, 2);
2545 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002546
Daniel Veillarda03e3652004-11-02 18:45:30 +00002547 ret_val = htmlReadDoc(cur, URL, encoding, options);
2548 desret_xmlDocPtr(ret_val);
2549 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002550 des_const_xmlChar_ptr(n_cur, cur, 0);
2551 des_filepath(n_URL, URL, 1);
2552 des_const_char_ptr(n_encoding, encoding, 2);
2553 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002554 xmlResetLastError();
2555 if (mem_base != xmlMemBlocks()) {
2556 printf("Leak of %d blocks found in htmlReadDoc",
2557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002558 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002559 printf(" %d", n_cur);
2560 printf(" %d", n_URL);
2561 printf(" %d", n_encoding);
2562 printf(" %d", n_options);
2563 printf("\n");
2564 }
2565 }
2566 }
2567 }
2568 }
2569#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002570
Daniel Veillard3d97e662004-11-04 10:49:00 +00002571 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002573}
2574
2575
2576static int
2577test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002578 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002579
Daniel Veillarda03e3652004-11-02 18:45:30 +00002580#ifdef LIBXML_HTML_ENABLED
2581 int mem_base;
2582 htmlDocPtr ret_val;
2583 const char * filename; /* a file or URL */
2584 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002585 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002586 int n_encoding;
2587 int options; /* a combination of htmlParserOption(s) */
2588 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002589
Daniel Veillarda03e3652004-11-02 18:45:30 +00002590 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2591 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2592 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2593 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002594 filename = gen_filepath(n_filename, 0);
2595 encoding = gen_const_char_ptr(n_encoding, 1);
2596 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002597
2598 ret_val = htmlReadFile(filename, encoding, options);
2599 desret_xmlDocPtr(ret_val);
2600 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002601 des_filepath(n_filename, filename, 0);
2602 des_const_char_ptr(n_encoding, encoding, 1);
2603 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002604 xmlResetLastError();
2605 if (mem_base != xmlMemBlocks()) {
2606 printf("Leak of %d blocks found in htmlReadFile",
2607 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002608 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002609 printf(" %d", n_filename);
2610 printf(" %d", n_encoding);
2611 printf(" %d", n_options);
2612 printf("\n");
2613 }
2614 }
2615 }
2616 }
2617#endif
2618
Daniel Veillard3d97e662004-11-04 10:49:00 +00002619 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002620 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002621}
2622
2623
2624static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002625test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002626 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002627
Daniel Veillarda03e3652004-11-02 18:45:30 +00002628#ifdef LIBXML_HTML_ENABLED
2629 int mem_base;
2630 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002631 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002632 int n_buffer;
2633 int size; /* the size of the array */
2634 int n_size;
2635 const char * URL; /* the base URL to use for the document */
2636 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002637 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002638 int n_encoding;
2639 int options; /* a combination of htmlParserOption(s) */
2640 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002641
Daniel Veillarda03e3652004-11-02 18:45:30 +00002642 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2643 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2644 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2645 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2646 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2647 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002648 buffer = gen_const_char_ptr(n_buffer, 0);
2649 size = gen_int(n_size, 1);
2650 URL = gen_filepath(n_URL, 2);
2651 encoding = gen_const_char_ptr(n_encoding, 3);
2652 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002653
2654 ret_val = htmlReadMemory(buffer, size, URL, encoding, options);
2655 desret_xmlDocPtr(ret_val);
2656 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002657 des_const_char_ptr(n_buffer, buffer, 0);
2658 des_int(n_size, size, 1);
2659 des_filepath(n_URL, URL, 2);
2660 des_const_char_ptr(n_encoding, encoding, 3);
2661 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002662 xmlResetLastError();
2663 if (mem_base != xmlMemBlocks()) {
2664 printf("Leak of %d blocks found in htmlReadMemory",
2665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002666 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002667 printf(" %d", n_buffer);
2668 printf(" %d", n_size);
2669 printf(" %d", n_URL);
2670 printf(" %d", n_encoding);
2671 printf(" %d", n_options);
2672 printf("\n");
2673 }
2674 }
2675 }
2676 }
2677 }
2678 }
2679#endif
2680
Daniel Veillard3d97e662004-11-04 10:49:00 +00002681 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002682 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002683}
2684
2685
2686static int
2687test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002688 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002689
Daniel Veillardce682bc2004-11-05 17:22:25 +00002690#ifdef LIBXML_HTML_ENABLED
2691 int mem_base;
2692 htmlDocPtr ret_val;
2693 xmlChar * cur; /* a pointer to an array of xmlChar */
2694 int n_cur;
2695 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2696 int n_encoding;
2697 htmlSAXHandlerPtr sax; /* the SAX handler block */
2698 int n_sax;
2699 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2700 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002701
Daniel Veillardce682bc2004-11-05 17:22:25 +00002702 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2703 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2704 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2705 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2706 mem_base = xmlMemBlocks();
2707 cur = gen_xmlChar_ptr(n_cur, 0);
2708 encoding = gen_const_char_ptr(n_encoding, 1);
2709 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2710 userData = gen_userdata(n_userData, 3);
2711
2712 ret_val = htmlSAXParseDoc(cur, encoding, sax, userData);
2713 desret_xmlDocPtr(ret_val);
2714 call_tests++;
2715 des_xmlChar_ptr(n_cur, cur, 0);
2716 des_const_char_ptr(n_encoding, encoding, 1);
2717 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2718 des_userdata(n_userData, userData, 3);
2719 xmlResetLastError();
2720 if (mem_base != xmlMemBlocks()) {
2721 printf("Leak of %d blocks found in htmlSAXParseDoc",
2722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002723 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002724 printf(" %d", n_cur);
2725 printf(" %d", n_encoding);
2726 printf(" %d", n_sax);
2727 printf(" %d", n_userData);
2728 printf("\n");
2729 }
2730 }
2731 }
2732 }
2733 }
2734#endif
2735
2736 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002737 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002738}
2739
2740
2741static int
2742test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002743 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002744
Daniel Veillardce682bc2004-11-05 17:22:25 +00002745#ifdef LIBXML_HTML_ENABLED
2746 int mem_base;
2747 htmlDocPtr ret_val;
2748 const char * filename; /* the filename */
2749 int n_filename;
2750 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2751 int n_encoding;
2752 htmlSAXHandlerPtr sax; /* the SAX handler block */
2753 int n_sax;
2754 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2755 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002756
Daniel Veillardce682bc2004-11-05 17:22:25 +00002757 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2758 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2759 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2760 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2761 mem_base = xmlMemBlocks();
2762 filename = gen_filepath(n_filename, 0);
2763 encoding = gen_const_char_ptr(n_encoding, 1);
2764 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2765 userData = gen_userdata(n_userData, 3);
2766
2767 ret_val = htmlSAXParseFile(filename, encoding, sax, userData);
2768 desret_xmlDocPtr(ret_val);
2769 call_tests++;
2770 des_filepath(n_filename, filename, 0);
2771 des_const_char_ptr(n_encoding, encoding, 1);
2772 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2773 des_userdata(n_userData, userData, 3);
2774 xmlResetLastError();
2775 if (mem_base != xmlMemBlocks()) {
2776 printf("Leak of %d blocks found in htmlSAXParseFile",
2777 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002778 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002779 printf(" %d", n_filename);
2780 printf(" %d", n_encoding);
2781 printf(" %d", n_sax);
2782 printf(" %d", n_userData);
2783 printf("\n");
2784 }
2785 }
2786 }
2787 }
2788 }
2789#endif
2790
2791 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002792 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002793}
2794
2795
2796static int
2797test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002798 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002799
2800
2801 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002802 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002803}
2804
2805static int
2806test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002808
Daniel Veillard42595322004-11-08 10:52:06 +00002809 printf("Testing HTMLparser : 31 of 37 functions ...\n");
2810 test_ret += test_UTF8ToHtml();
2811 test_ret += test_htmlAttrAllowed();
2812 test_ret += test_htmlAutoCloseTag();
2813 test_ret += test_htmlCreateMemoryParserCtxt();
2814 test_ret += test_htmlCreatePushParserCtxt();
2815 test_ret += test_htmlCtxtReadDoc();
2816 test_ret += test_htmlCtxtReadFile();
2817 test_ret += test_htmlCtxtReadMemory();
2818 test_ret += test_htmlCtxtReset();
2819 test_ret += test_htmlCtxtUseOptions();
2820 test_ret += test_htmlElementAllowedHere();
2821 test_ret += test_htmlElementStatusHere();
2822 test_ret += test_htmlEncodeEntities();
2823 test_ret += test_htmlEntityLookup();
2824 test_ret += test_htmlEntityValueLookup();
2825 test_ret += test_htmlHandleOmittedElem();
2826 test_ret += test_htmlIsAutoClosed();
2827 test_ret += test_htmlIsScriptAttribute();
2828 test_ret += test_htmlNodeStatus();
2829 test_ret += test_htmlParseCharRef();
2830 test_ret += test_htmlParseChunk();
2831 test_ret += test_htmlParseDoc();
2832 test_ret += test_htmlParseDocument();
2833 test_ret += test_htmlParseElement();
2834 test_ret += test_htmlParseEntityRef();
2835 test_ret += test_htmlParseFile();
2836 test_ret += test_htmlReadDoc();
2837 test_ret += test_htmlReadFile();
2838 test_ret += test_htmlReadMemory();
2839 test_ret += test_htmlSAXParseDoc();
2840 test_ret += test_htmlSAXParseFile();
2841 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00002842
Daniel Veillard42595322004-11-08 10:52:06 +00002843 if (test_ret != 0)
2844 printf("Module HTMLparser: %d errors\n", test_ret);
2845 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002846}
2847
2848static int
2849test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002851
Daniel Veillard3d97e662004-11-04 10:49:00 +00002852#ifdef LIBXML_HTML_ENABLED
2853#ifdef LIBXML_OUTPUT_ENABLED
2854 int mem_base;
2855 xmlOutputBufferPtr buf; /* the HTML buffer output */
2856 int n_buf;
2857 xmlDocPtr cur; /* the document */
2858 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002859 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002860 int n_encoding;
2861 int format; /* should formatting spaces been added */
2862 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002863
Daniel Veillard3d97e662004-11-04 10:49:00 +00002864 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2865 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2866 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2867 for (n_format = 0;n_format < gen_nb_int;n_format++) {
2868 mem_base = xmlMemBlocks();
2869 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2870 cur = gen_xmlDocPtr(n_cur, 1);
2871 encoding = gen_const_char_ptr(n_encoding, 2);
2872 format = gen_int(n_format, 3);
2873
2874 htmlDocContentDumpFormatOutput(buf, cur, encoding, format);
2875 call_tests++;
2876 des_xmlOutputBufferPtr(n_buf, buf, 0);
2877 des_xmlDocPtr(n_cur, cur, 1);
2878 des_const_char_ptr(n_encoding, encoding, 2);
2879 des_int(n_format, format, 3);
2880 xmlResetLastError();
2881 if (mem_base != xmlMemBlocks()) {
2882 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2883 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002884 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002885 printf(" %d", n_buf);
2886 printf(" %d", n_cur);
2887 printf(" %d", n_encoding);
2888 printf(" %d", n_format);
2889 printf("\n");
2890 }
2891 }
2892 }
2893 }
2894 }
2895#endif
2896#endif
2897
2898 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002899 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002900}
2901
2902
2903static int
2904test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002905 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002906
Daniel Veillard3d97e662004-11-04 10:49:00 +00002907#ifdef LIBXML_HTML_ENABLED
2908#ifdef LIBXML_OUTPUT_ENABLED
2909 int mem_base;
2910 xmlOutputBufferPtr buf; /* the HTML buffer output */
2911 int n_buf;
2912 xmlDocPtr cur; /* the document */
2913 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002914 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002915 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002916
Daniel Veillard3d97e662004-11-04 10:49:00 +00002917 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2918 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2919 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2920 mem_base = xmlMemBlocks();
2921 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2922 cur = gen_xmlDocPtr(n_cur, 1);
2923 encoding = gen_const_char_ptr(n_encoding, 2);
2924
2925 htmlDocContentDumpOutput(buf, cur, encoding);
2926 call_tests++;
2927 des_xmlOutputBufferPtr(n_buf, buf, 0);
2928 des_xmlDocPtr(n_cur, cur, 1);
2929 des_const_char_ptr(n_encoding, encoding, 2);
2930 xmlResetLastError();
2931 if (mem_base != xmlMemBlocks()) {
2932 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
2933 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002934 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002935 printf(" %d", n_buf);
2936 printf(" %d", n_cur);
2937 printf(" %d", n_encoding);
2938 printf("\n");
2939 }
2940 }
2941 }
2942 }
2943#endif
2944#endif
2945
2946 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002948}
2949
2950
2951static int
2952test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002954
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002955#ifdef LIBXML_HTML_ENABLED
2956#ifdef LIBXML_OUTPUT_ENABLED
2957 int mem_base;
2958 int ret_val;
2959 FILE * f; /* the FILE* */
2960 int n_f;
2961 xmlDocPtr cur; /* the document */
2962 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002963
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002964 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
2965 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2966 mem_base = xmlMemBlocks();
2967 f = gen_FILE_ptr(n_f, 0);
2968 cur = gen_xmlDocPtr(n_cur, 1);
2969
2970 ret_val = htmlDocDump(f, cur);
2971 desret_int(ret_val);
2972 call_tests++;
2973 des_FILE_ptr(n_f, f, 0);
2974 des_xmlDocPtr(n_cur, cur, 1);
2975 xmlResetLastError();
2976 if (mem_base != xmlMemBlocks()) {
2977 printf("Leak of %d blocks found in htmlDocDump",
2978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002979 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002980 printf(" %d", n_f);
2981 printf(" %d", n_cur);
2982 printf("\n");
2983 }
2984 }
2985 }
2986#endif
2987#endif
2988
2989 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002991}
2992
2993
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002994#define gen_nb_xmlChar_ptr_ptr 1
2995static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2996 return(NULL);
2997}
2998static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2999}
3000
Daniel Veillardd93f6252004-11-02 15:53:51 +00003001static int
3002test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003004
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003005#ifdef LIBXML_HTML_ENABLED
3006#ifdef LIBXML_OUTPUT_ENABLED
3007 int mem_base;
3008 xmlDocPtr cur; /* the document */
3009 int n_cur;
3010 xmlChar ** mem; /* OUT: the memory pointer */
3011 int n_mem;
3012 int * size; /* OUT: the memory length */
3013 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003014
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003015 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3016 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
3017 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
3018 mem_base = xmlMemBlocks();
3019 cur = gen_xmlDocPtr(n_cur, 0);
3020 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
3021 size = gen_int_ptr(n_size, 2);
3022
3023 htmlDocDumpMemory(cur, mem, size);
3024 call_tests++;
3025 des_xmlDocPtr(n_cur, cur, 0);
3026 des_xmlChar_ptr_ptr(n_mem, mem, 1);
3027 des_int_ptr(n_size, size, 2);
3028 xmlResetLastError();
3029 if (mem_base != xmlMemBlocks()) {
3030 printf("Leak of %d blocks found in htmlDocDumpMemory",
3031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003032 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003033 printf(" %d", n_cur);
3034 printf(" %d", n_mem);
3035 printf(" %d", n_size);
3036 printf("\n");
3037 }
3038 }
3039 }
3040 }
3041#endif
3042#endif
3043
3044 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003046}
3047
3048
3049static int
3050test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003052
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003053#ifdef LIBXML_HTML_ENABLED
3054 int mem_base;
3055 const xmlChar * ret_val;
3056 htmlDocPtr doc; /* the document */
3057 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003058
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003059 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3060 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003061 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003062
3063 ret_val = htmlGetMetaEncoding(doc);
3064 desret_const_xmlChar_ptr(ret_val);
3065 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003066 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003067 xmlResetLastError();
3068 if (mem_base != xmlMemBlocks()) {
3069 printf("Leak of %d blocks found in htmlGetMetaEncoding",
3070 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003071 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003072 printf(" %d", n_doc);
3073 printf("\n");
3074 }
3075 }
3076#endif
3077
Daniel Veillard3d97e662004-11-04 10:49:00 +00003078 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003080}
3081
3082
3083static int
3084test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003086
3087#ifdef LIBXML_HTML_ENABLED
3088 int mem_base;
3089 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003090 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003091 int n_name;
3092
3093 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3094 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003095 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003096
3097 ret_val = htmlIsBooleanAttr(name);
3098 desret_int(ret_val);
3099 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003100 des_const_xmlChar_ptr(n_name, name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003101 xmlResetLastError();
3102 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003103 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003105 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003106 printf(" %d", n_name);
3107 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003108 }
3109 }
3110#endif
3111
Daniel Veillard3d97e662004-11-04 10:49:00 +00003112 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003114}
3115
3116
3117static int
3118test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003120
Daniel Veillarda03e3652004-11-02 18:45:30 +00003121#ifdef LIBXML_HTML_ENABLED
3122 int mem_base;
3123 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003124 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003125 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003126 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003127 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003128
Daniel Veillarda03e3652004-11-02 18:45:30 +00003129 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3130 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003132 URI = gen_const_xmlChar_ptr(n_URI, 0);
3133 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003134
3135 ret_val = htmlNewDoc(URI, ExternalID);
3136 desret_xmlDocPtr(ret_val);
3137 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003138 des_const_xmlChar_ptr(n_URI, URI, 0);
3139 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003140 xmlResetLastError();
3141 if (mem_base != xmlMemBlocks()) {
3142 printf("Leak of %d blocks found in htmlNewDoc",
3143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003144 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003145 printf(" %d", n_URI);
3146 printf(" %d", n_ExternalID);
3147 printf("\n");
3148 }
3149 }
3150 }
3151#endif
3152
Daniel Veillard3d97e662004-11-04 10:49:00 +00003153 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003155}
3156
3157
3158static int
3159test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003161
Daniel Veillarda03e3652004-11-02 18:45:30 +00003162#ifdef LIBXML_HTML_ENABLED
3163 int mem_base;
3164 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003165 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003166 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003167 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003168 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003169
Daniel Veillarda03e3652004-11-02 18:45:30 +00003170 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3171 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3172 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003173 URI = gen_const_xmlChar_ptr(n_URI, 0);
3174 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003175
3176 ret_val = htmlNewDocNoDtD(URI, ExternalID);
3177 desret_xmlDocPtr(ret_val);
3178 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003179 des_const_xmlChar_ptr(n_URI, URI, 0);
3180 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003181 xmlResetLastError();
3182 if (mem_base != xmlMemBlocks()) {
3183 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003185 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003186 printf(" %d", n_URI);
3187 printf(" %d", n_ExternalID);
3188 printf("\n");
3189 }
3190 }
3191 }
3192#endif
3193
Daniel Veillard3d97e662004-11-04 10:49:00 +00003194 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003196}
3197
3198
3199static int
3200test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003202
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003203#ifdef LIBXML_HTML_ENABLED
3204#ifdef LIBXML_OUTPUT_ENABLED
3205 int mem_base;
3206 int ret_val;
3207 xmlBufferPtr buf; /* the HTML buffer output */
3208 int n_buf;
3209 xmlDocPtr doc; /* the document */
3210 int n_doc;
3211 xmlNodePtr cur; /* the current node */
3212 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003213
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003214 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3215 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3216 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3217 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003218 buf = gen_xmlBufferPtr(n_buf, 0);
3219 doc = gen_xmlDocPtr(n_doc, 1);
3220 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003221
3222 ret_val = htmlNodeDump(buf, doc, cur);
3223 desret_int(ret_val);
3224 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003225 des_xmlBufferPtr(n_buf, buf, 0);
3226 des_xmlDocPtr(n_doc, doc, 1);
3227 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003228 xmlResetLastError();
3229 if (mem_base != xmlMemBlocks()) {
3230 printf("Leak of %d blocks found in htmlNodeDump",
3231 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003232 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003233 printf(" %d", n_buf);
3234 printf(" %d", n_doc);
3235 printf(" %d", n_cur);
3236 printf("\n");
3237 }
3238 }
3239 }
3240 }
3241#endif
3242#endif
3243
Daniel Veillard3d97e662004-11-04 10:49:00 +00003244 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003246}
3247
3248
3249static int
3250test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003252
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003253#ifdef LIBXML_HTML_ENABLED
3254#ifdef LIBXML_OUTPUT_ENABLED
3255 int mem_base;
3256 FILE * out; /* the FILE pointer */
3257 int n_out;
3258 xmlDocPtr doc; /* the document */
3259 int n_doc;
3260 xmlNodePtr cur; /* the current node */
3261 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003262
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003263 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3264 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3265 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3266 mem_base = xmlMemBlocks();
3267 out = gen_FILE_ptr(n_out, 0);
3268 doc = gen_xmlDocPtr(n_doc, 1);
3269 cur = gen_xmlNodePtr(n_cur, 2);
3270
3271 htmlNodeDumpFile(out, doc, cur);
3272 call_tests++;
3273 des_FILE_ptr(n_out, out, 0);
3274 des_xmlDocPtr(n_doc, doc, 1);
3275 des_xmlNodePtr(n_cur, cur, 2);
3276 xmlResetLastError();
3277 if (mem_base != xmlMemBlocks()) {
3278 printf("Leak of %d blocks found in htmlNodeDumpFile",
3279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003280 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003281 printf(" %d", n_out);
3282 printf(" %d", n_doc);
3283 printf(" %d", n_cur);
3284 printf("\n");
3285 }
3286 }
3287 }
3288 }
3289#endif
3290#endif
3291
3292 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003293 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003294}
3295
3296
3297static int
3298test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003300
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003301#ifdef LIBXML_HTML_ENABLED
3302#ifdef LIBXML_OUTPUT_ENABLED
3303 int mem_base;
3304 int ret_val;
3305 FILE * out; /* the FILE pointer */
3306 int n_out;
3307 xmlDocPtr doc; /* the document */
3308 int n_doc;
3309 xmlNodePtr cur; /* the current node */
3310 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003311 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003312 int n_encoding;
3313 int format; /* should formatting spaces been added */
3314 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003315
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003316 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3317 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3318 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3319 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3320 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3321 mem_base = xmlMemBlocks();
3322 out = gen_FILE_ptr(n_out, 0);
3323 doc = gen_xmlDocPtr(n_doc, 1);
3324 cur = gen_xmlNodePtr(n_cur, 2);
3325 encoding = gen_const_char_ptr(n_encoding, 3);
3326 format = gen_int(n_format, 4);
3327
3328 ret_val = htmlNodeDumpFileFormat(out, doc, cur, encoding, format);
3329 desret_int(ret_val);
3330 call_tests++;
3331 des_FILE_ptr(n_out, out, 0);
3332 des_xmlDocPtr(n_doc, doc, 1);
3333 des_xmlNodePtr(n_cur, cur, 2);
3334 des_const_char_ptr(n_encoding, encoding, 3);
3335 des_int(n_format, format, 4);
3336 xmlResetLastError();
3337 if (mem_base != xmlMemBlocks()) {
3338 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003340 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003341 printf(" %d", n_out);
3342 printf(" %d", n_doc);
3343 printf(" %d", n_cur);
3344 printf(" %d", n_encoding);
3345 printf(" %d", n_format);
3346 printf("\n");
3347 }
3348 }
3349 }
3350 }
3351 }
3352 }
3353#endif
3354#endif
3355
3356 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003358}
3359
3360
3361static int
3362test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003364
Daniel Veillard3d97e662004-11-04 10:49:00 +00003365#ifdef LIBXML_HTML_ENABLED
3366#ifdef LIBXML_OUTPUT_ENABLED
3367 int mem_base;
3368 xmlOutputBufferPtr buf; /* the HTML buffer output */
3369 int n_buf;
3370 xmlDocPtr doc; /* the document */
3371 int n_doc;
3372 xmlNodePtr cur; /* the current node */
3373 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003374 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003375 int n_encoding;
3376 int format; /* should formatting spaces been added */
3377 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003378
Daniel Veillard3d97e662004-11-04 10:49:00 +00003379 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3380 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3381 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3382 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3383 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3384 mem_base = xmlMemBlocks();
3385 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3386 doc = gen_xmlDocPtr(n_doc, 1);
3387 cur = gen_xmlNodePtr(n_cur, 2);
3388 encoding = gen_const_char_ptr(n_encoding, 3);
3389 format = gen_int(n_format, 4);
3390
3391 htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format);
3392 call_tests++;
3393 des_xmlOutputBufferPtr(n_buf, buf, 0);
3394 des_xmlDocPtr(n_doc, doc, 1);
3395 des_xmlNodePtr(n_cur, cur, 2);
3396 des_const_char_ptr(n_encoding, encoding, 3);
3397 des_int(n_format, format, 4);
3398 xmlResetLastError();
3399 if (mem_base != xmlMemBlocks()) {
3400 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003402 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003403 printf(" %d", n_buf);
3404 printf(" %d", n_doc);
3405 printf(" %d", n_cur);
3406 printf(" %d", n_encoding);
3407 printf(" %d", n_format);
3408 printf("\n");
3409 }
3410 }
3411 }
3412 }
3413 }
3414 }
3415#endif
3416#endif
3417
3418 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003420}
3421
3422
3423static int
3424test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003426
Daniel Veillard3d97e662004-11-04 10:49:00 +00003427#ifdef LIBXML_HTML_ENABLED
3428#ifdef LIBXML_OUTPUT_ENABLED
3429 int mem_base;
3430 xmlOutputBufferPtr buf; /* the HTML buffer output */
3431 int n_buf;
3432 xmlDocPtr doc; /* the document */
3433 int n_doc;
3434 xmlNodePtr cur; /* the current node */
3435 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003436 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003437 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003438
Daniel Veillard3d97e662004-11-04 10:49:00 +00003439 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3440 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3441 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3442 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3443 mem_base = xmlMemBlocks();
3444 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3445 doc = gen_xmlDocPtr(n_doc, 1);
3446 cur = gen_xmlNodePtr(n_cur, 2);
3447 encoding = gen_const_char_ptr(n_encoding, 3);
3448
3449 htmlNodeDumpOutput(buf, doc, cur, encoding);
3450 call_tests++;
3451 des_xmlOutputBufferPtr(n_buf, buf, 0);
3452 des_xmlDocPtr(n_doc, doc, 1);
3453 des_xmlNodePtr(n_cur, cur, 2);
3454 des_const_char_ptr(n_encoding, encoding, 3);
3455 xmlResetLastError();
3456 if (mem_base != xmlMemBlocks()) {
3457 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003459 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003460 printf(" %d", n_buf);
3461 printf(" %d", n_doc);
3462 printf(" %d", n_cur);
3463 printf(" %d", n_encoding);
3464 printf("\n");
3465 }
3466 }
3467 }
3468 }
3469 }
3470#endif
3471#endif
3472
3473 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003475}
3476
3477
3478static int
3479test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003481
3482#ifdef LIBXML_HTML_ENABLED
3483#ifdef LIBXML_OUTPUT_ENABLED
3484 int mem_base;
3485 int ret_val;
3486 const char * filename; /* the filename (or URL) */
3487 int n_filename;
3488 xmlDocPtr cur; /* the document */
3489 int n_cur;
3490
3491 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3492 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3493 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003494 filename = gen_fileoutput(n_filename, 0);
3495 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003496
3497 ret_val = htmlSaveFile(filename, cur);
3498 desret_int(ret_val);
3499 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003500 des_fileoutput(n_filename, filename, 0);
3501 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003502 xmlResetLastError();
3503 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003504 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003505 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003506 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003507 printf(" %d", n_filename);
3508 printf(" %d", n_cur);
3509 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003510 }
3511 }
3512 }
3513#endif
3514#endif
3515
Daniel Veillard3d97e662004-11-04 10:49:00 +00003516 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003518}
3519
3520
3521static int
3522test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003524
3525#ifdef LIBXML_HTML_ENABLED
3526#ifdef LIBXML_OUTPUT_ENABLED
3527 int mem_base;
3528 int ret_val;
3529 const char * filename; /* the filename */
3530 int n_filename;
3531 xmlDocPtr cur; /* the document */
3532 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003533 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003534 int n_encoding;
3535
3536 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3537 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3538 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3539 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003540 filename = gen_fileoutput(n_filename, 0);
3541 cur = gen_xmlDocPtr(n_cur, 1);
3542 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003543
3544 ret_val = htmlSaveFileEnc(filename, cur, encoding);
3545 desret_int(ret_val);
3546 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003547 des_fileoutput(n_filename, filename, 0);
3548 des_xmlDocPtr(n_cur, cur, 1);
3549 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003550 xmlResetLastError();
3551 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003552 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003554 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003555 printf(" %d", n_filename);
3556 printf(" %d", n_cur);
3557 printf(" %d", n_encoding);
3558 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003559 }
3560 }
3561 }
3562 }
3563#endif
3564#endif
3565
Daniel Veillard3d97e662004-11-04 10:49:00 +00003566 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003567 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003568}
3569
3570
3571static int
3572test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003573 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003574
3575#ifdef LIBXML_HTML_ENABLED
3576#ifdef LIBXML_OUTPUT_ENABLED
3577 int mem_base;
3578 int ret_val;
3579 const char * filename; /* the filename */
3580 int n_filename;
3581 xmlDocPtr cur; /* the document */
3582 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003583 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003584 int n_encoding;
3585 int format; /* should formatting spaces been added */
3586 int n_format;
3587
3588 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3589 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3590 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3591 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3592 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003593 filename = gen_fileoutput(n_filename, 0);
3594 cur = gen_xmlDocPtr(n_cur, 1);
3595 encoding = gen_const_char_ptr(n_encoding, 2);
3596 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003597
3598 ret_val = htmlSaveFileFormat(filename, cur, encoding, format);
3599 desret_int(ret_val);
3600 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003601 des_fileoutput(n_filename, filename, 0);
3602 des_xmlDocPtr(n_cur, cur, 1);
3603 des_const_char_ptr(n_encoding, encoding, 2);
3604 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003605 xmlResetLastError();
3606 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003607 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003608 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003609 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003610 printf(" %d", n_filename);
3611 printf(" %d", n_cur);
3612 printf(" %d", n_encoding);
3613 printf(" %d", n_format);
3614 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003615 }
3616 }
3617 }
3618 }
3619 }
3620#endif
3621#endif
3622
Daniel Veillard3d97e662004-11-04 10:49:00 +00003623 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003625}
3626
3627
3628static int
3629test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003631
Daniel Veillarda03e3652004-11-02 18:45:30 +00003632#ifdef LIBXML_HTML_ENABLED
3633 int mem_base;
3634 int ret_val;
3635 htmlDocPtr doc; /* the document */
3636 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003637 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003638 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003639
Daniel Veillarda03e3652004-11-02 18:45:30 +00003640 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3641 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3642 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003643 doc = gen_xmlDocPtr(n_doc, 0);
3644 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003645
3646 ret_val = htmlSetMetaEncoding(doc, encoding);
3647 desret_int(ret_val);
3648 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003649 des_xmlDocPtr(n_doc, doc, 0);
3650 des_const_xmlChar_ptr(n_encoding, encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003651 xmlResetLastError();
3652 if (mem_base != xmlMemBlocks()) {
3653 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003655 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003656 printf(" %d", n_doc);
3657 printf(" %d", n_encoding);
3658 printf("\n");
3659 }
3660 }
3661 }
3662#endif
3663
Daniel Veillard3d97e662004-11-04 10:49:00 +00003664 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003666}
3667
3668static int
3669test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003670 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003671
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003672 printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003673 test_ret += test_htmlDocContentDumpFormatOutput();
3674 test_ret += test_htmlDocContentDumpOutput();
3675 test_ret += test_htmlDocDump();
3676 test_ret += test_htmlDocDumpMemory();
3677 test_ret += test_htmlGetMetaEncoding();
3678 test_ret += test_htmlIsBooleanAttr();
3679 test_ret += test_htmlNewDoc();
3680 test_ret += test_htmlNewDocNoDtD();
3681 test_ret += test_htmlNodeDump();
3682 test_ret += test_htmlNodeDumpFile();
3683 test_ret += test_htmlNodeDumpFileFormat();
3684 test_ret += test_htmlNodeDumpFormatOutput();
3685 test_ret += test_htmlNodeDumpOutput();
3686 test_ret += test_htmlSaveFile();
3687 test_ret += test_htmlSaveFileEnc();
3688 test_ret += test_htmlSaveFileFormat();
3689 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003690
Daniel Veillard42595322004-11-08 10:52:06 +00003691 if (test_ret != 0)
3692 printf("Module HTMLtree: %d errors\n", test_ret);
3693 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003694}
3695
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003696static int
3697test_docbDefaultSAXHandlerInit(void) {
3698 int test_ret = 0;
3699
3700 int mem_base;
3701
3702 mem_base = xmlMemBlocks();
3703
3704 docbDefaultSAXHandlerInit();
3705 call_tests++;
3706 xmlResetLastError();
3707 if (mem_base != xmlMemBlocks()) {
3708 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3709 xmlMemBlocks() - mem_base);
3710 test_ret++;
3711 printf("\n");
3712 }
3713
3714 function_tests++;
3715 return(test_ret);
3716}
3717
3718
3719static int
3720test_htmlDefaultSAXHandlerInit(void) {
3721 int test_ret = 0;
3722
3723 int mem_base;
3724
3725 mem_base = xmlMemBlocks();
3726
3727 htmlDefaultSAXHandlerInit();
3728 call_tests++;
3729 xmlResetLastError();
3730 if (mem_base != xmlMemBlocks()) {
3731 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3732 xmlMemBlocks() - mem_base);
3733 test_ret++;
3734 printf("\n");
3735 }
3736
3737 function_tests++;
3738 return(test_ret);
3739}
3740
3741
3742static int
3743test_xmlDefaultSAXHandlerInit(void) {
3744 int test_ret = 0;
3745
3746 int mem_base;
3747
3748 mem_base = xmlMemBlocks();
3749
3750 xmlDefaultSAXHandlerInit();
3751 call_tests++;
3752 xmlResetLastError();
3753 if (mem_base != xmlMemBlocks()) {
3754 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3755 xmlMemBlocks() - mem_base);
3756 test_ret++;
3757 printf("\n");
3758 }
3759
3760 function_tests++;
3761 return(test_ret);
3762}
3763
3764
3765#define gen_nb_xmlEnumerationPtr 1
3766static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3767 return(NULL);
3768}
3769static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3770}
3771
3772static int
3773test_xmlSAX2AttributeDecl(void) {
3774 int test_ret = 0;
3775
3776 int mem_base;
3777 void * ctx; /* the user data (XML parser context) */
3778 int n_ctx;
3779 xmlChar * elem; /* the name of the element */
3780 int n_elem;
3781 xmlChar * fullname; /* the attribute name */
3782 int n_fullname;
3783 int type; /* the attribute type */
3784 int n_type;
3785 int def; /* the type of default value */
3786 int n_def;
3787 xmlChar * defaultValue; /* the attribute default value */
3788 int n_defaultValue;
3789 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3790 int n_tree;
3791
3792 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3793 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3794 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3795 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3796 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3797 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3798 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3799 mem_base = xmlMemBlocks();
3800 ctx = gen_void_ptr(n_ctx, 0);
3801 elem = gen_const_xmlChar_ptr(n_elem, 1);
3802 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3803 type = gen_int(n_type, 3);
3804 def = gen_int(n_def, 4);
3805 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3806 tree = gen_xmlEnumerationPtr(n_tree, 6);
3807
3808 xmlSAX2AttributeDecl(ctx, elem, fullname, type, def, defaultValue, tree);
3809 call_tests++;
3810 des_void_ptr(n_ctx, ctx, 0);
3811 des_const_xmlChar_ptr(n_elem, elem, 1);
3812 des_const_xmlChar_ptr(n_fullname, fullname, 2);
3813 des_int(n_type, type, 3);
3814 des_int(n_def, def, 4);
3815 des_const_xmlChar_ptr(n_defaultValue, defaultValue, 5);
3816 des_xmlEnumerationPtr(n_tree, tree, 6);
3817 xmlResetLastError();
3818 if (mem_base != xmlMemBlocks()) {
3819 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3820 xmlMemBlocks() - mem_base);
3821 test_ret++;
3822 printf(" %d", n_ctx);
3823 printf(" %d", n_elem);
3824 printf(" %d", n_fullname);
3825 printf(" %d", n_type);
3826 printf(" %d", n_def);
3827 printf(" %d", n_defaultValue);
3828 printf(" %d", n_tree);
3829 printf("\n");
3830 }
3831 }
3832 }
3833 }
3834 }
3835 }
3836 }
3837 }
3838
3839 function_tests++;
3840 return(test_ret);
3841}
3842
3843
3844static int
3845test_xmlSAX2CDataBlock(void) {
3846 int test_ret = 0;
3847
3848 int mem_base;
3849 void * ctx; /* the user data (XML parser context) */
3850 int n_ctx;
3851 xmlChar * value; /* The pcdata content */
3852 int n_value;
3853 int len; /* the block length */
3854 int n_len;
3855
3856 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3857 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3858 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3859 mem_base = xmlMemBlocks();
3860 ctx = gen_void_ptr(n_ctx, 0);
3861 value = gen_const_xmlChar_ptr(n_value, 1);
3862 len = gen_int(n_len, 2);
3863
3864 xmlSAX2CDataBlock(ctx, value, len);
3865 call_tests++;
3866 des_void_ptr(n_ctx, ctx, 0);
3867 des_const_xmlChar_ptr(n_value, value, 1);
3868 des_int(n_len, len, 2);
3869 xmlResetLastError();
3870 if (mem_base != xmlMemBlocks()) {
3871 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
3872 xmlMemBlocks() - mem_base);
3873 test_ret++;
3874 printf(" %d", n_ctx);
3875 printf(" %d", n_value);
3876 printf(" %d", n_len);
3877 printf("\n");
3878 }
3879 }
3880 }
3881 }
3882
3883 function_tests++;
3884 return(test_ret);
3885}
3886
3887
3888static int
3889test_xmlSAX2Characters(void) {
3890 int test_ret = 0;
3891
3892 int mem_base;
3893 void * ctx; /* the user data (XML parser context) */
3894 int n_ctx;
3895 xmlChar * ch; /* a xmlChar string */
3896 int n_ch;
3897 int len; /* the number of xmlChar */
3898 int n_len;
3899
3900 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3901 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
3902 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3903 mem_base = xmlMemBlocks();
3904 ctx = gen_void_ptr(n_ctx, 0);
3905 ch = gen_const_xmlChar_ptr(n_ch, 1);
3906 len = gen_int(n_len, 2);
3907
3908 xmlSAX2Characters(ctx, ch, len);
3909 call_tests++;
3910 des_void_ptr(n_ctx, ctx, 0);
3911 des_const_xmlChar_ptr(n_ch, ch, 1);
3912 des_int(n_len, len, 2);
3913 xmlResetLastError();
3914 if (mem_base != xmlMemBlocks()) {
3915 printf("Leak of %d blocks found in xmlSAX2Characters",
3916 xmlMemBlocks() - mem_base);
3917 test_ret++;
3918 printf(" %d", n_ctx);
3919 printf(" %d", n_ch);
3920 printf(" %d", n_len);
3921 printf("\n");
3922 }
3923 }
3924 }
3925 }
3926
3927 function_tests++;
3928 return(test_ret);
3929}
3930
3931
3932static int
3933test_xmlSAX2Comment(void) {
3934 int test_ret = 0;
3935
3936 int mem_base;
3937 void * ctx; /* the user data (XML parser context) */
3938 int n_ctx;
3939 xmlChar * value; /* the xmlSAX2Comment content */
3940 int n_value;
3941
3942 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3943 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3944 mem_base = xmlMemBlocks();
3945 ctx = gen_void_ptr(n_ctx, 0);
3946 value = gen_const_xmlChar_ptr(n_value, 1);
3947
3948 xmlSAX2Comment(ctx, value);
3949 call_tests++;
3950 des_void_ptr(n_ctx, ctx, 0);
3951 des_const_xmlChar_ptr(n_value, value, 1);
3952 xmlResetLastError();
3953 if (mem_base != xmlMemBlocks()) {
3954 printf("Leak of %d blocks found in xmlSAX2Comment",
3955 xmlMemBlocks() - mem_base);
3956 test_ret++;
3957 printf(" %d", n_ctx);
3958 printf(" %d", n_value);
3959 printf("\n");
3960 }
3961 }
3962 }
3963
3964 function_tests++;
3965 return(test_ret);
3966}
3967
3968
3969#define gen_nb_xmlElementContentPtr 1
3970static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3971 return(NULL);
3972}
3973static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3974}
3975
3976static int
3977test_xmlSAX2ElementDecl(void) {
3978 int test_ret = 0;
3979
3980 int mem_base;
3981 void * ctx; /* the user data (XML parser context) */
3982 int n_ctx;
3983 xmlChar * name; /* the element name */
3984 int n_name;
3985 int type; /* the element type */
3986 int n_type;
3987 xmlElementContentPtr content; /* the element value tree */
3988 int n_content;
3989
3990 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3991 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3992 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3993 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
3994 mem_base = xmlMemBlocks();
3995 ctx = gen_void_ptr(n_ctx, 0);
3996 name = gen_const_xmlChar_ptr(n_name, 1);
3997 type = gen_int(n_type, 2);
3998 content = gen_xmlElementContentPtr(n_content, 3);
3999
4000 xmlSAX2ElementDecl(ctx, name, type, content);
4001 call_tests++;
4002 des_void_ptr(n_ctx, ctx, 0);
4003 des_const_xmlChar_ptr(n_name, name, 1);
4004 des_int(n_type, type, 2);
4005 des_xmlElementContentPtr(n_content, content, 3);
4006 xmlResetLastError();
4007 if (mem_base != xmlMemBlocks()) {
4008 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
4009 xmlMemBlocks() - mem_base);
4010 test_ret++;
4011 printf(" %d", n_ctx);
4012 printf(" %d", n_name);
4013 printf(" %d", n_type);
4014 printf(" %d", n_content);
4015 printf("\n");
4016 }
4017 }
4018 }
4019 }
4020 }
4021
4022 function_tests++;
4023 return(test_ret);
4024}
4025
4026
4027static int
4028test_xmlSAX2EndDocument(void) {
4029 int test_ret = 0;
4030
4031 int mem_base;
4032 void * ctx; /* the user data (XML parser context) */
4033 int n_ctx;
4034
4035 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4036 mem_base = xmlMemBlocks();
4037 ctx = gen_void_ptr(n_ctx, 0);
4038
4039 xmlSAX2EndDocument(ctx);
4040 call_tests++;
4041 des_void_ptr(n_ctx, ctx, 0);
4042 xmlResetLastError();
4043 if (mem_base != xmlMemBlocks()) {
4044 printf("Leak of %d blocks found in xmlSAX2EndDocument",
4045 xmlMemBlocks() - mem_base);
4046 test_ret++;
4047 printf(" %d", n_ctx);
4048 printf("\n");
4049 }
4050 }
4051
4052 function_tests++;
4053 return(test_ret);
4054}
4055
4056
4057static int
4058test_xmlSAX2EndElement(void) {
4059 int test_ret = 0;
4060
4061 int mem_base;
4062 void * ctx; /* the user data (XML parser context) */
4063 int n_ctx;
4064 xmlChar * name; /* The element name */
4065 int n_name;
4066
4067 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4068 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4069 mem_base = xmlMemBlocks();
4070 ctx = gen_void_ptr(n_ctx, 0);
4071 name = gen_const_xmlChar_ptr(n_name, 1);
4072
4073 xmlSAX2EndElement(ctx, name);
4074 call_tests++;
4075 des_void_ptr(n_ctx, ctx, 0);
4076 des_const_xmlChar_ptr(n_name, name, 1);
4077 xmlResetLastError();
4078 if (mem_base != xmlMemBlocks()) {
4079 printf("Leak of %d blocks found in xmlSAX2EndElement",
4080 xmlMemBlocks() - mem_base);
4081 test_ret++;
4082 printf(" %d", n_ctx);
4083 printf(" %d", n_name);
4084 printf("\n");
4085 }
4086 }
4087 }
4088
4089 function_tests++;
4090 return(test_ret);
4091}
4092
4093
4094static int
4095test_xmlSAX2EndElementNs(void) {
4096 int test_ret = 0;
4097
4098 int mem_base;
4099 void * ctx; /* the user data (XML parser context) */
4100 int n_ctx;
4101 xmlChar * localname; /* the local name of the element */
4102 int n_localname;
4103 xmlChar * prefix; /* the element namespace prefix if available */
4104 int n_prefix;
4105 xmlChar * URI; /* the element namespace name if available */
4106 int n_URI;
4107
4108 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4109 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4110 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4111 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4112 mem_base = xmlMemBlocks();
4113 ctx = gen_void_ptr(n_ctx, 0);
4114 localname = gen_const_xmlChar_ptr(n_localname, 1);
4115 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4116 URI = gen_const_xmlChar_ptr(n_URI, 3);
4117
4118 xmlSAX2EndElementNs(ctx, localname, prefix, URI);
4119 call_tests++;
4120 des_void_ptr(n_ctx, ctx, 0);
4121 des_const_xmlChar_ptr(n_localname, localname, 1);
4122 des_const_xmlChar_ptr(n_prefix, prefix, 2);
4123 des_const_xmlChar_ptr(n_URI, URI, 3);
4124 xmlResetLastError();
4125 if (mem_base != xmlMemBlocks()) {
4126 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
4127 xmlMemBlocks() - mem_base);
4128 test_ret++;
4129 printf(" %d", n_ctx);
4130 printf(" %d", n_localname);
4131 printf(" %d", n_prefix);
4132 printf(" %d", n_URI);
4133 printf("\n");
4134 }
4135 }
4136 }
4137 }
4138 }
4139
4140 function_tests++;
4141 return(test_ret);
4142}
4143
4144
4145static int
4146test_xmlSAX2EntityDecl(void) {
4147 int test_ret = 0;
4148
4149 int mem_base;
4150 void * ctx; /* the user data (XML parser context) */
4151 int n_ctx;
4152 xmlChar * name; /* the entity name */
4153 int n_name;
4154 int type; /* the entity type */
4155 int n_type;
4156 xmlChar * publicId; /* The public ID of the entity */
4157 int n_publicId;
4158 xmlChar * systemId; /* The system ID of the entity */
4159 int n_systemId;
4160 xmlChar * content; /* the entity value (without processing). */
4161 int n_content;
4162
4163 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4164 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4165 for (n_type = 0;n_type < gen_nb_int;n_type++) {
4166 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4167 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4168 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
4169 mem_base = xmlMemBlocks();
4170 ctx = gen_void_ptr(n_ctx, 0);
4171 name = gen_const_xmlChar_ptr(n_name, 1);
4172 type = gen_int(n_type, 2);
4173 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
4174 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
4175 content = gen_xmlChar_ptr(n_content, 5);
4176
4177 xmlSAX2EntityDecl(ctx, name, type, publicId, systemId, content);
4178 call_tests++;
4179 des_void_ptr(n_ctx, ctx, 0);
4180 des_const_xmlChar_ptr(n_name, name, 1);
4181 des_int(n_type, type, 2);
4182 des_const_xmlChar_ptr(n_publicId, publicId, 3);
4183 des_const_xmlChar_ptr(n_systemId, systemId, 4);
4184 des_xmlChar_ptr(n_content, content, 5);
4185 xmlResetLastError();
4186 if (mem_base != xmlMemBlocks()) {
4187 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4188 xmlMemBlocks() - mem_base);
4189 test_ret++;
4190 printf(" %d", n_ctx);
4191 printf(" %d", n_name);
4192 printf(" %d", n_type);
4193 printf(" %d", n_publicId);
4194 printf(" %d", n_systemId);
4195 printf(" %d", n_content);
4196 printf("\n");
4197 }
4198 }
4199 }
4200 }
4201 }
4202 }
4203 }
4204
4205 function_tests++;
4206 return(test_ret);
4207}
4208
4209
4210static int
4211test_xmlSAX2ExternalSubset(void) {
4212 int test_ret = 0;
4213
4214 int mem_base;
4215 void * ctx; /* the user data (XML parser context) */
4216 int n_ctx;
4217 xmlChar * name; /* the root element name */
4218 int n_name;
4219 xmlChar * ExternalID; /* the external ID */
4220 int n_ExternalID;
4221 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4222 int n_SystemID;
4223
4224 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4225 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4226 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4227 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4228 mem_base = xmlMemBlocks();
4229 ctx = gen_void_ptr(n_ctx, 0);
4230 name = gen_const_xmlChar_ptr(n_name, 1);
4231 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4232 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4233
4234 xmlSAX2ExternalSubset(ctx, name, ExternalID, SystemID);
4235 call_tests++;
4236 des_void_ptr(n_ctx, ctx, 0);
4237 des_const_xmlChar_ptr(n_name, name, 1);
4238 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
4239 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
4240 xmlResetLastError();
4241 if (mem_base != xmlMemBlocks()) {
4242 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4243 xmlMemBlocks() - mem_base);
4244 test_ret++;
4245 printf(" %d", n_ctx);
4246 printf(" %d", n_name);
4247 printf(" %d", n_ExternalID);
4248 printf(" %d", n_SystemID);
4249 printf("\n");
4250 }
4251 }
4252 }
4253 }
4254 }
4255
4256 function_tests++;
4257 return(test_ret);
4258}
4259
4260
4261static int
4262test_xmlSAX2GetColumnNumber(void) {
4263 int test_ret = 0;
4264
4265 int mem_base;
4266 int ret_val;
4267 void * ctx; /* the user data (XML parser context) */
4268 int n_ctx;
4269
4270 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4271 mem_base = xmlMemBlocks();
4272 ctx = gen_void_ptr(n_ctx, 0);
4273
4274 ret_val = xmlSAX2GetColumnNumber(ctx);
4275 desret_int(ret_val);
4276 call_tests++;
4277 des_void_ptr(n_ctx, ctx, 0);
4278 xmlResetLastError();
4279 if (mem_base != xmlMemBlocks()) {
4280 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4281 xmlMemBlocks() - mem_base);
4282 test_ret++;
4283 printf(" %d", n_ctx);
4284 printf("\n");
4285 }
4286 }
4287
4288 function_tests++;
4289 return(test_ret);
4290}
4291
4292
4293static int
4294test_xmlSAX2GetEntity(void) {
4295 int test_ret = 0;
4296
4297 int mem_base;
4298 xmlEntityPtr ret_val;
4299 void * ctx; /* the user data (XML parser context) */
4300 int n_ctx;
4301 xmlChar * name; /* The entity name */
4302 int n_name;
4303
4304 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4305 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4306 mem_base = xmlMemBlocks();
4307 ctx = gen_void_ptr(n_ctx, 0);
4308 name = gen_const_xmlChar_ptr(n_name, 1);
4309
4310 ret_val = xmlSAX2GetEntity(ctx, name);
4311 desret_xmlEntityPtr(ret_val);
4312 call_tests++;
4313 des_void_ptr(n_ctx, ctx, 0);
4314 des_const_xmlChar_ptr(n_name, name, 1);
4315 xmlResetLastError();
4316 if (mem_base != xmlMemBlocks()) {
4317 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4318 xmlMemBlocks() - mem_base);
4319 test_ret++;
4320 printf(" %d", n_ctx);
4321 printf(" %d", n_name);
4322 printf("\n");
4323 }
4324 }
4325 }
4326
4327 function_tests++;
4328 return(test_ret);
4329}
4330
4331
4332static int
4333test_xmlSAX2GetLineNumber(void) {
4334 int test_ret = 0;
4335
4336 int mem_base;
4337 int ret_val;
4338 void * ctx; /* the user data (XML parser context) */
4339 int n_ctx;
4340
4341 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4342 mem_base = xmlMemBlocks();
4343 ctx = gen_void_ptr(n_ctx, 0);
4344
4345 ret_val = xmlSAX2GetLineNumber(ctx);
4346 desret_int(ret_val);
4347 call_tests++;
4348 des_void_ptr(n_ctx, ctx, 0);
4349 xmlResetLastError();
4350 if (mem_base != xmlMemBlocks()) {
4351 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4352 xmlMemBlocks() - mem_base);
4353 test_ret++;
4354 printf(" %d", n_ctx);
4355 printf("\n");
4356 }
4357 }
4358
4359 function_tests++;
4360 return(test_ret);
4361}
4362
4363
4364static int
4365test_xmlSAX2GetParameterEntity(void) {
4366 int test_ret = 0;
4367
4368 int mem_base;
4369 xmlEntityPtr ret_val;
4370 void * ctx; /* the user data (XML parser context) */
4371 int n_ctx;
4372 xmlChar * name; /* The entity name */
4373 int n_name;
4374
4375 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4376 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4377 mem_base = xmlMemBlocks();
4378 ctx = gen_void_ptr(n_ctx, 0);
4379 name = gen_const_xmlChar_ptr(n_name, 1);
4380
4381 ret_val = xmlSAX2GetParameterEntity(ctx, name);
4382 desret_xmlEntityPtr(ret_val);
4383 call_tests++;
4384 des_void_ptr(n_ctx, ctx, 0);
4385 des_const_xmlChar_ptr(n_name, name, 1);
4386 xmlResetLastError();
4387 if (mem_base != xmlMemBlocks()) {
4388 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4389 xmlMemBlocks() - mem_base);
4390 test_ret++;
4391 printf(" %d", n_ctx);
4392 printf(" %d", n_name);
4393 printf("\n");
4394 }
4395 }
4396 }
4397
4398 function_tests++;
4399 return(test_ret);
4400}
4401
4402
4403static int
4404test_xmlSAX2GetPublicId(void) {
4405 int test_ret = 0;
4406
4407 int mem_base;
4408 const xmlChar * ret_val;
4409 void * ctx; /* the user data (XML parser context) */
4410 int n_ctx;
4411
4412 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4413 mem_base = xmlMemBlocks();
4414 ctx = gen_void_ptr(n_ctx, 0);
4415
4416 ret_val = xmlSAX2GetPublicId(ctx);
4417 desret_const_xmlChar_ptr(ret_val);
4418 call_tests++;
4419 des_void_ptr(n_ctx, ctx, 0);
4420 xmlResetLastError();
4421 if (mem_base != xmlMemBlocks()) {
4422 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4423 xmlMemBlocks() - mem_base);
4424 test_ret++;
4425 printf(" %d", n_ctx);
4426 printf("\n");
4427 }
4428 }
4429
4430 function_tests++;
4431 return(test_ret);
4432}
4433
4434
4435static int
4436test_xmlSAX2GetSystemId(void) {
4437 int test_ret = 0;
4438
4439 int mem_base;
4440 const xmlChar * ret_val;
4441 void * ctx; /* the user data (XML parser context) */
4442 int n_ctx;
4443
4444 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4445 mem_base = xmlMemBlocks();
4446 ctx = gen_void_ptr(n_ctx, 0);
4447
4448 ret_val = xmlSAX2GetSystemId(ctx);
4449 desret_const_xmlChar_ptr(ret_val);
4450 call_tests++;
4451 des_void_ptr(n_ctx, ctx, 0);
4452 xmlResetLastError();
4453 if (mem_base != xmlMemBlocks()) {
4454 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4455 xmlMemBlocks() - mem_base);
4456 test_ret++;
4457 printf(" %d", n_ctx);
4458 printf("\n");
4459 }
4460 }
4461
4462 function_tests++;
4463 return(test_ret);
4464}
4465
4466
4467static int
4468test_xmlSAX2HasExternalSubset(void) {
4469 int test_ret = 0;
4470
4471 int mem_base;
4472 int ret_val;
4473 void * ctx; /* the user data (XML parser context) */
4474 int n_ctx;
4475
4476 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4477 mem_base = xmlMemBlocks();
4478 ctx = gen_void_ptr(n_ctx, 0);
4479
4480 ret_val = xmlSAX2HasExternalSubset(ctx);
4481 desret_int(ret_val);
4482 call_tests++;
4483 des_void_ptr(n_ctx, ctx, 0);
4484 xmlResetLastError();
4485 if (mem_base != xmlMemBlocks()) {
4486 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4487 xmlMemBlocks() - mem_base);
4488 test_ret++;
4489 printf(" %d", n_ctx);
4490 printf("\n");
4491 }
4492 }
4493
4494 function_tests++;
4495 return(test_ret);
4496}
4497
4498
4499static int
4500test_xmlSAX2HasInternalSubset(void) {
4501 int test_ret = 0;
4502
4503 int mem_base;
4504 int ret_val;
4505 void * ctx; /* the user data (XML parser context) */
4506 int n_ctx;
4507
4508 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4509 mem_base = xmlMemBlocks();
4510 ctx = gen_void_ptr(n_ctx, 0);
4511
4512 ret_val = xmlSAX2HasInternalSubset(ctx);
4513 desret_int(ret_val);
4514 call_tests++;
4515 des_void_ptr(n_ctx, ctx, 0);
4516 xmlResetLastError();
4517 if (mem_base != xmlMemBlocks()) {
4518 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4519 xmlMemBlocks() - mem_base);
4520 test_ret++;
4521 printf(" %d", n_ctx);
4522 printf("\n");
4523 }
4524 }
4525
4526 function_tests++;
4527 return(test_ret);
4528}
4529
4530
4531static int
4532test_xmlSAX2IgnorableWhitespace(void) {
4533 int test_ret = 0;
4534
4535 int mem_base;
4536 void * ctx; /* the user data (XML parser context) */
4537 int n_ctx;
4538 xmlChar * ch; /* a xmlChar string */
4539 int n_ch;
4540 int len; /* the number of xmlChar */
4541 int n_len;
4542
4543 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4544 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4545 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4546 mem_base = xmlMemBlocks();
4547 ctx = gen_void_ptr(n_ctx, 0);
4548 ch = gen_const_xmlChar_ptr(n_ch, 1);
4549 len = gen_int(n_len, 2);
4550
4551 xmlSAX2IgnorableWhitespace(ctx, ch, len);
4552 call_tests++;
4553 des_void_ptr(n_ctx, ctx, 0);
4554 des_const_xmlChar_ptr(n_ch, ch, 1);
4555 des_int(n_len, len, 2);
4556 xmlResetLastError();
4557 if (mem_base != xmlMemBlocks()) {
4558 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4559 xmlMemBlocks() - mem_base);
4560 test_ret++;
4561 printf(" %d", n_ctx);
4562 printf(" %d", n_ch);
4563 printf(" %d", n_len);
4564 printf("\n");
4565 }
4566 }
4567 }
4568 }
4569
4570 function_tests++;
4571 return(test_ret);
4572}
4573
4574
4575#define gen_nb_xmlSAXHandler_ptr 1
4576static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4577 return(NULL);
4578}
4579static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4580}
4581
4582static int
4583test_xmlSAX2InitDefaultSAXHandler(void) {
4584 int test_ret = 0;
4585
4586 int mem_base;
4587 xmlSAXHandler * hdlr; /* the SAX handler */
4588 int n_hdlr;
4589 int warning; /* flag if non-zero sets the handler warning procedure */
4590 int n_warning;
4591
4592 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4593 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4594 mem_base = xmlMemBlocks();
4595 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4596 warning = gen_int(n_warning, 1);
4597
4598 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4599 call_tests++;
4600 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4601 des_int(n_warning, warning, 1);
4602 xmlResetLastError();
4603 if (mem_base != xmlMemBlocks()) {
4604 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4605 xmlMemBlocks() - mem_base);
4606 test_ret++;
4607 printf(" %d", n_hdlr);
4608 printf(" %d", n_warning);
4609 printf("\n");
4610 }
4611 }
4612 }
4613
4614 function_tests++;
4615 return(test_ret);
4616}
4617
4618
4619static int
4620test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4621 int test_ret = 0;
4622
4623#ifdef LIBXML_DOCB_ENABLED
4624 int mem_base;
4625 xmlSAXHandler * hdlr; /* the SAX handler */
4626 int n_hdlr;
4627
4628 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4629 mem_base = xmlMemBlocks();
4630 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4631
4632 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4633 call_tests++;
4634 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4635 xmlResetLastError();
4636 if (mem_base != xmlMemBlocks()) {
4637 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4638 xmlMemBlocks() - mem_base);
4639 test_ret++;
4640 printf(" %d", n_hdlr);
4641 printf("\n");
4642 }
4643 }
4644#endif
4645
4646 function_tests++;
4647 return(test_ret);
4648}
4649
4650
4651static int
4652test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4653 int test_ret = 0;
4654
4655#ifdef LIBXML_HTML_ENABLED
4656 int mem_base;
4657 xmlSAXHandler * hdlr; /* the SAX handler */
4658 int n_hdlr;
4659
4660 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4661 mem_base = xmlMemBlocks();
4662 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4663
4664 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4665 call_tests++;
4666 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4667 xmlResetLastError();
4668 if (mem_base != xmlMemBlocks()) {
4669 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4670 xmlMemBlocks() - mem_base);
4671 test_ret++;
4672 printf(" %d", n_hdlr);
4673 printf("\n");
4674 }
4675 }
4676#endif
4677
4678 function_tests++;
4679 return(test_ret);
4680}
4681
4682
4683static int
4684test_xmlSAX2InternalSubset(void) {
4685 int test_ret = 0;
4686
4687 int mem_base;
4688 void * ctx; /* the user data (XML parser context) */
4689 int n_ctx;
4690 xmlChar * name; /* the root element name */
4691 int n_name;
4692 xmlChar * ExternalID; /* the external ID */
4693 int n_ExternalID;
4694 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4695 int n_SystemID;
4696
4697 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4698 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4699 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4700 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4701 mem_base = xmlMemBlocks();
4702 ctx = gen_void_ptr(n_ctx, 0);
4703 name = gen_const_xmlChar_ptr(n_name, 1);
4704 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4705 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4706
4707 xmlSAX2InternalSubset(ctx, name, ExternalID, SystemID);
4708 call_tests++;
4709 des_void_ptr(n_ctx, ctx, 0);
4710 des_const_xmlChar_ptr(n_name, name, 1);
4711 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
4712 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
4713 xmlResetLastError();
4714 if (mem_base != xmlMemBlocks()) {
4715 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4716 xmlMemBlocks() - mem_base);
4717 test_ret++;
4718 printf(" %d", n_ctx);
4719 printf(" %d", n_name);
4720 printf(" %d", n_ExternalID);
4721 printf(" %d", n_SystemID);
4722 printf("\n");
4723 }
4724 }
4725 }
4726 }
4727 }
4728
4729 function_tests++;
4730 return(test_ret);
4731}
4732
4733
4734static int
4735test_xmlSAX2IsStandalone(void) {
4736 int test_ret = 0;
4737
4738 int mem_base;
4739 int ret_val;
4740 void * ctx; /* the user data (XML parser context) */
4741 int n_ctx;
4742
4743 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4744 mem_base = xmlMemBlocks();
4745 ctx = gen_void_ptr(n_ctx, 0);
4746
4747 ret_val = xmlSAX2IsStandalone(ctx);
4748 desret_int(ret_val);
4749 call_tests++;
4750 des_void_ptr(n_ctx, ctx, 0);
4751 xmlResetLastError();
4752 if (mem_base != xmlMemBlocks()) {
4753 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4754 xmlMemBlocks() - mem_base);
4755 test_ret++;
4756 printf(" %d", n_ctx);
4757 printf("\n");
4758 }
4759 }
4760
4761 function_tests++;
4762 return(test_ret);
4763}
4764
4765
4766static int
4767test_xmlSAX2NotationDecl(void) {
4768 int test_ret = 0;
4769
4770 int mem_base;
4771 void * ctx; /* the user data (XML parser context) */
4772 int n_ctx;
4773 xmlChar * name; /* The name of the notation */
4774 int n_name;
4775 xmlChar * publicId; /* The public ID of the entity */
4776 int n_publicId;
4777 xmlChar * systemId; /* The system ID of the entity */
4778 int n_systemId;
4779
4780 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4781 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4782 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4783 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4784 mem_base = xmlMemBlocks();
4785 ctx = gen_void_ptr(n_ctx, 0);
4786 name = gen_const_xmlChar_ptr(n_name, 1);
4787 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4788 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4789
4790 xmlSAX2NotationDecl(ctx, name, publicId, systemId);
4791 call_tests++;
4792 des_void_ptr(n_ctx, ctx, 0);
4793 des_const_xmlChar_ptr(n_name, name, 1);
4794 des_const_xmlChar_ptr(n_publicId, publicId, 2);
4795 des_const_xmlChar_ptr(n_systemId, systemId, 3);
4796 xmlResetLastError();
4797 if (mem_base != xmlMemBlocks()) {
4798 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4799 xmlMemBlocks() - mem_base);
4800 test_ret++;
4801 printf(" %d", n_ctx);
4802 printf(" %d", n_name);
4803 printf(" %d", n_publicId);
4804 printf(" %d", n_systemId);
4805 printf("\n");
4806 }
4807 }
4808 }
4809 }
4810 }
4811
4812 function_tests++;
4813 return(test_ret);
4814}
4815
4816
4817static int
4818test_xmlSAX2ProcessingInstruction(void) {
4819 int test_ret = 0;
4820
4821 int mem_base;
4822 void * ctx; /* the user data (XML parser context) */
4823 int n_ctx;
4824 xmlChar * target; /* the target name */
4825 int n_target;
4826 xmlChar * data; /* the PI data's */
4827 int n_data;
4828
4829 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4830 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
4831 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
4832 mem_base = xmlMemBlocks();
4833 ctx = gen_void_ptr(n_ctx, 0);
4834 target = gen_const_xmlChar_ptr(n_target, 1);
4835 data = gen_const_xmlChar_ptr(n_data, 2);
4836
4837 xmlSAX2ProcessingInstruction(ctx, target, data);
4838 call_tests++;
4839 des_void_ptr(n_ctx, ctx, 0);
4840 des_const_xmlChar_ptr(n_target, target, 1);
4841 des_const_xmlChar_ptr(n_data, data, 2);
4842 xmlResetLastError();
4843 if (mem_base != xmlMemBlocks()) {
4844 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
4845 xmlMemBlocks() - mem_base);
4846 test_ret++;
4847 printf(" %d", n_ctx);
4848 printf(" %d", n_target);
4849 printf(" %d", n_data);
4850 printf("\n");
4851 }
4852 }
4853 }
4854 }
4855
4856 function_tests++;
4857 return(test_ret);
4858}
4859
4860
4861static int
4862test_xmlSAX2Reference(void) {
4863 int test_ret = 0;
4864
4865 int mem_base;
4866 void * ctx; /* the user data (XML parser context) */
4867 int n_ctx;
4868 xmlChar * name; /* The entity name */
4869 int n_name;
4870
4871 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4872 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4873 mem_base = xmlMemBlocks();
4874 ctx = gen_void_ptr(n_ctx, 0);
4875 name = gen_const_xmlChar_ptr(n_name, 1);
4876
4877 xmlSAX2Reference(ctx, name);
4878 call_tests++;
4879 des_void_ptr(n_ctx, ctx, 0);
4880 des_const_xmlChar_ptr(n_name, name, 1);
4881 xmlResetLastError();
4882 if (mem_base != xmlMemBlocks()) {
4883 printf("Leak of %d blocks found in xmlSAX2Reference",
4884 xmlMemBlocks() - mem_base);
4885 test_ret++;
4886 printf(" %d", n_ctx);
4887 printf(" %d", n_name);
4888 printf("\n");
4889 }
4890 }
4891 }
4892
4893 function_tests++;
4894 return(test_ret);
4895}
4896
4897
4898static int
4899test_xmlSAX2ResolveEntity(void) {
4900 int test_ret = 0;
4901
4902 int mem_base;
4903 xmlParserInputPtr ret_val;
4904 void * ctx; /* the user data (XML parser context) */
4905 int n_ctx;
4906 xmlChar * publicId; /* The public ID of the entity */
4907 int n_publicId;
4908 xmlChar * systemId; /* The system ID of the entity */
4909 int n_systemId;
4910
4911 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4912 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4913 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4914 mem_base = xmlMemBlocks();
4915 ctx = gen_void_ptr(n_ctx, 0);
4916 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
4917 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
4918
4919 ret_val = xmlSAX2ResolveEntity(ctx, publicId, systemId);
4920 desret_xmlParserInputPtr(ret_val);
4921 call_tests++;
4922 des_void_ptr(n_ctx, ctx, 0);
4923 des_const_xmlChar_ptr(n_publicId, publicId, 1);
4924 des_const_xmlChar_ptr(n_systemId, systemId, 2);
4925 xmlResetLastError();
4926 if (mem_base != xmlMemBlocks()) {
4927 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
4928 xmlMemBlocks() - mem_base);
4929 test_ret++;
4930 printf(" %d", n_ctx);
4931 printf(" %d", n_publicId);
4932 printf(" %d", n_systemId);
4933 printf("\n");
4934 }
4935 }
4936 }
4937 }
4938
4939 function_tests++;
4940 return(test_ret);
4941}
4942
4943
4944#define gen_nb_xmlSAXLocatorPtr 1
4945static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4946 return(NULL);
4947}
4948static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4949}
4950
4951static int
4952test_xmlSAX2SetDocumentLocator(void) {
4953 int test_ret = 0;
4954
4955 int mem_base;
4956 void * ctx; /* the user data (XML parser context) */
4957 int n_ctx;
4958 xmlSAXLocatorPtr loc; /* A SAX Locator */
4959 int n_loc;
4960
4961 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4962 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
4963 mem_base = xmlMemBlocks();
4964 ctx = gen_void_ptr(n_ctx, 0);
4965 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
4966
4967 xmlSAX2SetDocumentLocator(ctx, loc);
4968 call_tests++;
4969 des_void_ptr(n_ctx, ctx, 0);
4970 des_xmlSAXLocatorPtr(n_loc, loc, 1);
4971 xmlResetLastError();
4972 if (mem_base != xmlMemBlocks()) {
4973 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
4974 xmlMemBlocks() - mem_base);
4975 test_ret++;
4976 printf(" %d", n_ctx);
4977 printf(" %d", n_loc);
4978 printf("\n");
4979 }
4980 }
4981 }
4982
4983 function_tests++;
4984 return(test_ret);
4985}
4986
4987
4988static int
4989test_xmlSAX2StartDocument(void) {
4990 int test_ret = 0;
4991
4992 int mem_base;
4993 void * ctx; /* the user data (XML parser context) */
4994 int n_ctx;
4995
4996 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4997 mem_base = xmlMemBlocks();
4998 ctx = gen_void_ptr(n_ctx, 0);
4999
5000 xmlSAX2StartDocument(ctx);
5001 call_tests++;
5002 des_void_ptr(n_ctx, ctx, 0);
5003 xmlResetLastError();
5004 if (mem_base != xmlMemBlocks()) {
5005 printf("Leak of %d blocks found in xmlSAX2StartDocument",
5006 xmlMemBlocks() - mem_base);
5007 test_ret++;
5008 printf(" %d", n_ctx);
5009 printf("\n");
5010 }
5011 }
5012
5013 function_tests++;
5014 return(test_ret);
5015}
5016
5017
5018static int
5019test_xmlSAX2StartElement(void) {
5020 int test_ret = 0;
5021
5022 int mem_base;
5023 void * ctx; /* the user data (XML parser context) */
5024 int n_ctx;
5025 xmlChar * fullname; /* The element name, including namespace prefix */
5026 int n_fullname;
5027 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
5028 int n_atts;
5029
5030 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5031 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
5032 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
5033 mem_base = xmlMemBlocks();
5034 ctx = gen_void_ptr(n_ctx, 0);
5035 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
5036 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
5037
5038 xmlSAX2StartElement(ctx, fullname, atts);
5039 call_tests++;
5040 des_void_ptr(n_ctx, ctx, 0);
5041 des_const_xmlChar_ptr(n_fullname, fullname, 1);
5042 des_const_xmlChar_ptr_ptr(n_atts, atts, 2);
5043 xmlResetLastError();
5044 if (mem_base != xmlMemBlocks()) {
5045 printf("Leak of %d blocks found in xmlSAX2StartElement",
5046 xmlMemBlocks() - mem_base);
5047 test_ret++;
5048 printf(" %d", n_ctx);
5049 printf(" %d", n_fullname);
5050 printf(" %d", n_atts);
5051 printf("\n");
5052 }
5053 }
5054 }
5055 }
5056
5057 function_tests++;
5058 return(test_ret);
5059}
5060
5061
5062static int
5063test_xmlSAX2StartElementNs(void) {
5064 int test_ret = 0;
5065
5066 int mem_base;
5067 void * ctx; /* the user data (XML parser context) */
5068 int n_ctx;
5069 xmlChar * localname; /* the local name of the element */
5070 int n_localname;
5071 xmlChar * prefix; /* the element namespace prefix if available */
5072 int n_prefix;
5073 xmlChar * URI; /* the element namespace name if available */
5074 int n_URI;
5075 int nb_namespaces; /* number of namespace definitions on that node */
5076 int n_nb_namespaces;
5077 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
5078 int n_namespaces;
5079 int nb_attributes; /* the number of attributes on that node */
5080 int n_nb_attributes;
5081 int nb_defaulted; /* the number of defaulted attributes. */
5082 int n_nb_defaulted;
5083 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
5084 int n_attributes;
5085
5086 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5087 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
5088 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
5089 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5090 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
5091 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
5092 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
5093 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
5094 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
5095 mem_base = xmlMemBlocks();
5096 ctx = gen_void_ptr(n_ctx, 0);
5097 localname = gen_const_xmlChar_ptr(n_localname, 1);
5098 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
5099 URI = gen_const_xmlChar_ptr(n_URI, 3);
5100 nb_namespaces = gen_int(n_nb_namespaces, 4);
5101 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
5102 nb_attributes = gen_int(n_nb_attributes, 6);
5103 nb_defaulted = gen_int(n_nb_defaulted, 7);
5104 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
5105
5106 xmlSAX2StartElementNs(ctx, localname, prefix, URI, nb_namespaces, namespaces, nb_attributes, nb_defaulted, attributes);
5107 call_tests++;
5108 des_void_ptr(n_ctx, ctx, 0);
5109 des_const_xmlChar_ptr(n_localname, localname, 1);
5110 des_const_xmlChar_ptr(n_prefix, prefix, 2);
5111 des_const_xmlChar_ptr(n_URI, URI, 3);
5112 des_int(n_nb_namespaces, nb_namespaces, 4);
5113 des_const_xmlChar_ptr_ptr(n_namespaces, namespaces, 5);
5114 des_int(n_nb_attributes, nb_attributes, 6);
5115 des_int(n_nb_defaulted, nb_defaulted, 7);
5116 des_const_xmlChar_ptr_ptr(n_attributes, attributes, 8);
5117 xmlResetLastError();
5118 if (mem_base != xmlMemBlocks()) {
5119 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
5120 xmlMemBlocks() - mem_base);
5121 test_ret++;
5122 printf(" %d", n_ctx);
5123 printf(" %d", n_localname);
5124 printf(" %d", n_prefix);
5125 printf(" %d", n_URI);
5126 printf(" %d", n_nb_namespaces);
5127 printf(" %d", n_namespaces);
5128 printf(" %d", n_nb_attributes);
5129 printf(" %d", n_nb_defaulted);
5130 printf(" %d", n_attributes);
5131 printf("\n");
5132 }
5133 }
5134 }
5135 }
5136 }
5137 }
5138 }
5139 }
5140 }
5141 }
5142
5143 function_tests++;
5144 return(test_ret);
5145}
5146
5147
5148static int
5149test_xmlSAX2UnparsedEntityDecl(void) {
5150 int test_ret = 0;
5151
5152 int mem_base;
5153 void * ctx; /* the user data (XML parser context) */
5154 int n_ctx;
5155 xmlChar * name; /* The name of the entity */
5156 int n_name;
5157 xmlChar * publicId; /* The public ID of the entity */
5158 int n_publicId;
5159 xmlChar * systemId; /* The system ID of the entity */
5160 int n_systemId;
5161 xmlChar * notationName; /* the name of the notation */
5162 int n_notationName;
5163
5164 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5165 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5166 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5167 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5168 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
5169 mem_base = xmlMemBlocks();
5170 ctx = gen_void_ptr(n_ctx, 0);
5171 name = gen_const_xmlChar_ptr(n_name, 1);
5172 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
5173 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
5174 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
5175
5176 xmlSAX2UnparsedEntityDecl(ctx, name, publicId, systemId, notationName);
5177 call_tests++;
5178 des_void_ptr(n_ctx, ctx, 0);
5179 des_const_xmlChar_ptr(n_name, name, 1);
5180 des_const_xmlChar_ptr(n_publicId, publicId, 2);
5181 des_const_xmlChar_ptr(n_systemId, systemId, 3);
5182 des_const_xmlChar_ptr(n_notationName, notationName, 4);
5183 xmlResetLastError();
5184 if (mem_base != xmlMemBlocks()) {
5185 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5186 xmlMemBlocks() - mem_base);
5187 test_ret++;
5188 printf(" %d", n_ctx);
5189 printf(" %d", n_name);
5190 printf(" %d", n_publicId);
5191 printf(" %d", n_systemId);
5192 printf(" %d", n_notationName);
5193 printf("\n");
5194 }
5195 }
5196 }
5197 }
5198 }
5199 }
5200
5201 function_tests++;
5202 return(test_ret);
5203}
5204
5205
5206static int
5207test_xmlSAXDefaultVersion(void) {
5208 int test_ret = 0;
5209
5210 int mem_base;
5211 int ret_val;
5212 int version; /* the version, 1 or 2 */
5213 int n_version;
5214
5215 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5216 mem_base = xmlMemBlocks();
5217 version = gen_int(n_version, 0);
5218
5219 ret_val = xmlSAXDefaultVersion(version);
5220 desret_int(ret_val);
5221 call_tests++;
5222 des_int(n_version, version, 0);
5223 xmlResetLastError();
5224 if (mem_base != xmlMemBlocks()) {
5225 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5226 xmlMemBlocks() - mem_base);
5227 test_ret++;
5228 printf(" %d", n_version);
5229 printf("\n");
5230 }
5231 }
5232
5233 function_tests++;
5234 return(test_ret);
5235}
5236
5237
5238static int
5239test_xmlSAXVersion(void) {
5240 int test_ret = 0;
5241
5242 int mem_base;
5243 int ret_val;
5244 xmlSAXHandler * hdlr; /* the SAX handler */
5245 int n_hdlr;
5246 int version; /* the version, 1 or 2 */
5247 int n_version;
5248
5249 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5250 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5251 mem_base = xmlMemBlocks();
5252 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5253 version = gen_int(n_version, 1);
5254
5255 ret_val = xmlSAXVersion(hdlr, version);
5256 desret_int(ret_val);
5257 call_tests++;
5258 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5259 des_int(n_version, version, 1);
5260 xmlResetLastError();
5261 if (mem_base != xmlMemBlocks()) {
5262 printf("Leak of %d blocks found in xmlSAXVersion",
5263 xmlMemBlocks() - mem_base);
5264 test_ret++;
5265 printf(" %d", n_hdlr);
5266 printf(" %d", n_version);
5267 printf("\n");
5268 }
5269 }
5270 }
5271
5272 function_tests++;
5273 return(test_ret);
5274}
5275
5276static int
5277test_SAX2(void) {
5278 int test_ret = 0;
5279
5280 printf("Testing SAX2 : 38 of 38 functions ...\n");
5281 test_ret += test_docbDefaultSAXHandlerInit();
5282 test_ret += test_htmlDefaultSAXHandlerInit();
5283 test_ret += test_xmlDefaultSAXHandlerInit();
5284 test_ret += test_xmlSAX2AttributeDecl();
5285 test_ret += test_xmlSAX2CDataBlock();
5286 test_ret += test_xmlSAX2Characters();
5287 test_ret += test_xmlSAX2Comment();
5288 test_ret += test_xmlSAX2ElementDecl();
5289 test_ret += test_xmlSAX2EndDocument();
5290 test_ret += test_xmlSAX2EndElement();
5291 test_ret += test_xmlSAX2EndElementNs();
5292 test_ret += test_xmlSAX2EntityDecl();
5293 test_ret += test_xmlSAX2ExternalSubset();
5294 test_ret += test_xmlSAX2GetColumnNumber();
5295 test_ret += test_xmlSAX2GetEntity();
5296 test_ret += test_xmlSAX2GetLineNumber();
5297 test_ret += test_xmlSAX2GetParameterEntity();
5298 test_ret += test_xmlSAX2GetPublicId();
5299 test_ret += test_xmlSAX2GetSystemId();
5300 test_ret += test_xmlSAX2HasExternalSubset();
5301 test_ret += test_xmlSAX2HasInternalSubset();
5302 test_ret += test_xmlSAX2IgnorableWhitespace();
5303 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5304 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5305 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5306 test_ret += test_xmlSAX2InternalSubset();
5307 test_ret += test_xmlSAX2IsStandalone();
5308 test_ret += test_xmlSAX2NotationDecl();
5309 test_ret += test_xmlSAX2ProcessingInstruction();
5310 test_ret += test_xmlSAX2Reference();
5311 test_ret += test_xmlSAX2ResolveEntity();
5312 test_ret += test_xmlSAX2SetDocumentLocator();
5313 test_ret += test_xmlSAX2StartDocument();
5314 test_ret += test_xmlSAX2StartElement();
5315 test_ret += test_xmlSAX2StartElementNs();
5316 test_ret += test_xmlSAX2UnparsedEntityDecl();
5317 test_ret += test_xmlSAXDefaultVersion();
5318 test_ret += test_xmlSAXVersion();
5319
5320 if (test_ret != 0)
5321 printf("Module SAX2: %d errors\n", test_ret);
5322 return(test_ret);
5323}
5324
Daniel Veillarda82b1822004-11-08 16:24:57 +00005325#define gen_nb_xmlNodeSetPtr 1
5326static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5327 return(NULL);
5328}
5329static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5330}
5331
5332static int
5333test_xmlC14NDocDumpMemory(void) {
5334 int test_ret = 0;
5335
5336#ifdef LIBXML_C14N_ENABLED
5337#ifdef LIBXML_OUTPUT_ENABLED
5338 int mem_base;
5339 int ret_val;
5340 xmlDocPtr doc; /* the XML document for canonization */
5341 int n_doc;
5342 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5343 int n_nodes;
5344 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5345 int n_exclusive;
5346 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) */
5347 int n_inclusive_ns_prefixes;
5348 int with_comments; /* include comments in the result (!=0) or not (==0) */
5349 int n_with_comments;
5350 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 */
5351 int n_doc_txt_ptr;
5352
5353 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5354 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5355 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5356 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5357 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5358 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5359 mem_base = xmlMemBlocks();
5360 doc = gen_xmlDocPtr(n_doc, 0);
5361 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5362 exclusive = gen_int(n_exclusive, 2);
5363 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5364 with_comments = gen_int(n_with_comments, 4);
5365 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5366
5367 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5368 desret_int(ret_val);
5369 call_tests++;
5370 des_xmlDocPtr(n_doc, doc, 0);
5371 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5372 des_int(n_exclusive, exclusive, 2);
5373 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5374 des_int(n_with_comments, with_comments, 4);
5375 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5376 xmlResetLastError();
5377 if (mem_base != xmlMemBlocks()) {
5378 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5379 xmlMemBlocks() - mem_base);
5380 test_ret++;
5381 printf(" %d", n_doc);
5382 printf(" %d", n_nodes);
5383 printf(" %d", n_exclusive);
5384 printf(" %d", n_inclusive_ns_prefixes);
5385 printf(" %d", n_with_comments);
5386 printf(" %d", n_doc_txt_ptr);
5387 printf("\n");
5388 }
5389 }
5390 }
5391 }
5392 }
5393 }
5394 }
5395#endif
5396#endif
5397
5398 function_tests++;
5399 return(test_ret);
5400}
5401
5402
5403static int
5404test_xmlC14NDocSave(void) {
5405 int test_ret = 0;
5406
5407#ifdef LIBXML_C14N_ENABLED
5408#ifdef LIBXML_OUTPUT_ENABLED
5409 int mem_base;
5410 int ret_val;
5411 xmlDocPtr doc; /* the XML document for canonization */
5412 int n_doc;
5413 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5414 int n_nodes;
5415 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5416 int n_exclusive;
5417 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) */
5418 int n_inclusive_ns_prefixes;
5419 int with_comments; /* include comments in the result (!=0) or not (==0) */
5420 int n_with_comments;
5421 const char * filename; /* the filename to store canonical XML image */
5422 int n_filename;
5423 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5424 int n_compression;
5425
5426 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5427 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5428 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5429 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5430 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5431 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5432 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5433 mem_base = xmlMemBlocks();
5434 doc = gen_xmlDocPtr(n_doc, 0);
5435 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5436 exclusive = gen_int(n_exclusive, 2);
5437 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5438 with_comments = gen_int(n_with_comments, 4);
5439 filename = gen_fileoutput(n_filename, 5);
5440 compression = gen_int(n_compression, 6);
5441
5442 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5443 desret_int(ret_val);
5444 call_tests++;
5445 des_xmlDocPtr(n_doc, doc, 0);
5446 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5447 des_int(n_exclusive, exclusive, 2);
5448 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5449 des_int(n_with_comments, with_comments, 4);
5450 des_fileoutput(n_filename, filename, 5);
5451 des_int(n_compression, compression, 6);
5452 xmlResetLastError();
5453 if (mem_base != xmlMemBlocks()) {
5454 printf("Leak of %d blocks found in xmlC14NDocSave",
5455 xmlMemBlocks() - mem_base);
5456 test_ret++;
5457 printf(" %d", n_doc);
5458 printf(" %d", n_nodes);
5459 printf(" %d", n_exclusive);
5460 printf(" %d", n_inclusive_ns_prefixes);
5461 printf(" %d", n_with_comments);
5462 printf(" %d", n_filename);
5463 printf(" %d", n_compression);
5464 printf("\n");
5465 }
5466 }
5467 }
5468 }
5469 }
5470 }
5471 }
5472 }
5473#endif
5474#endif
5475
5476 function_tests++;
5477 return(test_ret);
5478}
5479
5480
5481static int
5482test_xmlC14NDocSaveTo(void) {
5483 int test_ret = 0;
5484
5485#ifdef LIBXML_C14N_ENABLED
5486#ifdef LIBXML_OUTPUT_ENABLED
5487 int mem_base;
5488 int ret_val;
5489 xmlDocPtr doc; /* the XML document for canonization */
5490 int n_doc;
5491 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5492 int n_nodes;
5493 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5494 int n_exclusive;
5495 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) */
5496 int n_inclusive_ns_prefixes;
5497 int with_comments; /* include comments in the result (!=0) or not (==0) */
5498 int n_with_comments;
5499 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5500 int n_buf;
5501
5502 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5503 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5504 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5505 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5506 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5507 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5508 mem_base = xmlMemBlocks();
5509 doc = gen_xmlDocPtr(n_doc, 0);
5510 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5511 exclusive = gen_int(n_exclusive, 2);
5512 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5513 with_comments = gen_int(n_with_comments, 4);
5514 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5515
5516 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5517 desret_int(ret_val);
5518 call_tests++;
5519 des_xmlDocPtr(n_doc, doc, 0);
5520 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5521 des_int(n_exclusive, exclusive, 2);
5522 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5523 des_int(n_with_comments, with_comments, 4);
5524 des_xmlOutputBufferPtr(n_buf, buf, 5);
5525 xmlResetLastError();
5526 if (mem_base != xmlMemBlocks()) {
5527 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5528 xmlMemBlocks() - mem_base);
5529 test_ret++;
5530 printf(" %d", n_doc);
5531 printf(" %d", n_nodes);
5532 printf(" %d", n_exclusive);
5533 printf(" %d", n_inclusive_ns_prefixes);
5534 printf(" %d", n_with_comments);
5535 printf(" %d", n_buf);
5536 printf("\n");
5537 }
5538 }
5539 }
5540 }
5541 }
5542 }
5543 }
5544#endif
5545#endif
5546
5547 function_tests++;
5548 return(test_ret);
5549}
5550
5551
5552static int
5553test_xmlC14NExecute(void) {
5554 int test_ret = 0;
5555
5556
5557 /* missing type support */
5558 return(test_ret);
5559}
5560
5561static int
5562test_c14n(void) {
5563 int test_ret = 0;
5564
5565 printf("Testing c14n : 3 of 4 functions ...\n");
5566 test_ret += test_xmlC14NDocDumpMemory();
5567 test_ret += test_xmlC14NDocSave();
5568 test_ret += test_xmlC14NDocSaveTo();
5569 test_ret += test_xmlC14NExecute();
5570
5571 if (test_ret != 0)
5572 printf("Module c14n: %d errors\n", test_ret);
5573 return(test_ret);
5574}
5575
Daniel Veillardce682bc2004-11-05 17:22:25 +00005576#define gen_nb_xmlCatalogPtr 1
5577static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5578 return(NULL);
5579}
5580static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5581}
5582
Daniel Veillardd93f6252004-11-02 15:53:51 +00005583static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005584test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005585 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005586
Daniel Veillardce682bc2004-11-05 17:22:25 +00005587#ifdef LIBXML_CATALOG_ENABLED
5588 int mem_base;
5589 int ret_val;
5590 xmlCatalogPtr catal; /* a Catalog */
5591 int n_catal;
5592 xmlChar * type; /* the type of record to add to the catalog */
5593 int n_type;
5594 xmlChar * orig; /* the system, public or prefix to match */
5595 int n_orig;
5596 xmlChar * replace; /* the replacement value for the match */
5597 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005598
Daniel Veillardce682bc2004-11-05 17:22:25 +00005599 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5600 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5601 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5602 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5603 mem_base = xmlMemBlocks();
5604 catal = gen_xmlCatalogPtr(n_catal, 0);
5605 type = gen_const_xmlChar_ptr(n_type, 1);
5606 orig = gen_const_xmlChar_ptr(n_orig, 2);
5607 replace = gen_const_xmlChar_ptr(n_replace, 3);
5608
5609 ret_val = xmlACatalogAdd(catal, type, orig, replace);
5610 desret_int(ret_val);
5611 call_tests++;
5612 des_xmlCatalogPtr(n_catal, catal, 0);
5613 des_const_xmlChar_ptr(n_type, type, 1);
5614 des_const_xmlChar_ptr(n_orig, orig, 2);
5615 des_const_xmlChar_ptr(n_replace, replace, 3);
5616 xmlResetLastError();
5617 if (mem_base != xmlMemBlocks()) {
5618 printf("Leak of %d blocks found in xmlACatalogAdd",
5619 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005620 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005621 printf(" %d", n_catal);
5622 printf(" %d", n_type);
5623 printf(" %d", n_orig);
5624 printf(" %d", n_replace);
5625 printf("\n");
5626 }
5627 }
5628 }
5629 }
5630 }
5631#endif
5632
5633 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005635}
5636
5637
5638static int
5639test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005641
Daniel Veillardce682bc2004-11-05 17:22:25 +00005642#ifdef LIBXML_CATALOG_ENABLED
5643#ifdef LIBXML_OUTPUT_ENABLED
5644 int mem_base;
5645 xmlCatalogPtr catal; /* a Catalog */
5646 int n_catal;
5647 FILE * out; /* the file. */
5648 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005649
Daniel Veillardce682bc2004-11-05 17:22:25 +00005650 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5651 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5652 mem_base = xmlMemBlocks();
5653 catal = gen_xmlCatalogPtr(n_catal, 0);
5654 out = gen_FILE_ptr(n_out, 1);
5655
5656 xmlACatalogDump(catal, out);
5657 call_tests++;
5658 des_xmlCatalogPtr(n_catal, catal, 0);
5659 des_FILE_ptr(n_out, out, 1);
5660 xmlResetLastError();
5661 if (mem_base != xmlMemBlocks()) {
5662 printf("Leak of %d blocks found in xmlACatalogDump",
5663 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005664 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005665 printf(" %d", n_catal);
5666 printf(" %d", n_out);
5667 printf("\n");
5668 }
5669 }
5670 }
5671#endif
5672#endif
5673
5674 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005676}
5677
5678
5679static int
5680test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005682
Daniel Veillardce682bc2004-11-05 17:22:25 +00005683#ifdef LIBXML_CATALOG_ENABLED
5684 int mem_base;
5685 int ret_val;
5686 xmlCatalogPtr catal; /* a Catalog */
5687 int n_catal;
5688 xmlChar * value; /* the value to remove */
5689 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005690
Daniel Veillardce682bc2004-11-05 17:22:25 +00005691 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5692 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5693 mem_base = xmlMemBlocks();
5694 catal = gen_xmlCatalogPtr(n_catal, 0);
5695 value = gen_const_xmlChar_ptr(n_value, 1);
5696
5697 ret_val = xmlACatalogRemove(catal, value);
5698 desret_int(ret_val);
5699 call_tests++;
5700 des_xmlCatalogPtr(n_catal, catal, 0);
5701 des_const_xmlChar_ptr(n_value, value, 1);
5702 xmlResetLastError();
5703 if (mem_base != xmlMemBlocks()) {
5704 printf("Leak of %d blocks found in xmlACatalogRemove",
5705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005706 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005707 printf(" %d", n_catal);
5708 printf(" %d", n_value);
5709 printf("\n");
5710 }
5711 }
5712 }
5713#endif
5714
5715 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005716 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005717}
5718
5719
5720static int
5721test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005722 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005723
Daniel Veillardce682bc2004-11-05 17:22:25 +00005724#ifdef LIBXML_CATALOG_ENABLED
5725 int mem_base;
5726 xmlChar * ret_val;
5727 xmlCatalogPtr catal; /* a Catalog */
5728 int n_catal;
5729 xmlChar * pubID; /* the public ID string */
5730 int n_pubID;
5731 xmlChar * sysID; /* the system ID string */
5732 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005733
Daniel Veillardce682bc2004-11-05 17:22:25 +00005734 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5735 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5736 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5737 mem_base = xmlMemBlocks();
5738 catal = gen_xmlCatalogPtr(n_catal, 0);
5739 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5740 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5741
5742 ret_val = xmlACatalogResolve(catal, pubID, sysID);
5743 desret_xmlChar_ptr(ret_val);
5744 call_tests++;
5745 des_xmlCatalogPtr(n_catal, catal, 0);
5746 des_const_xmlChar_ptr(n_pubID, pubID, 1);
5747 des_const_xmlChar_ptr(n_sysID, sysID, 2);
5748 xmlResetLastError();
5749 if (mem_base != xmlMemBlocks()) {
5750 printf("Leak of %d blocks found in xmlACatalogResolve",
5751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005752 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005753 printf(" %d", n_catal);
5754 printf(" %d", n_pubID);
5755 printf(" %d", n_sysID);
5756 printf("\n");
5757 }
5758 }
5759 }
5760 }
5761#endif
5762
5763 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005764 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005765}
5766
5767
5768static int
5769test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005770 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005771
Daniel Veillardce682bc2004-11-05 17:22:25 +00005772#ifdef LIBXML_CATALOG_ENABLED
5773 int mem_base;
5774 xmlChar * ret_val;
5775 xmlCatalogPtr catal; /* a Catalog */
5776 int n_catal;
5777 xmlChar * pubID; /* the public ID string */
5778 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005779
Daniel Veillardce682bc2004-11-05 17:22:25 +00005780 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5781 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5782 mem_base = xmlMemBlocks();
5783 catal = gen_xmlCatalogPtr(n_catal, 0);
5784 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5785
5786 ret_val = xmlACatalogResolvePublic(catal, pubID);
5787 desret_xmlChar_ptr(ret_val);
5788 call_tests++;
5789 des_xmlCatalogPtr(n_catal, catal, 0);
5790 des_const_xmlChar_ptr(n_pubID, pubID, 1);
5791 xmlResetLastError();
5792 if (mem_base != xmlMemBlocks()) {
5793 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005795 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005796 printf(" %d", n_catal);
5797 printf(" %d", n_pubID);
5798 printf("\n");
5799 }
5800 }
5801 }
5802#endif
5803
5804 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005806}
5807
5808
5809static int
5810test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005811 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005812
Daniel Veillardce682bc2004-11-05 17:22:25 +00005813#ifdef LIBXML_CATALOG_ENABLED
5814 int mem_base;
5815 xmlChar * ret_val;
5816 xmlCatalogPtr catal; /* a Catalog */
5817 int n_catal;
5818 xmlChar * sysID; /* the system ID string */
5819 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005820
Daniel Veillardce682bc2004-11-05 17:22:25 +00005821 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5822 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5823 mem_base = xmlMemBlocks();
5824 catal = gen_xmlCatalogPtr(n_catal, 0);
5825 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
5826
5827 ret_val = xmlACatalogResolveSystem(catal, sysID);
5828 desret_xmlChar_ptr(ret_val);
5829 call_tests++;
5830 des_xmlCatalogPtr(n_catal, catal, 0);
5831 des_const_xmlChar_ptr(n_sysID, sysID, 1);
5832 xmlResetLastError();
5833 if (mem_base != xmlMemBlocks()) {
5834 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
5835 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005836 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005837 printf(" %d", n_catal);
5838 printf(" %d", n_sysID);
5839 printf("\n");
5840 }
5841 }
5842 }
5843#endif
5844
5845 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005846 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005847}
5848
5849
5850static int
5851test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005852 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005853
Daniel Veillardce682bc2004-11-05 17:22:25 +00005854#ifdef LIBXML_CATALOG_ENABLED
5855 int mem_base;
5856 xmlChar * ret_val;
5857 xmlCatalogPtr catal; /* a Catalog */
5858 int n_catal;
5859 xmlChar * URI; /* the URI */
5860 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005861
Daniel Veillardce682bc2004-11-05 17:22:25 +00005862 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5863 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5864 mem_base = xmlMemBlocks();
5865 catal = gen_xmlCatalogPtr(n_catal, 0);
5866 URI = gen_const_xmlChar_ptr(n_URI, 1);
5867
5868 ret_val = xmlACatalogResolveURI(catal, URI);
5869 desret_xmlChar_ptr(ret_val);
5870 call_tests++;
5871 des_xmlCatalogPtr(n_catal, catal, 0);
5872 des_const_xmlChar_ptr(n_URI, URI, 1);
5873 xmlResetLastError();
5874 if (mem_base != xmlMemBlocks()) {
5875 printf("Leak of %d blocks found in xmlACatalogResolveURI",
5876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005877 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005878 printf(" %d", n_catal);
5879 printf(" %d", n_URI);
5880 printf("\n");
5881 }
5882 }
5883 }
5884#endif
5885
5886 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005887 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005888}
5889
5890
5891static int
5892test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005893 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005894
5895#ifdef LIBXML_CATALOG_ENABLED
5896 int mem_base;
5897 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005898 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005899 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005900 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005901 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005902 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005903 int n_replace;
5904
5905 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5906 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5907 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5908 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005909 type = gen_const_xmlChar_ptr(n_type, 0);
5910 orig = gen_const_xmlChar_ptr(n_orig, 1);
5911 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005912
5913 ret_val = xmlCatalogAdd(type, orig, replace);
5914 desret_int(ret_val);
5915 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005916 des_const_xmlChar_ptr(n_type, type, 0);
5917 des_const_xmlChar_ptr(n_orig, orig, 1);
5918 des_const_xmlChar_ptr(n_replace, replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005919 xmlResetLastError();
5920 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005921 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005922 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005923 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005924 printf(" %d", n_type);
5925 printf(" %d", n_orig);
5926 printf(" %d", n_replace);
5927 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005928 }
5929 }
5930 }
5931 }
5932#endif
5933
Daniel Veillard3d97e662004-11-04 10:49:00 +00005934 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005935 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005936}
5937
5938
5939static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005940test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005941 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005942
5943#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00005944
Daniel Veillardd93f6252004-11-02 15:53:51 +00005945
5946 xmlCatalogCleanup();
5947 call_tests++;
5948 xmlResetLastError();
Daniel Veillardd93f6252004-11-02 15:53:51 +00005949#endif
5950
Daniel Veillard3d97e662004-11-04 10:49:00 +00005951 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005952 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005953}
5954
5955
5956static int
5957test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005958 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005959
5960#ifdef LIBXML_CATALOG_ENABLED
5961 int ret_val;
5962
5963
5964 ret_val = xmlCatalogConvert();
5965 desret_int(ret_val);
5966 call_tests++;
5967 xmlResetLastError();
5968#endif
5969
Daniel Veillard3d97e662004-11-04 10:49:00 +00005970 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005971 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005972}
5973
5974
5975static int
5976test_xmlCatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005977 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005978
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005979#ifdef LIBXML_CATALOG_ENABLED
5980#ifdef LIBXML_OUTPUT_ENABLED
5981 int mem_base;
5982 FILE * out; /* the file. */
5983 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005984
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005985 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5986 mem_base = xmlMemBlocks();
5987 out = gen_FILE_ptr(n_out, 0);
5988
5989 xmlCatalogDump(out);
5990 call_tests++;
5991 des_FILE_ptr(n_out, out, 0);
5992 xmlResetLastError();
5993 if (mem_base != xmlMemBlocks()) {
5994 printf("Leak of %d blocks found in xmlCatalogDump",
5995 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005996 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005997 printf(" %d", n_out);
5998 printf("\n");
5999 }
6000 }
6001#endif
6002#endif
6003
6004 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006005 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006006}
6007
6008
6009static int
6010test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006011 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006012
Daniel Veillard57b25162004-11-06 14:50:18 +00006013#ifdef LIBXML_CATALOG_ENABLED
6014 int mem_base;
6015 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006016
Daniel Veillard57b25162004-11-06 14:50:18 +00006017 mem_base = xmlMemBlocks();
6018
6019 ret_val = xmlCatalogGetDefaults();
6020 desret_xmlCatalogAllow(ret_val);
6021 call_tests++;
6022 xmlResetLastError();
6023 if (mem_base != xmlMemBlocks()) {
6024 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
6025 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006026 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006027 printf("\n");
6028 }
6029#endif
6030
6031 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006033}
6034
6035
6036static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006037test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006039
Daniel Veillardce682bc2004-11-05 17:22:25 +00006040#ifdef LIBXML_CATALOG_ENABLED
6041 int mem_base;
6042 int ret_val;
6043 xmlCatalogPtr catal; /* should this create an SGML catalog */
6044 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006045
Daniel Veillardce682bc2004-11-05 17:22:25 +00006046 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6047 mem_base = xmlMemBlocks();
6048 catal = gen_xmlCatalogPtr(n_catal, 0);
6049
6050 ret_val = xmlCatalogIsEmpty(catal);
6051 desret_int(ret_val);
6052 call_tests++;
6053 des_xmlCatalogPtr(n_catal, catal, 0);
6054 xmlResetLastError();
6055 if (mem_base != xmlMemBlocks()) {
6056 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
6057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006058 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006059 printf(" %d", n_catal);
6060 printf("\n");
6061 }
6062 }
6063#endif
6064
6065 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006067}
6068
6069
6070static int
6071test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006073
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006074#ifdef LIBXML_CATALOG_ENABLED
6075 int mem_base;
6076 xmlChar * ret_val;
6077 void * catalogs; /* a document's list of catalogs */
6078 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006079 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006080 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006081 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006082 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006083
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006084 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
6085 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6086 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6087 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006088 catalogs = gen_void_ptr(n_catalogs, 0);
6089 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
6090 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006091
6092 ret_val = xmlCatalogLocalResolve(catalogs, pubID, sysID);
6093 desret_xmlChar_ptr(ret_val);
6094 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006095 des_void_ptr(n_catalogs, catalogs, 0);
6096 des_const_xmlChar_ptr(n_pubID, pubID, 1);
6097 des_const_xmlChar_ptr(n_sysID, sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006098 xmlResetLastError();
6099 if (mem_base != xmlMemBlocks()) {
6100 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
6101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006102 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006103 printf(" %d", n_catalogs);
6104 printf(" %d", n_pubID);
6105 printf(" %d", n_sysID);
6106 printf("\n");
6107 }
6108 }
6109 }
6110 }
6111#endif
6112
Daniel Veillard3d97e662004-11-04 10:49:00 +00006113 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006115}
6116
6117
6118static int
6119test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006120 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006121
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006122#ifdef LIBXML_CATALOG_ENABLED
6123 int mem_base;
6124 xmlChar * ret_val;
6125 void * catalogs; /* a document's list of catalogs */
6126 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006127 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006128 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006129
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006130 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
6131 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6132 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006133 catalogs = gen_void_ptr(n_catalogs, 0);
6134 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006135
6136 ret_val = xmlCatalogLocalResolveURI(catalogs, URI);
6137 desret_xmlChar_ptr(ret_val);
6138 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006139 des_void_ptr(n_catalogs, catalogs, 0);
6140 des_const_xmlChar_ptr(n_URI, URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006141 xmlResetLastError();
6142 if (mem_base != xmlMemBlocks()) {
6143 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
6144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006145 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006146 printf(" %d", n_catalogs);
6147 printf(" %d", n_URI);
6148 printf("\n");
6149 }
6150 }
6151 }
6152#endif
6153
Daniel Veillard3d97e662004-11-04 10:49:00 +00006154 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006156}
6157
6158
6159static int
6160test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006162
6163#ifdef LIBXML_CATALOG_ENABLED
6164 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006165 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006166 int n_value;
6167
6168 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006169 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006170
6171 ret_val = xmlCatalogRemove(value);
6172 desret_int(ret_val);
6173 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006174 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006175 xmlResetLastError();
6176 }
6177#endif
6178
Daniel Veillard3d97e662004-11-04 10:49:00 +00006179 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006181}
6182
6183
6184static int
6185test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006187
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006188#ifdef LIBXML_CATALOG_ENABLED
6189 int mem_base;
6190 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006191 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006192 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006193 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006194 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006195
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006196 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6197 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6198 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006199 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6200 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006201
6202 ret_val = xmlCatalogResolve(pubID, sysID);
6203 desret_xmlChar_ptr(ret_val);
6204 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006205 des_const_xmlChar_ptr(n_pubID, pubID, 0);
6206 des_const_xmlChar_ptr(n_sysID, sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006207 xmlResetLastError();
6208 if (mem_base != xmlMemBlocks()) {
6209 printf("Leak of %d blocks found in xmlCatalogResolve",
6210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006211 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006212 printf(" %d", n_pubID);
6213 printf(" %d", n_sysID);
6214 printf("\n");
6215 }
6216 }
6217 }
6218#endif
6219
Daniel Veillard3d97e662004-11-04 10:49:00 +00006220 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006222}
6223
6224
6225static int
6226test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006228
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006229#ifdef LIBXML_CATALOG_ENABLED
6230 int mem_base;
6231 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006232 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006233 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006234
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006235 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6236 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006237 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006238
6239 ret_val = xmlCatalogResolvePublic(pubID);
6240 desret_xmlChar_ptr(ret_val);
6241 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006242 des_const_xmlChar_ptr(n_pubID, pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006243 xmlResetLastError();
6244 if (mem_base != xmlMemBlocks()) {
6245 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
6246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006247 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006248 printf(" %d", n_pubID);
6249 printf("\n");
6250 }
6251 }
6252#endif
6253
Daniel Veillard3d97e662004-11-04 10:49:00 +00006254 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006256}
6257
6258
6259static int
6260test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006262
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006263#ifdef LIBXML_CATALOG_ENABLED
6264 int mem_base;
6265 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006266 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006267 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006268
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006269 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6270 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006271 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006272
6273 ret_val = xmlCatalogResolveSystem(sysID);
6274 desret_xmlChar_ptr(ret_val);
6275 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006276 des_const_xmlChar_ptr(n_sysID, sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006277 xmlResetLastError();
6278 if (mem_base != xmlMemBlocks()) {
6279 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006281 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006282 printf(" %d", n_sysID);
6283 printf("\n");
6284 }
6285 }
6286#endif
6287
Daniel Veillard3d97e662004-11-04 10:49:00 +00006288 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006290}
6291
6292
6293static int
6294test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006296
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006297#ifdef LIBXML_CATALOG_ENABLED
6298 int mem_base;
6299 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006300 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006301 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006302
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006303 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6304 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006305 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006306
6307 ret_val = xmlCatalogResolveURI(URI);
6308 desret_xmlChar_ptr(ret_val);
6309 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006310 des_const_xmlChar_ptr(n_URI, URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006311 xmlResetLastError();
6312 if (mem_base != xmlMemBlocks()) {
6313 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006315 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006316 printf(" %d", n_URI);
6317 printf("\n");
6318 }
6319 }
6320#endif
6321
Daniel Veillard3d97e662004-11-04 10:49:00 +00006322 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006324}
6325
6326
6327static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006328test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006330
Daniel Veillard57b25162004-11-06 14:50:18 +00006331#ifdef LIBXML_CATALOG_ENABLED
6332 int mem_base;
6333 xmlCatalogPrefer ret_val;
6334 xmlCatalogPrefer prefer; /* the default preference for delegation */
6335 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006336
Daniel Veillard57b25162004-11-06 14:50:18 +00006337 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6338 mem_base = xmlMemBlocks();
6339 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6340
6341 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6342 desret_xmlCatalogPrefer(ret_val);
6343 call_tests++;
6344 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6345 xmlResetLastError();
6346 if (mem_base != xmlMemBlocks()) {
6347 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6348 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006349 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006350 printf(" %d", n_prefer);
6351 printf("\n");
6352 }
6353 }
6354#endif
6355
6356 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006358}
6359
6360
6361static int
6362test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006364
Daniel Veillard57b25162004-11-06 14:50:18 +00006365#ifdef LIBXML_CATALOG_ENABLED
6366 int mem_base;
6367 xmlCatalogAllow allow; /* what catalogs should be accepted */
6368 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006369
Daniel Veillard57b25162004-11-06 14:50:18 +00006370 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6371 mem_base = xmlMemBlocks();
6372 allow = gen_xmlCatalogAllow(n_allow, 0);
6373
6374 xmlCatalogSetDefaults(allow);
6375 call_tests++;
6376 des_xmlCatalogAllow(n_allow, allow, 0);
6377 xmlResetLastError();
6378 if (mem_base != xmlMemBlocks()) {
6379 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006381 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006382 printf(" %d", n_allow);
6383 printf("\n");
6384 }
6385 }
6386#endif
6387
6388 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006390}
6391
6392
6393static int
6394test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006395 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006396
Daniel Veillardce682bc2004-11-05 17:22:25 +00006397#ifdef LIBXML_CATALOG_ENABLED
6398 int mem_base;
6399 int ret_val;
6400 xmlCatalogPtr catal; /* the catalog */
6401 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006402
Daniel Veillardce682bc2004-11-05 17:22:25 +00006403 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6404 mem_base = xmlMemBlocks();
6405 catal = gen_xmlCatalogPtr(n_catal, 0);
6406
6407 ret_val = xmlConvertSGMLCatalog(catal);
6408 desret_int(ret_val);
6409 call_tests++;
6410 des_xmlCatalogPtr(n_catal, catal, 0);
6411 xmlResetLastError();
6412 if (mem_base != xmlMemBlocks()) {
6413 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006415 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006416 printf(" %d", n_catal);
6417 printf("\n");
6418 }
6419 }
6420#endif
6421
6422 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006423 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006424}
6425
6426
6427static int
6428test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006430
6431#ifdef LIBXML_CATALOG_ENABLED
6432 int mem_base;
6433
6434 mem_base = xmlMemBlocks();
6435
6436 xmlInitializeCatalog();
6437 call_tests++;
6438 xmlResetLastError();
6439 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006440 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006442 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006443 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006444 }
6445#endif
6446
Daniel Veillard3d97e662004-11-04 10:49:00 +00006447 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006449}
6450
6451
6452static int
6453test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006454 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006455
6456
6457 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006458 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006459}
6460
6461
6462static int
6463test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006464 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006465
6466#ifdef LIBXML_CATALOG_ENABLED
6467 int ret_val;
6468 const char * filename; /* a file path */
6469 int n_filename;
6470
6471 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006472 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006473
6474 ret_val = xmlLoadCatalog(filename);
6475 desret_int(ret_val);
6476 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006477 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006478 xmlResetLastError();
6479 }
6480#endif
6481
Daniel Veillard3d97e662004-11-04 10:49:00 +00006482 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006484}
6485
6486
6487static int
6488test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006490
6491#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00006492 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006493 int n_pathss;
6494
6495 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006496 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006497
6498 xmlLoadCatalogs(pathss);
6499 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006500 des_const_char_ptr(n_pathss, pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006501 xmlResetLastError();
6502 }
6503#endif
6504
Daniel Veillard3d97e662004-11-04 10:49:00 +00006505 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006507}
6508
6509
6510static int
6511test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006513
6514
6515 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006516 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006517}
6518
6519
6520static int
6521test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006522 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006523
6524
6525 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006527}
6528
6529
6530static int
6531test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006533
6534#ifdef LIBXML_CATALOG_ENABLED
6535 int mem_base;
6536 xmlDocPtr ret_val;
6537 const char * filename; /* the filename */
6538 int n_filename;
6539
6540 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6541 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006542 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006543
6544 ret_val = xmlParseCatalogFile(filename);
6545 desret_xmlDocPtr(ret_val);
6546 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006547 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006548 xmlResetLastError();
6549 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006550 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006552 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006553 printf(" %d", n_filename);
6554 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006555 }
6556 }
6557#endif
6558
Daniel Veillard3d97e662004-11-04 10:49:00 +00006559 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006560 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006561}
6562
6563static int
6564test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006565 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006566
Daniel Veillardc2c894f2004-11-07 12:17:35 +00006567 printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006568 test_ret += test_xmlACatalogAdd();
6569 test_ret += test_xmlACatalogDump();
6570 test_ret += test_xmlACatalogRemove();
6571 test_ret += test_xmlACatalogResolve();
6572 test_ret += test_xmlACatalogResolvePublic();
6573 test_ret += test_xmlACatalogResolveSystem();
6574 test_ret += test_xmlACatalogResolveURI();
6575 test_ret += test_xmlCatalogAdd();
6576 test_ret += test_xmlCatalogCleanup();
6577 test_ret += test_xmlCatalogConvert();
6578 test_ret += test_xmlCatalogDump();
6579 test_ret += test_xmlCatalogGetDefaults();
6580 test_ret += test_xmlCatalogIsEmpty();
6581 test_ret += test_xmlCatalogLocalResolve();
6582 test_ret += test_xmlCatalogLocalResolveURI();
6583 test_ret += test_xmlCatalogRemove();
6584 test_ret += test_xmlCatalogResolve();
6585 test_ret += test_xmlCatalogResolvePublic();
6586 test_ret += test_xmlCatalogResolveSystem();
6587 test_ret += test_xmlCatalogResolveURI();
6588 test_ret += test_xmlCatalogSetDefaultPrefer();
6589 test_ret += test_xmlCatalogSetDefaults();
6590 test_ret += test_xmlConvertSGMLCatalog();
6591 test_ret += test_xmlInitializeCatalog();
6592 test_ret += test_xmlLoadACatalog();
6593 test_ret += test_xmlLoadCatalog();
6594 test_ret += test_xmlLoadCatalogs();
6595 test_ret += test_xmlLoadSGMLSuperCatalog();
6596 test_ret += test_xmlNewCatalog();
6597 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006598
Daniel Veillard42595322004-11-08 10:52:06 +00006599 if (test_ret != 0)
6600 printf("Module catalog: %d errors\n", test_ret);
6601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006602}
6603
Daniel Veillardce682bc2004-11-05 17:22:25 +00006604#define gen_nb_const_xmlChRangeGroupPtr 1
6605static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6606 return(NULL);
6607}
6608static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6609}
6610
Daniel Veillardd93f6252004-11-02 15:53:51 +00006611static int
6612test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006613 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006614
Daniel Veillardce682bc2004-11-05 17:22:25 +00006615 int mem_base;
6616 int ret_val;
6617 unsigned int val; /* character to be validated */
6618 int n_val;
6619 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6620 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006621
Daniel Veillardce682bc2004-11-05 17:22:25 +00006622 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6623 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6624 mem_base = xmlMemBlocks();
6625 val = gen_unsigned_int(n_val, 0);
6626 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6627
6628 ret_val = xmlCharInRange(val, rptr);
6629 desret_int(ret_val);
6630 call_tests++;
6631 des_unsigned_int(n_val, val, 0);
6632 des_const_xmlChRangeGroupPtr(n_rptr, rptr, 1);
6633 xmlResetLastError();
6634 if (mem_base != xmlMemBlocks()) {
6635 printf("Leak of %d blocks found in xmlCharInRange",
6636 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006637 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006638 printf(" %d", n_val);
6639 printf(" %d", n_rptr);
6640 printf("\n");
6641 }
6642 }
6643 }
6644
6645 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006646 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006647}
6648
6649
6650static int
6651test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006652 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006653
Daniel Veillard3d97e662004-11-04 10:49:00 +00006654 int mem_base;
6655 int ret_val;
6656 unsigned int ch; /* character to validate */
6657 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006658
Daniel Veillard3d97e662004-11-04 10:49:00 +00006659 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6660 mem_base = xmlMemBlocks();
6661 ch = gen_unsigned_int(n_ch, 0);
6662
6663 ret_val = xmlIsBaseChar(ch);
6664 desret_int(ret_val);
6665 call_tests++;
6666 des_unsigned_int(n_ch, ch, 0);
6667 xmlResetLastError();
6668 if (mem_base != xmlMemBlocks()) {
6669 printf("Leak of %d blocks found in xmlIsBaseChar",
6670 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006671 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006672 printf(" %d", n_ch);
6673 printf("\n");
6674 }
6675 }
6676
6677 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006678 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006679}
6680
6681
6682static int
6683test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006684 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006685
Daniel Veillard3d97e662004-11-04 10:49:00 +00006686 int mem_base;
6687 int ret_val;
6688 unsigned int ch; /* character to validate */
6689 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006690
Daniel Veillard3d97e662004-11-04 10:49:00 +00006691 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6692 mem_base = xmlMemBlocks();
6693 ch = gen_unsigned_int(n_ch, 0);
6694
6695 ret_val = xmlIsBlank(ch);
6696 desret_int(ret_val);
6697 call_tests++;
6698 des_unsigned_int(n_ch, ch, 0);
6699 xmlResetLastError();
6700 if (mem_base != xmlMemBlocks()) {
6701 printf("Leak of %d blocks found in xmlIsBlank",
6702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006703 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006704 printf(" %d", n_ch);
6705 printf("\n");
6706 }
6707 }
6708
6709 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006710 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006711}
6712
6713
6714static int
6715test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006716 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006717
Daniel Veillard3d97e662004-11-04 10:49:00 +00006718 int mem_base;
6719 int ret_val;
6720 unsigned int ch; /* character to validate */
6721 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006722
Daniel Veillard3d97e662004-11-04 10:49:00 +00006723 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6724 mem_base = xmlMemBlocks();
6725 ch = gen_unsigned_int(n_ch, 0);
6726
6727 ret_val = xmlIsChar(ch);
6728 desret_int(ret_val);
6729 call_tests++;
6730 des_unsigned_int(n_ch, ch, 0);
6731 xmlResetLastError();
6732 if (mem_base != xmlMemBlocks()) {
6733 printf("Leak of %d blocks found in xmlIsChar",
6734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006735 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006736 printf(" %d", n_ch);
6737 printf("\n");
6738 }
6739 }
6740
6741 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006742 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006743}
6744
6745
6746static int
6747test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006748 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006749
Daniel Veillard3d97e662004-11-04 10:49:00 +00006750 int mem_base;
6751 int ret_val;
6752 unsigned int ch; /* character to validate */
6753 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006754
Daniel Veillard3d97e662004-11-04 10:49:00 +00006755 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6756 mem_base = xmlMemBlocks();
6757 ch = gen_unsigned_int(n_ch, 0);
6758
6759 ret_val = xmlIsCombining(ch);
6760 desret_int(ret_val);
6761 call_tests++;
6762 des_unsigned_int(n_ch, ch, 0);
6763 xmlResetLastError();
6764 if (mem_base != xmlMemBlocks()) {
6765 printf("Leak of %d blocks found in xmlIsCombining",
6766 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006767 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006768 printf(" %d", n_ch);
6769 printf("\n");
6770 }
6771 }
6772
6773 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006774 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006775}
6776
6777
6778static int
6779test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006781
Daniel Veillard3d97e662004-11-04 10:49:00 +00006782 int mem_base;
6783 int ret_val;
6784 unsigned int ch; /* character to validate */
6785 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006786
Daniel Veillard3d97e662004-11-04 10:49:00 +00006787 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6788 mem_base = xmlMemBlocks();
6789 ch = gen_unsigned_int(n_ch, 0);
6790
6791 ret_val = xmlIsDigit(ch);
6792 desret_int(ret_val);
6793 call_tests++;
6794 des_unsigned_int(n_ch, ch, 0);
6795 xmlResetLastError();
6796 if (mem_base != xmlMemBlocks()) {
6797 printf("Leak of %d blocks found in xmlIsDigit",
6798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006799 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006800 printf(" %d", n_ch);
6801 printf("\n");
6802 }
6803 }
6804
6805 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006806 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006807}
6808
6809
6810static int
6811test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006812 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006813
Daniel Veillard3d97e662004-11-04 10:49:00 +00006814 int mem_base;
6815 int ret_val;
6816 unsigned int ch; /* character to validate */
6817 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006818
Daniel Veillard3d97e662004-11-04 10:49:00 +00006819 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6820 mem_base = xmlMemBlocks();
6821 ch = gen_unsigned_int(n_ch, 0);
6822
6823 ret_val = xmlIsExtender(ch);
6824 desret_int(ret_val);
6825 call_tests++;
6826 des_unsigned_int(n_ch, ch, 0);
6827 xmlResetLastError();
6828 if (mem_base != xmlMemBlocks()) {
6829 printf("Leak of %d blocks found in xmlIsExtender",
6830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006831 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006832 printf(" %d", n_ch);
6833 printf("\n");
6834 }
6835 }
6836
6837 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006838 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006839}
6840
6841
6842static int
6843test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006844 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006845
Daniel Veillard3d97e662004-11-04 10:49:00 +00006846 int mem_base;
6847 int ret_val;
6848 unsigned int ch; /* character to validate */
6849 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006850
Daniel Veillard3d97e662004-11-04 10:49:00 +00006851 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6852 mem_base = xmlMemBlocks();
6853 ch = gen_unsigned_int(n_ch, 0);
6854
6855 ret_val = xmlIsIdeographic(ch);
6856 desret_int(ret_val);
6857 call_tests++;
6858 des_unsigned_int(n_ch, ch, 0);
6859 xmlResetLastError();
6860 if (mem_base != xmlMemBlocks()) {
6861 printf("Leak of %d blocks found in xmlIsIdeographic",
6862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006863 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006864 printf(" %d", n_ch);
6865 printf("\n");
6866 }
6867 }
6868
6869 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006870 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006871}
6872
6873
6874static int
6875test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006876 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006877
Daniel Veillard3d97e662004-11-04 10:49:00 +00006878 int mem_base;
6879 int ret_val;
6880 unsigned int ch; /* character to validate */
6881 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006882
Daniel Veillard3d97e662004-11-04 10:49:00 +00006883 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6884 mem_base = xmlMemBlocks();
6885 ch = gen_unsigned_int(n_ch, 0);
6886
6887 ret_val = xmlIsPubidChar(ch);
6888 desret_int(ret_val);
6889 call_tests++;
6890 des_unsigned_int(n_ch, ch, 0);
6891 xmlResetLastError();
6892 if (mem_base != xmlMemBlocks()) {
6893 printf("Leak of %d blocks found in xmlIsPubidChar",
6894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006895 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006896 printf(" %d", n_ch);
6897 printf("\n");
6898 }
6899 }
6900
6901 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006902 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006903}
6904
6905static int
6906test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006908
Daniel Veillardce682bc2004-11-05 17:22:25 +00006909 printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006910 test_ret += test_xmlCharInRange();
6911 test_ret += test_xmlIsBaseChar();
6912 test_ret += test_xmlIsBlank();
6913 test_ret += test_xmlIsChar();
6914 test_ret += test_xmlIsCombining();
6915 test_ret += test_xmlIsDigit();
6916 test_ret += test_xmlIsExtender();
6917 test_ret += test_xmlIsIdeographic();
6918 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006919
Daniel Veillard42595322004-11-08 10:52:06 +00006920 if (test_ret != 0)
6921 printf("Module chvalid: %d errors\n", test_ret);
6922 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006923}
6924
6925static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00006926test_xmlBoolToText(void) {
6927 int test_ret = 0;
6928
6929#ifdef LIBXML_DEBUG_ENABLED
6930 int mem_base;
6931 const char * ret_val;
6932 int boolval; /* a bool to turn into text */
6933 int n_boolval;
6934
6935 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
6936 mem_base = xmlMemBlocks();
6937 boolval = gen_int(n_boolval, 0);
6938
6939 ret_val = xmlBoolToText(boolval);
6940 desret_const_char_ptr(ret_val);
6941 call_tests++;
6942 des_int(n_boolval, boolval, 0);
6943 xmlResetLastError();
6944 if (mem_base != xmlMemBlocks()) {
6945 printf("Leak of %d blocks found in xmlBoolToText",
6946 xmlMemBlocks() - mem_base);
6947 test_ret++;
6948 printf(" %d", n_boolval);
6949 printf("\n");
6950 }
6951 }
6952#endif
6953
6954 function_tests++;
6955 return(test_ret);
6956}
6957
6958
6959static int
6960test_xmlDebugCheckDocument(void) {
6961 int test_ret = 0;
6962
6963#ifdef LIBXML_DEBUG_ENABLED
6964 int mem_base;
6965 int ret_val;
6966 FILE * output; /* the FILE * for the output */
6967 int n_output;
6968 xmlDocPtr doc; /* the document */
6969 int n_doc;
6970
6971 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6972 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6973 mem_base = xmlMemBlocks();
6974 output = gen_debug_FILE_ptr(n_output, 0);
6975 doc = gen_xmlDocPtr(n_doc, 1);
6976
6977 ret_val = xmlDebugCheckDocument(output, doc);
6978 desret_int(ret_val);
6979 call_tests++;
6980 des_debug_FILE_ptr(n_output, output, 0);
6981 des_xmlDocPtr(n_doc, doc, 1);
6982 xmlResetLastError();
6983 if (mem_base != xmlMemBlocks()) {
6984 printf("Leak of %d blocks found in xmlDebugCheckDocument",
6985 xmlMemBlocks() - mem_base);
6986 test_ret++;
6987 printf(" %d", n_output);
6988 printf(" %d", n_doc);
6989 printf("\n");
6990 }
6991 }
6992 }
6993#endif
6994
6995 function_tests++;
6996 return(test_ret);
6997}
6998
6999
7000static int
7001test_xmlDebugDumpAttr(void) {
7002 int test_ret = 0;
7003
7004#ifdef LIBXML_DEBUG_ENABLED
7005 int mem_base;
7006 FILE * output; /* the FILE * for the output */
7007 int n_output;
7008 xmlAttrPtr attr; /* the attribute */
7009 int n_attr;
7010 int depth; /* the indentation level. */
7011 int n_depth;
7012
7013 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7014 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
7015 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7016 mem_base = xmlMemBlocks();
7017 output = gen_debug_FILE_ptr(n_output, 0);
7018 attr = gen_xmlAttrPtr(n_attr, 1);
7019 depth = gen_int(n_depth, 2);
7020
7021 xmlDebugDumpAttr(output, attr, depth);
7022 call_tests++;
7023 des_debug_FILE_ptr(n_output, output, 0);
7024 des_xmlAttrPtr(n_attr, attr, 1);
7025 des_int(n_depth, depth, 2);
7026 xmlResetLastError();
7027 if (mem_base != xmlMemBlocks()) {
7028 printf("Leak of %d blocks found in xmlDebugDumpAttr",
7029 xmlMemBlocks() - mem_base);
7030 test_ret++;
7031 printf(" %d", n_output);
7032 printf(" %d", n_attr);
7033 printf(" %d", n_depth);
7034 printf("\n");
7035 }
7036 }
7037 }
7038 }
7039#endif
7040
7041 function_tests++;
7042 return(test_ret);
7043}
7044
7045
7046static int
7047test_xmlDebugDumpAttrList(void) {
7048 int test_ret = 0;
7049
7050#ifdef LIBXML_DEBUG_ENABLED
7051 int mem_base;
7052 FILE * output; /* the FILE * for the output */
7053 int n_output;
7054 xmlAttrPtr attr; /* the attribute list */
7055 int n_attr;
7056 int depth; /* the indentation level. */
7057 int n_depth;
7058
7059 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7060 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
7061 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7062 mem_base = xmlMemBlocks();
7063 output = gen_debug_FILE_ptr(n_output, 0);
7064 attr = gen_xmlAttrPtr(n_attr, 1);
7065 depth = gen_int(n_depth, 2);
7066
7067 xmlDebugDumpAttrList(output, attr, depth);
7068 call_tests++;
7069 des_debug_FILE_ptr(n_output, output, 0);
7070 des_xmlAttrPtr(n_attr, attr, 1);
7071 des_int(n_depth, depth, 2);
7072 xmlResetLastError();
7073 if (mem_base != xmlMemBlocks()) {
7074 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
7075 xmlMemBlocks() - mem_base);
7076 test_ret++;
7077 printf(" %d", n_output);
7078 printf(" %d", n_attr);
7079 printf(" %d", n_depth);
7080 printf("\n");
7081 }
7082 }
7083 }
7084 }
7085#endif
7086
7087 function_tests++;
7088 return(test_ret);
7089}
7090
7091
7092static int
7093test_xmlDebugDumpDTD(void) {
7094 int test_ret = 0;
7095
7096#ifdef LIBXML_DEBUG_ENABLED
7097 int mem_base;
7098 FILE * output; /* the FILE * for the output */
7099 int n_output;
7100 xmlDtdPtr dtd; /* the DTD */
7101 int n_dtd;
7102
7103 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7104 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
7105 mem_base = xmlMemBlocks();
7106 output = gen_debug_FILE_ptr(n_output, 0);
7107 dtd = gen_xmlDtdPtr(n_dtd, 1);
7108
7109 xmlDebugDumpDTD(output, dtd);
7110 call_tests++;
7111 des_debug_FILE_ptr(n_output, output, 0);
7112 des_xmlDtdPtr(n_dtd, dtd, 1);
7113 xmlResetLastError();
7114 if (mem_base != xmlMemBlocks()) {
7115 printf("Leak of %d blocks found in xmlDebugDumpDTD",
7116 xmlMemBlocks() - mem_base);
7117 test_ret++;
7118 printf(" %d", n_output);
7119 printf(" %d", n_dtd);
7120 printf("\n");
7121 }
7122 }
7123 }
7124#endif
7125
7126 function_tests++;
7127 return(test_ret);
7128}
7129
7130
7131static int
7132test_xmlDebugDumpDocument(void) {
7133 int test_ret = 0;
7134
7135#ifdef LIBXML_DEBUG_ENABLED
7136 int mem_base;
7137 FILE * output; /* the FILE * for the output */
7138 int n_output;
7139 xmlDocPtr doc; /* the document */
7140 int n_doc;
7141
7142 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7143 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7144 mem_base = xmlMemBlocks();
7145 output = gen_debug_FILE_ptr(n_output, 0);
7146 doc = gen_xmlDocPtr(n_doc, 1);
7147
7148 xmlDebugDumpDocument(output, doc);
7149 call_tests++;
7150 des_debug_FILE_ptr(n_output, output, 0);
7151 des_xmlDocPtr(n_doc, doc, 1);
7152 xmlResetLastError();
7153 if (mem_base != xmlMemBlocks()) {
7154 printf("Leak of %d blocks found in xmlDebugDumpDocument",
7155 xmlMemBlocks() - mem_base);
7156 test_ret++;
7157 printf(" %d", n_output);
7158 printf(" %d", n_doc);
7159 printf("\n");
7160 }
7161 }
7162 }
7163#endif
7164
7165 function_tests++;
7166 return(test_ret);
7167}
7168
7169
7170static int
7171test_xmlDebugDumpDocumentHead(void) {
7172 int test_ret = 0;
7173
7174#ifdef LIBXML_DEBUG_ENABLED
7175 int mem_base;
7176 FILE * output; /* the FILE * for the output */
7177 int n_output;
7178 xmlDocPtr doc; /* the document */
7179 int n_doc;
7180
7181 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7182 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7183 mem_base = xmlMemBlocks();
7184 output = gen_debug_FILE_ptr(n_output, 0);
7185 doc = gen_xmlDocPtr(n_doc, 1);
7186
7187 xmlDebugDumpDocumentHead(output, doc);
7188 call_tests++;
7189 des_debug_FILE_ptr(n_output, output, 0);
7190 des_xmlDocPtr(n_doc, doc, 1);
7191 xmlResetLastError();
7192 if (mem_base != xmlMemBlocks()) {
7193 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7194 xmlMemBlocks() - mem_base);
7195 test_ret++;
7196 printf(" %d", n_output);
7197 printf(" %d", n_doc);
7198 printf("\n");
7199 }
7200 }
7201 }
7202#endif
7203
7204 function_tests++;
7205 return(test_ret);
7206}
7207
7208
7209static int
7210test_xmlDebugDumpEntities(void) {
7211 int test_ret = 0;
7212
7213#ifdef LIBXML_DEBUG_ENABLED
7214 int mem_base;
7215 FILE * output; /* the FILE * for the output */
7216 int n_output;
7217 xmlDocPtr doc; /* the document */
7218 int n_doc;
7219
7220 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7221 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7222 mem_base = xmlMemBlocks();
7223 output = gen_debug_FILE_ptr(n_output, 0);
7224 doc = gen_xmlDocPtr(n_doc, 1);
7225
7226 xmlDebugDumpEntities(output, doc);
7227 call_tests++;
7228 des_debug_FILE_ptr(n_output, output, 0);
7229 des_xmlDocPtr(n_doc, doc, 1);
7230 xmlResetLastError();
7231 if (mem_base != xmlMemBlocks()) {
7232 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7233 xmlMemBlocks() - mem_base);
7234 test_ret++;
7235 printf(" %d", n_output);
7236 printf(" %d", n_doc);
7237 printf("\n");
7238 }
7239 }
7240 }
7241#endif
7242
7243 function_tests++;
7244 return(test_ret);
7245}
7246
7247
7248static int
7249test_xmlDebugDumpNode(void) {
7250 int test_ret = 0;
7251
7252#ifdef LIBXML_DEBUG_ENABLED
7253 int mem_base;
7254 FILE * output; /* the FILE * for the output */
7255 int n_output;
7256 xmlNodePtr node; /* the node */
7257 int n_node;
7258 int depth; /* the indentation level. */
7259 int n_depth;
7260
7261 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7262 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7263 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7264 mem_base = xmlMemBlocks();
7265 output = gen_debug_FILE_ptr(n_output, 0);
7266 node = gen_xmlNodePtr(n_node, 1);
7267 depth = gen_int(n_depth, 2);
7268
7269 xmlDebugDumpNode(output, node, depth);
7270 call_tests++;
7271 des_debug_FILE_ptr(n_output, output, 0);
7272 des_xmlNodePtr(n_node, node, 1);
7273 des_int(n_depth, depth, 2);
7274 xmlResetLastError();
7275 if (mem_base != xmlMemBlocks()) {
7276 printf("Leak of %d blocks found in xmlDebugDumpNode",
7277 xmlMemBlocks() - mem_base);
7278 test_ret++;
7279 printf(" %d", n_output);
7280 printf(" %d", n_node);
7281 printf(" %d", n_depth);
7282 printf("\n");
7283 }
7284 }
7285 }
7286 }
7287#endif
7288
7289 function_tests++;
7290 return(test_ret);
7291}
7292
7293
7294static int
7295test_xmlDebugDumpNodeList(void) {
7296 int test_ret = 0;
7297
7298#ifdef LIBXML_DEBUG_ENABLED
7299 int mem_base;
7300 FILE * output; /* the FILE * for the output */
7301 int n_output;
7302 xmlNodePtr node; /* the node list */
7303 int n_node;
7304 int depth; /* the indentation level. */
7305 int n_depth;
7306
7307 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7308 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7309 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7310 mem_base = xmlMemBlocks();
7311 output = gen_debug_FILE_ptr(n_output, 0);
7312 node = gen_xmlNodePtr(n_node, 1);
7313 depth = gen_int(n_depth, 2);
7314
7315 xmlDebugDumpNodeList(output, node, depth);
7316 call_tests++;
7317 des_debug_FILE_ptr(n_output, output, 0);
7318 des_xmlNodePtr(n_node, node, 1);
7319 des_int(n_depth, depth, 2);
7320 xmlResetLastError();
7321 if (mem_base != xmlMemBlocks()) {
7322 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7323 xmlMemBlocks() - mem_base);
7324 test_ret++;
7325 printf(" %d", n_output);
7326 printf(" %d", n_node);
7327 printf(" %d", n_depth);
7328 printf("\n");
7329 }
7330 }
7331 }
7332 }
7333#endif
7334
7335 function_tests++;
7336 return(test_ret);
7337}
7338
7339
7340static int
7341test_xmlDebugDumpOneNode(void) {
7342 int test_ret = 0;
7343
7344#ifdef LIBXML_DEBUG_ENABLED
7345 int mem_base;
7346 FILE * output; /* the FILE * for the output */
7347 int n_output;
7348 xmlNodePtr node; /* the node */
7349 int n_node;
7350 int depth; /* the indentation level. */
7351 int n_depth;
7352
7353 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7354 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7355 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7356 mem_base = xmlMemBlocks();
7357 output = gen_debug_FILE_ptr(n_output, 0);
7358 node = gen_xmlNodePtr(n_node, 1);
7359 depth = gen_int(n_depth, 2);
7360
7361 xmlDebugDumpOneNode(output, node, depth);
7362 call_tests++;
7363 des_debug_FILE_ptr(n_output, output, 0);
7364 des_xmlNodePtr(n_node, node, 1);
7365 des_int(n_depth, depth, 2);
7366 xmlResetLastError();
7367 if (mem_base != xmlMemBlocks()) {
7368 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7369 xmlMemBlocks() - mem_base);
7370 test_ret++;
7371 printf(" %d", n_output);
7372 printf(" %d", n_node);
7373 printf(" %d", n_depth);
7374 printf("\n");
7375 }
7376 }
7377 }
7378 }
7379#endif
7380
7381 function_tests++;
7382 return(test_ret);
7383}
7384
7385
7386static int
7387test_xmlDebugDumpString(void) {
7388 int test_ret = 0;
7389
7390#ifdef LIBXML_DEBUG_ENABLED
7391 int mem_base;
7392 FILE * output; /* the FILE * for the output */
7393 int n_output;
7394 xmlChar * str; /* the string */
7395 int n_str;
7396
7397 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7398 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7399 mem_base = xmlMemBlocks();
7400 output = gen_debug_FILE_ptr(n_output, 0);
7401 str = gen_const_xmlChar_ptr(n_str, 1);
7402
7403 xmlDebugDumpString(output, str);
7404 call_tests++;
7405 des_debug_FILE_ptr(n_output, output, 0);
7406 des_const_xmlChar_ptr(n_str, str, 1);
7407 xmlResetLastError();
7408 if (mem_base != xmlMemBlocks()) {
7409 printf("Leak of %d blocks found in xmlDebugDumpString",
7410 xmlMemBlocks() - mem_base);
7411 test_ret++;
7412 printf(" %d", n_output);
7413 printf(" %d", n_str);
7414 printf("\n");
7415 }
7416 }
7417 }
7418#endif
7419
7420 function_tests++;
7421 return(test_ret);
7422}
7423
7424
7425static int
7426test_xmlLsCountNode(void) {
7427 int test_ret = 0;
7428
7429#ifdef LIBXML_DEBUG_ENABLED
7430 int mem_base;
7431 int ret_val;
7432 xmlNodePtr node; /* the node to count */
7433 int n_node;
7434
7435 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7436 mem_base = xmlMemBlocks();
7437 node = gen_xmlNodePtr(n_node, 0);
7438
7439 ret_val = xmlLsCountNode(node);
7440 desret_int(ret_val);
7441 call_tests++;
7442 des_xmlNodePtr(n_node, node, 0);
7443 xmlResetLastError();
7444 if (mem_base != xmlMemBlocks()) {
7445 printf("Leak of %d blocks found in xmlLsCountNode",
7446 xmlMemBlocks() - mem_base);
7447 test_ret++;
7448 printf(" %d", n_node);
7449 printf("\n");
7450 }
7451 }
7452#endif
7453
7454 function_tests++;
7455 return(test_ret);
7456}
7457
7458
7459static int
7460test_xmlLsOneNode(void) {
7461 int test_ret = 0;
7462
7463#ifdef LIBXML_DEBUG_ENABLED
7464 int mem_base;
7465 FILE * output; /* the FILE * for the output */
7466 int n_output;
7467 xmlNodePtr node; /* the node to dump */
7468 int n_node;
7469
7470 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7471 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7472 mem_base = xmlMemBlocks();
7473 output = gen_debug_FILE_ptr(n_output, 0);
7474 node = gen_xmlNodePtr(n_node, 1);
7475
7476 xmlLsOneNode(output, node);
7477 call_tests++;
7478 des_debug_FILE_ptr(n_output, output, 0);
7479 des_xmlNodePtr(n_node, node, 1);
7480 xmlResetLastError();
7481 if (mem_base != xmlMemBlocks()) {
7482 printf("Leak of %d blocks found in xmlLsOneNode",
7483 xmlMemBlocks() - mem_base);
7484 test_ret++;
7485 printf(" %d", n_output);
7486 printf(" %d", n_node);
7487 printf("\n");
7488 }
7489 }
7490 }
7491#endif
7492
7493 function_tests++;
7494 return(test_ret);
7495}
7496
7497
7498#define gen_nb_char_ptr 1
7499static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7500 return(NULL);
7501}
7502static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7503}
7504
7505static int
7506test_xmlShell(void) {
7507 int test_ret = 0;
7508
7509
7510 /* missing type support */
7511 return(test_ret);
7512}
7513
7514
7515#define gen_nb_xmlShellCtxtPtr 1
7516static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7517 return(NULL);
7518}
7519static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7520}
7521
7522static int
7523test_xmlShellBase(void) {
7524 int test_ret = 0;
7525
7526#ifdef LIBXML_DEBUG_ENABLED
7527 int mem_base;
7528 int ret_val;
7529 xmlShellCtxtPtr ctxt; /* the shell context */
7530 int n_ctxt;
7531 char * arg; /* unused */
7532 int n_arg;
7533 xmlNodePtr node; /* a node */
7534 int n_node;
7535 xmlNodePtr node2; /* unused */
7536 int n_node2;
7537
7538 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7539 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7540 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7541 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7542 mem_base = xmlMemBlocks();
7543 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7544 arg = gen_char_ptr(n_arg, 1);
7545 node = gen_xmlNodePtr(n_node, 2);
7546 node2 = gen_xmlNodePtr(n_node2, 3);
7547
7548 ret_val = xmlShellBase(ctxt, arg, node, node2);
7549 desret_int(ret_val);
7550 call_tests++;
7551 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7552 des_char_ptr(n_arg, arg, 1);
7553 des_xmlNodePtr(n_node, node, 2);
7554 des_xmlNodePtr(n_node2, node2, 3);
7555 xmlResetLastError();
7556 if (mem_base != xmlMemBlocks()) {
7557 printf("Leak of %d blocks found in xmlShellBase",
7558 xmlMemBlocks() - mem_base);
7559 test_ret++;
7560 printf(" %d", n_ctxt);
7561 printf(" %d", n_arg);
7562 printf(" %d", n_node);
7563 printf(" %d", n_node2);
7564 printf("\n");
7565 }
7566 }
7567 }
7568 }
7569 }
7570#endif
7571
7572 function_tests++;
7573 return(test_ret);
7574}
7575
7576
7577static int
7578test_xmlShellCat(void) {
7579 int test_ret = 0;
7580
7581#ifdef LIBXML_DEBUG_ENABLED
7582 int mem_base;
7583 int ret_val;
7584 xmlShellCtxtPtr ctxt; /* the shell context */
7585 int n_ctxt;
7586 char * arg; /* unused */
7587 int n_arg;
7588 xmlNodePtr node; /* a node */
7589 int n_node;
7590 xmlNodePtr node2; /* unused */
7591 int n_node2;
7592
7593 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7594 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7595 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7596 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7597 mem_base = xmlMemBlocks();
7598 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7599 arg = gen_char_ptr(n_arg, 1);
7600 node = gen_xmlNodePtr(n_node, 2);
7601 node2 = gen_xmlNodePtr(n_node2, 3);
7602
7603 ret_val = xmlShellCat(ctxt, arg, node, node2);
7604 desret_int(ret_val);
7605 call_tests++;
7606 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7607 des_char_ptr(n_arg, arg, 1);
7608 des_xmlNodePtr(n_node, node, 2);
7609 des_xmlNodePtr(n_node2, node2, 3);
7610 xmlResetLastError();
7611 if (mem_base != xmlMemBlocks()) {
7612 printf("Leak of %d blocks found in xmlShellCat",
7613 xmlMemBlocks() - mem_base);
7614 test_ret++;
7615 printf(" %d", n_ctxt);
7616 printf(" %d", n_arg);
7617 printf(" %d", n_node);
7618 printf(" %d", n_node2);
7619 printf("\n");
7620 }
7621 }
7622 }
7623 }
7624 }
7625#endif
7626
7627 function_tests++;
7628 return(test_ret);
7629}
7630
7631
7632static int
7633test_xmlShellDir(void) {
7634 int test_ret = 0;
7635
7636#ifdef LIBXML_DEBUG_ENABLED
7637 int mem_base;
7638 int ret_val;
7639 xmlShellCtxtPtr ctxt; /* the shell context */
7640 int n_ctxt;
7641 char * arg; /* unused */
7642 int n_arg;
7643 xmlNodePtr node; /* a node */
7644 int n_node;
7645 xmlNodePtr node2; /* unused */
7646 int n_node2;
7647
7648 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7649 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7650 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7651 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7652 mem_base = xmlMemBlocks();
7653 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7654 arg = gen_char_ptr(n_arg, 1);
7655 node = gen_xmlNodePtr(n_node, 2);
7656 node2 = gen_xmlNodePtr(n_node2, 3);
7657
7658 ret_val = xmlShellDir(ctxt, arg, node, node2);
7659 desret_int(ret_val);
7660 call_tests++;
7661 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7662 des_char_ptr(n_arg, arg, 1);
7663 des_xmlNodePtr(n_node, node, 2);
7664 des_xmlNodePtr(n_node2, node2, 3);
7665 xmlResetLastError();
7666 if (mem_base != xmlMemBlocks()) {
7667 printf("Leak of %d blocks found in xmlShellDir",
7668 xmlMemBlocks() - mem_base);
7669 test_ret++;
7670 printf(" %d", n_ctxt);
7671 printf(" %d", n_arg);
7672 printf(" %d", n_node);
7673 printf(" %d", n_node2);
7674 printf("\n");
7675 }
7676 }
7677 }
7678 }
7679 }
7680#endif
7681
7682 function_tests++;
7683 return(test_ret);
7684}
7685
7686
7687static int
7688test_xmlShellDu(void) {
7689 int test_ret = 0;
7690
7691#ifdef LIBXML_DEBUG_ENABLED
7692 int mem_base;
7693 int ret_val;
7694 xmlShellCtxtPtr ctxt; /* the shell context */
7695 int n_ctxt;
7696 char * arg; /* unused */
7697 int n_arg;
7698 xmlNodePtr tree; /* a node defining a subtree */
7699 int n_tree;
7700 xmlNodePtr node2; /* unused */
7701 int n_node2;
7702
7703 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7704 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7705 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7706 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7707 mem_base = xmlMemBlocks();
7708 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7709 arg = gen_char_ptr(n_arg, 1);
7710 tree = gen_xmlNodePtr(n_tree, 2);
7711 node2 = gen_xmlNodePtr(n_node2, 3);
7712
7713 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7714 desret_int(ret_val);
7715 call_tests++;
7716 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7717 des_char_ptr(n_arg, arg, 1);
7718 des_xmlNodePtr(n_tree, tree, 2);
7719 des_xmlNodePtr(n_node2, node2, 3);
7720 xmlResetLastError();
7721 if (mem_base != xmlMemBlocks()) {
7722 printf("Leak of %d blocks found in xmlShellDu",
7723 xmlMemBlocks() - mem_base);
7724 test_ret++;
7725 printf(" %d", n_ctxt);
7726 printf(" %d", n_arg);
7727 printf(" %d", n_tree);
7728 printf(" %d", n_node2);
7729 printf("\n");
7730 }
7731 }
7732 }
7733 }
7734 }
7735#endif
7736
7737 function_tests++;
7738 return(test_ret);
7739}
7740
7741
7742static int
7743test_xmlShellList(void) {
7744 int test_ret = 0;
7745
7746#ifdef LIBXML_DEBUG_ENABLED
7747 int mem_base;
7748 int ret_val;
7749 xmlShellCtxtPtr ctxt; /* the shell context */
7750 int n_ctxt;
7751 char * arg; /* unused */
7752 int n_arg;
7753 xmlNodePtr node; /* a node */
7754 int n_node;
7755 xmlNodePtr node2; /* unused */
7756 int n_node2;
7757
7758 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7759 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7760 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7761 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7762 mem_base = xmlMemBlocks();
7763 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7764 arg = gen_char_ptr(n_arg, 1);
7765 node = gen_xmlNodePtr(n_node, 2);
7766 node2 = gen_xmlNodePtr(n_node2, 3);
7767
7768 ret_val = xmlShellList(ctxt, arg, node, node2);
7769 desret_int(ret_val);
7770 call_tests++;
7771 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7772 des_char_ptr(n_arg, arg, 1);
7773 des_xmlNodePtr(n_node, node, 2);
7774 des_xmlNodePtr(n_node2, node2, 3);
7775 xmlResetLastError();
7776 if (mem_base != xmlMemBlocks()) {
7777 printf("Leak of %d blocks found in xmlShellList",
7778 xmlMemBlocks() - mem_base);
7779 test_ret++;
7780 printf(" %d", n_ctxt);
7781 printf(" %d", n_arg);
7782 printf(" %d", n_node);
7783 printf(" %d", n_node2);
7784 printf("\n");
7785 }
7786 }
7787 }
7788 }
7789 }
7790#endif
7791
7792 function_tests++;
7793 return(test_ret);
7794}
7795
7796
7797static int
7798test_xmlShellLoad(void) {
7799 int test_ret = 0;
7800
7801#ifdef LIBXML_DEBUG_ENABLED
7802 int mem_base;
7803 int ret_val;
7804 xmlShellCtxtPtr ctxt; /* the shell context */
7805 int n_ctxt;
7806 char * filename; /* the file name */
7807 int n_filename;
7808 xmlNodePtr node; /* unused */
7809 int n_node;
7810 xmlNodePtr node2; /* unused */
7811 int n_node2;
7812
7813 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7814 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7815 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7816 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7817 mem_base = xmlMemBlocks();
7818 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7819 filename = gen_char_ptr(n_filename, 1);
7820 node = gen_xmlNodePtr(n_node, 2);
7821 node2 = gen_xmlNodePtr(n_node2, 3);
7822
7823 ret_val = xmlShellLoad(ctxt, filename, node, node2);
7824 desret_int(ret_val);
7825 call_tests++;
7826 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7827 des_char_ptr(n_filename, filename, 1);
7828 des_xmlNodePtr(n_node, node, 2);
7829 des_xmlNodePtr(n_node2, node2, 3);
7830 xmlResetLastError();
7831 if (mem_base != xmlMemBlocks()) {
7832 printf("Leak of %d blocks found in xmlShellLoad",
7833 xmlMemBlocks() - mem_base);
7834 test_ret++;
7835 printf(" %d", n_ctxt);
7836 printf(" %d", n_filename);
7837 printf(" %d", n_node);
7838 printf(" %d", n_node2);
7839 printf("\n");
7840 }
7841 }
7842 }
7843 }
7844 }
7845#endif
7846
7847 function_tests++;
7848 return(test_ret);
7849}
7850
7851
7852static int
7853test_xmlShellPrintXPathResult(void) {
7854 int test_ret = 0;
7855
7856#ifdef LIBXML_DEBUG_ENABLED
7857 int mem_base;
7858 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
7859 int n_list;
7860
7861 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
7862 mem_base = xmlMemBlocks();
7863 list = gen_xmlXPathObjectPtr(n_list, 0);
7864
7865 xmlShellPrintXPathResult(list);
7866 call_tests++;
7867 des_xmlXPathObjectPtr(n_list, list, 0);
7868 xmlResetLastError();
7869 if (mem_base != xmlMemBlocks()) {
7870 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
7871 xmlMemBlocks() - mem_base);
7872 test_ret++;
7873 printf(" %d", n_list);
7874 printf("\n");
7875 }
7876 }
7877#endif
7878
7879 function_tests++;
7880 return(test_ret);
7881}
7882
7883
7884static int
7885test_xmlShellPwd(void) {
7886 int test_ret = 0;
7887
7888#ifdef LIBXML_DEBUG_ENABLED
7889 int mem_base;
7890 int ret_val;
7891 xmlShellCtxtPtr ctxt; /* the shell context */
7892 int n_ctxt;
7893 char * buffer; /* the output buffer */
7894 int n_buffer;
7895 xmlNodePtr node; /* a node */
7896 int n_node;
7897 xmlNodePtr node2; /* unused */
7898 int n_node2;
7899
7900 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7901 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
7902 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7903 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7904 mem_base = xmlMemBlocks();
7905 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7906 buffer = gen_char_ptr(n_buffer, 1);
7907 node = gen_xmlNodePtr(n_node, 2);
7908 node2 = gen_xmlNodePtr(n_node2, 3);
7909
7910 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
7911 desret_int(ret_val);
7912 call_tests++;
7913 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7914 des_char_ptr(n_buffer, buffer, 1);
7915 des_xmlNodePtr(n_node, node, 2);
7916 des_xmlNodePtr(n_node2, node2, 3);
7917 xmlResetLastError();
7918 if (mem_base != xmlMemBlocks()) {
7919 printf("Leak of %d blocks found in xmlShellPwd",
7920 xmlMemBlocks() - mem_base);
7921 test_ret++;
7922 printf(" %d", n_ctxt);
7923 printf(" %d", n_buffer);
7924 printf(" %d", n_node);
7925 printf(" %d", n_node2);
7926 printf("\n");
7927 }
7928 }
7929 }
7930 }
7931 }
7932#endif
7933
7934 function_tests++;
7935 return(test_ret);
7936}
7937
7938
7939static int
7940test_xmlShellSave(void) {
7941 int test_ret = 0;
7942
7943#ifdef LIBXML_DEBUG_ENABLED
7944#ifdef LIBXML_OUTPUT_ENABLED
7945 int mem_base;
7946 int ret_val;
7947 xmlShellCtxtPtr ctxt; /* the shell context */
7948 int n_ctxt;
7949 char * filename; /* the file name (optional) */
7950 int n_filename;
7951 xmlNodePtr node; /* unused */
7952 int n_node;
7953 xmlNodePtr node2; /* unused */
7954 int n_node2;
7955
7956 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7957 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7958 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7959 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7960 mem_base = xmlMemBlocks();
7961 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7962 filename = gen_char_ptr(n_filename, 1);
7963 node = gen_xmlNodePtr(n_node, 2);
7964 node2 = gen_xmlNodePtr(n_node2, 3);
7965
7966 ret_val = xmlShellSave(ctxt, filename, node, node2);
7967 desret_int(ret_val);
7968 call_tests++;
7969 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7970 des_char_ptr(n_filename, filename, 1);
7971 des_xmlNodePtr(n_node, node, 2);
7972 des_xmlNodePtr(n_node2, node2, 3);
7973 xmlResetLastError();
7974 if (mem_base != xmlMemBlocks()) {
7975 printf("Leak of %d blocks found in xmlShellSave",
7976 xmlMemBlocks() - mem_base);
7977 test_ret++;
7978 printf(" %d", n_ctxt);
7979 printf(" %d", n_filename);
7980 printf(" %d", n_node);
7981 printf(" %d", n_node2);
7982 printf("\n");
7983 }
7984 }
7985 }
7986 }
7987 }
7988#endif
7989#endif
7990
7991 function_tests++;
7992 return(test_ret);
7993}
7994
7995
7996static int
7997test_xmlShellValidate(void) {
7998 int test_ret = 0;
7999
8000#ifdef LIBXML_DEBUG_ENABLED
8001 int mem_base;
8002 int ret_val;
8003 xmlShellCtxtPtr ctxt; /* the shell context */
8004 int n_ctxt;
8005 char * dtd; /* the DTD URI (optional) */
8006 int n_dtd;
8007 xmlNodePtr node; /* unused */
8008 int n_node;
8009 xmlNodePtr node2; /* unused */
8010 int n_node2;
8011
8012 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8013 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
8014 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8015 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8016 mem_base = xmlMemBlocks();
8017 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8018 dtd = gen_char_ptr(n_dtd, 1);
8019 node = gen_xmlNodePtr(n_node, 2);
8020 node2 = gen_xmlNodePtr(n_node2, 3);
8021
8022 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
8023 desret_int(ret_val);
8024 call_tests++;
8025 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8026 des_char_ptr(n_dtd, dtd, 1);
8027 des_xmlNodePtr(n_node, node, 2);
8028 des_xmlNodePtr(n_node2, node2, 3);
8029 xmlResetLastError();
8030 if (mem_base != xmlMemBlocks()) {
8031 printf("Leak of %d blocks found in xmlShellValidate",
8032 xmlMemBlocks() - mem_base);
8033 test_ret++;
8034 printf(" %d", n_ctxt);
8035 printf(" %d", n_dtd);
8036 printf(" %d", n_node);
8037 printf(" %d", n_node2);
8038 printf("\n");
8039 }
8040 }
8041 }
8042 }
8043 }
8044#endif
8045
8046 function_tests++;
8047 return(test_ret);
8048}
8049
8050
8051static int
8052test_xmlShellWrite(void) {
8053 int test_ret = 0;
8054
8055#ifdef LIBXML_DEBUG_ENABLED
8056#ifdef LIBXML_OUTPUT_ENABLED
8057 int mem_base;
8058 int ret_val;
8059 xmlShellCtxtPtr ctxt; /* the shell context */
8060 int n_ctxt;
8061 char * filename; /* the file name */
8062 int n_filename;
8063 xmlNodePtr node; /* a node in the tree */
8064 int n_node;
8065 xmlNodePtr node2; /* unused */
8066 int n_node2;
8067
8068 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8069 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
8070 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8071 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8072 mem_base = xmlMemBlocks();
8073 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8074 filename = gen_char_ptr(n_filename, 1);
8075 node = gen_xmlNodePtr(n_node, 2);
8076 node2 = gen_xmlNodePtr(n_node2, 3);
8077
8078 ret_val = xmlShellWrite(ctxt, filename, node, node2);
8079 desret_int(ret_val);
8080 call_tests++;
8081 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8082 des_char_ptr(n_filename, filename, 1);
8083 des_xmlNodePtr(n_node, node, 2);
8084 des_xmlNodePtr(n_node2, node2, 3);
8085 xmlResetLastError();
8086 if (mem_base != xmlMemBlocks()) {
8087 printf("Leak of %d blocks found in xmlShellWrite",
8088 xmlMemBlocks() - mem_base);
8089 test_ret++;
8090 printf(" %d", n_ctxt);
8091 printf(" %d", n_filename);
8092 printf(" %d", n_node);
8093 printf(" %d", n_node2);
8094 printf("\n");
8095 }
8096 }
8097 }
8098 }
8099 }
8100#endif
8101#endif
8102
8103 function_tests++;
8104 return(test_ret);
8105}
8106
8107static int
8108test_debugXML(void) {
8109 int test_ret = 0;
8110
8111 printf("Testing debugXML : 25 of 28 functions ...\n");
8112 test_ret += test_xmlBoolToText();
8113 test_ret += test_xmlDebugCheckDocument();
8114 test_ret += test_xmlDebugDumpAttr();
8115 test_ret += test_xmlDebugDumpAttrList();
8116 test_ret += test_xmlDebugDumpDTD();
8117 test_ret += test_xmlDebugDumpDocument();
8118 test_ret += test_xmlDebugDumpDocumentHead();
8119 test_ret += test_xmlDebugDumpEntities();
8120 test_ret += test_xmlDebugDumpNode();
8121 test_ret += test_xmlDebugDumpNodeList();
8122 test_ret += test_xmlDebugDumpOneNode();
8123 test_ret += test_xmlDebugDumpString();
8124 test_ret += test_xmlLsCountNode();
8125 test_ret += test_xmlLsOneNode();
8126 test_ret += test_xmlShell();
8127 test_ret += test_xmlShellBase();
8128 test_ret += test_xmlShellCat();
8129 test_ret += test_xmlShellDir();
8130 test_ret += test_xmlShellDu();
8131 test_ret += test_xmlShellList();
8132 test_ret += test_xmlShellLoad();
8133 test_ret += test_xmlShellPrintXPathResult();
8134 test_ret += test_xmlShellPwd();
8135 test_ret += test_xmlShellSave();
8136 test_ret += test_xmlShellValidate();
8137 test_ret += test_xmlShellWrite();
8138
8139 if (test_ret != 0)
8140 printf("Module debugXML: %d errors\n", test_ret);
8141 return(test_ret);
8142}
8143
8144static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008145test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008147
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008148 int mem_base;
8149 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008150
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008151 mem_base = xmlMemBlocks();
8152
8153 ret_val = xmlDictCreate();
8154 desret_xmlDictPtr(ret_val);
8155 call_tests++;
8156 xmlResetLastError();
8157 if (mem_base != xmlMemBlocks()) {
8158 printf("Leak of %d blocks found in xmlDictCreate",
8159 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008160 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008161 printf("\n");
8162 }
8163
8164 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008166}
8167
8168
8169static int
8170test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008172
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008173 int mem_base;
8174 xmlDictPtr ret_val;
8175 xmlDictPtr sub; /* an existing dictionnary */
8176 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008177
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008178 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
8179 mem_base = xmlMemBlocks();
8180 sub = gen_xmlDictPtr(n_sub, 0);
8181
8182 ret_val = xmlDictCreateSub(sub);
8183 desret_xmlDictPtr(ret_val);
8184 call_tests++;
8185 des_xmlDictPtr(n_sub, sub, 0);
8186 xmlResetLastError();
8187 if (mem_base != xmlMemBlocks()) {
8188 printf("Leak of %d blocks found in xmlDictCreateSub",
8189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008190 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008191 printf(" %d", n_sub);
8192 printf("\n");
8193 }
8194 }
8195
8196 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008197 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008198}
8199
8200
8201static int
8202test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008203 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008204
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008205 int mem_base;
8206 const xmlChar * ret_val;
8207 xmlDictPtr dict; /* the dictionnary */
8208 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008209 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008210 int n_name;
8211 int len; /* the length of the name, if -1 it is recomputed */
8212 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008213
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008214 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8215 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8216 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8217 mem_base = xmlMemBlocks();
8218 dict = gen_xmlDictPtr(n_dict, 0);
8219 name = gen_const_xmlChar_ptr(n_name, 1);
8220 len = gen_int(n_len, 2);
8221
8222 ret_val = xmlDictLookup(dict, name, len);
8223 desret_const_xmlChar_ptr(ret_val);
8224 call_tests++;
8225 des_xmlDictPtr(n_dict, dict, 0);
8226 des_const_xmlChar_ptr(n_name, name, 1);
8227 des_int(n_len, len, 2);
8228 xmlResetLastError();
8229 if (mem_base != xmlMemBlocks()) {
8230 printf("Leak of %d blocks found in xmlDictLookup",
8231 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008232 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008233 printf(" %d", n_dict);
8234 printf(" %d", n_name);
8235 printf(" %d", n_len);
8236 printf("\n");
8237 }
8238 }
8239 }
8240 }
8241
8242 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008243 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008244}
8245
8246
8247static int
8248test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008249 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008250
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008251 int mem_base;
8252 int ret_val;
8253 xmlDictPtr dict; /* the dictionnary */
8254 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008255 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008256 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008257
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008258 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8259 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8260 mem_base = xmlMemBlocks();
8261 dict = gen_xmlDictPtr(n_dict, 0);
8262 str = gen_const_xmlChar_ptr(n_str, 1);
8263
8264 ret_val = xmlDictOwns(dict, str);
8265 desret_int(ret_val);
8266 call_tests++;
8267 des_xmlDictPtr(n_dict, dict, 0);
8268 des_const_xmlChar_ptr(n_str, str, 1);
8269 xmlResetLastError();
8270 if (mem_base != xmlMemBlocks()) {
8271 printf("Leak of %d blocks found in xmlDictOwns",
8272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008273 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008274 printf(" %d", n_dict);
8275 printf(" %d", n_str);
8276 printf("\n");
8277 }
8278 }
8279 }
8280
8281 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008282 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008283}
8284
8285
8286static int
8287test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008288 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008289
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008290 int mem_base;
8291 const xmlChar * ret_val;
8292 xmlDictPtr dict; /* the dictionnary */
8293 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008294 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008295 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008296 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008297 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008298
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008299 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8300 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8301 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8302 mem_base = xmlMemBlocks();
8303 dict = gen_xmlDictPtr(n_dict, 0);
8304 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8305 name = gen_const_xmlChar_ptr(n_name, 2);
8306
8307 ret_val = xmlDictQLookup(dict, prefix, name);
8308 desret_const_xmlChar_ptr(ret_val);
8309 call_tests++;
8310 des_xmlDictPtr(n_dict, dict, 0);
8311 des_const_xmlChar_ptr(n_prefix, prefix, 1);
8312 des_const_xmlChar_ptr(n_name, name, 2);
8313 xmlResetLastError();
8314 if (mem_base != xmlMemBlocks()) {
8315 printf("Leak of %d blocks found in xmlDictQLookup",
8316 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008317 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008318 printf(" %d", n_dict);
8319 printf(" %d", n_prefix);
8320 printf(" %d", n_name);
8321 printf("\n");
8322 }
8323 }
8324 }
8325 }
8326
8327 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008328 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008329}
8330
8331
8332static int
8333test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008334 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008335
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008336 int mem_base;
8337 int ret_val;
8338 xmlDictPtr dict; /* the dictionnary */
8339 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008340
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008341 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8342 mem_base = xmlMemBlocks();
8343 dict = gen_xmlDictPtr(n_dict, 0);
8344
8345 ret_val = xmlDictReference(dict);
8346 xmlDictFree(dict);
8347 desret_int(ret_val);
8348 call_tests++;
8349 des_xmlDictPtr(n_dict, dict, 0);
8350 xmlResetLastError();
8351 if (mem_base != xmlMemBlocks()) {
8352 printf("Leak of %d blocks found in xmlDictReference",
8353 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008354 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008355 printf(" %d", n_dict);
8356 printf("\n");
8357 }
8358 }
8359
8360 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008361 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008362}
8363
8364
8365static int
8366test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008367 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008368
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008369 int mem_base;
8370 int ret_val;
8371 xmlDictPtr dict; /* the dictionnary */
8372 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008373
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008374 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8375 mem_base = xmlMemBlocks();
8376 dict = gen_xmlDictPtr(n_dict, 0);
8377
8378 ret_val = xmlDictSize(dict);
8379 desret_int(ret_val);
8380 call_tests++;
8381 des_xmlDictPtr(n_dict, dict, 0);
8382 xmlResetLastError();
8383 if (mem_base != xmlMemBlocks()) {
8384 printf("Leak of %d blocks found in xmlDictSize",
8385 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008386 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008387 printf(" %d", n_dict);
8388 printf("\n");
8389 }
8390 }
8391
8392 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008394}
8395
8396static int
8397test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008399
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008400 printf("Testing dict : 7 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008401 test_ret += test_xmlDictCreate();
8402 test_ret += test_xmlDictCreateSub();
8403 test_ret += test_xmlDictLookup();
8404 test_ret += test_xmlDictOwns();
8405 test_ret += test_xmlDictQLookup();
8406 test_ret += test_xmlDictReference();
8407 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008408
Daniel Veillard42595322004-11-08 10:52:06 +00008409 if (test_ret != 0)
8410 printf("Module dict: %d errors\n", test_ret);
8411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008412}
8413
8414static int
8415test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008417
Daniel Veillardce682bc2004-11-05 17:22:25 +00008418 int mem_base;
8419 int ret_val;
8420 unsigned char * out; /* a pointer to an array of bytes to store the result */
8421 int n_out;
8422 int * outlen; /* the length of @out */
8423 int n_outlen;
8424 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8425 int n_in;
8426 int * inlen; /* the length of @in */
8427 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008428
Daniel Veillardce682bc2004-11-05 17:22:25 +00008429 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8430 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8431 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8432 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8433 mem_base = xmlMemBlocks();
8434 out = gen_unsigned_char_ptr(n_out, 0);
8435 outlen = gen_int_ptr(n_outlen, 1);
8436 in = gen_const_unsigned_char_ptr(n_in, 2);
8437 inlen = gen_int_ptr(n_inlen, 3);
8438
8439 ret_val = UTF8Toisolat1(out, outlen, in, inlen);
8440 desret_int(ret_val);
8441 call_tests++;
8442 des_unsigned_char_ptr(n_out, out, 0);
8443 des_int_ptr(n_outlen, outlen, 1);
8444 des_const_unsigned_char_ptr(n_in, in, 2);
8445 des_int_ptr(n_inlen, inlen, 3);
8446 xmlResetLastError();
8447 if (mem_base != xmlMemBlocks()) {
8448 printf("Leak of %d blocks found in UTF8Toisolat1",
8449 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008450 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008451 printf(" %d", n_out);
8452 printf(" %d", n_outlen);
8453 printf(" %d", n_in);
8454 printf(" %d", n_inlen);
8455 printf("\n");
8456 }
8457 }
8458 }
8459 }
8460 }
8461
8462 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008463 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008464}
8465
8466
8467static int
8468test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008469 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008470
Daniel Veillardce682bc2004-11-05 17:22:25 +00008471 int mem_base;
8472 int ret_val;
8473 unsigned char * out; /* a pointer to an array of bytes to store the result */
8474 int n_out;
8475 int * outlen; /* the length of @out */
8476 int n_outlen;
8477 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8478 int n_in;
8479 int * inlen; /* the length of @in */
8480 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008481
Daniel Veillardce682bc2004-11-05 17:22:25 +00008482 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8483 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8484 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8485 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8486 mem_base = xmlMemBlocks();
8487 out = gen_unsigned_char_ptr(n_out, 0);
8488 outlen = gen_int_ptr(n_outlen, 1);
8489 in = gen_const_unsigned_char_ptr(n_in, 2);
8490 inlen = gen_int_ptr(n_inlen, 3);
8491
8492 ret_val = isolat1ToUTF8(out, outlen, in, inlen);
8493 desret_int(ret_val);
8494 call_tests++;
8495 des_unsigned_char_ptr(n_out, out, 0);
8496 des_int_ptr(n_outlen, outlen, 1);
8497 des_const_unsigned_char_ptr(n_in, in, 2);
8498 des_int_ptr(n_inlen, inlen, 3);
8499 xmlResetLastError();
8500 if (mem_base != xmlMemBlocks()) {
8501 printf("Leak of %d blocks found in isolat1ToUTF8",
8502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008503 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008504 printf(" %d", n_out);
8505 printf(" %d", n_outlen);
8506 printf(" %d", n_in);
8507 printf(" %d", n_inlen);
8508 printf("\n");
8509 }
8510 }
8511 }
8512 }
8513 }
8514
8515 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008516 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008517}
8518
8519
8520static int
8521test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008522 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008523
8524 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008525 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008526 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008527 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008528 int n_alias;
8529
8530 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8531 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008532 name = gen_const_char_ptr(n_name, 0);
8533 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008534
8535 ret_val = xmlAddEncodingAlias(name, alias);
8536 desret_int(ret_val);
8537 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008538 des_const_char_ptr(n_name, name, 0);
8539 des_const_char_ptr(n_alias, alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008540 xmlResetLastError();
8541 }
8542 }
8543
Daniel Veillard3d97e662004-11-04 10:49:00 +00008544 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008545 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008546}
8547
8548
Daniel Veillardce682bc2004-11-05 17:22:25 +00008549#define gen_nb_xmlCharEncodingHandler_ptr 1
8550static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8551 return(NULL);
8552}
8553static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8554}
8555
Daniel Veillardd93f6252004-11-02 15:53:51 +00008556static int
8557test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008558 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008559
Daniel Veillardce682bc2004-11-05 17:22:25 +00008560 int mem_base;
8561 int ret_val;
8562 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8563 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008564
Daniel Veillardce682bc2004-11-05 17:22:25 +00008565 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8566 mem_base = xmlMemBlocks();
8567 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8568
8569 ret_val = xmlCharEncCloseFunc(handler);
8570 desret_int(ret_val);
8571 call_tests++;
8572 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8573 xmlResetLastError();
8574 if (mem_base != xmlMemBlocks()) {
8575 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8576 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008577 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008578 printf(" %d", n_handler);
8579 printf("\n");
8580 }
8581 }
8582
8583 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008584 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008585}
8586
8587
8588static int
8589test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008591
Daniel Veillardce682bc2004-11-05 17:22:25 +00008592 int mem_base;
8593 int ret_val;
8594 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8595 int n_handler;
8596 xmlBufferPtr out; /* an xmlBuffer for the output. */
8597 int n_out;
8598 xmlBufferPtr in; /* an xmlBuffer for the input */
8599 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008600
Daniel Veillardce682bc2004-11-05 17:22:25 +00008601 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8602 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8603 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8604 mem_base = xmlMemBlocks();
8605 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8606 out = gen_xmlBufferPtr(n_out, 1);
8607 in = gen_xmlBufferPtr(n_in, 2);
8608
8609 ret_val = xmlCharEncFirstLine(handler, out, in);
8610 desret_int(ret_val);
8611 call_tests++;
8612 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8613 des_xmlBufferPtr(n_out, out, 1);
8614 des_xmlBufferPtr(n_in, in, 2);
8615 xmlResetLastError();
8616 if (mem_base != xmlMemBlocks()) {
8617 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8618 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008619 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008620 printf(" %d", n_handler);
8621 printf(" %d", n_out);
8622 printf(" %d", n_in);
8623 printf("\n");
8624 }
8625 }
8626 }
8627 }
8628
8629 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008631}
8632
8633
8634static int
8635test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008637
Daniel Veillardce682bc2004-11-05 17:22:25 +00008638 int mem_base;
8639 int ret_val;
8640 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8641 int n_handler;
8642 xmlBufferPtr out; /* an xmlBuffer for the output. */
8643 int n_out;
8644 xmlBufferPtr in; /* an xmlBuffer for the input */
8645 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008646
Daniel Veillardce682bc2004-11-05 17:22:25 +00008647 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8648 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8649 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8650 mem_base = xmlMemBlocks();
8651 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8652 out = gen_xmlBufferPtr(n_out, 1);
8653 in = gen_xmlBufferPtr(n_in, 2);
8654
8655 ret_val = xmlCharEncInFunc(handler, out, in);
8656 desret_int(ret_val);
8657 call_tests++;
8658 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8659 des_xmlBufferPtr(n_out, out, 1);
8660 des_xmlBufferPtr(n_in, in, 2);
8661 xmlResetLastError();
8662 if (mem_base != xmlMemBlocks()) {
8663 printf("Leak of %d blocks found in xmlCharEncInFunc",
8664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008665 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008666 printf(" %d", n_handler);
8667 printf(" %d", n_out);
8668 printf(" %d", n_in);
8669 printf("\n");
8670 }
8671 }
8672 }
8673 }
8674
8675 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008677}
8678
8679
8680static int
8681test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008683
Daniel Veillardce682bc2004-11-05 17:22:25 +00008684 int mem_base;
8685 int ret_val;
8686 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8687 int n_handler;
8688 xmlBufferPtr out; /* an xmlBuffer for the output. */
8689 int n_out;
8690 xmlBufferPtr in; /* an xmlBuffer for the input */
8691 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008692
Daniel Veillardce682bc2004-11-05 17:22:25 +00008693 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8694 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8695 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8696 mem_base = xmlMemBlocks();
8697 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8698 out = gen_xmlBufferPtr(n_out, 1);
8699 in = gen_xmlBufferPtr(n_in, 2);
8700
8701 ret_val = xmlCharEncOutFunc(handler, out, in);
8702 desret_int(ret_val);
8703 call_tests++;
8704 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8705 des_xmlBufferPtr(n_out, out, 1);
8706 des_xmlBufferPtr(n_in, in, 2);
8707 xmlResetLastError();
8708 if (mem_base != xmlMemBlocks()) {
8709 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008711 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008712 printf(" %d", n_handler);
8713 printf(" %d", n_out);
8714 printf(" %d", n_in);
8715 printf("\n");
8716 }
8717 }
8718 }
8719 }
8720
8721 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008722 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008723}
8724
8725
8726static int
8727test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008728 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008729
8730
8731
8732 xmlCleanupCharEncodingHandlers();
8733 call_tests++;
8734 xmlResetLastError();
8735
Daniel Veillard3d97e662004-11-04 10:49:00 +00008736 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008737 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008738}
8739
8740
8741static int
8742test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008743 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008744
8745 int mem_base;
8746
8747 mem_base = xmlMemBlocks();
8748
8749 xmlCleanupEncodingAliases();
8750 call_tests++;
8751 xmlResetLastError();
8752 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008753 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008754 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008755 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008756 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008757 }
8758
Daniel Veillard3d97e662004-11-04 10:49:00 +00008759 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008760 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008761}
8762
8763
8764static int
8765test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008766 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008767
8768 int mem_base;
8769 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008770 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008771 int n_alias;
8772
8773 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8774 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008775 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008776
8777 ret_val = xmlDelEncodingAlias(alias);
8778 desret_int(ret_val);
8779 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008780 des_const_char_ptr(n_alias, alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008781 xmlResetLastError();
8782 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008783 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008785 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008786 printf(" %d", n_alias);
8787 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008788 }
8789 }
8790
Daniel Veillard3d97e662004-11-04 10:49:00 +00008791 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008792 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008793}
8794
8795
8796static int
8797test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008798 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008799
Daniel Veillardce682bc2004-11-05 17:22:25 +00008800 int mem_base;
8801 xmlCharEncoding ret_val;
8802 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). */
8803 int n_in;
8804 int len; /* pointer to the length of the buffer */
8805 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008806
Daniel Veillardce682bc2004-11-05 17:22:25 +00008807 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8808 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8809 mem_base = xmlMemBlocks();
8810 in = gen_const_unsigned_char_ptr(n_in, 0);
8811 len = gen_int(n_len, 1);
8812
8813 ret_val = xmlDetectCharEncoding(in, len);
8814 desret_xmlCharEncoding(ret_val);
8815 call_tests++;
8816 des_const_unsigned_char_ptr(n_in, in, 0);
8817 des_int(n_len, len, 1);
8818 xmlResetLastError();
8819 if (mem_base != xmlMemBlocks()) {
8820 printf("Leak of %d blocks found in xmlDetectCharEncoding",
8821 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008822 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008823 printf(" %d", n_in);
8824 printf(" %d", n_len);
8825 printf("\n");
8826 }
8827 }
8828 }
8829
8830 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008831 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008832}
8833
8834
8835static int
8836test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008837 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008838
8839
8840 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008841 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008842}
8843
8844
8845static int
8846test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008847 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008848
8849
8850 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008852}
8853
8854
8855static int
8856test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008858
Daniel Veillard3d97e662004-11-04 10:49:00 +00008859 int mem_base;
8860 const char * ret_val;
8861 xmlCharEncoding enc; /* the encoding */
8862 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008863
Daniel Veillard3d97e662004-11-04 10:49:00 +00008864 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
8865 mem_base = xmlMemBlocks();
8866 enc = gen_xmlCharEncoding(n_enc, 0);
8867
8868 ret_val = xmlGetCharEncodingName(enc);
8869 desret_const_char_ptr(ret_val);
8870 call_tests++;
8871 des_xmlCharEncoding(n_enc, enc, 0);
8872 xmlResetLastError();
8873 if (mem_base != xmlMemBlocks()) {
8874 printf("Leak of %d blocks found in xmlGetCharEncodingName",
8875 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008876 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008877 printf(" %d", n_enc);
8878 printf("\n");
8879 }
8880 }
8881
8882 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008884}
8885
8886
8887static int
8888test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008889 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008890
8891 int mem_base;
8892 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008893 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008894 int n_alias;
8895
8896 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8897 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008898 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008899
8900 ret_val = xmlGetEncodingAlias(alias);
8901 desret_const_char_ptr(ret_val);
8902 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008903 des_const_char_ptr(n_alias, alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008904 xmlResetLastError();
8905 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008906 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008907 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008908 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008909 printf(" %d", n_alias);
8910 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008911 }
8912 }
8913
Daniel Veillard3d97e662004-11-04 10:49:00 +00008914 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008915 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008916}
8917
8918
8919static int
8920test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008921 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008922
8923
8924
8925 xmlInitCharEncodingHandlers();
8926 call_tests++;
8927 xmlResetLastError();
8928
Daniel Veillard3d97e662004-11-04 10:49:00 +00008929 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008931}
8932
8933
8934static int
8935test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008937
8938
8939 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008941}
8942
8943
8944static int
8945test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008947
Daniel Veillard3d97e662004-11-04 10:49:00 +00008948 int mem_base;
8949 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008950 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00008951 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008952
Daniel Veillard3d97e662004-11-04 10:49:00 +00008953 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8954 mem_base = xmlMemBlocks();
8955 name = gen_const_char_ptr(n_name, 0);
8956
8957 ret_val = xmlParseCharEncoding(name);
8958 desret_xmlCharEncoding(ret_val);
8959 call_tests++;
8960 des_const_char_ptr(n_name, name, 0);
8961 xmlResetLastError();
8962 if (mem_base != xmlMemBlocks()) {
8963 printf("Leak of %d blocks found in xmlParseCharEncoding",
8964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008965 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008966 printf(" %d", n_name);
8967 printf("\n");
8968 }
8969 }
8970
8971 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008973}
8974
8975
Daniel Veillardce682bc2004-11-05 17:22:25 +00008976#define gen_nb_xmlCharEncodingHandlerPtr 1
8977static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8978 return(NULL);
8979}
8980static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8981}
8982
Daniel Veillardd93f6252004-11-02 15:53:51 +00008983static int
8984test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008986
Daniel Veillardce682bc2004-11-05 17:22:25 +00008987 int mem_base;
8988 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
8989 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008990
Daniel Veillardce682bc2004-11-05 17:22:25 +00008991 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
8992 mem_base = xmlMemBlocks();
8993 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
8994
8995 xmlRegisterCharEncodingHandler(handler);
8996 call_tests++;
8997 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
8998 xmlResetLastError();
8999 if (mem_base != xmlMemBlocks()) {
9000 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
9001 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009002 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009003 printf(" %d", n_handler);
9004 printf("\n");
9005 }
9006 }
9007
9008 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009009 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009010}
9011
9012static int
9013test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009015
Daniel Veillardce682bc2004-11-05 17:22:25 +00009016 printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009017 test_ret += test_UTF8Toisolat1();
9018 test_ret += test_isolat1ToUTF8();
9019 test_ret += test_xmlAddEncodingAlias();
9020 test_ret += test_xmlCharEncCloseFunc();
9021 test_ret += test_xmlCharEncFirstLine();
9022 test_ret += test_xmlCharEncInFunc();
9023 test_ret += test_xmlCharEncOutFunc();
9024 test_ret += test_xmlCleanupCharEncodingHandlers();
9025 test_ret += test_xmlCleanupEncodingAliases();
9026 test_ret += test_xmlDelEncodingAlias();
9027 test_ret += test_xmlDetectCharEncoding();
9028 test_ret += test_xmlFindCharEncodingHandler();
9029 test_ret += test_xmlGetCharEncodingHandler();
9030 test_ret += test_xmlGetCharEncodingName();
9031 test_ret += test_xmlGetEncodingAlias();
9032 test_ret += test_xmlInitCharEncodingHandlers();
9033 test_ret += test_xmlNewCharEncodingHandler();
9034 test_ret += test_xmlParseCharEncoding();
9035 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009036
Daniel Veillard42595322004-11-08 10:52:06 +00009037 if (test_ret != 0)
9038 printf("Module encoding: %d errors\n", test_ret);
9039 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009040}
9041
9042static int
9043test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009045
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009046 int mem_base;
9047 xmlEntityPtr ret_val;
9048 xmlDocPtr doc; /* the document */
9049 int n_doc;
9050 xmlChar * name; /* the entity name */
9051 int n_name;
9052 int type; /* the entity type XML_xxx_yyy_ENTITY */
9053 int n_type;
9054 xmlChar * ExternalID; /* the entity external ID if available */
9055 int n_ExternalID;
9056 xmlChar * SystemID; /* the entity system ID if available */
9057 int n_SystemID;
9058 xmlChar * content; /* the entity content */
9059 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009060
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009061 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9062 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9063 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9064 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9065 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9066 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9067 mem_base = xmlMemBlocks();
9068 doc = gen_xmlDocPtr(n_doc, 0);
9069 name = gen_const_xmlChar_ptr(n_name, 1);
9070 type = gen_int(n_type, 2);
9071 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9072 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9073 content = gen_const_xmlChar_ptr(n_content, 5);
9074
9075 ret_val = xmlAddDocEntity(doc, name, type, ExternalID, SystemID, content);
9076 desret_xmlEntityPtr(ret_val);
9077 call_tests++;
9078 des_xmlDocPtr(n_doc, doc, 0);
9079 des_const_xmlChar_ptr(n_name, name, 1);
9080 des_int(n_type, type, 2);
9081 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3);
9082 des_const_xmlChar_ptr(n_SystemID, SystemID, 4);
9083 des_const_xmlChar_ptr(n_content, content, 5);
9084 xmlResetLastError();
9085 if (mem_base != xmlMemBlocks()) {
9086 printf("Leak of %d blocks found in xmlAddDocEntity",
9087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009088 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009089 printf(" %d", n_doc);
9090 printf(" %d", n_name);
9091 printf(" %d", n_type);
9092 printf(" %d", n_ExternalID);
9093 printf(" %d", n_SystemID);
9094 printf(" %d", n_content);
9095 printf("\n");
9096 }
9097 }
9098 }
9099 }
9100 }
9101 }
9102 }
9103
9104 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009106}
9107
9108
9109static int
9110test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009112
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009113 int mem_base;
9114 xmlEntityPtr ret_val;
9115 xmlDocPtr doc; /* the document */
9116 int n_doc;
9117 xmlChar * name; /* the entity name */
9118 int n_name;
9119 int type; /* the entity type XML_xxx_yyy_ENTITY */
9120 int n_type;
9121 xmlChar * ExternalID; /* the entity external ID if available */
9122 int n_ExternalID;
9123 xmlChar * SystemID; /* the entity system ID if available */
9124 int n_SystemID;
9125 xmlChar * content; /* the entity content */
9126 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009127
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009128 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9129 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9130 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9131 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9132 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9133 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9134 mem_base = xmlMemBlocks();
9135 doc = gen_xmlDocPtr(n_doc, 0);
9136 name = gen_const_xmlChar_ptr(n_name, 1);
9137 type = gen_int(n_type, 2);
9138 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9139 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9140 content = gen_const_xmlChar_ptr(n_content, 5);
9141
9142 ret_val = xmlAddDtdEntity(doc, name, type, ExternalID, SystemID, content);
9143 desret_xmlEntityPtr(ret_val);
9144 call_tests++;
9145 des_xmlDocPtr(n_doc, doc, 0);
9146 des_const_xmlChar_ptr(n_name, name, 1);
9147 des_int(n_type, type, 2);
9148 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3);
9149 des_const_xmlChar_ptr(n_SystemID, SystemID, 4);
9150 des_const_xmlChar_ptr(n_content, content, 5);
9151 xmlResetLastError();
9152 if (mem_base != xmlMemBlocks()) {
9153 printf("Leak of %d blocks found in xmlAddDtdEntity",
9154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009155 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009156 printf(" %d", n_doc);
9157 printf(" %d", n_name);
9158 printf(" %d", n_type);
9159 printf(" %d", n_ExternalID);
9160 printf(" %d", n_SystemID);
9161 printf(" %d", n_content);
9162 printf("\n");
9163 }
9164 }
9165 }
9166 }
9167 }
9168 }
9169 }
9170
9171 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009173}
9174
9175
9176static int
9177test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009179
9180 int mem_base;
9181
9182 mem_base = xmlMemBlocks();
9183
9184 xmlCleanupPredefinedEntities();
9185 call_tests++;
9186 xmlResetLastError();
9187 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009188 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009190 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009191 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009192 }
9193
Daniel Veillard3d97e662004-11-04 10:49:00 +00009194 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009196}
9197
9198
Daniel Veillardce682bc2004-11-05 17:22:25 +00009199#define gen_nb_xmlEntitiesTablePtr 1
9200static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9201 return(NULL);
9202}
9203static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9204}
9205
Daniel Veillardd93f6252004-11-02 15:53:51 +00009206static int
9207test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009209
9210
9211 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009212 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009213}
9214
9215
9216static int
9217test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009218 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009219
9220
9221 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009223}
9224
9225
9226static int
9227test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009229
Daniel Veillardce682bc2004-11-05 17:22:25 +00009230#ifdef LIBXML_OUTPUT_ENABLED
9231 int mem_base;
9232 xmlBufferPtr buf; /* An XML buffer. */
9233 int n_buf;
9234 xmlEntitiesTablePtr table; /* An entity table */
9235 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009236
Daniel Veillardce682bc2004-11-05 17:22:25 +00009237 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9238 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9239 mem_base = xmlMemBlocks();
9240 buf = gen_xmlBufferPtr(n_buf, 0);
9241 table = gen_xmlEntitiesTablePtr(n_table, 1);
9242
9243 xmlDumpEntitiesTable(buf, table);
9244 call_tests++;
9245 des_xmlBufferPtr(n_buf, buf, 0);
9246 des_xmlEntitiesTablePtr(n_table, table, 1);
9247 xmlResetLastError();
9248 if (mem_base != xmlMemBlocks()) {
9249 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009251 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009252 printf(" %d", n_buf);
9253 printf(" %d", n_table);
9254 printf("\n");
9255 }
9256 }
9257 }
9258#endif
9259
9260 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009262}
9263
9264
Daniel Veillardce682bc2004-11-05 17:22:25 +00009265#define gen_nb_xmlEntityPtr 1
9266static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9267 return(NULL);
9268}
9269static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9270}
9271
Daniel Veillardd93f6252004-11-02 15:53:51 +00009272static int
9273test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009274 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009275
Daniel Veillardce682bc2004-11-05 17:22:25 +00009276#ifdef LIBXML_OUTPUT_ENABLED
9277 int mem_base;
9278 xmlBufferPtr buf; /* An XML buffer. */
9279 int n_buf;
9280 xmlEntityPtr ent; /* An entity table */
9281 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009282
Daniel Veillardce682bc2004-11-05 17:22:25 +00009283 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9284 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9285 mem_base = xmlMemBlocks();
9286 buf = gen_xmlBufferPtr(n_buf, 0);
9287 ent = gen_xmlEntityPtr(n_ent, 1);
9288
9289 xmlDumpEntityDecl(buf, ent);
9290 call_tests++;
9291 des_xmlBufferPtr(n_buf, buf, 0);
9292 des_xmlEntityPtr(n_ent, ent, 1);
9293 xmlResetLastError();
9294 if (mem_base != xmlMemBlocks()) {
9295 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9296 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009297 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009298 printf(" %d", n_buf);
9299 printf(" %d", n_ent);
9300 printf("\n");
9301 }
9302 }
9303 }
9304#endif
9305
9306 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009308}
9309
9310
9311static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009312test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009314
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009315 int mem_base;
9316 xmlChar * ret_val;
9317 xmlDocPtr doc; /* the document containing the string */
9318 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009319 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009320 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009321
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009322 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9323 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9324 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009325 doc = gen_xmlDocPtr(n_doc, 0);
9326 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009327
9328 ret_val = xmlEncodeEntitiesReentrant(doc, input);
9329 desret_xmlChar_ptr(ret_val);
9330 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009331 des_xmlDocPtr(n_doc, doc, 0);
9332 des_const_xmlChar_ptr(n_input, input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009333 xmlResetLastError();
9334 if (mem_base != xmlMemBlocks()) {
9335 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009337 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009338 printf(" %d", n_doc);
9339 printf(" %d", n_input);
9340 printf("\n");
9341 }
9342 }
9343 }
9344
Daniel Veillard3d97e662004-11-04 10:49:00 +00009345 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009346 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009347}
9348
9349
9350static int
9351test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009352 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009353
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009354 int mem_base;
9355 xmlChar * ret_val;
9356 xmlDocPtr doc; /* the document containing the string */
9357 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009358 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009359 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009360
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009361 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9362 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9363 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009364 doc = gen_xmlDocPtr(n_doc, 0);
9365 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009366
9367 ret_val = xmlEncodeSpecialChars(doc, input);
9368 desret_xmlChar_ptr(ret_val);
9369 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009370 des_xmlDocPtr(n_doc, doc, 0);
9371 des_const_xmlChar_ptr(n_input, input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009372 xmlResetLastError();
9373 if (mem_base != xmlMemBlocks()) {
9374 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9375 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009376 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009377 printf(" %d", n_doc);
9378 printf(" %d", n_input);
9379 printf("\n");
9380 }
9381 }
9382 }
9383
Daniel Veillard3d97e662004-11-04 10:49:00 +00009384 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009385 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009386}
9387
9388
9389static int
9390test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009391 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009392
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009393 int mem_base;
9394 xmlEntityPtr ret_val;
9395 xmlDocPtr doc; /* the document referencing the entity */
9396 int n_doc;
9397 xmlChar * name; /* the entity name */
9398 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009399
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009400 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9401 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9402 mem_base = xmlMemBlocks();
9403 doc = gen_xmlDocPtr(n_doc, 0);
9404 name = gen_const_xmlChar_ptr(n_name, 1);
9405
9406 ret_val = xmlGetDocEntity(doc, name);
9407 desret_xmlEntityPtr(ret_val);
9408 call_tests++;
9409 des_xmlDocPtr(n_doc, doc, 0);
9410 des_const_xmlChar_ptr(n_name, name, 1);
9411 xmlResetLastError();
9412 if (mem_base != xmlMemBlocks()) {
9413 printf("Leak of %d blocks found in xmlGetDocEntity",
9414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009415 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009416 printf(" %d", n_doc);
9417 printf(" %d", n_name);
9418 printf("\n");
9419 }
9420 }
9421 }
9422
9423 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009424 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009425}
9426
9427
9428static int
9429test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009430 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009431
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009432 int mem_base;
9433 xmlEntityPtr ret_val;
9434 xmlDocPtr doc; /* the document referencing the entity */
9435 int n_doc;
9436 xmlChar * name; /* the entity name */
9437 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009438
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009439 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9440 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9441 mem_base = xmlMemBlocks();
9442 doc = gen_xmlDocPtr(n_doc, 0);
9443 name = gen_const_xmlChar_ptr(n_name, 1);
9444
9445 ret_val = xmlGetDtdEntity(doc, name);
9446 desret_xmlEntityPtr(ret_val);
9447 call_tests++;
9448 des_xmlDocPtr(n_doc, doc, 0);
9449 des_const_xmlChar_ptr(n_name, name, 1);
9450 xmlResetLastError();
9451 if (mem_base != xmlMemBlocks()) {
9452 printf("Leak of %d blocks found in xmlGetDtdEntity",
9453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009454 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009455 printf(" %d", n_doc);
9456 printf(" %d", n_name);
9457 printf("\n");
9458 }
9459 }
9460 }
9461
9462 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009463 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009464}
9465
9466
9467static int
9468test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009469 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009470
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009471 int mem_base;
9472 xmlEntityPtr ret_val;
9473 xmlDocPtr doc; /* the document referencing the entity */
9474 int n_doc;
9475 xmlChar * name; /* the entity name */
9476 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009477
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009478 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9479 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9480 mem_base = xmlMemBlocks();
9481 doc = gen_xmlDocPtr(n_doc, 0);
9482 name = gen_const_xmlChar_ptr(n_name, 1);
9483
9484 ret_val = xmlGetParameterEntity(doc, name);
9485 desret_xmlEntityPtr(ret_val);
9486 call_tests++;
9487 des_xmlDocPtr(n_doc, doc, 0);
9488 des_const_xmlChar_ptr(n_name, name, 1);
9489 xmlResetLastError();
9490 if (mem_base != xmlMemBlocks()) {
9491 printf("Leak of %d blocks found in xmlGetParameterEntity",
9492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009493 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009494 printf(" %d", n_doc);
9495 printf(" %d", n_name);
9496 printf("\n");
9497 }
9498 }
9499 }
9500
9501 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009502 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009503}
9504
9505
9506static int
9507test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009508 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009509
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009510 int mem_base;
9511 xmlEntityPtr ret_val;
9512 xmlChar * name; /* the entity name */
9513 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009514
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009515 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9516 mem_base = xmlMemBlocks();
9517 name = gen_const_xmlChar_ptr(n_name, 0);
9518
9519 ret_val = xmlGetPredefinedEntity(name);
9520 desret_xmlEntityPtr(ret_val);
9521 call_tests++;
9522 des_const_xmlChar_ptr(n_name, name, 0);
9523 xmlResetLastError();
9524 if (mem_base != xmlMemBlocks()) {
9525 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009527 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009528 printf(" %d", n_name);
9529 printf("\n");
9530 }
9531 }
9532
9533 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009534 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009535}
9536
9537
9538static int
9539test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009540 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009541
9542 int mem_base;
9543
9544 mem_base = xmlMemBlocks();
9545
9546 xmlInitializePredefinedEntities();
9547 call_tests++;
9548 xmlResetLastError();
9549 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009550 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009552 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009553 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009554 }
9555
Daniel Veillard3d97e662004-11-04 10:49:00 +00009556 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009557 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009558}
9559
9560static int
9561test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009562 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009563
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009564 printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009565 test_ret += test_xmlAddDocEntity();
9566 test_ret += test_xmlAddDtdEntity();
9567 test_ret += test_xmlCleanupPredefinedEntities();
9568 test_ret += test_xmlCopyEntitiesTable();
9569 test_ret += test_xmlCreateEntitiesTable();
9570 test_ret += test_xmlDumpEntitiesTable();
9571 test_ret += test_xmlDumpEntityDecl();
9572 test_ret += test_xmlEncodeEntitiesReentrant();
9573 test_ret += test_xmlEncodeSpecialChars();
9574 test_ret += test_xmlGetDocEntity();
9575 test_ret += test_xmlGetDtdEntity();
9576 test_ret += test_xmlGetParameterEntity();
9577 test_ret += test_xmlGetPredefinedEntity();
9578 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009579
Daniel Veillard42595322004-11-08 10:52:06 +00009580 if (test_ret != 0)
9581 printf("Module entities: %d errors\n", test_ret);
9582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009583}
9584
9585static int
9586test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009588
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009589 int mem_base;
9590 int ret_val;
9591 xmlHashTablePtr table; /* the hash table */
9592 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009593 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009594 int n_name;
9595 void * userdata; /* a pointer to the userdata */
9596 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009597
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009598 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9599 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9600 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9601 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009602 table = gen_xmlHashTablePtr(n_table, 0);
9603 name = gen_const_xmlChar_ptr(n_name, 1);
9604 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009605
9606 ret_val = xmlHashAddEntry(table, name, userdata);
9607 desret_int(ret_val);
9608 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009609 des_xmlHashTablePtr(n_table, table, 0);
9610 des_const_xmlChar_ptr(n_name, name, 1);
9611 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009612 xmlResetLastError();
9613 if (mem_base != xmlMemBlocks()) {
9614 printf("Leak of %d blocks found in xmlHashAddEntry",
9615 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009616 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009617 printf(" %d", n_table);
9618 printf(" %d", n_name);
9619 printf(" %d", n_userdata);
9620 printf("\n");
9621 }
9622 }
9623 }
9624 }
9625
Daniel Veillard3d97e662004-11-04 10:49:00 +00009626 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009628}
9629
9630
9631static int
9632test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009633 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009634
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009635 int mem_base;
9636 int ret_val;
9637 xmlHashTablePtr table; /* the hash table */
9638 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009639 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009640 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009641 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009642 int n_name2;
9643 void * userdata; /* a pointer to the userdata */
9644 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009645
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009646 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9647 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9648 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9649 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9650 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009651 table = gen_xmlHashTablePtr(n_table, 0);
9652 name = gen_const_xmlChar_ptr(n_name, 1);
9653 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9654 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009655
9656 ret_val = xmlHashAddEntry2(table, name, name2, userdata);
9657 desret_int(ret_val);
9658 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009659 des_xmlHashTablePtr(n_table, table, 0);
9660 des_const_xmlChar_ptr(n_name, name, 1);
9661 des_const_xmlChar_ptr(n_name2, name2, 2);
9662 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009663 xmlResetLastError();
9664 if (mem_base != xmlMemBlocks()) {
9665 printf("Leak of %d blocks found in xmlHashAddEntry2",
9666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009667 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009668 printf(" %d", n_table);
9669 printf(" %d", n_name);
9670 printf(" %d", n_name2);
9671 printf(" %d", n_userdata);
9672 printf("\n");
9673 }
9674 }
9675 }
9676 }
9677 }
9678
Daniel Veillard3d97e662004-11-04 10:49:00 +00009679 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009681}
9682
9683
9684static int
9685test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009687
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009688 int mem_base;
9689 int ret_val;
9690 xmlHashTablePtr table; /* the hash table */
9691 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009692 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009693 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009694 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009695 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009696 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009697 int n_name3;
9698 void * userdata; /* a pointer to the userdata */
9699 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009700
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009701 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9702 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9703 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9704 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9705 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9706 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009707 table = gen_xmlHashTablePtr(n_table, 0);
9708 name = gen_const_xmlChar_ptr(n_name, 1);
9709 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9710 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9711 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009712
9713 ret_val = xmlHashAddEntry3(table, name, name2, name3, userdata);
9714 desret_int(ret_val);
9715 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009716 des_xmlHashTablePtr(n_table, table, 0);
9717 des_const_xmlChar_ptr(n_name, name, 1);
9718 des_const_xmlChar_ptr(n_name2, name2, 2);
9719 des_const_xmlChar_ptr(n_name3, name3, 3);
9720 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009721 xmlResetLastError();
9722 if (mem_base != xmlMemBlocks()) {
9723 printf("Leak of %d blocks found in xmlHashAddEntry3",
9724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009725 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009726 printf(" %d", n_table);
9727 printf(" %d", n_name);
9728 printf(" %d", n_name2);
9729 printf(" %d", n_name3);
9730 printf(" %d", n_userdata);
9731 printf("\n");
9732 }
9733 }
9734 }
9735 }
9736 }
9737 }
9738
Daniel Veillard3d97e662004-11-04 10:49:00 +00009739 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009741}
9742
9743
9744static int
9745test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009747
9748
9749 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009751}
9752
9753
9754static int
9755test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009757
9758
9759 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009760 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009761}
9762
9763
9764static int
9765test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009766 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009767
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009768 int mem_base;
9769 void * ret_val;
9770 xmlHashTablePtr table; /* the hash table */
9771 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009772 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009773 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009774
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009775 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9776 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9777 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009778 table = gen_xmlHashTablePtr(n_table, 0);
9779 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009780
9781 ret_val = xmlHashLookup(table, name);
9782 desret_void_ptr(ret_val);
9783 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009784 des_xmlHashTablePtr(n_table, table, 0);
9785 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009786 xmlResetLastError();
9787 if (mem_base != xmlMemBlocks()) {
9788 printf("Leak of %d blocks found in xmlHashLookup",
9789 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009790 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009791 printf(" %d", n_table);
9792 printf(" %d", n_name);
9793 printf("\n");
9794 }
9795 }
9796 }
9797
Daniel Veillard3d97e662004-11-04 10:49:00 +00009798 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009800}
9801
9802
9803static int
9804test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009806
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009807 int mem_base;
9808 void * ret_val;
9809 xmlHashTablePtr table; /* the hash table */
9810 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009811 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009812 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009813 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009814 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009815
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009816 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9817 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9818 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9819 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009820 table = gen_xmlHashTablePtr(n_table, 0);
9821 name = gen_const_xmlChar_ptr(n_name, 1);
9822 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009823
9824 ret_val = xmlHashLookup2(table, name, name2);
9825 desret_void_ptr(ret_val);
9826 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009827 des_xmlHashTablePtr(n_table, table, 0);
9828 des_const_xmlChar_ptr(n_name, name, 1);
9829 des_const_xmlChar_ptr(n_name2, name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009830 xmlResetLastError();
9831 if (mem_base != xmlMemBlocks()) {
9832 printf("Leak of %d blocks found in xmlHashLookup2",
9833 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009834 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009835 printf(" %d", n_table);
9836 printf(" %d", n_name);
9837 printf(" %d", n_name2);
9838 printf("\n");
9839 }
9840 }
9841 }
9842 }
9843
Daniel Veillard3d97e662004-11-04 10:49:00 +00009844 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009845 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009846}
9847
9848
9849static int
9850test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009851 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009852
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009853 int mem_base;
9854 void * ret_val;
9855 xmlHashTablePtr table; /* the hash table */
9856 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009857 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009858 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009859 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009860 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009861 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009862 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009863
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009864 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9865 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9866 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9867 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9868 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009869 table = gen_xmlHashTablePtr(n_table, 0);
9870 name = gen_const_xmlChar_ptr(n_name, 1);
9871 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9872 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009873
9874 ret_val = xmlHashLookup3(table, name, name2, name3);
9875 desret_void_ptr(ret_val);
9876 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009877 des_xmlHashTablePtr(n_table, table, 0);
9878 des_const_xmlChar_ptr(n_name, name, 1);
9879 des_const_xmlChar_ptr(n_name2, name2, 2);
9880 des_const_xmlChar_ptr(n_name3, name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009881 xmlResetLastError();
9882 if (mem_base != xmlMemBlocks()) {
9883 printf("Leak of %d blocks found in xmlHashLookup3",
9884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009885 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009886 printf(" %d", n_table);
9887 printf(" %d", n_name);
9888 printf(" %d", n_name2);
9889 printf(" %d", n_name3);
9890 printf("\n");
9891 }
9892 }
9893 }
9894 }
9895 }
9896
Daniel Veillard3d97e662004-11-04 10:49:00 +00009897 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009899}
9900
9901
9902static int
9903test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009905
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009906 int mem_base;
9907 void * ret_val;
9908 xmlHashTablePtr table; /* the hash table */
9909 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009910 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009911 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009912 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009913 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009914
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009915 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9916 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9917 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9918 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009919 table = gen_xmlHashTablePtr(n_table, 0);
9920 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9921 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009922
9923 ret_val = xmlHashQLookup(table, prefix, name);
9924 desret_void_ptr(ret_val);
9925 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009926 des_xmlHashTablePtr(n_table, table, 0);
9927 des_const_xmlChar_ptr(n_prefix, prefix, 1);
9928 des_const_xmlChar_ptr(n_name, name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009929 xmlResetLastError();
9930 if (mem_base != xmlMemBlocks()) {
9931 printf("Leak of %d blocks found in xmlHashQLookup",
9932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009933 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009934 printf(" %d", n_table);
9935 printf(" %d", n_prefix);
9936 printf(" %d", n_name);
9937 printf("\n");
9938 }
9939 }
9940 }
9941 }
9942
Daniel Veillard3d97e662004-11-04 10:49:00 +00009943 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009944 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009945}
9946
9947
9948static int
9949test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009950 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009951
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009952 int mem_base;
9953 void * ret_val;
9954 xmlHashTablePtr table; /* the hash table */
9955 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009956 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009957 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009958 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009959 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009960 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009961 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009962 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009963 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009964
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009965 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9966 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9967 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9968 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9969 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9970 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009971 table = gen_xmlHashTablePtr(n_table, 0);
9972 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9973 name = gen_const_xmlChar_ptr(n_name, 2);
9974 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9975 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009976
9977 ret_val = xmlHashQLookup2(table, prefix, name, prefix2, name2);
9978 desret_void_ptr(ret_val);
9979 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009980 des_xmlHashTablePtr(n_table, table, 0);
9981 des_const_xmlChar_ptr(n_prefix, prefix, 1);
9982 des_const_xmlChar_ptr(n_name, name, 2);
9983 des_const_xmlChar_ptr(n_prefix2, prefix2, 3);
9984 des_const_xmlChar_ptr(n_name2, name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009985 xmlResetLastError();
9986 if (mem_base != xmlMemBlocks()) {
9987 printf("Leak of %d blocks found in xmlHashQLookup2",
9988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009989 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009990 printf(" %d", n_table);
9991 printf(" %d", n_prefix);
9992 printf(" %d", n_name);
9993 printf(" %d", n_prefix2);
9994 printf(" %d", n_name2);
9995 printf("\n");
9996 }
9997 }
9998 }
9999 }
10000 }
10001 }
10002
Daniel Veillard3d97e662004-11-04 10:49:00 +000010003 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010005}
10006
10007
10008static int
10009test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010011
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010012 int mem_base;
10013 void * ret_val;
10014 xmlHashTablePtr table; /* the hash table */
10015 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010016 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010017 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010018 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010019 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010020 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010021 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010022 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010023 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010024 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010025 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010026 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010027 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010028
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010029 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10030 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
10031 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10032 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
10033 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10034 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
10035 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10036 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010037 table = gen_xmlHashTablePtr(n_table, 0);
10038 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
10039 name = gen_const_xmlChar_ptr(n_name, 2);
10040 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
10041 name2 = gen_const_xmlChar_ptr(n_name2, 4);
10042 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
10043 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010044
10045 ret_val = xmlHashQLookup3(table, prefix, name, prefix2, name2, prefix3, name3);
10046 desret_void_ptr(ret_val);
10047 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010048 des_xmlHashTablePtr(n_table, table, 0);
10049 des_const_xmlChar_ptr(n_prefix, prefix, 1);
10050 des_const_xmlChar_ptr(n_name, name, 2);
10051 des_const_xmlChar_ptr(n_prefix2, prefix2, 3);
10052 des_const_xmlChar_ptr(n_name2, name2, 4);
10053 des_const_xmlChar_ptr(n_prefix3, prefix3, 5);
10054 des_const_xmlChar_ptr(n_name3, name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010055 xmlResetLastError();
10056 if (mem_base != xmlMemBlocks()) {
10057 printf("Leak of %d blocks found in xmlHashQLookup3",
10058 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010059 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010060 printf(" %d", n_table);
10061 printf(" %d", n_prefix);
10062 printf(" %d", n_name);
10063 printf(" %d", n_prefix2);
10064 printf(" %d", n_name2);
10065 printf(" %d", n_prefix3);
10066 printf(" %d", n_name3);
10067 printf("\n");
10068 }
10069 }
10070 }
10071 }
10072 }
10073 }
10074 }
10075 }
10076
Daniel Veillard3d97e662004-11-04 10:49:00 +000010077 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010079}
10080
10081
10082static int
10083test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010085
Daniel Veillard42595322004-11-08 10:52:06 +000010086 int mem_base;
10087 int ret_val;
10088 xmlHashTablePtr table; /* the hash table */
10089 int n_table;
10090 xmlChar * name; /* the name of the userdata */
10091 int n_name;
10092 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10093 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010094
Daniel Veillard42595322004-11-08 10:52:06 +000010095 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10096 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10097 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10098 mem_base = xmlMemBlocks();
10099 table = gen_xmlHashTablePtr(n_table, 0);
10100 name = gen_const_xmlChar_ptr(n_name, 1);
10101 f = gen_xmlHashDeallocator(n_f, 2);
10102
10103 ret_val = xmlHashRemoveEntry(table, name, f);
10104 desret_int(ret_val);
10105 call_tests++;
10106 des_xmlHashTablePtr(n_table, table, 0);
10107 des_const_xmlChar_ptr(n_name, name, 1);
10108 des_xmlHashDeallocator(n_f, f, 2);
10109 xmlResetLastError();
10110 if (mem_base != xmlMemBlocks()) {
10111 printf("Leak of %d blocks found in xmlHashRemoveEntry",
10112 xmlMemBlocks() - mem_base);
10113 test_ret++;
10114 printf(" %d", n_table);
10115 printf(" %d", n_name);
10116 printf(" %d", n_f);
10117 printf("\n");
10118 }
10119 }
10120 }
10121 }
10122
10123 function_tests++;
10124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010125}
10126
10127
10128static int
10129test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010131
Daniel Veillard42595322004-11-08 10:52:06 +000010132 int mem_base;
10133 int ret_val;
10134 xmlHashTablePtr table; /* the hash table */
10135 int n_table;
10136 xmlChar * name; /* the name of the userdata */
10137 int n_name;
10138 xmlChar * name2; /* a second name of the userdata */
10139 int n_name2;
10140 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10141 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010142
Daniel Veillard42595322004-11-08 10:52:06 +000010143 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10144 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10145 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10146 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10147 mem_base = xmlMemBlocks();
10148 table = gen_xmlHashTablePtr(n_table, 0);
10149 name = gen_const_xmlChar_ptr(n_name, 1);
10150 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10151 f = gen_xmlHashDeallocator(n_f, 3);
10152
10153 ret_val = xmlHashRemoveEntry2(table, name, name2, f);
10154 desret_int(ret_val);
10155 call_tests++;
10156 des_xmlHashTablePtr(n_table, table, 0);
10157 des_const_xmlChar_ptr(n_name, name, 1);
10158 des_const_xmlChar_ptr(n_name2, name2, 2);
10159 des_xmlHashDeallocator(n_f, f, 3);
10160 xmlResetLastError();
10161 if (mem_base != xmlMemBlocks()) {
10162 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10163 xmlMemBlocks() - mem_base);
10164 test_ret++;
10165 printf(" %d", n_table);
10166 printf(" %d", n_name);
10167 printf(" %d", n_name2);
10168 printf(" %d", n_f);
10169 printf("\n");
10170 }
10171 }
10172 }
10173 }
10174 }
10175
10176 function_tests++;
10177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010178}
10179
10180
10181static int
10182test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010184
Daniel Veillard42595322004-11-08 10:52:06 +000010185 int mem_base;
10186 int ret_val;
10187 xmlHashTablePtr table; /* the hash table */
10188 int n_table;
10189 xmlChar * name; /* the name of the userdata */
10190 int n_name;
10191 xmlChar * name2; /* a second name of the userdata */
10192 int n_name2;
10193 xmlChar * name3; /* a third name of the userdata */
10194 int n_name3;
10195 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10196 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010197
Daniel Veillard42595322004-11-08 10:52:06 +000010198 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10199 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10200 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10201 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10202 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10203 mem_base = xmlMemBlocks();
10204 table = gen_xmlHashTablePtr(n_table, 0);
10205 name = gen_const_xmlChar_ptr(n_name, 1);
10206 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10207 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10208 f = gen_xmlHashDeallocator(n_f, 4);
10209
10210 ret_val = xmlHashRemoveEntry3(table, name, name2, name3, f);
10211 desret_int(ret_val);
10212 call_tests++;
10213 des_xmlHashTablePtr(n_table, table, 0);
10214 des_const_xmlChar_ptr(n_name, name, 1);
10215 des_const_xmlChar_ptr(n_name2, name2, 2);
10216 des_const_xmlChar_ptr(n_name3, name3, 3);
10217 des_xmlHashDeallocator(n_f, f, 4);
10218 xmlResetLastError();
10219 if (mem_base != xmlMemBlocks()) {
10220 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10221 xmlMemBlocks() - mem_base);
10222 test_ret++;
10223 printf(" %d", n_table);
10224 printf(" %d", n_name);
10225 printf(" %d", n_name2);
10226 printf(" %d", n_name3);
10227 printf(" %d", n_f);
10228 printf("\n");
10229 }
10230 }
10231 }
10232 }
10233 }
10234 }
10235
10236 function_tests++;
10237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010238}
10239
10240
10241static int
10242test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010244
10245
10246 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010248}
10249
10250
10251static int
10252test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010254
10255
10256 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010257 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010258}
10259
10260
10261static int
10262test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010264
10265
10266 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010267 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010268}
10269
10270
10271static int
10272test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010273 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010274
10275
10276 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010278}
10279
10280
10281static int
10282test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010284
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010285 int mem_base;
10286 int ret_val;
10287 xmlHashTablePtr table; /* the hash table */
10288 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010289
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010290 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10291 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010292 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010293
10294 ret_val = xmlHashSize(table);
10295 desret_int(ret_val);
10296 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010297 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010298 xmlResetLastError();
10299 if (mem_base != xmlMemBlocks()) {
10300 printf("Leak of %d blocks found in xmlHashSize",
10301 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010302 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010303 printf(" %d", n_table);
10304 printf("\n");
10305 }
10306 }
10307
Daniel Veillard3d97e662004-11-04 10:49:00 +000010308 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010309 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010310}
10311
10312
10313static int
10314test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010315 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010316
Daniel Veillard42595322004-11-08 10:52:06 +000010317 int mem_base;
10318 int ret_val;
10319 xmlHashTablePtr table; /* the hash table */
10320 int n_table;
10321 xmlChar * name; /* the name of the userdata */
10322 int n_name;
10323 void * userdata; /* a pointer to the userdata */
10324 int n_userdata;
10325 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10326 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010327
Daniel Veillard42595322004-11-08 10:52:06 +000010328 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10329 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10330 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10331 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10332 mem_base = xmlMemBlocks();
10333 table = gen_xmlHashTablePtr(n_table, 0);
10334 name = gen_const_xmlChar_ptr(n_name, 1);
10335 userdata = gen_userdata(n_userdata, 2);
10336 f = gen_xmlHashDeallocator(n_f, 3);
10337
10338 ret_val = xmlHashUpdateEntry(table, name, userdata, f);
10339 desret_int(ret_val);
10340 call_tests++;
10341 des_xmlHashTablePtr(n_table, table, 0);
10342 des_const_xmlChar_ptr(n_name, name, 1);
10343 des_userdata(n_userdata, userdata, 2);
10344 des_xmlHashDeallocator(n_f, f, 3);
10345 xmlResetLastError();
10346 if (mem_base != xmlMemBlocks()) {
10347 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10348 xmlMemBlocks() - mem_base);
10349 test_ret++;
10350 printf(" %d", n_table);
10351 printf(" %d", n_name);
10352 printf(" %d", n_userdata);
10353 printf(" %d", n_f);
10354 printf("\n");
10355 }
10356 }
10357 }
10358 }
10359 }
10360
10361 function_tests++;
10362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010363}
10364
10365
10366static int
10367test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010369
Daniel Veillard42595322004-11-08 10:52:06 +000010370 int mem_base;
10371 int ret_val;
10372 xmlHashTablePtr table; /* the hash table */
10373 int n_table;
10374 xmlChar * name; /* the name of the userdata */
10375 int n_name;
10376 xmlChar * name2; /* a second name of the userdata */
10377 int n_name2;
10378 void * userdata; /* a pointer to the userdata */
10379 int n_userdata;
10380 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10381 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010382
Daniel Veillard42595322004-11-08 10:52:06 +000010383 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10384 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10385 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10386 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10387 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10388 mem_base = xmlMemBlocks();
10389 table = gen_xmlHashTablePtr(n_table, 0);
10390 name = gen_const_xmlChar_ptr(n_name, 1);
10391 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10392 userdata = gen_userdata(n_userdata, 3);
10393 f = gen_xmlHashDeallocator(n_f, 4);
10394
10395 ret_val = xmlHashUpdateEntry2(table, name, name2, userdata, f);
10396 desret_int(ret_val);
10397 call_tests++;
10398 des_xmlHashTablePtr(n_table, table, 0);
10399 des_const_xmlChar_ptr(n_name, name, 1);
10400 des_const_xmlChar_ptr(n_name2, name2, 2);
10401 des_userdata(n_userdata, userdata, 3);
10402 des_xmlHashDeallocator(n_f, f, 4);
10403 xmlResetLastError();
10404 if (mem_base != xmlMemBlocks()) {
10405 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10406 xmlMemBlocks() - mem_base);
10407 test_ret++;
10408 printf(" %d", n_table);
10409 printf(" %d", n_name);
10410 printf(" %d", n_name2);
10411 printf(" %d", n_userdata);
10412 printf(" %d", n_f);
10413 printf("\n");
10414 }
10415 }
10416 }
10417 }
10418 }
10419 }
10420
10421 function_tests++;
10422 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010423}
10424
10425
10426static int
10427test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010428 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010429
Daniel Veillard42595322004-11-08 10:52:06 +000010430 int mem_base;
10431 int ret_val;
10432 xmlHashTablePtr table; /* the hash table */
10433 int n_table;
10434 xmlChar * name; /* the name of the userdata */
10435 int n_name;
10436 xmlChar * name2; /* a second name of the userdata */
10437 int n_name2;
10438 xmlChar * name3; /* a third name of the userdata */
10439 int n_name3;
10440 void * userdata; /* a pointer to the userdata */
10441 int n_userdata;
10442 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10443 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010444
Daniel Veillard42595322004-11-08 10:52:06 +000010445 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10446 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10447 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10448 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10449 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10450 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10451 mem_base = xmlMemBlocks();
10452 table = gen_xmlHashTablePtr(n_table, 0);
10453 name = gen_const_xmlChar_ptr(n_name, 1);
10454 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10455 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10456 userdata = gen_userdata(n_userdata, 4);
10457 f = gen_xmlHashDeallocator(n_f, 5);
10458
10459 ret_val = xmlHashUpdateEntry3(table, name, name2, name3, userdata, f);
10460 desret_int(ret_val);
10461 call_tests++;
10462 des_xmlHashTablePtr(n_table, table, 0);
10463 des_const_xmlChar_ptr(n_name, name, 1);
10464 des_const_xmlChar_ptr(n_name2, name2, 2);
10465 des_const_xmlChar_ptr(n_name3, name3, 3);
10466 des_userdata(n_userdata, userdata, 4);
10467 des_xmlHashDeallocator(n_f, f, 5);
10468 xmlResetLastError();
10469 if (mem_base != xmlMemBlocks()) {
10470 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10471 xmlMemBlocks() - mem_base);
10472 test_ret++;
10473 printf(" %d", n_table);
10474 printf(" %d", n_name);
10475 printf(" %d", n_name2);
10476 printf(" %d", n_name3);
10477 printf(" %d", n_userdata);
10478 printf(" %d", n_f);
10479 printf("\n");
10480 }
10481 }
10482 }
10483 }
10484 }
10485 }
10486 }
10487
10488 function_tests++;
10489 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010490}
10491
10492static int
10493test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010495
Daniel Veillard42595322004-11-08 10:52:06 +000010496 printf("Testing hash : 16 of 23 functions ...\n");
10497 test_ret += test_xmlHashAddEntry();
10498 test_ret += test_xmlHashAddEntry2();
10499 test_ret += test_xmlHashAddEntry3();
10500 test_ret += test_xmlHashCopy();
10501 test_ret += test_xmlHashCreate();
10502 test_ret += test_xmlHashLookup();
10503 test_ret += test_xmlHashLookup2();
10504 test_ret += test_xmlHashLookup3();
10505 test_ret += test_xmlHashQLookup();
10506 test_ret += test_xmlHashQLookup2();
10507 test_ret += test_xmlHashQLookup3();
10508 test_ret += test_xmlHashRemoveEntry();
10509 test_ret += test_xmlHashRemoveEntry2();
10510 test_ret += test_xmlHashRemoveEntry3();
10511 test_ret += test_xmlHashScan();
10512 test_ret += test_xmlHashScan3();
10513 test_ret += test_xmlHashScanFull();
10514 test_ret += test_xmlHashScanFull3();
10515 test_ret += test_xmlHashSize();
10516 test_ret += test_xmlHashUpdateEntry();
10517 test_ret += test_xmlHashUpdateEntry2();
10518 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010519
Daniel Veillard42595322004-11-08 10:52:06 +000010520 if (test_ret != 0)
10521 printf("Module hash: %d errors\n", test_ret);
10522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010523}
10524
Daniel Veillardce682bc2004-11-05 17:22:25 +000010525#define gen_nb_xmlLinkPtr 1
10526static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10527 return(NULL);
10528}
10529static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10530}
10531
Daniel Veillardd93f6252004-11-02 15:53:51 +000010532static int
10533test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010535
Daniel Veillardce682bc2004-11-05 17:22:25 +000010536 int mem_base;
10537 void * ret_val;
10538 xmlLinkPtr lk; /* a link */
10539 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010540
Daniel Veillardce682bc2004-11-05 17:22:25 +000010541 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10542 mem_base = xmlMemBlocks();
10543 lk = gen_xmlLinkPtr(n_lk, 0);
10544
10545 ret_val = xmlLinkGetData(lk);
10546 desret_void_ptr(ret_val);
10547 call_tests++;
10548 des_xmlLinkPtr(n_lk, lk, 0);
10549 xmlResetLastError();
10550 if (mem_base != xmlMemBlocks()) {
10551 printf("Leak of %d blocks found in xmlLinkGetData",
10552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010553 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010554 printf(" %d", n_lk);
10555 printf("\n");
10556 }
10557 }
10558
10559 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010560 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010561}
10562
10563
10564static int
10565test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010566 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010567
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010568 int mem_base;
10569 int ret_val;
10570 xmlListPtr l; /* a list */
10571 int n_l;
10572 void * data; /* the data */
10573 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010574
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010575 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10576 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10577 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010578 l = gen_xmlListPtr(n_l, 0);
10579 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010580
10581 ret_val = xmlListAppend(l, data);
10582 desret_int(ret_val);
10583 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010584 des_xmlListPtr(n_l, l, 0);
10585 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010586 xmlResetLastError();
10587 if (mem_base != xmlMemBlocks()) {
10588 printf("Leak of %d blocks found in xmlListAppend",
10589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010590 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010591 printf(" %d", n_l);
10592 printf(" %d", n_data);
10593 printf("\n");
10594 }
10595 }
10596 }
10597
Daniel Veillard3d97e662004-11-04 10:49:00 +000010598 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010599 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010600}
10601
10602
10603static int
10604test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010605 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010606
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010607 int mem_base;
10608 xmlListPtr l; /* a list */
10609 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010610
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010611 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10612 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010613 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010614
10615 xmlListClear(l);
10616 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010617 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010618 xmlResetLastError();
10619 if (mem_base != xmlMemBlocks()) {
10620 printf("Leak of %d blocks found in xmlListClear",
10621 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010622 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010623 printf(" %d", n_l);
10624 printf("\n");
10625 }
10626 }
10627
Daniel Veillard3d97e662004-11-04 10:49:00 +000010628 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010630}
10631
10632
Daniel Veillardce682bc2004-11-05 17:22:25 +000010633#define gen_nb_const_xmlListPtr 1
10634static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10635 return(NULL);
10636}
10637static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10638}
10639
Daniel Veillardd93f6252004-11-02 15:53:51 +000010640static int
10641test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010642 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010643
Daniel Veillardce682bc2004-11-05 17:22:25 +000010644 int mem_base;
10645 int ret_val;
10646 xmlListPtr cur; /* the new list */
10647 int n_cur;
10648 xmlListPtr old; /* the old list */
10649 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010650
Daniel Veillardce682bc2004-11-05 17:22:25 +000010651 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10652 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10653 mem_base = xmlMemBlocks();
10654 cur = gen_xmlListPtr(n_cur, 0);
10655 old = gen_const_xmlListPtr(n_old, 1);
10656
10657 ret_val = xmlListCopy(cur, old);
10658 desret_int(ret_val);
10659 call_tests++;
10660 des_xmlListPtr(n_cur, cur, 0);
10661 des_const_xmlListPtr(n_old, old, 1);
10662 xmlResetLastError();
10663 if (mem_base != xmlMemBlocks()) {
10664 printf("Leak of %d blocks found in xmlListCopy",
10665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010666 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010667 printf(" %d", n_cur);
10668 printf(" %d", n_old);
10669 printf("\n");
10670 }
10671 }
10672 }
10673
10674 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010676}
10677
10678
10679static int
10680test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010682
10683
10684 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010686}
10687
10688
10689static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010690test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010692
10693
10694 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010696}
10697
10698
10699static int
10700test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010701 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010702
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010703 int mem_base;
10704 int ret_val;
10705 xmlListPtr l; /* a list */
10706 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010707
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010708 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10709 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010710 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010711
10712 ret_val = xmlListEmpty(l);
10713 desret_int(ret_val);
10714 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010715 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010716 xmlResetLastError();
10717 if (mem_base != xmlMemBlocks()) {
10718 printf("Leak of %d blocks found in xmlListEmpty",
10719 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010720 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010721 printf(" %d", n_l);
10722 printf("\n");
10723 }
10724 }
10725
Daniel Veillard3d97e662004-11-04 10:49:00 +000010726 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010728}
10729
10730
10731static int
10732test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010734
10735
10736 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010737 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010738}
10739
10740
10741static int
10742test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010743 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010744
10745
10746 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010747 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010748}
10749
10750
10751static int
10752test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010753 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010754
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010755 int mem_base;
10756 int ret_val;
10757 xmlListPtr l; /* a list */
10758 int n_l;
10759 void * data; /* the data */
10760 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010761
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010762 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10763 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10764 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010765 l = gen_xmlListPtr(n_l, 0);
10766 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010767
10768 ret_val = xmlListInsert(l, data);
10769 desret_int(ret_val);
10770 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010771 des_xmlListPtr(n_l, l, 0);
10772 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010773 xmlResetLastError();
10774 if (mem_base != xmlMemBlocks()) {
10775 printf("Leak of %d blocks found in xmlListInsert",
10776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010777 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010778 printf(" %d", n_l);
10779 printf(" %d", n_data);
10780 printf("\n");
10781 }
10782 }
10783 }
10784
Daniel Veillard3d97e662004-11-04 10:49:00 +000010785 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010786 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010787}
10788
10789
10790static int
10791test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010792 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010793
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010794 int mem_base;
10795 xmlListPtr l1; /* the original list */
10796 int n_l1;
10797 xmlListPtr l2; /* the new list */
10798 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010799
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010800 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10801 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10802 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010803 l1 = gen_xmlListPtr(n_l1, 0);
10804 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010805
10806 xmlListMerge(l1, l2);
10807 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010808 des_xmlListPtr(n_l1, l1, 0);
10809 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010810 xmlResetLastError();
10811 if (mem_base != xmlMemBlocks()) {
10812 printf("Leak of %d blocks found in xmlListMerge",
10813 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010814 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010815 printf(" %d", n_l1);
10816 printf(" %d", n_l2);
10817 printf("\n");
10818 }
10819 }
10820 }
10821
Daniel Veillard3d97e662004-11-04 10:49:00 +000010822 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010824}
10825
10826
10827static int
10828test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010830
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010831 int mem_base;
10832 xmlListPtr l; /* a list */
10833 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010834
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010835 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10836 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010837 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010838
10839 xmlListPopBack(l);
10840 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010841 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010842 xmlResetLastError();
10843 if (mem_base != xmlMemBlocks()) {
10844 printf("Leak of %d blocks found in xmlListPopBack",
10845 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010846 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010847 printf(" %d", n_l);
10848 printf("\n");
10849 }
10850 }
10851
Daniel Veillard3d97e662004-11-04 10:49:00 +000010852 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010853 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010854}
10855
10856
10857static int
10858test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010859 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010860
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010861 int mem_base;
10862 xmlListPtr l; /* a list */
10863 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010864
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010865 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10866 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010867 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010868
10869 xmlListPopFront(l);
10870 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010871 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010872 xmlResetLastError();
10873 if (mem_base != xmlMemBlocks()) {
10874 printf("Leak of %d blocks found in xmlListPopFront",
10875 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010876 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010877 printf(" %d", n_l);
10878 printf("\n");
10879 }
10880 }
10881
Daniel Veillard3d97e662004-11-04 10:49:00 +000010882 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010884}
10885
10886
10887static int
10888test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010889 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010890
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010891 int mem_base;
10892 int ret_val;
10893 xmlListPtr l; /* a list */
10894 int n_l;
10895 void * data; /* new data */
10896 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010897
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010898 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10899 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10900 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010901 l = gen_xmlListPtr(n_l, 0);
10902 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010903
10904 ret_val = xmlListPushBack(l, data);
10905 desret_int(ret_val);
10906 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010907 des_xmlListPtr(n_l, l, 0);
10908 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010909 xmlResetLastError();
10910 if (mem_base != xmlMemBlocks()) {
10911 printf("Leak of %d blocks found in xmlListPushBack",
10912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010913 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010914 printf(" %d", n_l);
10915 printf(" %d", n_data);
10916 printf("\n");
10917 }
10918 }
10919 }
10920
Daniel Veillard3d97e662004-11-04 10:49:00 +000010921 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010922 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010923}
10924
10925
10926static int
10927test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010928 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010929
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010930 int mem_base;
10931 int ret_val;
10932 xmlListPtr l; /* a list */
10933 int n_l;
10934 void * data; /* new data */
10935 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010936
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010937 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10938 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10939 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010940 l = gen_xmlListPtr(n_l, 0);
10941 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010942
10943 ret_val = xmlListPushFront(l, data);
10944 desret_int(ret_val);
10945 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010946 des_xmlListPtr(n_l, l, 0);
10947 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010948 xmlResetLastError();
10949 if (mem_base != xmlMemBlocks()) {
10950 printf("Leak of %d blocks found in xmlListPushFront",
10951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010952 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010953 printf(" %d", n_l);
10954 printf(" %d", n_data);
10955 printf("\n");
10956 }
10957 }
10958 }
10959
Daniel Veillard3d97e662004-11-04 10:49:00 +000010960 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010961 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010962}
10963
10964
10965static int
10966test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010967 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010968
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010969 int mem_base;
10970 int ret_val;
10971 xmlListPtr l; /* a list */
10972 int n_l;
10973 void * data; /* list data */
10974 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010975
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010976 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10977 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10978 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010979 l = gen_xmlListPtr(n_l, 0);
10980 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010981
10982 ret_val = xmlListRemoveAll(l, data);
10983 desret_int(ret_val);
10984 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010985 des_xmlListPtr(n_l, l, 0);
10986 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010987 xmlResetLastError();
10988 if (mem_base != xmlMemBlocks()) {
10989 printf("Leak of %d blocks found in xmlListRemoveAll",
10990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010991 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010992 printf(" %d", n_l);
10993 printf(" %d", n_data);
10994 printf("\n");
10995 }
10996 }
10997 }
10998
Daniel Veillard3d97e662004-11-04 10:49:00 +000010999 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011000 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011001}
11002
11003
11004static int
11005test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011006 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011007
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011008 int mem_base;
11009 int ret_val;
11010 xmlListPtr l; /* a list */
11011 int n_l;
11012 void * data; /* list data */
11013 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011014
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011015 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11016 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11017 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011018 l = gen_xmlListPtr(n_l, 0);
11019 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011020
11021 ret_val = xmlListRemoveFirst(l, data);
11022 desret_int(ret_val);
11023 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011024 des_xmlListPtr(n_l, l, 0);
11025 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011026 xmlResetLastError();
11027 if (mem_base != xmlMemBlocks()) {
11028 printf("Leak of %d blocks found in xmlListRemoveFirst",
11029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011030 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011031 printf(" %d", n_l);
11032 printf(" %d", n_data);
11033 printf("\n");
11034 }
11035 }
11036 }
11037
Daniel Veillard3d97e662004-11-04 10:49:00 +000011038 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011039 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011040}
11041
11042
11043static int
11044test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011045 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011046
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011047 int mem_base;
11048 int ret_val;
11049 xmlListPtr l; /* a list */
11050 int n_l;
11051 void * data; /* list data */
11052 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011053
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011054 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11055 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11056 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011057 l = gen_xmlListPtr(n_l, 0);
11058 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011059
11060 ret_val = xmlListRemoveLast(l, data);
11061 desret_int(ret_val);
11062 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011063 des_xmlListPtr(n_l, l, 0);
11064 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011065 xmlResetLastError();
11066 if (mem_base != xmlMemBlocks()) {
11067 printf("Leak of %d blocks found in xmlListRemoveLast",
11068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011069 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011070 printf(" %d", n_l);
11071 printf(" %d", n_data);
11072 printf("\n");
11073 }
11074 }
11075 }
11076
Daniel Veillard3d97e662004-11-04 10:49:00 +000011077 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011079}
11080
11081
11082static int
11083test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011085
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011086 int mem_base;
11087 xmlListPtr l; /* a list */
11088 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011089
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011090 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11091 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011092 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011093
11094 xmlListReverse(l);
11095 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011096 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011097 xmlResetLastError();
11098 if (mem_base != xmlMemBlocks()) {
11099 printf("Leak of %d blocks found in xmlListReverse",
11100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011101 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011102 printf(" %d", n_l);
11103 printf("\n");
11104 }
11105 }
11106
Daniel Veillard3d97e662004-11-04 10:49:00 +000011107 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011109}
11110
11111
11112static int
11113test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011115
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011116 int mem_base;
11117 void * ret_val;
11118 xmlListPtr l; /* a list */
11119 int n_l;
11120 void * data; /* a search value */
11121 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011122
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011123 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11124 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11125 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011126 l = gen_xmlListPtr(n_l, 0);
11127 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011128
11129 ret_val = xmlListReverseSearch(l, data);
11130 desret_void_ptr(ret_val);
11131 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011132 des_xmlListPtr(n_l, l, 0);
11133 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011134 xmlResetLastError();
11135 if (mem_base != xmlMemBlocks()) {
11136 printf("Leak of %d blocks found in xmlListReverseSearch",
11137 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011138 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011139 printf(" %d", n_l);
11140 printf(" %d", n_data);
11141 printf("\n");
11142 }
11143 }
11144 }
11145
Daniel Veillard3d97e662004-11-04 10:49:00 +000011146 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011148}
11149
11150
11151static int
11152test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011154
11155
11156 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011158}
11159
11160
11161static int
11162test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011164
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011165 int mem_base;
11166 void * ret_val;
11167 xmlListPtr l; /* a list */
11168 int n_l;
11169 void * data; /* a search value */
11170 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011171
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011172 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11173 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11174 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011175 l = gen_xmlListPtr(n_l, 0);
11176 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011177
11178 ret_val = xmlListSearch(l, data);
11179 desret_void_ptr(ret_val);
11180 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011181 des_xmlListPtr(n_l, l, 0);
11182 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011183 xmlResetLastError();
11184 if (mem_base != xmlMemBlocks()) {
11185 printf("Leak of %d blocks found in xmlListSearch",
11186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011187 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011188 printf(" %d", n_l);
11189 printf(" %d", n_data);
11190 printf("\n");
11191 }
11192 }
11193 }
11194
Daniel Veillard3d97e662004-11-04 10:49:00 +000011195 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011197}
11198
11199
11200static int
11201test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011203
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011204 int mem_base;
11205 int ret_val;
11206 xmlListPtr l; /* a list */
11207 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011208
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011209 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11210 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011211 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011212
11213 ret_val = xmlListSize(l);
11214 desret_int(ret_val);
11215 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011216 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011217 xmlResetLastError();
11218 if (mem_base != xmlMemBlocks()) {
11219 printf("Leak of %d blocks found in xmlListSize",
11220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011221 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011222 printf(" %d", n_l);
11223 printf("\n");
11224 }
11225 }
11226
Daniel Veillard3d97e662004-11-04 10:49:00 +000011227 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011228 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011229}
11230
11231
11232static int
11233test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011235
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011236 int mem_base;
11237 xmlListPtr l; /* a list */
11238 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011239
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011240 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11241 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011242 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011243
11244 xmlListSort(l);
11245 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011246 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011247 xmlResetLastError();
11248 if (mem_base != xmlMemBlocks()) {
11249 printf("Leak of %d blocks found in xmlListSort",
11250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011251 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011252 printf(" %d", n_l);
11253 printf("\n");
11254 }
11255 }
11256
Daniel Veillard3d97e662004-11-04 10:49:00 +000011257 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011259}
11260
11261
11262static int
11263test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011264 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011265
11266
11267 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011268 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011269}
11270
11271static int
11272test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011273 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011274
Daniel Veillardce682bc2004-11-05 17:22:25 +000011275 printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011276 test_ret += test_xmlLinkGetData();
11277 test_ret += test_xmlListAppend();
11278 test_ret += test_xmlListClear();
11279 test_ret += test_xmlListCopy();
11280 test_ret += test_xmlListCreate();
11281 test_ret += test_xmlListDup();
11282 test_ret += test_xmlListEmpty();
11283 test_ret += test_xmlListEnd();
11284 test_ret += test_xmlListFront();
11285 test_ret += test_xmlListInsert();
11286 test_ret += test_xmlListMerge();
11287 test_ret += test_xmlListPopBack();
11288 test_ret += test_xmlListPopFront();
11289 test_ret += test_xmlListPushBack();
11290 test_ret += test_xmlListPushFront();
11291 test_ret += test_xmlListRemoveAll();
11292 test_ret += test_xmlListRemoveFirst();
11293 test_ret += test_xmlListRemoveLast();
11294 test_ret += test_xmlListReverse();
11295 test_ret += test_xmlListReverseSearch();
11296 test_ret += test_xmlListReverseWalk();
11297 test_ret += test_xmlListSearch();
11298 test_ret += test_xmlListSize();
11299 test_ret += test_xmlListSort();
11300 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011301
Daniel Veillard42595322004-11-08 10:52:06 +000011302 if (test_ret != 0)
11303 printf("Module list: %d errors\n", test_ret);
11304 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011305}
11306
11307static int
11308test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011309 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011310
Daniel Veillard27f20102004-11-05 11:50:11 +000011311#ifdef LIBXML_FTP_ENABLED
11312 int mem_base;
11313 int ret_val;
11314 void * ctx; /* an FTP context */
11315 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011316
Daniel Veillard27f20102004-11-05 11:50:11 +000011317 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11318 mem_base = xmlMemBlocks();
11319 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11320
11321 ret_val = xmlNanoFTPCheckResponse(ctx);
11322 desret_int(ret_val);
11323 call_tests++;
11324 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11325 xmlResetLastError();
11326 if (mem_base != xmlMemBlocks()) {
11327 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11328 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011329 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011330 printf(" %d", n_ctx);
11331 printf("\n");
11332 }
11333 }
11334#endif
11335
11336 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011338}
11339
11340
11341static int
11342test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011344
11345#ifdef LIBXML_FTP_ENABLED
11346 int mem_base;
11347
11348 mem_base = xmlMemBlocks();
11349
11350 xmlNanoFTPCleanup();
11351 call_tests++;
11352 xmlResetLastError();
11353 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011354 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011356 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011357 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011358 }
11359#endif
11360
Daniel Veillard3d97e662004-11-04 10:49:00 +000011361 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011363}
11364
11365
11366static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011367test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011369
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011370#ifdef LIBXML_FTP_ENABLED
11371 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011372 int ret_val;
11373 void * ctx; /* an FTP context */
11374 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011375
Daniel Veillard27f20102004-11-05 11:50:11 +000011376 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011377 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011378 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011379
Daniel Veillard27f20102004-11-05 11:50:11 +000011380 ret_val = xmlNanoFTPCloseConnection(ctx);
11381 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011382 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011383 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011384 xmlResetLastError();
11385 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011386 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011387 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011388 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011389 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011390 printf("\n");
11391 }
11392 }
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011393#endif
11394
Daniel Veillard3d97e662004-11-04 10:49:00 +000011395 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011397}
11398
11399
11400static int
11401test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011403
Daniel Veillard27f20102004-11-05 11:50:11 +000011404#ifdef LIBXML_FTP_ENABLED
11405 int mem_base;
11406 int ret_val;
11407 void * ctx; /* an FTP context */
11408 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011409 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011410 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011411
Daniel Veillard27f20102004-11-05 11:50:11 +000011412 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11413 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11414 mem_base = xmlMemBlocks();
11415 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11416 directory = gen_const_char_ptr(n_directory, 1);
11417
11418 ret_val = xmlNanoFTPCwd(ctx, directory);
11419 desret_int(ret_val);
11420 call_tests++;
11421 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11422 des_const_char_ptr(n_directory, directory, 1);
11423 xmlResetLastError();
11424 if (mem_base != xmlMemBlocks()) {
11425 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11426 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011427 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011428 printf(" %d", n_ctx);
11429 printf(" %d", n_directory);
11430 printf("\n");
11431 }
11432 }
11433 }
11434#endif
11435
11436 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011437 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011438}
11439
11440
11441static int
11442test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011443 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011444
Daniel Veillard27f20102004-11-05 11:50:11 +000011445#ifdef LIBXML_FTP_ENABLED
11446 int mem_base;
11447 int ret_val;
11448 void * ctx; /* an FTP context */
11449 int n_ctx;
11450 const char * file; /* a file or directory on the server */
11451 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011452
Daniel Veillard27f20102004-11-05 11:50:11 +000011453 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11454 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11455 mem_base = xmlMemBlocks();
11456 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11457 file = gen_filepath(n_file, 1);
11458
11459 ret_val = xmlNanoFTPDele(ctx, file);
11460 desret_int(ret_val);
11461 call_tests++;
11462 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11463 des_filepath(n_file, file, 1);
11464 xmlResetLastError();
11465 if (mem_base != xmlMemBlocks()) {
11466 printf("Leak of %d blocks found in xmlNanoFTPDele",
11467 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011468 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011469 printf(" %d", n_ctx);
11470 printf(" %d", n_file);
11471 printf("\n");
11472 }
11473 }
11474 }
11475#endif
11476
11477 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011478 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011479}
11480
11481
11482static int
11483test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011484 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011485
11486
11487 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011489}
11490
11491
11492static int
11493test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011495
Daniel Veillard27f20102004-11-05 11:50:11 +000011496#ifdef LIBXML_FTP_ENABLED
11497 int mem_base;
11498 int ret_val;
11499 void * ctx; /* an FTP context */
11500 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011501
Daniel Veillard27f20102004-11-05 11:50:11 +000011502 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11503 mem_base = xmlMemBlocks();
11504 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11505
11506 ret_val = xmlNanoFTPGetConnection(ctx);
11507 desret_int(ret_val);
11508 call_tests++;
11509 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11510 xmlResetLastError();
11511 if (mem_base != xmlMemBlocks()) {
11512 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11513 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011514 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011515 printf(" %d", n_ctx);
11516 printf("\n");
11517 }
11518 }
11519#endif
11520
11521 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011523}
11524
11525
11526static int
11527test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011529
Daniel Veillard27f20102004-11-05 11:50:11 +000011530#ifdef LIBXML_FTP_ENABLED
11531 int mem_base;
11532 int ret_val;
11533 void * ctx; /* an FTP context */
11534 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011535
Daniel Veillard27f20102004-11-05 11:50:11 +000011536 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11537 mem_base = xmlMemBlocks();
11538 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11539
11540 ret_val = xmlNanoFTPGetResponse(ctx);
11541 desret_int(ret_val);
11542 call_tests++;
11543 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11544 xmlResetLastError();
11545 if (mem_base != xmlMemBlocks()) {
11546 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011548 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011549 printf(" %d", n_ctx);
11550 printf("\n");
11551 }
11552 }
11553#endif
11554
11555 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011556 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011557}
11558
11559
11560static int
11561test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011562 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011563
Daniel Veillard27f20102004-11-05 11:50:11 +000011564#ifdef LIBXML_FTP_ENABLED
11565 int mem_base;
11566 int ret_val;
11567 void * ctx; /* an FTP context */
11568 int n_ctx;
11569 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11570 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011571
Daniel Veillard27f20102004-11-05 11:50:11 +000011572 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11573 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11574 mem_base = xmlMemBlocks();
11575 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11576 filename = gen_filepath(n_filename, 1);
11577
11578 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11579 desret_int(ret_val);
11580 call_tests++;
11581 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11582 des_filepath(n_filename, filename, 1);
11583 xmlResetLastError();
11584 if (mem_base != xmlMemBlocks()) {
11585 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011587 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011588 printf(" %d", n_ctx);
11589 printf(" %d", n_filename);
11590 printf("\n");
11591 }
11592 }
11593 }
11594#endif
11595
11596 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011597 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011598}
11599
11600
11601static int
11602test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011603 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011604
11605#ifdef LIBXML_FTP_ENABLED
11606 int mem_base;
11607
11608 mem_base = xmlMemBlocks();
11609
11610 xmlNanoFTPInit();
11611 call_tests++;
11612 xmlResetLastError();
11613 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011614 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011615 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011616 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011617 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011618 }
11619#endif
11620
Daniel Veillard3d97e662004-11-04 10:49:00 +000011621 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011623}
11624
11625
11626static int
11627test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011629
11630
11631 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011633}
11634
11635
11636static int
11637test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011639
11640
11641 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011643}
11644
11645
11646static int
11647test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011649
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011650#ifdef LIBXML_FTP_ENABLED
11651 int mem_base;
11652 void * ret_val;
11653 const char * URL; /* the URL to the resource */
11654 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011655
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011656 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11657 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011658 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011659
11660 ret_val = xmlNanoFTPOpen(URL);
11661 desret_void_ptr(ret_val);
11662 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011663 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011664 xmlResetLastError();
11665 if (mem_base != xmlMemBlocks()) {
11666 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11667 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011668 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011669 printf(" %d", n_URL);
11670 printf("\n");
11671 }
11672 }
11673#endif
11674
Daniel Veillard3d97e662004-11-04 10:49:00 +000011675 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011677}
11678
11679
11680static int
11681test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011683
11684#ifdef LIBXML_FTP_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000011685 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011686 int n_host;
11687 int port; /* the proxy port */
11688 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011689 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011690 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011691 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011692 int n_passwd;
11693 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11694 int n_type;
11695
11696 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11697 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11698 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11699 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11700 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011701 host = gen_const_char_ptr(n_host, 0);
11702 port = gen_int(n_port, 1);
11703 user = gen_const_char_ptr(n_user, 2);
11704 passwd = gen_const_char_ptr(n_passwd, 3);
11705 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011706
11707 xmlNanoFTPProxy(host, port, user, passwd, type);
11708 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011709 des_const_char_ptr(n_host, host, 0);
11710 des_int(n_port, port, 1);
11711 des_const_char_ptr(n_user, user, 2);
11712 des_const_char_ptr(n_passwd, passwd, 3);
11713 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011714 xmlResetLastError();
11715 }
11716 }
11717 }
11718 }
11719 }
11720#endif
11721
Daniel Veillard3d97e662004-11-04 10:49:00 +000011722 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011724}
11725
11726
11727static int
11728test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011730
Daniel Veillard27f20102004-11-05 11:50:11 +000011731#ifdef LIBXML_FTP_ENABLED
11732 int mem_base;
11733 int ret_val;
11734 void * ctx; /* an FTP context */
11735 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011736
Daniel Veillard27f20102004-11-05 11:50:11 +000011737 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11738 mem_base = xmlMemBlocks();
11739 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11740
11741 ret_val = xmlNanoFTPQuit(ctx);
11742 desret_int(ret_val);
11743 call_tests++;
11744 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11745 xmlResetLastError();
11746 if (mem_base != xmlMemBlocks()) {
11747 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011749 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011750 printf(" %d", n_ctx);
11751 printf("\n");
11752 }
11753 }
11754#endif
11755
11756 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011758}
11759
11760
11761static int
11762test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011764
Daniel Veillard27f20102004-11-05 11:50:11 +000011765#ifdef LIBXML_FTP_ENABLED
11766 int mem_base;
11767 int ret_val;
11768 void * ctx; /* the FTP context */
11769 int n_ctx;
11770 void * dest; /* a buffer */
11771 int n_dest;
11772 int len; /* the buffer length */
11773 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011774
Daniel Veillard27f20102004-11-05 11:50:11 +000011775 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11776 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11777 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11778 mem_base = xmlMemBlocks();
11779 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11780 dest = gen_void_ptr(n_dest, 1);
11781 len = gen_int(n_len, 2);
11782
11783 ret_val = xmlNanoFTPRead(ctx, dest, len);
11784 desret_int(ret_val);
11785 call_tests++;
11786 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11787 des_void_ptr(n_dest, dest, 1);
11788 des_int(n_len, len, 2);
11789 xmlResetLastError();
11790 if (mem_base != xmlMemBlocks()) {
11791 printf("Leak of %d blocks found in xmlNanoFTPRead",
11792 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011793 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011794 printf(" %d", n_ctx);
11795 printf(" %d", n_dest);
11796 printf(" %d", n_len);
11797 printf("\n");
11798 }
11799 }
11800 }
11801 }
11802#endif
11803
11804 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011806}
11807
11808
11809static int
11810test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011811 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011812
11813#ifdef LIBXML_FTP_ENABLED
11814 const char * URL; /* The proxy URL used to initialize the proxy context */
11815 int n_URL;
11816
11817 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011818 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011819
11820 xmlNanoFTPScanProxy(URL);
11821 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011822 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011823 xmlResetLastError();
11824 }
11825#endif
11826
Daniel Veillard3d97e662004-11-04 10:49:00 +000011827 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011829}
11830
11831
11832static int
11833test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011835
Daniel Veillard27f20102004-11-05 11:50:11 +000011836#ifdef LIBXML_FTP_ENABLED
11837 int mem_base;
11838 int ret_val;
11839 void * ctx; /* an FTP context */
11840 int n_ctx;
11841 const char * URL; /* The URL used to update the context */
11842 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011843
Daniel Veillard27f20102004-11-05 11:50:11 +000011844 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11845 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11846 mem_base = xmlMemBlocks();
11847 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11848 URL = gen_filepath(n_URL, 1);
11849
11850 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
11851 desret_int(ret_val);
11852 call_tests++;
11853 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11854 des_filepath(n_URL, URL, 1);
11855 xmlResetLastError();
11856 if (mem_base != xmlMemBlocks()) {
11857 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
11858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011859 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011860 printf(" %d", n_ctx);
11861 printf(" %d", n_URL);
11862 printf("\n");
11863 }
11864 }
11865 }
11866#endif
11867
11868 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011870}
11871
11872static int
11873test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011875
Daniel Veillard27f20102004-11-05 11:50:11 +000011876 printf("Testing nanoftp : 15 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011877 test_ret += test_xmlNanoFTPCheckResponse();
11878 test_ret += test_xmlNanoFTPCleanup();
11879 test_ret += test_xmlNanoFTPCloseConnection();
11880 test_ret += test_xmlNanoFTPCwd();
11881 test_ret += test_xmlNanoFTPDele();
11882 test_ret += test_xmlNanoFTPGet();
11883 test_ret += test_xmlNanoFTPGetConnection();
11884 test_ret += test_xmlNanoFTPGetResponse();
11885 test_ret += test_xmlNanoFTPGetSocket();
11886 test_ret += test_xmlNanoFTPInit();
11887 test_ret += test_xmlNanoFTPList();
11888 test_ret += test_xmlNanoFTPNewCtxt();
11889 test_ret += test_xmlNanoFTPOpen();
11890 test_ret += test_xmlNanoFTPProxy();
11891 test_ret += test_xmlNanoFTPQuit();
11892 test_ret += test_xmlNanoFTPRead();
11893 test_ret += test_xmlNanoFTPScanProxy();
11894 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011895
Daniel Veillard42595322004-11-08 10:52:06 +000011896 if (test_ret != 0)
11897 printf("Module nanoftp: %d errors\n", test_ret);
11898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011899}
11900
11901static int
11902test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011904
Daniel Veillard27f20102004-11-05 11:50:11 +000011905#ifdef LIBXML_HTTP_ENABLED
11906 int mem_base;
11907 const char * ret_val;
11908 void * ctx; /* the HTTP context */
11909 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011910
Daniel Veillard27f20102004-11-05 11:50:11 +000011911 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11912 mem_base = xmlMemBlocks();
11913 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11914
11915 ret_val = xmlNanoHTTPAuthHeader(ctx);
11916 desret_const_char_ptr(ret_val);
11917 call_tests++;
11918 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11919 xmlResetLastError();
11920 if (mem_base != xmlMemBlocks()) {
11921 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
11922 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011923 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011924 printf(" %d", n_ctx);
11925 printf("\n");
11926 }
11927 }
11928#endif
11929
11930 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011932}
11933
11934
11935static int
11936test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011938
11939#ifdef LIBXML_HTTP_ENABLED
11940 int mem_base;
11941
11942 mem_base = xmlMemBlocks();
11943
11944 xmlNanoHTTPCleanup();
11945 call_tests++;
11946 xmlResetLastError();
11947 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011948 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011950 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011951 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011952 }
11953#endif
11954
Daniel Veillard3d97e662004-11-04 10:49:00 +000011955 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011956 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011957}
11958
11959
11960static int
11961test_xmlNanoHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011962 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011963
Daniel Veillard27f20102004-11-05 11:50:11 +000011964#ifdef LIBXML_HTTP_ENABLED
11965 int mem_base;
11966 void * ctx; /* the HTTP context */
11967 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011968
Daniel Veillard27f20102004-11-05 11:50:11 +000011969 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11970 mem_base = xmlMemBlocks();
11971 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11972
11973 xmlNanoHTTPClose(ctx);
11974 call_tests++;
11975 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11976 xmlResetLastError();
11977 if (mem_base != xmlMemBlocks()) {
11978 printf("Leak of %d blocks found in xmlNanoHTTPClose",
11979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011980 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011981 printf(" %d", n_ctx);
11982 printf("\n");
11983 }
11984 }
11985#endif
11986
11987 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011988 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011989}
11990
11991
11992static int
11993test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011994 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011995
Daniel Veillard27f20102004-11-05 11:50:11 +000011996#ifdef LIBXML_HTTP_ENABLED
11997 int mem_base;
11998 int ret_val;
11999 void * ctx; /* the HTTP context */
12000 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012001
Daniel Veillard27f20102004-11-05 11:50:11 +000012002 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12003 mem_base = xmlMemBlocks();
12004 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12005
12006 ret_val = xmlNanoHTTPContentLength(ctx);
12007 desret_int(ret_val);
12008 call_tests++;
12009 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12010 xmlResetLastError();
12011 if (mem_base != xmlMemBlocks()) {
12012 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
12013 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012014 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012015 printf(" %d", n_ctx);
12016 printf("\n");
12017 }
12018 }
12019#endif
12020
12021 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012022 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012023}
12024
12025
12026static int
12027test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012028 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012029
Daniel Veillard27f20102004-11-05 11:50:11 +000012030#ifdef LIBXML_HTTP_ENABLED
12031 int mem_base;
12032 const char * ret_val;
12033 void * ctx; /* the HTTP context */
12034 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012035
Daniel Veillard27f20102004-11-05 11:50:11 +000012036 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12037 mem_base = xmlMemBlocks();
12038 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12039
12040 ret_val = xmlNanoHTTPEncoding(ctx);
12041 desret_const_char_ptr(ret_val);
12042 call_tests++;
12043 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12044 xmlResetLastError();
12045 if (mem_base != xmlMemBlocks()) {
12046 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
12047 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012048 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012049 printf(" %d", n_ctx);
12050 printf("\n");
12051 }
12052 }
12053#endif
12054
12055 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012057}
12058
12059
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012060#define gen_nb_char_ptr_ptr 1
12061static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12062 return(NULL);
12063}
12064static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12065}
12066
Daniel Veillardd93f6252004-11-02 15:53:51 +000012067static int
12068test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012070
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012071#ifdef LIBXML_HTTP_ENABLED
12072 int mem_base;
12073 int ret_val;
12074 const char * URL; /* The URL to load */
12075 int n_URL;
12076 const char * filename; /* the filename where the content should be saved */
12077 int n_filename;
12078 char ** contentType; /* if available the Content-Type information will be returned at that location */
12079 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012080
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012081 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12082 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12083 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12084 mem_base = xmlMemBlocks();
12085 URL = gen_filepath(n_URL, 0);
12086 filename = gen_filepath(n_filename, 1);
12087 contentType = gen_char_ptr_ptr(n_contentType, 2);
12088
12089 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
12090 desret_int(ret_val);
12091 call_tests++;
12092 des_filepath(n_URL, URL, 0);
12093 des_filepath(n_filename, filename, 1);
12094 des_char_ptr_ptr(n_contentType, contentType, 2);
12095 xmlResetLastError();
12096 if (mem_base != xmlMemBlocks()) {
12097 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
12098 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012099 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012100 printf(" %d", n_URL);
12101 printf(" %d", n_filename);
12102 printf(" %d", n_contentType);
12103 printf("\n");
12104 }
12105 }
12106 }
12107 }
12108#endif
12109
12110 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012111 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012112}
12113
12114
12115static int
12116test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012117 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012118
12119#ifdef LIBXML_HTTP_ENABLED
12120 int mem_base;
12121
12122 mem_base = xmlMemBlocks();
12123
12124 xmlNanoHTTPInit();
12125 call_tests++;
12126 xmlResetLastError();
12127 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012128 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012130 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012131 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012132 }
12133#endif
12134
Daniel Veillard3d97e662004-11-04 10:49:00 +000012135 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012137}
12138
12139
12140static int
12141test_xmlNanoHTTPMethod(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012143
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012144#ifdef LIBXML_HTTP_ENABLED
12145 int mem_base;
12146 void * ret_val;
12147 const char * URL; /* The URL to load */
12148 int n_URL;
12149 char * method; /* the HTTP method to use */
12150 int n_method;
12151 char * input; /* the input string if any */
12152 int n_input;
12153 char ** contentType; /* the Content-Type information IN and OUT */
12154 int n_contentType;
12155 char * headers; /* the extra headers */
12156 int n_headers;
12157 int ilen; /* input length */
12158 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012159
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012160 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12161 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12162 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12163 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12164 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12165 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12166 mem_base = xmlMemBlocks();
12167 URL = gen_filepath(n_URL, 0);
12168 method = gen_const_char_ptr(n_method, 1);
12169 input = gen_const_char_ptr(n_input, 2);
12170 contentType = gen_char_ptr_ptr(n_contentType, 3);
12171 headers = gen_const_char_ptr(n_headers, 4);
12172 ilen = gen_int(n_ilen, 5);
12173
12174 ret_val = xmlNanoHTTPMethod(URL, method, input, contentType, headers, ilen);
12175 desret_void_ptr(ret_val);
12176 call_tests++;
12177 des_filepath(n_URL, URL, 0);
12178 des_const_char_ptr(n_method, method, 1);
12179 des_const_char_ptr(n_input, input, 2);
12180 des_char_ptr_ptr(n_contentType, contentType, 3);
12181 des_const_char_ptr(n_headers, headers, 4);
12182 des_int(n_ilen, ilen, 5);
12183 xmlResetLastError();
12184 if (mem_base != xmlMemBlocks()) {
12185 printf("Leak of %d blocks found in xmlNanoHTTPMethod",
12186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012187 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012188 printf(" %d", n_URL);
12189 printf(" %d", n_method);
12190 printf(" %d", n_input);
12191 printf(" %d", n_contentType);
12192 printf(" %d", n_headers);
12193 printf(" %d", n_ilen);
12194 printf("\n");
12195 }
12196 }
12197 }
12198 }
12199 }
12200 }
12201 }
12202#endif
12203
12204 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012206}
12207
12208
12209static int
12210test_xmlNanoHTTPMethodRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012212
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012213#ifdef LIBXML_HTTP_ENABLED
12214 int mem_base;
12215 void * ret_val;
12216 const char * URL; /* The URL to load */
12217 int n_URL;
12218 char * method; /* the HTTP method to use */
12219 int n_method;
12220 char * input; /* the input string if any */
12221 int n_input;
12222 char ** contentType; /* the Content-Type information IN and OUT */
12223 int n_contentType;
12224 char ** redir; /* the redirected URL OUT */
12225 int n_redir;
12226 char * headers; /* the extra headers */
12227 int n_headers;
12228 int ilen; /* input length */
12229 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012230
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012231 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12232 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12233 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12234 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12235 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12236 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12237 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12238 mem_base = xmlMemBlocks();
12239 URL = gen_filepath(n_URL, 0);
12240 method = gen_const_char_ptr(n_method, 1);
12241 input = gen_const_char_ptr(n_input, 2);
12242 contentType = gen_char_ptr_ptr(n_contentType, 3);
12243 redir = gen_char_ptr_ptr(n_redir, 4);
12244 headers = gen_const_char_ptr(n_headers, 5);
12245 ilen = gen_int(n_ilen, 6);
12246
12247 ret_val = xmlNanoHTTPMethodRedir(URL, method, input, contentType, redir, headers, ilen);
12248 desret_void_ptr(ret_val);
12249 call_tests++;
12250 des_filepath(n_URL, URL, 0);
12251 des_const_char_ptr(n_method, method, 1);
12252 des_const_char_ptr(n_input, input, 2);
12253 des_char_ptr_ptr(n_contentType, contentType, 3);
12254 des_char_ptr_ptr(n_redir, redir, 4);
12255 des_const_char_ptr(n_headers, headers, 5);
12256 des_int(n_ilen, ilen, 6);
12257 xmlResetLastError();
12258 if (mem_base != xmlMemBlocks()) {
12259 printf("Leak of %d blocks found in xmlNanoHTTPMethodRedir",
12260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012261 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012262 printf(" %d", n_URL);
12263 printf(" %d", n_method);
12264 printf(" %d", n_input);
12265 printf(" %d", n_contentType);
12266 printf(" %d", n_redir);
12267 printf(" %d", n_headers);
12268 printf(" %d", n_ilen);
12269 printf("\n");
12270 }
12271 }
12272 }
12273 }
12274 }
12275 }
12276 }
12277 }
12278#endif
12279
12280 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012282}
12283
12284
12285static int
12286test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012288
Daniel Veillard27f20102004-11-05 11:50:11 +000012289#ifdef LIBXML_HTTP_ENABLED
12290 int mem_base;
12291 const char * ret_val;
12292 void * ctx; /* the HTTP context */
12293 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012294
Daniel Veillard27f20102004-11-05 11:50:11 +000012295 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12296 mem_base = xmlMemBlocks();
12297 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12298
12299 ret_val = xmlNanoHTTPMimeType(ctx);
12300 desret_const_char_ptr(ret_val);
12301 call_tests++;
12302 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12303 xmlResetLastError();
12304 if (mem_base != xmlMemBlocks()) {
12305 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012307 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012308 printf(" %d", n_ctx);
12309 printf("\n");
12310 }
12311 }
12312#endif
12313
12314 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012315 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012316}
12317
12318
12319static int
12320test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012321 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012322
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012323#ifdef LIBXML_HTTP_ENABLED
12324 int mem_base;
12325 void * ret_val;
12326 const char * URL; /* The URL to load */
12327 int n_URL;
12328 char ** contentType; /* if available the Content-Type information will be returned at that location */
12329 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012330
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012331 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12332 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12333 mem_base = xmlMemBlocks();
12334 URL = gen_filepath(n_URL, 0);
12335 contentType = gen_char_ptr_ptr(n_contentType, 1);
12336
12337 ret_val = xmlNanoHTTPOpen(URL, contentType);
12338 desret_void_ptr(ret_val);
12339 call_tests++;
12340 des_filepath(n_URL, URL, 0);
12341 des_char_ptr_ptr(n_contentType, contentType, 1);
12342 xmlResetLastError();
12343 if (mem_base != xmlMemBlocks()) {
12344 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12345 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012346 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012347 printf(" %d", n_URL);
12348 printf(" %d", n_contentType);
12349 printf("\n");
12350 }
12351 }
12352 }
12353#endif
12354
12355 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012356 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012357}
12358
12359
12360static int
12361test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012362 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012363
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012364#ifdef LIBXML_HTTP_ENABLED
12365 int mem_base;
12366 void * ret_val;
12367 const char * URL; /* The URL to load */
12368 int n_URL;
12369 char ** contentType; /* if available the Content-Type information will be returned at that location */
12370 int n_contentType;
12371 char ** redir; /* if available the redirected URL will be returned */
12372 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012373
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012374 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12375 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12376 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12377 mem_base = xmlMemBlocks();
12378 URL = gen_filepath(n_URL, 0);
12379 contentType = gen_char_ptr_ptr(n_contentType, 1);
12380 redir = gen_char_ptr_ptr(n_redir, 2);
12381
12382 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
12383 desret_void_ptr(ret_val);
12384 call_tests++;
12385 des_filepath(n_URL, URL, 0);
12386 des_char_ptr_ptr(n_contentType, contentType, 1);
12387 des_char_ptr_ptr(n_redir, redir, 2);
12388 xmlResetLastError();
12389 if (mem_base != xmlMemBlocks()) {
12390 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12391 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012392 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012393 printf(" %d", n_URL);
12394 printf(" %d", n_contentType);
12395 printf(" %d", n_redir);
12396 printf("\n");
12397 }
12398 }
12399 }
12400 }
12401#endif
12402
12403 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012405}
12406
12407
12408static int
12409test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012411
Daniel Veillard27f20102004-11-05 11:50:11 +000012412#ifdef LIBXML_HTTP_ENABLED
12413 int mem_base;
12414 int ret_val;
12415 void * ctx; /* the HTTP context */
12416 int n_ctx;
12417 void * dest; /* a buffer */
12418 int n_dest;
12419 int len; /* the buffer length */
12420 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012421
Daniel Veillard27f20102004-11-05 11:50:11 +000012422 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12423 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12424 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12425 mem_base = xmlMemBlocks();
12426 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12427 dest = gen_void_ptr(n_dest, 1);
12428 len = gen_int(n_len, 2);
12429
12430 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12431 desret_int(ret_val);
12432 call_tests++;
12433 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12434 des_void_ptr(n_dest, dest, 1);
12435 des_int(n_len, len, 2);
12436 xmlResetLastError();
12437 if (mem_base != xmlMemBlocks()) {
12438 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12439 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012440 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012441 printf(" %d", n_ctx);
12442 printf(" %d", n_dest);
12443 printf(" %d", n_len);
12444 printf("\n");
12445 }
12446 }
12447 }
12448 }
12449#endif
12450
12451 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012453}
12454
12455
12456static int
12457test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012459
12460
12461 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012463}
12464
12465
12466static int
12467test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012469
Daniel Veillard27f20102004-11-05 11:50:11 +000012470#ifdef LIBXML_HTTP_ENABLED
12471 int mem_base;
12472 int ret_val;
12473 void * ctx; /* the HTTP context */
12474 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012475
Daniel Veillard27f20102004-11-05 11:50:11 +000012476 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12477 mem_base = xmlMemBlocks();
12478 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12479
12480 ret_val = xmlNanoHTTPReturnCode(ctx);
12481 desret_int(ret_val);
12482 call_tests++;
12483 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12484 xmlResetLastError();
12485 if (mem_base != xmlMemBlocks()) {
12486 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012488 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012489 printf(" %d", n_ctx);
12490 printf("\n");
12491 }
12492 }
12493#endif
12494
12495 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012496 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012497}
12498
12499
12500static int
12501test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012502 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012503
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012504#ifdef LIBXML_HTTP_ENABLED
12505#ifdef LIBXML_OUTPUT_ENABLED
12506 int mem_base;
12507 int ret_val;
12508 void * ctxt; /* the HTTP context */
12509 int n_ctxt;
12510 const char * filename; /* the filename where the content should be saved */
12511 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012512
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012513 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12514 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12515 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012516 ctxt = gen_void_ptr(n_ctxt, 0);
12517 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012518
12519 ret_val = xmlNanoHTTPSave(ctxt, filename);
12520 desret_int(ret_val);
12521 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012522 des_void_ptr(n_ctxt, ctxt, 0);
12523 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012524 xmlResetLastError();
12525 if (mem_base != xmlMemBlocks()) {
12526 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12527 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012528 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012529 printf(" %d", n_ctxt);
12530 printf(" %d", n_filename);
12531 printf("\n");
12532 }
12533 }
12534 }
12535#endif
12536#endif
12537
Daniel Veillard3d97e662004-11-04 10:49:00 +000012538 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012539 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012540}
12541
12542
12543static int
12544test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012545 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012546
12547#ifdef LIBXML_HTTP_ENABLED
12548 const char * URL; /* The proxy URL used to initialize the proxy context */
12549 int n_URL;
12550
12551 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012552 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012553
12554 xmlNanoHTTPScanProxy(URL);
12555 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012556 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012557 xmlResetLastError();
12558 }
12559#endif
12560
Daniel Veillard3d97e662004-11-04 10:49:00 +000012561 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012563}
12564
12565static int
12566test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012568
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012569 printf("Testing nanohttp : 16 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012570 test_ret += test_xmlNanoHTTPAuthHeader();
12571 test_ret += test_xmlNanoHTTPCleanup();
12572 test_ret += test_xmlNanoHTTPClose();
12573 test_ret += test_xmlNanoHTTPContentLength();
12574 test_ret += test_xmlNanoHTTPEncoding();
12575 test_ret += test_xmlNanoHTTPFetch();
12576 test_ret += test_xmlNanoHTTPInit();
12577 test_ret += test_xmlNanoHTTPMethod();
12578 test_ret += test_xmlNanoHTTPMethodRedir();
12579 test_ret += test_xmlNanoHTTPMimeType();
12580 test_ret += test_xmlNanoHTTPOpen();
12581 test_ret += test_xmlNanoHTTPOpenRedir();
12582 test_ret += test_xmlNanoHTTPRead();
12583 test_ret += test_xmlNanoHTTPRedir();
12584 test_ret += test_xmlNanoHTTPReturnCode();
12585 test_ret += test_xmlNanoHTTPSave();
12586 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012587
Daniel Veillard42595322004-11-08 10:52:06 +000012588 if (test_ret != 0)
12589 printf("Module nanohttp: %d errors\n", test_ret);
12590 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012591}
12592
12593static int
12594test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012596
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012597 int mem_base;
12598 long ret_val;
12599 xmlParserCtxtPtr ctxt; /* an XML parser context */
12600 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012601
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012602 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12603 mem_base = xmlMemBlocks();
12604 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12605
12606 ret_val = xmlByteConsumed(ctxt);
12607 desret_long(ret_val);
12608 call_tests++;
12609 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12610 xmlResetLastError();
12611 if (mem_base != xmlMemBlocks()) {
12612 printf("Leak of %d blocks found in xmlByteConsumed",
12613 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012614 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012615 printf(" %d", n_ctxt);
12616 printf("\n");
12617 }
12618 }
12619
12620 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012622}
12623
12624
Daniel Veillardce682bc2004-11-05 17:22:25 +000012625#define gen_nb_xmlParserNodeInfoSeqPtr 1
12626static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12627 return(NULL);
12628}
12629static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12630}
12631
Daniel Veillardd93f6252004-11-02 15:53:51 +000012632static int
12633test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012634 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012635
Daniel Veillardce682bc2004-11-05 17:22:25 +000012636 int mem_base;
12637 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12638 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012639
Daniel Veillardce682bc2004-11-05 17:22:25 +000012640 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12641 mem_base = xmlMemBlocks();
12642 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12643
12644 xmlClearNodeInfoSeq(seq);
12645 call_tests++;
12646 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12647 xmlResetLastError();
12648 if (mem_base != xmlMemBlocks()) {
12649 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12650 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012651 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012652 printf(" %d", n_seq);
12653 printf("\n");
12654 }
12655 }
12656
12657 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012659}
12660
12661
12662static int
12663test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012665
12666 int mem_base;
12667 xmlParserCtxtPtr ctxt; /* an XML parser context */
12668 int n_ctxt;
12669
12670 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12671 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012672 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012673
12674 xmlClearParserCtxt(ctxt);
12675 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012676 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012677 xmlResetLastError();
12678 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012679 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012681 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012682 printf(" %d", n_ctxt);
12683 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012684 }
12685 }
12686
Daniel Veillard3d97e662004-11-04 10:49:00 +000012687 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012689}
12690
12691
12692static int
12693test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012695
Daniel Veillard34099b42004-11-04 17:34:35 +000012696 int mem_base;
12697 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012698 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012699 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012700
Daniel Veillard34099b42004-11-04 17:34:35 +000012701 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12702 mem_base = xmlMemBlocks();
12703 cur = gen_const_xmlChar_ptr(n_cur, 0);
12704
12705 ret_val = xmlCreateDocParserCtxt(cur);
12706 desret_xmlParserCtxtPtr(ret_val);
12707 call_tests++;
12708 des_const_xmlChar_ptr(n_cur, cur, 0);
12709 xmlResetLastError();
12710 if (mem_base != xmlMemBlocks()) {
12711 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12712 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012713 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012714 printf(" %d", n_cur);
12715 printf("\n");
12716 }
12717 }
12718
12719 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012720 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012721}
12722
12723
12724static int
12725test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012726 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012727
Daniel Veillard34099b42004-11-04 17:34:35 +000012728#ifdef LIBXML_PUSH_ENABLED
12729 int mem_base;
12730 xmlParserCtxtPtr ret_val;
12731 xmlSAXHandlerPtr sax; /* a SAX handler */
12732 int n_sax;
12733 void * user_data; /* The user data returned on SAX callbacks */
12734 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012735 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012736 int n_chunk;
12737 int size; /* number of chars in the array */
12738 int n_size;
12739 const char * filename; /* an optional file name or URI */
12740 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012741
Daniel Veillard34099b42004-11-04 17:34:35 +000012742 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12743 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12744 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12745 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012746 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012747 mem_base = xmlMemBlocks();
12748 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12749 user_data = gen_userdata(n_user_data, 1);
12750 chunk = gen_const_char_ptr(n_chunk, 2);
12751 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012752 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012753
12754 ret_val = xmlCreatePushParserCtxt(sax, user_data, chunk, size, filename);
12755 desret_xmlParserCtxtPtr(ret_val);
12756 call_tests++;
12757 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12758 des_userdata(n_user_data, user_data, 1);
12759 des_const_char_ptr(n_chunk, chunk, 2);
12760 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012761 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012762 xmlResetLastError();
12763 if (mem_base != xmlMemBlocks()) {
12764 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12765 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012766 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012767 printf(" %d", n_sax);
12768 printf(" %d", n_user_data);
12769 printf(" %d", n_chunk);
12770 printf(" %d", n_size);
12771 printf(" %d", n_filename);
12772 printf("\n");
12773 }
12774 }
12775 }
12776 }
12777 }
12778 }
12779#endif
12780
12781 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012783}
12784
12785
12786static int
12787test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012789
12790 int mem_base;
12791 xmlDocPtr ret_val;
12792 xmlParserCtxtPtr ctxt; /* an XML parser context */
12793 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012794 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012795 int n_cur;
12796 const char * URL; /* the base URL to use for the document */
12797 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012798 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012799 int n_encoding;
12800 int options; /* a combination of xmlParserOption */
12801 int n_options;
12802
12803 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12804 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12805 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12806 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12807 for (n_options = 0;n_options < gen_nb_int;n_options++) {
12808 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012809 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12810 cur = gen_const_xmlChar_ptr(n_cur, 1);
12811 URL = gen_filepath(n_URL, 2);
12812 encoding = gen_const_char_ptr(n_encoding, 3);
12813 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012814
12815 ret_val = xmlCtxtReadDoc(ctxt, cur, URL, encoding, options);
12816 desret_xmlDocPtr(ret_val);
12817 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012818 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12819 des_const_xmlChar_ptr(n_cur, cur, 1);
12820 des_filepath(n_URL, URL, 2);
12821 des_const_char_ptr(n_encoding, encoding, 3);
12822 des_int(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012823 xmlResetLastError();
12824 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012825 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012827 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012828 printf(" %d", n_ctxt);
12829 printf(" %d", n_cur);
12830 printf(" %d", n_URL);
12831 printf(" %d", n_encoding);
12832 printf(" %d", n_options);
12833 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012834 }
12835 }
12836 }
12837 }
12838 }
12839 }
12840
Daniel Veillard3d97e662004-11-04 10:49:00 +000012841 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012842 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012843}
12844
12845
12846static int
12847test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012848 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012849
12850 int mem_base;
12851 xmlDocPtr ret_val;
12852 xmlParserCtxtPtr ctxt; /* an XML parser context */
12853 int n_ctxt;
12854 const char * filename; /* a file or URL */
12855 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012856 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012857 int n_encoding;
12858 int options; /* a combination of xmlParserOption */
12859 int n_options;
12860
12861 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12862 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12863 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12864 for (n_options = 0;n_options < gen_nb_int;n_options++) {
12865 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012866 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12867 filename = gen_filepath(n_filename, 1);
12868 encoding = gen_const_char_ptr(n_encoding, 2);
12869 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012870
12871 ret_val = xmlCtxtReadFile(ctxt, filename, encoding, options);
12872 desret_xmlDocPtr(ret_val);
12873 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012874 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12875 des_filepath(n_filename, filename, 1);
12876 des_const_char_ptr(n_encoding, encoding, 2);
12877 des_int(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012878 xmlResetLastError();
12879 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012880 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012881 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012882 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012883 printf(" %d", n_ctxt);
12884 printf(" %d", n_filename);
12885 printf(" %d", n_encoding);
12886 printf(" %d", n_options);
12887 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012888 }
12889 }
12890 }
12891 }
12892 }
12893
Daniel Veillard3d97e662004-11-04 10:49:00 +000012894 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012895 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012896}
12897
12898
12899static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012900test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012902
12903 int mem_base;
12904 xmlDocPtr ret_val;
12905 xmlParserCtxtPtr ctxt; /* an XML parser context */
12906 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012907 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012908 int n_buffer;
12909 int size; /* the size of the array */
12910 int n_size;
12911 const char * URL; /* the base URL to use for the document */
12912 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012913 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012914 int n_encoding;
12915 int options; /* a combination of xmlParserOption */
12916 int n_options;
12917
12918 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12919 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12920 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12921 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12922 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12923 for (n_options = 0;n_options < gen_nb_int;n_options++) {
12924 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012925 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12926 buffer = gen_const_char_ptr(n_buffer, 1);
12927 size = gen_int(n_size, 2);
12928 URL = gen_filepath(n_URL, 3);
12929 encoding = gen_const_char_ptr(n_encoding, 4);
12930 options = gen_int(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012931
12932 ret_val = xmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options);
12933 desret_xmlDocPtr(ret_val);
12934 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012935 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12936 des_const_char_ptr(n_buffer, buffer, 1);
12937 des_int(n_size, size, 2);
12938 des_filepath(n_URL, URL, 3);
12939 des_const_char_ptr(n_encoding, encoding, 4);
12940 des_int(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012941 xmlResetLastError();
12942 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012943 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012945 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012946 printf(" %d", n_ctxt);
12947 printf(" %d", n_buffer);
12948 printf(" %d", n_size);
12949 printf(" %d", n_URL);
12950 printf(" %d", n_encoding);
12951 printf(" %d", n_options);
12952 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012953 }
12954 }
12955 }
12956 }
12957 }
12958 }
12959 }
12960
Daniel Veillard3d97e662004-11-04 10:49:00 +000012961 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012963}
12964
12965
12966static int
12967test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012969
12970 int mem_base;
12971 xmlParserCtxtPtr ctxt; /* an XML parser context */
12972 int n_ctxt;
12973
12974 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12975 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012976 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012977
12978 xmlCtxtReset(ctxt);
12979 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012980 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012981 xmlResetLastError();
12982 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012983 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012985 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012986 printf(" %d", n_ctxt);
12987 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012988 }
12989 }
12990
Daniel Veillard3d97e662004-11-04 10:49:00 +000012991 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012992 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012993}
12994
12995
12996static int
12997test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012998 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012999
13000 int mem_base;
13001 int ret_val;
13002 xmlParserCtxtPtr ctxt; /* an XML parser context */
13003 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013004 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013005 int n_chunk;
13006 int size; /* number of chars in the array */
13007 int n_size;
13008 const char * filename; /* an optional file name or URI */
13009 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013010 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013011 int n_encoding;
13012
13013 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13014 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13015 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13016 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13017 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
13018 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013019 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13020 chunk = gen_const_char_ptr(n_chunk, 1);
13021 size = gen_int(n_size, 2);
13022 filename = gen_filepath(n_filename, 3);
13023 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013024
13025 ret_val = xmlCtxtResetPush(ctxt, chunk, size, filename, encoding);
13026 desret_int(ret_val);
13027 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013028 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13029 des_const_char_ptr(n_chunk, chunk, 1);
13030 des_int(n_size, size, 2);
13031 des_filepath(n_filename, filename, 3);
13032 des_const_char_ptr(n_encoding, encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013033 xmlResetLastError();
13034 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013035 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013037 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013038 printf(" %d", n_ctxt);
13039 printf(" %d", n_chunk);
13040 printf(" %d", n_size);
13041 printf(" %d", n_filename);
13042 printf(" %d", n_encoding);
13043 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013044 }
13045 }
13046 }
13047 }
13048 }
13049 }
13050
Daniel Veillard3d97e662004-11-04 10:49:00 +000013051 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013053}
13054
13055
13056static int
13057test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013058 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013059
13060 int mem_base;
13061 int ret_val;
13062 xmlParserCtxtPtr ctxt; /* an XML parser context */
13063 int n_ctxt;
13064 int options; /* a combination of xmlParserOption */
13065 int n_options;
13066
13067 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13068 for (n_options = 0;n_options < gen_nb_int;n_options++) {
13069 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013070 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13071 options = gen_int(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013072
13073 ret_val = xmlCtxtUseOptions(ctxt, options);
13074 desret_int(ret_val);
13075 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013076 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13077 des_int(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013078 xmlResetLastError();
13079 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013080 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013081 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013082 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013083 printf(" %d", n_ctxt);
13084 printf(" %d", n_options);
13085 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013086 }
13087 }
13088 }
13089
Daniel Veillard3d97e662004-11-04 10:49:00 +000013090 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013092}
13093
13094
13095static int
13096test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013098
13099
13100 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000013101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013102}
13103
13104
13105static int
13106test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013108
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013109 int mem_base;
13110 int ret_val;
13111 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
13112 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013113 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013114 int n_name;
13115 void * result; /* location to store the result */
13116 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013117
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013118 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13119 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
13120 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
13121 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013122 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13123 name = gen_const_char_ptr(n_name, 1);
13124 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013125
13126 ret_val = xmlGetFeature(ctxt, name, result);
13127 desret_int(ret_val);
13128 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013129 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13130 des_const_char_ptr(n_name, name, 1);
13131 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013132 xmlResetLastError();
13133 if (mem_base != xmlMemBlocks()) {
13134 printf("Leak of %d blocks found in xmlGetFeature",
13135 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013136 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013137 printf(" %d", n_ctxt);
13138 printf(" %d", n_name);
13139 printf(" %d", n_result);
13140 printf("\n");
13141 }
13142 }
13143 }
13144 }
13145
Daniel Veillard3d97e662004-11-04 10:49:00 +000013146 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013148}
13149
13150
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013151#define gen_nb_const_char_ptr_ptr 1
13152static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13153 return(NULL);
13154}
13155static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13156}
13157
Daniel Veillardd93f6252004-11-02 15:53:51 +000013158static int
13159test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013161
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013162 int mem_base;
13163 int ret_val;
13164 int * len; /* the length of the features name array (input/output) */
13165 int n_len;
13166 char ** result; /* an array of string to be filled with the features name. */
13167 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013168
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013169 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
13170 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
13171 mem_base = xmlMemBlocks();
13172 len = gen_int_ptr(n_len, 0);
13173 result = gen_const_char_ptr_ptr(n_result, 1);
13174
13175 ret_val = xmlGetFeaturesList(len, result);
13176 desret_int(ret_val);
13177 call_tests++;
13178 des_int_ptr(n_len, len, 0);
13179 des_const_char_ptr_ptr(n_result, result, 1);
13180 xmlResetLastError();
13181 if (mem_base != xmlMemBlocks()) {
13182 printf("Leak of %d blocks found in xmlGetFeaturesList",
13183 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013184 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013185 printf(" %d", n_len);
13186 printf(" %d", n_result);
13187 printf("\n");
13188 }
13189 }
13190 }
13191
13192 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013194}
13195
13196
13197static int
13198test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013200
Daniel Veillard34099b42004-11-04 17:34:35 +000013201 int mem_base;
13202 xmlDtdPtr ret_val;
13203 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
13204 int n_sax;
13205 xmlParserInputBufferPtr input; /* an Input Buffer */
13206 int n_input;
13207 xmlCharEncoding enc; /* the charset encoding if known */
13208 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013209
Daniel Veillard34099b42004-11-04 17:34:35 +000013210 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13211 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13212 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13213 mem_base = xmlMemBlocks();
13214 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
13215 input = gen_xmlParserInputBufferPtr(n_input, 1);
13216 enc = gen_xmlCharEncoding(n_enc, 2);
13217
13218 ret_val = xmlIOParseDTD(sax, input, enc);
13219 input = NULL;
13220 desret_xmlDtdPtr(ret_val);
13221 call_tests++;
13222 des_xmlSAXHandlerPtr(n_sax, sax, 0);
13223 des_xmlParserInputBufferPtr(n_input, input, 1);
13224 des_xmlCharEncoding(n_enc, enc, 2);
13225 xmlResetLastError();
13226 if (mem_base != xmlMemBlocks()) {
13227 printf("Leak of %d blocks found in xmlIOParseDTD",
13228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013229 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013230 printf(" %d", n_sax);
13231 printf(" %d", n_input);
13232 printf(" %d", n_enc);
13233 printf("\n");
13234 }
13235 }
13236 }
13237 }
13238
13239 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013241}
13242
13243
13244static int
13245test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013247
Daniel Veillardce682bc2004-11-05 17:22:25 +000013248 int mem_base;
13249 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13250 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013251
Daniel Veillardce682bc2004-11-05 17:22:25 +000013252 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13253 mem_base = xmlMemBlocks();
13254 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13255
13256 xmlInitNodeInfoSeq(seq);
13257 call_tests++;
13258 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13259 xmlResetLastError();
13260 if (mem_base != xmlMemBlocks()) {
13261 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13262 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013263 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013264 printf(" %d", n_seq);
13265 printf("\n");
13266 }
13267 }
13268
13269 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013271}
13272
13273
13274static int
13275test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013277
13278 int mem_base;
13279
13280 mem_base = xmlMemBlocks();
13281
13282 xmlInitParser();
13283 call_tests++;
13284 xmlResetLastError();
13285 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013286 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013287 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013288 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013289 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013290 }
13291
Daniel Veillard3d97e662004-11-04 10:49:00 +000013292 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013293 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013294}
13295
13296
13297static int
13298test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013300
13301 int mem_base;
13302 int ret_val;
13303 xmlParserCtxtPtr ctxt; /* an XML parser context */
13304 int n_ctxt;
13305
13306 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13307 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013308 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013309
13310 ret_val = xmlInitParserCtxt(ctxt);
13311 desret_int(ret_val);
13312 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013313 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013314 xmlResetLastError();
13315 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013316 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013317 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013318 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013319 printf(" %d", n_ctxt);
13320 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013321 }
13322 }
13323
Daniel Veillard3d97e662004-11-04 10:49:00 +000013324 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013325 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013326}
13327
13328
13329static int
13330test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013331 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013332
13333 int mem_base;
13334 int ret_val;
13335 int val; /* int 0 or 1 */
13336 int n_val;
13337
13338 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13339 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013340 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013341
13342 ret_val = xmlKeepBlanksDefault(val);
13343 desret_int(ret_val);
13344 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013345 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013346 xmlResetLastError();
13347 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013348 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013350 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013351 printf(" %d", n_val);
13352 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013353 }
13354 }
13355
Daniel Veillard3d97e662004-11-04 10:49:00 +000013356 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013358}
13359
13360
13361static int
13362test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013364
13365 int mem_base;
13366 int ret_val;
13367 int val; /* int 0 or 1 */
13368 int n_val;
13369
13370 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13371 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013372 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013373
13374 ret_val = xmlLineNumbersDefault(val);
13375 desret_int(ret_val);
13376 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013377 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013378 xmlResetLastError();
13379 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013380 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013382 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013383 printf(" %d", n_val);
13384 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013385 }
13386 }
13387
Daniel Veillard3d97e662004-11-04 10:49:00 +000013388 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013390}
13391
13392
13393static int
13394test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013395 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013396
Daniel Veillard42595322004-11-08 10:52:06 +000013397 int mem_base;
13398 xmlParserInputPtr ret_val;
13399 const char * URL; /* the URL for the entity to load */
13400 int n_URL;
13401 char * ID; /* the Public ID for the entity to load */
13402 int n_ID;
13403 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13404 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013405
Daniel Veillard42595322004-11-08 10:52:06 +000013406 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13407 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13408 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13409 mem_base = xmlMemBlocks();
13410 URL = gen_filepath(n_URL, 0);
13411 ID = gen_const_char_ptr(n_ID, 1);
13412 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13413
13414 ret_val = xmlLoadExternalEntity(URL, ID, ctxt);
13415 desret_xmlParserInputPtr(ret_val);
13416 call_tests++;
13417 des_filepath(n_URL, URL, 0);
13418 des_const_char_ptr(n_ID, ID, 1);
13419 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13420 xmlResetLastError();
13421 if (mem_base != xmlMemBlocks()) {
13422 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13423 xmlMemBlocks() - mem_base);
13424 test_ret++;
13425 printf(" %d", n_URL);
13426 printf(" %d", n_ID);
13427 printf(" %d", n_ctxt);
13428 printf("\n");
13429 }
13430 }
13431 }
13432 }
13433
13434 function_tests++;
13435 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013436}
13437
13438
13439static int
13440test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013441 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013442
Daniel Veillard42595322004-11-08 10:52:06 +000013443 int mem_base;
13444 xmlParserInputPtr ret_val;
13445 xmlParserCtxtPtr ctxt; /* an XML parser context */
13446 int n_ctxt;
13447 xmlParserInputBufferPtr input; /* an I/O Input */
13448 int n_input;
13449 xmlCharEncoding enc; /* the charset encoding if known */
13450 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013451
Daniel Veillard42595322004-11-08 10:52:06 +000013452 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13453 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13454 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13455 mem_base = xmlMemBlocks();
13456 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13457 input = gen_xmlParserInputBufferPtr(n_input, 1);
13458 enc = gen_xmlCharEncoding(n_enc, 2);
13459
13460 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13461 if (ret_val != NULL) input = NULL;
13462 desret_xmlParserInputPtr(ret_val);
13463 call_tests++;
13464 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13465 des_xmlParserInputBufferPtr(n_input, input, 1);
13466 des_xmlCharEncoding(n_enc, enc, 2);
13467 xmlResetLastError();
13468 if (mem_base != xmlMemBlocks()) {
13469 printf("Leak of %d blocks found in xmlNewIOInputStream",
13470 xmlMemBlocks() - mem_base);
13471 test_ret++;
13472 printf(" %d", n_ctxt);
13473 printf(" %d", n_input);
13474 printf(" %d", n_enc);
13475 printf("\n");
13476 }
13477 }
13478 }
13479 }
13480
13481 function_tests++;
13482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013483}
13484
13485
13486static int
13487test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013489
Daniel Veillard34099b42004-11-04 17:34:35 +000013490 int mem_base;
13491 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013492
Daniel Veillard34099b42004-11-04 17:34:35 +000013493 mem_base = xmlMemBlocks();
13494
13495 ret_val = xmlNewParserCtxt();
13496 desret_xmlParserCtxtPtr(ret_val);
13497 call_tests++;
13498 xmlResetLastError();
13499 if (mem_base != xmlMemBlocks()) {
13500 printf("Leak of %d blocks found in xmlNewParserCtxt",
13501 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013502 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013503 printf("\n");
13504 }
13505
13506 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013508}
13509
13510
Daniel Veillardce682bc2004-11-05 17:22:25 +000013511#define gen_nb_xmlNodePtr_ptr 1
13512static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13513 return(NULL);
13514}
13515static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13516}
13517
Daniel Veillardd93f6252004-11-02 15:53:51 +000013518static int
13519test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013520 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013521
Daniel Veillardce682bc2004-11-05 17:22:25 +000013522 int mem_base;
13523 int ret_val;
13524 xmlDocPtr doc; /* the document the chunk pertains to */
13525 int n_doc;
13526 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13527 int n_sax;
13528 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13529 int n_user_data;
13530 int depth; /* Used for loop detection, use 0 */
13531 int n_depth;
13532 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13533 int n_string;
13534 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13535 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013536
Daniel Veillardce682bc2004-11-05 17:22:25 +000013537 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13538 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13539 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13540 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13541 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13542 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13543 mem_base = xmlMemBlocks();
13544 doc = gen_xmlDocPtr(n_doc, 0);
13545 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13546 user_data = gen_userdata(n_user_data, 2);
13547 depth = gen_int(n_depth, 3);
13548 string = gen_const_xmlChar_ptr(n_string, 4);
13549 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13550 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
13551
13552 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, string, lst);
13553 desret_int(ret_val);
13554 call_tests++;
13555 des_xmlDocPtr(n_doc, doc, 0);
13556 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13557 des_userdata(n_user_data, user_data, 2);
13558 des_int(n_depth, depth, 3);
13559 des_const_xmlChar_ptr(n_string, string, 4);
13560 des_xmlNodePtr_ptr(n_lst, lst, 5);
13561 xmlResetLastError();
13562 if (mem_base != xmlMemBlocks()) {
13563 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13564 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013565 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013566 printf(" %d", n_doc);
13567 printf(" %d", n_sax);
13568 printf(" %d", n_user_data);
13569 printf(" %d", n_depth);
13570 printf(" %d", n_string);
13571 printf(" %d", n_lst);
13572 printf("\n");
13573 }
13574 }
13575 }
13576 }
13577 }
13578 }
13579 }
13580
13581 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013583}
13584
13585
13586static int
13587test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013589
Daniel Veillardce682bc2004-11-05 17:22:25 +000013590 int mem_base;
13591 int ret_val;
13592 xmlDocPtr doc; /* the document the chunk pertains to */
13593 int n_doc;
13594 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13595 int n_sax;
13596 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13597 int n_user_data;
13598 int depth; /* Used for loop detection, use 0 */
13599 int n_depth;
13600 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13601 int n_string;
13602 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13603 int n_lst;
13604 int recover; /* return nodes even if the data is broken (use 0) */
13605 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013606
Daniel Veillardce682bc2004-11-05 17:22:25 +000013607 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13608 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13609 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13610 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13611 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13612 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13613 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13614 mem_base = xmlMemBlocks();
13615 doc = gen_xmlDocPtr(n_doc, 0);
13616 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13617 user_data = gen_userdata(n_user_data, 2);
13618 depth = gen_int(n_depth, 3);
13619 string = gen_const_xmlChar_ptr(n_string, 4);
13620 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13621 recover = gen_int(n_recover, 6);
13622 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
13623
13624 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, string, lst, recover);
13625 desret_int(ret_val);
13626 call_tests++;
13627 des_xmlDocPtr(n_doc, doc, 0);
13628 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13629 des_userdata(n_user_data, user_data, 2);
13630 des_int(n_depth, depth, 3);
13631 des_const_xmlChar_ptr(n_string, string, 4);
13632 des_xmlNodePtr_ptr(n_lst, lst, 5);
13633 des_int(n_recover, recover, 6);
13634 xmlResetLastError();
13635 if (mem_base != xmlMemBlocks()) {
13636 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13637 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013638 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013639 printf(" %d", n_doc);
13640 printf(" %d", n_sax);
13641 printf(" %d", n_user_data);
13642 printf(" %d", n_depth);
13643 printf(" %d", n_string);
13644 printf(" %d", n_lst);
13645 printf(" %d", n_recover);
13646 printf("\n");
13647 }
13648 }
13649 }
13650 }
13651 }
13652 }
13653 }
13654 }
13655
13656 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013657 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013658}
13659
13660
13661static int
13662test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013663 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013664
13665#ifdef LIBXML_PUSH_ENABLED
13666 int mem_base;
13667 int ret_val;
13668 xmlParserCtxtPtr ctxt; /* an XML parser context */
13669 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013670 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013671 int n_chunk;
13672 int size; /* the size in byte of the chunk */
13673 int n_size;
13674 int terminate; /* last chunk indicator */
13675 int n_terminate;
13676
13677 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13678 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13679 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13680 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13681 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013682 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13683 chunk = gen_const_char_ptr(n_chunk, 1);
13684 size = gen_int(n_size, 2);
13685 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013686
13687 ret_val = xmlParseChunk(ctxt, chunk, size, terminate);
13688 desret_int(ret_val);
13689 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013690 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13691 des_const_char_ptr(n_chunk, chunk, 1);
13692 des_int(n_size, size, 2);
13693 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013694 xmlResetLastError();
13695 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013696 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013697 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013698 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013699 printf(" %d", n_ctxt);
13700 printf(" %d", n_chunk);
13701 printf(" %d", n_size);
13702 printf(" %d", n_terminate);
13703 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013704 }
13705 }
13706 }
13707 }
13708 }
13709#endif
13710
Daniel Veillard3d97e662004-11-04 10:49:00 +000013711 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013713}
13714
13715
13716static int
13717test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013719
Daniel Veillardce682bc2004-11-05 17:22:25 +000013720 int mem_base;
13721 int ret_val;
13722 xmlParserCtxtPtr ctx; /* the existing parsing context */
13723 int n_ctx;
13724 xmlChar * URL; /* the URL for the entity to load */
13725 int n_URL;
13726 xmlChar * ID; /* the System ID for the entity to load */
13727 int n_ID;
13728 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13729 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013730
Daniel Veillardce682bc2004-11-05 17:22:25 +000013731 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13732 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13733 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13734 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13735 mem_base = xmlMemBlocks();
13736 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13737 URL = gen_const_xmlChar_ptr(n_URL, 1);
13738 ID = gen_const_xmlChar_ptr(n_ID, 2);
13739 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13740
13741 ret_val = xmlParseCtxtExternalEntity(ctx, URL, ID, lst);
13742 desret_int(ret_val);
13743 call_tests++;
13744 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
13745 des_const_xmlChar_ptr(n_URL, URL, 1);
13746 des_const_xmlChar_ptr(n_ID, ID, 2);
13747 des_xmlNodePtr_ptr(n_lst, lst, 3);
13748 xmlResetLastError();
13749 if (mem_base != xmlMemBlocks()) {
13750 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013752 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013753 printf(" %d", n_ctx);
13754 printf(" %d", n_URL);
13755 printf(" %d", n_ID);
13756 printf(" %d", n_lst);
13757 printf("\n");
13758 }
13759 }
13760 }
13761 }
13762 }
13763
13764 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013766}
13767
13768
13769static int
13770test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013772
Daniel Veillard34099b42004-11-04 17:34:35 +000013773 int mem_base;
13774 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013775 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013776 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013777 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013778 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013779
Daniel Veillard34099b42004-11-04 17:34:35 +000013780 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13781 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13782 mem_base = xmlMemBlocks();
13783 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13784 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13785
13786 ret_val = xmlParseDTD(ExternalID, SystemID);
13787 desret_xmlDtdPtr(ret_val);
13788 call_tests++;
13789 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 0);
13790 des_const_xmlChar_ptr(n_SystemID, SystemID, 1);
13791 xmlResetLastError();
13792 if (mem_base != xmlMemBlocks()) {
13793 printf("Leak of %d blocks found in xmlParseDTD",
13794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013795 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013796 printf(" %d", n_ExternalID);
13797 printf(" %d", n_SystemID);
13798 printf("\n");
13799 }
13800 }
13801 }
13802
13803 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013804 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013805}
13806
13807
13808static int
13809test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013810 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013811
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013812 int mem_base;
13813 xmlDocPtr ret_val;
13814 xmlChar * cur; /* a pointer to an array of xmlChar */
13815 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013816
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013817 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
13818 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013819 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013820
13821 ret_val = xmlParseDoc(cur);
13822 desret_xmlDocPtr(ret_val);
13823 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013824 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013825 xmlResetLastError();
13826 if (mem_base != xmlMemBlocks()) {
13827 printf("Leak of %d blocks found in xmlParseDoc",
13828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013829 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013830 printf(" %d", n_cur);
13831 printf("\n");
13832 }
13833 }
13834
Daniel Veillard3d97e662004-11-04 10:49:00 +000013835 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013837}
13838
13839
13840static int
13841test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013843
13844 int mem_base;
13845 int ret_val;
13846 xmlParserCtxtPtr ctxt; /* an XML parser context */
13847 int n_ctxt;
13848
13849 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13850 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013851 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013852
13853 ret_val = xmlParseDocument(ctxt);
13854 desret_int(ret_val);
13855 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013856 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013857 xmlResetLastError();
13858 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013859 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013861 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013862 printf(" %d", n_ctxt);
13863 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013864 }
13865 }
13866
Daniel Veillard3d97e662004-11-04 10:49:00 +000013867 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013869}
13870
13871
13872static int
13873test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013875
13876 int mem_base;
13877 xmlDocPtr ret_val;
13878 const char * filename; /* the filename */
13879 int n_filename;
13880
13881 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13882 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013883 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013884
13885 ret_val = xmlParseEntity(filename);
13886 desret_xmlDocPtr(ret_val);
13887 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013888 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013889 xmlResetLastError();
13890 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013891 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013893 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013894 printf(" %d", n_filename);
13895 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013896 }
13897 }
13898
Daniel Veillard3d97e662004-11-04 10:49:00 +000013899 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013900 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013901}
13902
13903
13904static int
13905test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013907
13908 int mem_base;
13909 int ret_val;
13910 xmlParserCtxtPtr ctxt; /* an XML parser context */
13911 int n_ctxt;
13912
13913 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13914 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013915 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013916
13917 ret_val = xmlParseExtParsedEnt(ctxt);
13918 desret_int(ret_val);
13919 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013920 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013921 xmlResetLastError();
13922 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013923 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013924 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013925 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013926 printf(" %d", n_ctxt);
13927 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013928 }
13929 }
13930
Daniel Veillard3d97e662004-11-04 10:49:00 +000013931 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013932 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013933}
13934
13935
13936static int
13937test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013938 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013939
Daniel Veillardce682bc2004-11-05 17:22:25 +000013940 int mem_base;
13941 int ret_val;
13942 xmlDocPtr doc; /* the document the chunk pertains to */
13943 int n_doc;
13944 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13945 int n_sax;
13946 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13947 int n_user_data;
13948 int depth; /* Used for loop detection, use 0 */
13949 int n_depth;
13950 xmlChar * URL; /* the URL for the entity to load */
13951 int n_URL;
13952 xmlChar * ID; /* the System ID for the entity to load */
13953 int n_ID;
13954 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13955 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013956
Daniel Veillardce682bc2004-11-05 17:22:25 +000013957 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13958 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13959 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13960 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13961 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13962 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13963 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13964 mem_base = xmlMemBlocks();
13965 doc = gen_xmlDocPtr(n_doc, 0);
13966 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13967 user_data = gen_userdata(n_user_data, 2);
13968 depth = gen_int(n_depth, 3);
13969 URL = gen_const_xmlChar_ptr(n_URL, 4);
13970 ID = gen_const_xmlChar_ptr(n_ID, 5);
13971 lst = gen_xmlNodePtr_ptr(n_lst, 6);
13972
13973 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, URL, ID, lst);
13974 desret_int(ret_val);
13975 call_tests++;
13976 des_xmlDocPtr(n_doc, doc, 0);
13977 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13978 des_userdata(n_user_data, user_data, 2);
13979 des_int(n_depth, depth, 3);
13980 des_const_xmlChar_ptr(n_URL, URL, 4);
13981 des_const_xmlChar_ptr(n_ID, ID, 5);
13982 des_xmlNodePtr_ptr(n_lst, lst, 6);
13983 xmlResetLastError();
13984 if (mem_base != xmlMemBlocks()) {
13985 printf("Leak of %d blocks found in xmlParseExternalEntity",
13986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013987 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013988 printf(" %d", n_doc);
13989 printf(" %d", n_sax);
13990 printf(" %d", n_user_data);
13991 printf(" %d", n_depth);
13992 printf(" %d", n_URL);
13993 printf(" %d", n_ID);
13994 printf(" %d", n_lst);
13995 printf("\n");
13996 }
13997 }
13998 }
13999 }
14000 }
14001 }
14002 }
14003 }
14004
14005 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014006 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014007}
14008
14009
14010static int
14011test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014012 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014013
14014 int mem_base;
14015 xmlDocPtr ret_val;
14016 const char * filename; /* the filename */
14017 int n_filename;
14018
14019 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14020 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014021 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014022
14023 ret_val = xmlParseFile(filename);
14024 desret_xmlDocPtr(ret_val);
14025 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014026 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014027 xmlResetLastError();
14028 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014029 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014030 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014031 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014032 printf(" %d", n_filename);
14033 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014034 }
14035 }
14036
Daniel Veillard3d97e662004-11-04 10:49:00 +000014037 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014039}
14040
14041
14042static int
14043test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014045
Daniel Veillard57b25162004-11-06 14:50:18 +000014046 int mem_base;
14047 xmlParserErrors ret_val;
14048 xmlNodePtr node; /* the context node */
14049 int n_node;
14050 char * data; /* the input string */
14051 int n_data;
14052 int datalen; /* the input string length in bytes */
14053 int n_datalen;
14054 int options; /* a combination of xmlParserOption */
14055 int n_options;
14056 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
14057 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014058
Daniel Veillard57b25162004-11-06 14:50:18 +000014059 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
14060 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
14061 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
14062 for (n_options = 0;n_options < gen_nb_int;n_options++) {
14063 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
14064 mem_base = xmlMemBlocks();
14065 node = gen_xmlNodePtr(n_node, 0);
14066 data = gen_const_char_ptr(n_data, 1);
14067 datalen = gen_int(n_datalen, 2);
14068 options = gen_int(n_options, 3);
14069 lst = gen_xmlNodePtr_ptr(n_lst, 4);
14070
14071 ret_val = xmlParseInNodeContext(node, data, datalen, options, lst);
14072 desret_xmlParserErrors(ret_val);
14073 call_tests++;
14074 des_xmlNodePtr(n_node, node, 0);
14075 des_const_char_ptr(n_data, data, 1);
14076 des_int(n_datalen, datalen, 2);
14077 des_int(n_options, options, 3);
14078 des_xmlNodePtr_ptr(n_lst, lst, 4);
14079 xmlResetLastError();
14080 if (mem_base != xmlMemBlocks()) {
14081 printf("Leak of %d blocks found in xmlParseInNodeContext",
14082 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014083 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000014084 printf(" %d", n_node);
14085 printf(" %d", n_data);
14086 printf(" %d", n_datalen);
14087 printf(" %d", n_options);
14088 printf(" %d", n_lst);
14089 printf("\n");
14090 }
14091 }
14092 }
14093 }
14094 }
14095 }
14096
14097 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014098 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014099}
14100
14101
14102static int
14103test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014105
14106 int mem_base;
14107 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014108 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014109 int n_buffer;
14110 int size; /* the size of the array */
14111 int n_size;
14112
14113 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14114 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14115 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014116 buffer = gen_const_char_ptr(n_buffer, 0);
14117 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014118
14119 ret_val = xmlParseMemory(buffer, size);
14120 desret_xmlDocPtr(ret_val);
14121 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014122 des_const_char_ptr(n_buffer, buffer, 0);
14123 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014124 xmlResetLastError();
14125 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014126 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014127 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014128 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014129 printf(" %d", n_buffer);
14130 printf(" %d", n_size);
14131 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014132 }
14133 }
14134 }
14135
Daniel Veillard3d97e662004-11-04 10:49:00 +000014136 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014137 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014138}
14139
14140
Daniel Veillardce682bc2004-11-05 17:22:25 +000014141#define gen_nb_const_xmlParserNodeInfoPtr 1
14142static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14143 return(NULL);
14144}
14145static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14146}
14147
Daniel Veillardd93f6252004-11-02 15:53:51 +000014148static int
14149test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014150 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014151
Daniel Veillardce682bc2004-11-05 17:22:25 +000014152 int mem_base;
14153 xmlParserCtxtPtr ctxt; /* an XML parser context */
14154 int n_ctxt;
14155 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
14156 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014157
Daniel Veillardce682bc2004-11-05 17:22:25 +000014158 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14159 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
14160 mem_base = xmlMemBlocks();
14161 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
14162 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
14163
14164 xmlParserAddNodeInfo(ctxt, info);
14165 call_tests++;
14166 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
14167 des_const_xmlParserNodeInfoPtr(n_info, info, 1);
14168 xmlResetLastError();
14169 if (mem_base != xmlMemBlocks()) {
14170 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
14171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014172 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014173 printf(" %d", n_ctxt);
14174 printf(" %d", n_info);
14175 printf("\n");
14176 }
14177 }
14178 }
14179
14180 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014182}
14183
14184
Daniel Veillardce682bc2004-11-05 17:22:25 +000014185#define gen_nb_const_xmlParserCtxtPtr 1
14186static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14187 return(NULL);
14188}
14189static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14190}
14191
Daniel Veillardd93f6252004-11-02 15:53:51 +000014192static int
14193test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014195
14196
14197 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000014198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014199}
14200
14201
Daniel Veillardce682bc2004-11-05 17:22:25 +000014202#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14203static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14204 return(NULL);
14205}
14206static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14207}
14208
Daniel Veillardd93f6252004-11-02 15:53:51 +000014209static int
14210test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014212
14213
14214 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000014215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014216}
14217
14218
Daniel Veillardce682bc2004-11-05 17:22:25 +000014219#define gen_nb_xmlParserInputPtr 1
14220static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14221 return(NULL);
14222}
14223static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14224}
14225
Daniel Veillardd93f6252004-11-02 15:53:51 +000014226static int
14227test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014229
Daniel Veillardce682bc2004-11-05 17:22:25 +000014230 int mem_base;
14231 int ret_val;
14232 xmlParserInputPtr in; /* an XML parser input */
14233 int n_in;
14234 int len; /* an indicative size for the lookahead */
14235 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014236
Daniel Veillardce682bc2004-11-05 17:22:25 +000014237 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14238 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14239 mem_base = xmlMemBlocks();
14240 in = gen_xmlParserInputPtr(n_in, 0);
14241 len = gen_int(n_len, 1);
14242
14243 ret_val = xmlParserInputGrow(in, len);
14244 desret_int(ret_val);
14245 call_tests++;
14246 des_xmlParserInputPtr(n_in, in, 0);
14247 des_int(n_len, len, 1);
14248 xmlResetLastError();
14249 if (mem_base != xmlMemBlocks()) {
14250 printf("Leak of %d blocks found in xmlParserInputGrow",
14251 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014252 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014253 printf(" %d", n_in);
14254 printf(" %d", n_len);
14255 printf("\n");
14256 }
14257 }
14258 }
14259
14260 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014262}
14263
14264
14265static int
14266test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014267 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014268
Daniel Veillardce682bc2004-11-05 17:22:25 +000014269 int mem_base;
14270 int ret_val;
14271 xmlParserInputPtr in; /* an XML parser input */
14272 int n_in;
14273 int len; /* an indicative size for the lookahead */
14274 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014275
Daniel Veillardce682bc2004-11-05 17:22:25 +000014276 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14277 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14278 mem_base = xmlMemBlocks();
14279 in = gen_xmlParserInputPtr(n_in, 0);
14280 len = gen_int(n_len, 1);
14281
14282 ret_val = xmlParserInputRead(in, len);
14283 desret_int(ret_val);
14284 call_tests++;
14285 des_xmlParserInputPtr(n_in, in, 0);
14286 des_int(n_len, len, 1);
14287 xmlResetLastError();
14288 if (mem_base != xmlMemBlocks()) {
14289 printf("Leak of %d blocks found in xmlParserInputRead",
14290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014291 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014292 printf(" %d", n_in);
14293 printf(" %d", n_len);
14294 printf("\n");
14295 }
14296 }
14297 }
14298
14299 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014300 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014301}
14302
14303
14304static int
14305test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014307
14308 int mem_base;
14309 int ret_val;
14310 int val; /* int 0 or 1 */
14311 int n_val;
14312
14313 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14314 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014315 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014316
14317 ret_val = xmlPedanticParserDefault(val);
14318 desret_int(ret_val);
14319 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014320 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014321 xmlResetLastError();
14322 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014323 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014324 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014325 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014326 printf(" %d", n_val);
14327 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014328 }
14329 }
14330
Daniel Veillard3d97e662004-11-04 10:49:00 +000014331 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014332 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014333}
14334
14335
14336static int
14337test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014338 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014339
14340 int mem_base;
14341 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014342 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014343 int n_cur;
14344 const char * URL; /* the base URL to use for the document */
14345 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014346 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014347 int n_encoding;
14348 int options; /* a combination of xmlParserOption */
14349 int n_options;
14350
14351 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14352 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14353 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
14354 for (n_options = 0;n_options < gen_nb_int;n_options++) {
14355 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014356 cur = gen_const_xmlChar_ptr(n_cur, 0);
14357 URL = gen_filepath(n_URL, 1);
14358 encoding = gen_const_char_ptr(n_encoding, 2);
14359 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014360
14361 ret_val = xmlReadDoc(cur, URL, encoding, options);
14362 desret_xmlDocPtr(ret_val);
14363 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014364 des_const_xmlChar_ptr(n_cur, cur, 0);
14365 des_filepath(n_URL, URL, 1);
14366 des_const_char_ptr(n_encoding, encoding, 2);
14367 des_int(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014368 xmlResetLastError();
14369 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014370 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014371 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014372 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014373 printf(" %d", n_cur);
14374 printf(" %d", n_URL);
14375 printf(" %d", n_encoding);
14376 printf(" %d", n_options);
14377 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014378 }
14379 }
14380 }
14381 }
14382 }
14383
Daniel Veillard3d97e662004-11-04 10:49:00 +000014384 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014385 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014386}
14387
14388
14389static int
14390test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014391 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014392
14393 int mem_base;
14394 xmlDocPtr ret_val;
14395 const char * filename; /* a file or URL */
14396 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014397 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014398 int n_encoding;
14399 int options; /* a combination of xmlParserOption */
14400 int n_options;
14401
14402 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14403 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
14404 for (n_options = 0;n_options < gen_nb_int;n_options++) {
14405 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014406 filename = gen_filepath(n_filename, 0);
14407 encoding = gen_const_char_ptr(n_encoding, 1);
14408 options = gen_int(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014409
14410 ret_val = xmlReadFile(filename, encoding, options);
14411 desret_xmlDocPtr(ret_val);
14412 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014413 des_filepath(n_filename, filename, 0);
14414 des_const_char_ptr(n_encoding, encoding, 1);
14415 des_int(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014416 xmlResetLastError();
14417 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014418 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014419 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014420 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014421 printf(" %d", n_filename);
14422 printf(" %d", n_encoding);
14423 printf(" %d", n_options);
14424 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014425 }
14426 }
14427 }
14428 }
14429
Daniel Veillard3d97e662004-11-04 10:49:00 +000014430 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014431 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014432}
14433
14434
14435static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014436test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014437 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014438
14439 int mem_base;
14440 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014441 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014442 int n_buffer;
14443 int size; /* the size of the array */
14444 int n_size;
14445 const char * URL; /* the base URL to use for the document */
14446 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014447 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014448 int n_encoding;
14449 int options; /* a combination of xmlParserOption */
14450 int n_options;
14451
14452 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14453 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14454 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14455 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
14456 for (n_options = 0;n_options < gen_nb_int;n_options++) {
14457 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014458 buffer = gen_const_char_ptr(n_buffer, 0);
14459 size = gen_int(n_size, 1);
14460 URL = gen_filepath(n_URL, 2);
14461 encoding = gen_const_char_ptr(n_encoding, 3);
14462 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014463
14464 ret_val = xmlReadMemory(buffer, size, URL, encoding, options);
14465 desret_xmlDocPtr(ret_val);
14466 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014467 des_const_char_ptr(n_buffer, buffer, 0);
14468 des_int(n_size, size, 1);
14469 des_filepath(n_URL, URL, 2);
14470 des_const_char_ptr(n_encoding, encoding, 3);
14471 des_int(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014472 xmlResetLastError();
14473 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014474 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014476 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014477 printf(" %d", n_buffer);
14478 printf(" %d", n_size);
14479 printf(" %d", n_URL);
14480 printf(" %d", n_encoding);
14481 printf(" %d", n_options);
14482 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014483 }
14484 }
14485 }
14486 }
14487 }
14488 }
14489
Daniel Veillard3d97e662004-11-04 10:49:00 +000014490 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014492}
14493
14494
14495static int
14496test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014498
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014499 int mem_base;
14500 xmlDocPtr ret_val;
14501 xmlChar * cur; /* a pointer to an array of xmlChar */
14502 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014503
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014504 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14505 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014506 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014507
14508 ret_val = xmlRecoverDoc(cur);
14509 desret_xmlDocPtr(ret_val);
14510 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014511 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014512 xmlResetLastError();
14513 if (mem_base != xmlMemBlocks()) {
14514 printf("Leak of %d blocks found in xmlRecoverDoc",
14515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014516 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014517 printf(" %d", n_cur);
14518 printf("\n");
14519 }
14520 }
14521
Daniel Veillard3d97e662004-11-04 10:49:00 +000014522 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014524}
14525
14526
14527static int
14528test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014530
14531 int mem_base;
14532 xmlDocPtr ret_val;
14533 const char * filename; /* the filename */
14534 int n_filename;
14535
14536 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14537 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014538 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014539
14540 ret_val = xmlRecoverFile(filename);
14541 desret_xmlDocPtr(ret_val);
14542 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014543 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014544 xmlResetLastError();
14545 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014546 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014548 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014549 printf(" %d", n_filename);
14550 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014551 }
14552 }
14553
Daniel Veillard3d97e662004-11-04 10:49:00 +000014554 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014555 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014556}
14557
14558
14559static int
14560test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014561 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014562
14563 int mem_base;
14564 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014565 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014566 int n_buffer;
14567 int size; /* the size of the array */
14568 int n_size;
14569
14570 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14571 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14572 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014573 buffer = gen_const_char_ptr(n_buffer, 0);
14574 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014575
14576 ret_val = xmlRecoverMemory(buffer, size);
14577 desret_xmlDocPtr(ret_val);
14578 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014579 des_const_char_ptr(n_buffer, buffer, 0);
14580 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014581 xmlResetLastError();
14582 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014583 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014584 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014585 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014586 printf(" %d", n_buffer);
14587 printf(" %d", n_size);
14588 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014589 }
14590 }
14591 }
14592
Daniel Veillard3d97e662004-11-04 10:49:00 +000014593 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014594 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014595}
14596
14597
14598static int
14599test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014600 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014601
Daniel Veillard34099b42004-11-04 17:34:35 +000014602 int mem_base;
14603 xmlDtdPtr ret_val;
14604 xmlSAXHandlerPtr sax; /* the SAX handler block */
14605 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014606 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014607 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014608 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014609 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014610
Daniel Veillard34099b42004-11-04 17:34:35 +000014611 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14612 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14613 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14614 mem_base = xmlMemBlocks();
14615 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14616 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14617 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14618
14619 ret_val = xmlSAXParseDTD(sax, ExternalID, SystemID);
14620 desret_xmlDtdPtr(ret_val);
14621 call_tests++;
14622 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14623 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
14624 des_const_xmlChar_ptr(n_SystemID, SystemID, 2);
14625 xmlResetLastError();
14626 if (mem_base != xmlMemBlocks()) {
14627 printf("Leak of %d blocks found in xmlSAXParseDTD",
14628 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014629 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014630 printf(" %d", n_sax);
14631 printf(" %d", n_ExternalID);
14632 printf(" %d", n_SystemID);
14633 printf("\n");
14634 }
14635 }
14636 }
14637 }
14638
14639 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014640 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014641}
14642
14643
14644static int
14645test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014647
Daniel Veillard34099b42004-11-04 17:34:35 +000014648 int mem_base;
14649 xmlDocPtr ret_val;
14650 xmlSAXHandlerPtr sax; /* the SAX handler block */
14651 int n_sax;
14652 xmlChar * cur; /* a pointer to an array of xmlChar */
14653 int n_cur;
14654 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14655 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014656
Daniel Veillard34099b42004-11-04 17:34:35 +000014657 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14658 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14659 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14660 mem_base = xmlMemBlocks();
14661 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14662 cur = gen_xmlChar_ptr(n_cur, 1);
14663 recovery = gen_int(n_recovery, 2);
14664
14665 ret_val = xmlSAXParseDoc(sax, cur, recovery);
14666 desret_xmlDocPtr(ret_val);
14667 call_tests++;
14668 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14669 des_xmlChar_ptr(n_cur, cur, 1);
14670 des_int(n_recovery, recovery, 2);
14671 xmlResetLastError();
14672 if (mem_base != xmlMemBlocks()) {
14673 printf("Leak of %d blocks found in xmlSAXParseDoc",
14674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014675 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014676 printf(" %d", n_sax);
14677 printf(" %d", n_cur);
14678 printf(" %d", n_recovery);
14679 printf("\n");
14680 }
14681 }
14682 }
14683 }
14684
14685 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014687}
14688
14689
14690static int
14691test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014693
Daniel Veillard34099b42004-11-04 17:34:35 +000014694 int mem_base;
14695 xmlDocPtr ret_val;
14696 xmlSAXHandlerPtr sax; /* the SAX handler block */
14697 int n_sax;
14698 const char * filename; /* the filename */
14699 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014700
Daniel Veillard34099b42004-11-04 17:34:35 +000014701 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14702 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14703 mem_base = xmlMemBlocks();
14704 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14705 filename = gen_filepath(n_filename, 1);
14706
14707 ret_val = xmlSAXParseEntity(sax, filename);
14708 desret_xmlDocPtr(ret_val);
14709 call_tests++;
14710 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14711 des_filepath(n_filename, filename, 1);
14712 xmlResetLastError();
14713 if (mem_base != xmlMemBlocks()) {
14714 printf("Leak of %d blocks found in xmlSAXParseEntity",
14715 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014716 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014717 printf(" %d", n_sax);
14718 printf(" %d", n_filename);
14719 printf("\n");
14720 }
14721 }
14722 }
14723
14724 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014725 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014726}
14727
14728
14729static int
14730test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014731 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014732
Daniel Veillard34099b42004-11-04 17:34:35 +000014733 int mem_base;
14734 xmlDocPtr ret_val;
14735 xmlSAXHandlerPtr sax; /* the SAX handler block */
14736 int n_sax;
14737 const char * filename; /* the filename */
14738 int n_filename;
14739 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14740 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014741
Daniel Veillard34099b42004-11-04 17:34:35 +000014742 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14743 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14744 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14745 mem_base = xmlMemBlocks();
14746 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14747 filename = gen_filepath(n_filename, 1);
14748 recovery = gen_int(n_recovery, 2);
14749
14750 ret_val = xmlSAXParseFile(sax, filename, recovery);
14751 desret_xmlDocPtr(ret_val);
14752 call_tests++;
14753 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14754 des_filepath(n_filename, filename, 1);
14755 des_int(n_recovery, recovery, 2);
14756 xmlResetLastError();
14757 if (mem_base != xmlMemBlocks()) {
14758 printf("Leak of %d blocks found in xmlSAXParseFile",
14759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014760 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014761 printf(" %d", n_sax);
14762 printf(" %d", n_filename);
14763 printf(" %d", n_recovery);
14764 printf("\n");
14765 }
14766 }
14767 }
14768 }
14769
14770 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014771 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014772}
14773
14774
14775static int
14776test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014777 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014778
Daniel Veillard34099b42004-11-04 17:34:35 +000014779 int mem_base;
14780 xmlDocPtr ret_val;
14781 xmlSAXHandlerPtr sax; /* the SAX handler block */
14782 int n_sax;
14783 const char * filename; /* the filename */
14784 int n_filename;
14785 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14786 int n_recovery;
14787 void * data; /* the userdata */
14788 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014789
Daniel Veillard34099b42004-11-04 17:34:35 +000014790 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14791 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14792 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14793 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14794 mem_base = xmlMemBlocks();
14795 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14796 filename = gen_filepath(n_filename, 1);
14797 recovery = gen_int(n_recovery, 2);
14798 data = gen_userdata(n_data, 3);
14799
14800 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
14801 desret_xmlDocPtr(ret_val);
14802 call_tests++;
14803 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14804 des_filepath(n_filename, filename, 1);
14805 des_int(n_recovery, recovery, 2);
14806 des_userdata(n_data, data, 3);
14807 xmlResetLastError();
14808 if (mem_base != xmlMemBlocks()) {
14809 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
14810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014811 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014812 printf(" %d", n_sax);
14813 printf(" %d", n_filename);
14814 printf(" %d", n_recovery);
14815 printf(" %d", n_data);
14816 printf("\n");
14817 }
14818 }
14819 }
14820 }
14821 }
14822
14823 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014824 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014825}
14826
14827
14828static int
14829test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014830 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014831
Daniel Veillard34099b42004-11-04 17:34:35 +000014832 int mem_base;
14833 xmlDocPtr ret_val;
14834 xmlSAXHandlerPtr sax; /* the SAX handler block */
14835 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014836 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014837 int n_buffer;
14838 int size; /* the size of the array */
14839 int n_size;
14840 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
14841 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014842
Daniel Veillard34099b42004-11-04 17:34:35 +000014843 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14844 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14845 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14846 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14847 mem_base = xmlMemBlocks();
14848 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14849 buffer = gen_const_char_ptr(n_buffer, 1);
14850 size = gen_int(n_size, 2);
14851 recovery = gen_int(n_recovery, 3);
14852
14853 ret_val = xmlSAXParseMemory(sax, buffer, size, recovery);
14854 desret_xmlDocPtr(ret_val);
14855 call_tests++;
14856 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14857 des_const_char_ptr(n_buffer, buffer, 1);
14858 des_int(n_size, size, 2);
14859 des_int(n_recovery, recovery, 3);
14860 xmlResetLastError();
14861 if (mem_base != xmlMemBlocks()) {
14862 printf("Leak of %d blocks found in xmlSAXParseMemory",
14863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014864 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014865 printf(" %d", n_sax);
14866 printf(" %d", n_buffer);
14867 printf(" %d", n_size);
14868 printf(" %d", n_recovery);
14869 printf("\n");
14870 }
14871 }
14872 }
14873 }
14874 }
14875
14876 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014877 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014878}
14879
14880
14881static int
14882test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014883 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014884
Daniel Veillard34099b42004-11-04 17:34:35 +000014885 int mem_base;
14886 xmlDocPtr ret_val;
14887 xmlSAXHandlerPtr sax; /* the SAX handler block */
14888 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014889 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014890 int n_buffer;
14891 int size; /* the size of the array */
14892 int n_size;
14893 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14894 int n_recovery;
14895 void * data; /* the userdata */
14896 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014897
Daniel Veillard34099b42004-11-04 17:34:35 +000014898 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14899 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14900 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14901 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14902 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14903 mem_base = xmlMemBlocks();
14904 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14905 buffer = gen_const_char_ptr(n_buffer, 1);
14906 size = gen_int(n_size, 2);
14907 recovery = gen_int(n_recovery, 3);
14908 data = gen_userdata(n_data, 4);
14909
14910 ret_val = xmlSAXParseMemoryWithData(sax, buffer, size, recovery, data);
14911 desret_xmlDocPtr(ret_val);
14912 call_tests++;
14913 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14914 des_const_char_ptr(n_buffer, buffer, 1);
14915 des_int(n_size, size, 2);
14916 des_int(n_recovery, recovery, 3);
14917 des_userdata(n_data, data, 4);
14918 xmlResetLastError();
14919 if (mem_base != xmlMemBlocks()) {
14920 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
14921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014922 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014923 printf(" %d", n_sax);
14924 printf(" %d", n_buffer);
14925 printf(" %d", n_size);
14926 printf(" %d", n_recovery);
14927 printf(" %d", n_data);
14928 printf("\n");
14929 }
14930 }
14931 }
14932 }
14933 }
14934 }
14935
14936 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014938}
14939
14940
14941static int
14942test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014944
Daniel Veillard34099b42004-11-04 17:34:35 +000014945 int mem_base;
14946 int ret_val;
14947 xmlSAXHandlerPtr sax; /* a SAX handler */
14948 int n_sax;
14949 void * user_data; /* The user data returned on SAX callbacks */
14950 int n_user_data;
14951 const char * filename; /* a file name */
14952 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014953
Daniel Veillard34099b42004-11-04 17:34:35 +000014954 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14955 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14956 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14957 mem_base = xmlMemBlocks();
14958 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14959 user_data = gen_userdata(n_user_data, 1);
14960 filename = gen_filepath(n_filename, 2);
Daniel Veillardce244ad2004-11-05 10:03:46 +000014961 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillard34099b42004-11-04 17:34:35 +000014962
14963 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
14964 desret_int(ret_val);
14965 call_tests++;
14966 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14967 des_userdata(n_user_data, user_data, 1);
14968 des_filepath(n_filename, filename, 2);
14969 xmlResetLastError();
14970 if (mem_base != xmlMemBlocks()) {
14971 printf("Leak of %d blocks found in xmlSAXUserParseFile",
14972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014973 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014974 printf(" %d", n_sax);
14975 printf(" %d", n_user_data);
14976 printf(" %d", n_filename);
14977 printf("\n");
14978 }
14979 }
14980 }
14981 }
14982
14983 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014985}
14986
14987
14988static int
14989test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014991
Daniel Veillard34099b42004-11-04 17:34:35 +000014992 int mem_base;
14993 int ret_val;
14994 xmlSAXHandlerPtr sax; /* a SAX handler */
14995 int n_sax;
14996 void * user_data; /* The user data returned on SAX callbacks */
14997 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014998 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000014999 int n_buffer;
15000 int size; /* the length of the XML document in bytes */
15001 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015002
Daniel Veillard34099b42004-11-04 17:34:35 +000015003 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15004 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
15005 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15006 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15007 mem_base = xmlMemBlocks();
15008 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15009 user_data = gen_userdata(n_user_data, 1);
15010 buffer = gen_const_char_ptr(n_buffer, 2);
15011 size = gen_int(n_size, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000015012 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillard34099b42004-11-04 17:34:35 +000015013
15014 ret_val = xmlSAXUserParseMemory(sax, user_data, buffer, size);
15015 desret_int(ret_val);
15016 call_tests++;
15017 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15018 des_userdata(n_user_data, user_data, 1);
15019 des_const_char_ptr(n_buffer, buffer, 2);
15020 des_int(n_size, size, 3);
15021 xmlResetLastError();
15022 if (mem_base != xmlMemBlocks()) {
15023 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
15024 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015025 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015026 printf(" %d", n_sax);
15027 printf(" %d", n_user_data);
15028 printf(" %d", n_buffer);
15029 printf(" %d", n_size);
15030 printf("\n");
15031 }
15032 }
15033 }
15034 }
15035 }
15036
15037 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015039}
15040
15041
15042static int
15043test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015045
15046
15047 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000015048 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015049}
15050
15051
15052static int
15053test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015054 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015055
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015056 int mem_base;
15057 int ret_val;
15058 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
15059 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015060 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015061 int n_name;
15062 void * value; /* pointer to the location of the new value */
15063 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015064
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015065 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15066 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15067 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15068 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015069 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15070 name = gen_const_char_ptr(n_name, 1);
15071 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015072
15073 ret_val = xmlSetFeature(ctxt, name, value);
15074 desret_int(ret_val);
15075 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015076 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15077 des_const_char_ptr(n_name, name, 1);
15078 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015079 xmlResetLastError();
15080 if (mem_base != xmlMemBlocks()) {
15081 printf("Leak of %d blocks found in xmlSetFeature",
15082 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015083 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015084 printf(" %d", n_ctxt);
15085 printf(" %d", n_name);
15086 printf(" %d", n_value);
15087 printf("\n");
15088 }
15089 }
15090 }
15091 }
15092
Daniel Veillard3d97e662004-11-04 10:49:00 +000015093 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015095}
15096
15097
15098static int
15099test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015101
15102 int mem_base;
15103 xmlParserCtxtPtr ctxt; /* an XML parser context */
15104 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015105 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015106 int n_buffer;
15107 const char * filename; /* a file name */
15108 int n_filename;
15109
15110 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15111 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15112 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15113 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015114 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15115 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15116 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015117
15118 xmlSetupParserForBuffer(ctxt, buffer, filename);
15119 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015120 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15121 des_const_xmlChar_ptr(n_buffer, buffer, 1);
15122 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015123 xmlResetLastError();
15124 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015125 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015126 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015127 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015128 printf(" %d", n_ctxt);
15129 printf(" %d", n_buffer);
15130 printf(" %d", n_filename);
15131 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015132 }
15133 }
15134 }
15135 }
15136
Daniel Veillard3d97e662004-11-04 10:49:00 +000015137 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015139}
15140
15141
15142static int
15143test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015145
15146 int mem_base;
15147 xmlParserCtxtPtr ctxt; /* an XML parser context */
15148 int n_ctxt;
15149
15150 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15151 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015152 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015153
15154 xmlStopParser(ctxt);
15155 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015156 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015157 xmlResetLastError();
15158 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015159 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015161 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015162 printf(" %d", n_ctxt);
15163 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015164 }
15165 }
15166
Daniel Veillard3d97e662004-11-04 10:49:00 +000015167 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015169}
15170
15171
15172static int
15173test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015175
15176 int mem_base;
15177 int ret_val;
15178 int val; /* int 0 or 1 */
15179 int n_val;
15180
15181 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15182 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015183 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015184
15185 ret_val = xmlSubstituteEntitiesDefault(val);
15186 desret_int(ret_val);
15187 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015188 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015189 xmlResetLastError();
15190 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015191 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015193 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015194 printf(" %d", n_val);
15195 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015196 }
15197 }
15198
Daniel Veillard3d97e662004-11-04 10:49:00 +000015199 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015200 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015201}
15202
15203static int
15204test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015205 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015206
Daniel Veillard42595322004-11-08 10:52:06 +000015207 printf("Testing parser : 58 of 69 functions ...\n");
15208 test_ret += test_xmlByteConsumed();
15209 test_ret += test_xmlClearNodeInfoSeq();
15210 test_ret += test_xmlClearParserCtxt();
15211 test_ret += test_xmlCreateDocParserCtxt();
15212 test_ret += test_xmlCreatePushParserCtxt();
15213 test_ret += test_xmlCtxtReadDoc();
15214 test_ret += test_xmlCtxtReadFile();
15215 test_ret += test_xmlCtxtReadMemory();
15216 test_ret += test_xmlCtxtReset();
15217 test_ret += test_xmlCtxtResetPush();
15218 test_ret += test_xmlCtxtUseOptions();
15219 test_ret += test_xmlGetExternalEntityLoader();
15220 test_ret += test_xmlGetFeature();
15221 test_ret += test_xmlGetFeaturesList();
15222 test_ret += test_xmlIOParseDTD();
15223 test_ret += test_xmlInitNodeInfoSeq();
15224 test_ret += test_xmlInitParser();
15225 test_ret += test_xmlInitParserCtxt();
15226 test_ret += test_xmlKeepBlanksDefault();
15227 test_ret += test_xmlLineNumbersDefault();
15228 test_ret += test_xmlLoadExternalEntity();
15229 test_ret += test_xmlNewIOInputStream();
15230 test_ret += test_xmlNewParserCtxt();
15231 test_ret += test_xmlParseBalancedChunkMemory();
15232 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15233 test_ret += test_xmlParseChunk();
15234 test_ret += test_xmlParseCtxtExternalEntity();
15235 test_ret += test_xmlParseDTD();
15236 test_ret += test_xmlParseDoc();
15237 test_ret += test_xmlParseDocument();
15238 test_ret += test_xmlParseEntity();
15239 test_ret += test_xmlParseExtParsedEnt();
15240 test_ret += test_xmlParseExternalEntity();
15241 test_ret += test_xmlParseFile();
15242 test_ret += test_xmlParseInNodeContext();
15243 test_ret += test_xmlParseMemory();
15244 test_ret += test_xmlParserAddNodeInfo();
15245 test_ret += test_xmlParserFindNodeInfo();
15246 test_ret += test_xmlParserFindNodeInfoIndex();
15247 test_ret += test_xmlParserInputGrow();
15248 test_ret += test_xmlParserInputRead();
15249 test_ret += test_xmlPedanticParserDefault();
15250 test_ret += test_xmlReadDoc();
15251 test_ret += test_xmlReadFile();
15252 test_ret += test_xmlReadMemory();
15253 test_ret += test_xmlRecoverDoc();
15254 test_ret += test_xmlRecoverFile();
15255 test_ret += test_xmlRecoverMemory();
15256 test_ret += test_xmlSAXParseDTD();
15257 test_ret += test_xmlSAXParseDoc();
15258 test_ret += test_xmlSAXParseEntity();
15259 test_ret += test_xmlSAXParseFile();
15260 test_ret += test_xmlSAXParseFileWithData();
15261 test_ret += test_xmlSAXParseMemory();
15262 test_ret += test_xmlSAXParseMemoryWithData();
15263 test_ret += test_xmlSAXUserParseFile();
15264 test_ret += test_xmlSAXUserParseMemory();
15265 test_ret += test_xmlSetExternalEntityLoader();
15266 test_ret += test_xmlSetFeature();
15267 test_ret += test_xmlSetupParserForBuffer();
15268 test_ret += test_xmlStopParser();
15269 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015270
Daniel Veillard42595322004-11-08 10:52:06 +000015271 if (test_ret != 0)
15272 printf("Module parser: %d errors\n", test_ret);
15273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015274}
15275
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015276static int
15277test_htmlCreateFileParserCtxt(void) {
15278 int test_ret = 0;
15279
15280#ifdef LIBXML_HTML_ENABLED
15281 int mem_base;
15282 htmlParserCtxtPtr ret_val;
15283 const char * filename; /* the filename */
15284 int n_filename;
15285 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15286 int n_encoding;
15287
15288 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15289 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15290 mem_base = xmlMemBlocks();
15291 filename = gen_fileoutput(n_filename, 0);
15292 encoding = gen_const_char_ptr(n_encoding, 1);
15293
15294 ret_val = htmlCreateFileParserCtxt(filename, encoding);
15295 desret_xmlParserCtxtPtr(ret_val);
15296 call_tests++;
15297 des_fileoutput(n_filename, filename, 0);
15298 des_const_char_ptr(n_encoding, encoding, 1);
15299 xmlResetLastError();
15300 if (mem_base != xmlMemBlocks()) {
15301 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15302 xmlMemBlocks() - mem_base);
15303 test_ret++;
15304 printf(" %d", n_filename);
15305 printf(" %d", n_encoding);
15306 printf("\n");
15307 }
15308 }
15309 }
15310#endif
15311
15312 function_tests++;
15313 return(test_ret);
15314}
15315
15316
15317static int
15318test_htmlInitAutoClose(void) {
15319 int test_ret = 0;
15320
15321#ifdef LIBXML_HTML_ENABLED
15322 int mem_base;
15323
15324 mem_base = xmlMemBlocks();
15325
15326 htmlInitAutoClose();
15327 call_tests++;
15328 xmlResetLastError();
15329 if (mem_base != xmlMemBlocks()) {
15330 printf("Leak of %d blocks found in htmlInitAutoClose",
15331 xmlMemBlocks() - mem_base);
15332 test_ret++;
15333 printf("\n");
15334 }
15335#endif
15336
15337 function_tests++;
15338 return(test_ret);
15339}
15340
15341
15342static int
15343test_inputPop(void) {
15344 int test_ret = 0;
15345
15346 int mem_base;
15347 xmlParserInputPtr ret_val;
15348 xmlParserCtxtPtr ctxt; /* an XML parser context */
15349 int n_ctxt;
15350
15351 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15352 mem_base = xmlMemBlocks();
15353 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15354
15355 ret_val = inputPop(ctxt);
15356 desret_xmlParserInputPtr(ret_val);
15357 call_tests++;
15358 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15359 xmlResetLastError();
15360 if (mem_base != xmlMemBlocks()) {
15361 printf("Leak of %d blocks found in inputPop",
15362 xmlMemBlocks() - mem_base);
15363 test_ret++;
15364 printf(" %d", n_ctxt);
15365 printf("\n");
15366 }
15367 }
15368
15369 function_tests++;
15370 return(test_ret);
15371}
15372
15373
15374static int
15375test_inputPush(void) {
15376 int test_ret = 0;
15377
15378 int mem_base;
15379 int ret_val;
15380 xmlParserCtxtPtr ctxt; /* an XML parser context */
15381 int n_ctxt;
15382 xmlParserInputPtr value; /* the parser input */
15383 int n_value;
15384
15385 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15386 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15387 mem_base = xmlMemBlocks();
15388 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15389 value = gen_xmlParserInputPtr(n_value, 1);
15390
15391 ret_val = inputPush(ctxt, value);
15392 desret_int(ret_val);
15393 call_tests++;
15394 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15395 des_xmlParserInputPtr(n_value, value, 1);
15396 xmlResetLastError();
15397 if (mem_base != xmlMemBlocks()) {
15398 printf("Leak of %d blocks found in inputPush",
15399 xmlMemBlocks() - mem_base);
15400 test_ret++;
15401 printf(" %d", n_ctxt);
15402 printf(" %d", n_value);
15403 printf("\n");
15404 }
15405 }
15406 }
15407
15408 function_tests++;
15409 return(test_ret);
15410}
15411
15412
15413static int
15414test_namePop(void) {
15415 int test_ret = 0;
15416
15417 int mem_base;
15418 const xmlChar * ret_val;
15419 xmlParserCtxtPtr ctxt; /* an XML parser context */
15420 int n_ctxt;
15421
15422 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15423 mem_base = xmlMemBlocks();
15424 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15425
15426 ret_val = namePop(ctxt);
15427 desret_const_xmlChar_ptr(ret_val);
15428 call_tests++;
15429 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15430 xmlResetLastError();
15431 if (mem_base != xmlMemBlocks()) {
15432 printf("Leak of %d blocks found in namePop",
15433 xmlMemBlocks() - mem_base);
15434 test_ret++;
15435 printf(" %d", n_ctxt);
15436 printf("\n");
15437 }
15438 }
15439
15440 function_tests++;
15441 return(test_ret);
15442}
15443
15444
15445static int
15446test_namePush(void) {
15447 int test_ret = 0;
15448
15449 int mem_base;
15450 int ret_val;
15451 xmlParserCtxtPtr ctxt; /* an XML parser context */
15452 int n_ctxt;
15453 xmlChar * value; /* the element name */
15454 int n_value;
15455
15456 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15457 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15458 mem_base = xmlMemBlocks();
15459 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15460 value = gen_const_xmlChar_ptr(n_value, 1);
15461
15462 ret_val = namePush(ctxt, value);
15463 desret_int(ret_val);
15464 call_tests++;
15465 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15466 des_const_xmlChar_ptr(n_value, value, 1);
15467 xmlResetLastError();
15468 if (mem_base != xmlMemBlocks()) {
15469 printf("Leak of %d blocks found in namePush",
15470 xmlMemBlocks() - mem_base);
15471 test_ret++;
15472 printf(" %d", n_ctxt);
15473 printf(" %d", n_value);
15474 printf("\n");
15475 }
15476 }
15477 }
15478
15479 function_tests++;
15480 return(test_ret);
15481}
15482
15483
15484static int
15485test_nodePop(void) {
15486 int test_ret = 0;
15487
15488 int mem_base;
15489 xmlNodePtr ret_val;
15490 xmlParserCtxtPtr ctxt; /* an XML parser context */
15491 int n_ctxt;
15492
15493 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15494 mem_base = xmlMemBlocks();
15495 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15496
15497 ret_val = nodePop(ctxt);
15498 desret_xmlNodePtr(ret_val);
15499 call_tests++;
15500 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15501 xmlResetLastError();
15502 if (mem_base != xmlMemBlocks()) {
15503 printf("Leak of %d blocks found in nodePop",
15504 xmlMemBlocks() - mem_base);
15505 test_ret++;
15506 printf(" %d", n_ctxt);
15507 printf("\n");
15508 }
15509 }
15510
15511 function_tests++;
15512 return(test_ret);
15513}
15514
15515
15516static int
15517test_nodePush(void) {
15518 int test_ret = 0;
15519
15520 int mem_base;
15521 int ret_val;
15522 xmlParserCtxtPtr ctxt; /* an XML parser context */
15523 int n_ctxt;
15524 xmlNodePtr value; /* the element node */
15525 int n_value;
15526
15527 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15528 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15529 mem_base = xmlMemBlocks();
15530 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15531 value = gen_xmlNodePtr(n_value, 1);
15532
15533 ret_val = nodePush(ctxt, value);
15534 desret_int(ret_val);
15535 call_tests++;
15536 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15537 des_xmlNodePtr(n_value, value, 1);
15538 xmlResetLastError();
15539 if (mem_base != xmlMemBlocks()) {
15540 printf("Leak of %d blocks found in nodePush",
15541 xmlMemBlocks() - mem_base);
15542 test_ret++;
15543 printf(" %d", n_ctxt);
15544 printf(" %d", n_value);
15545 printf("\n");
15546 }
15547 }
15548 }
15549
15550 function_tests++;
15551 return(test_ret);
15552}
15553
15554
15555static int
15556test_xmlCheckLanguageID(void) {
15557 int test_ret = 0;
15558
15559 int mem_base;
15560 int ret_val;
15561 xmlChar * lang; /* pointer to the string value */
15562 int n_lang;
15563
15564 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15565 mem_base = xmlMemBlocks();
15566 lang = gen_const_xmlChar_ptr(n_lang, 0);
15567
15568 ret_val = xmlCheckLanguageID(lang);
15569 desret_int(ret_val);
15570 call_tests++;
15571 des_const_xmlChar_ptr(n_lang, lang, 0);
15572 xmlResetLastError();
15573 if (mem_base != xmlMemBlocks()) {
15574 printf("Leak of %d blocks found in xmlCheckLanguageID",
15575 xmlMemBlocks() - mem_base);
15576 test_ret++;
15577 printf(" %d", n_lang);
15578 printf("\n");
15579 }
15580 }
15581
15582 function_tests++;
15583 return(test_ret);
15584}
15585
15586
15587static int
15588test_xmlCopyChar(void) {
15589 int test_ret = 0;
15590
15591 int mem_base;
15592 int ret_val;
15593 int len; /* Ignored, compatibility */
15594 int n_len;
15595 xmlChar * out; /* pointer to an array of xmlChar */
15596 int n_out;
15597 int val; /* the char value */
15598 int n_val;
15599
15600 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15601 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15602 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15603 mem_base = xmlMemBlocks();
15604 len = gen_int(n_len, 0);
15605 out = gen_xmlChar_ptr(n_out, 1);
15606 val = gen_int(n_val, 2);
15607
15608 ret_val = xmlCopyChar(len, out, val);
15609 desret_int(ret_val);
15610 call_tests++;
15611 des_int(n_len, len, 0);
15612 des_xmlChar_ptr(n_out, out, 1);
15613 des_int(n_val, val, 2);
15614 xmlResetLastError();
15615 if (mem_base != xmlMemBlocks()) {
15616 printf("Leak of %d blocks found in xmlCopyChar",
15617 xmlMemBlocks() - mem_base);
15618 test_ret++;
15619 printf(" %d", n_len);
15620 printf(" %d", n_out);
15621 printf(" %d", n_val);
15622 printf("\n");
15623 }
15624 }
15625 }
15626 }
15627
15628 function_tests++;
15629 return(test_ret);
15630}
15631
15632
15633static int
15634test_xmlCopyCharMultiByte(void) {
15635 int test_ret = 0;
15636
15637 int mem_base;
15638 int ret_val;
15639 xmlChar * out; /* pointer to an array of xmlChar */
15640 int n_out;
15641 int val; /* the char value */
15642 int n_val;
15643
15644 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15645 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15646 mem_base = xmlMemBlocks();
15647 out = gen_xmlChar_ptr(n_out, 0);
15648 val = gen_int(n_val, 1);
15649
15650 ret_val = xmlCopyCharMultiByte(out, val);
15651 desret_int(ret_val);
15652 call_tests++;
15653 des_xmlChar_ptr(n_out, out, 0);
15654 des_int(n_val, val, 1);
15655 xmlResetLastError();
15656 if (mem_base != xmlMemBlocks()) {
15657 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15658 xmlMemBlocks() - mem_base);
15659 test_ret++;
15660 printf(" %d", n_out);
15661 printf(" %d", n_val);
15662 printf("\n");
15663 }
15664 }
15665 }
15666
15667 function_tests++;
15668 return(test_ret);
15669}
15670
15671
15672static int
15673test_xmlCreateEntityParserCtxt(void) {
15674 int test_ret = 0;
15675
15676 int mem_base;
15677 xmlParserCtxtPtr ret_val;
15678 xmlChar * URL; /* the entity URL */
15679 int n_URL;
15680 xmlChar * ID; /* the entity PUBLIC ID */
15681 int n_ID;
15682 xmlChar * base; /* a possible base for the target URI */
15683 int n_base;
15684
15685 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15686 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15687 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15688 mem_base = xmlMemBlocks();
15689 URL = gen_const_xmlChar_ptr(n_URL, 0);
15690 ID = gen_const_xmlChar_ptr(n_ID, 1);
15691 base = gen_const_xmlChar_ptr(n_base, 2);
15692
15693 ret_val = xmlCreateEntityParserCtxt(URL, ID, base);
15694 desret_xmlParserCtxtPtr(ret_val);
15695 call_tests++;
15696 des_const_xmlChar_ptr(n_URL, URL, 0);
15697 des_const_xmlChar_ptr(n_ID, ID, 1);
15698 des_const_xmlChar_ptr(n_base, base, 2);
15699 xmlResetLastError();
15700 if (mem_base != xmlMemBlocks()) {
15701 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15702 xmlMemBlocks() - mem_base);
15703 test_ret++;
15704 printf(" %d", n_URL);
15705 printf(" %d", n_ID);
15706 printf(" %d", n_base);
15707 printf("\n");
15708 }
15709 }
15710 }
15711 }
15712
15713 function_tests++;
15714 return(test_ret);
15715}
15716
15717
15718static int
15719test_xmlCreateFileParserCtxt(void) {
15720 int test_ret = 0;
15721
15722 int mem_base;
15723 xmlParserCtxtPtr ret_val;
15724 const char * filename; /* the filename */
15725 int n_filename;
15726
15727 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15728 mem_base = xmlMemBlocks();
15729 filename = gen_fileoutput(n_filename, 0);
15730
15731 ret_val = xmlCreateFileParserCtxt(filename);
15732 desret_xmlParserCtxtPtr(ret_val);
15733 call_tests++;
15734 des_fileoutput(n_filename, filename, 0);
15735 xmlResetLastError();
15736 if (mem_base != xmlMemBlocks()) {
15737 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15738 xmlMemBlocks() - mem_base);
15739 test_ret++;
15740 printf(" %d", n_filename);
15741 printf("\n");
15742 }
15743 }
15744
15745 function_tests++;
15746 return(test_ret);
15747}
15748
15749
15750static int
15751test_xmlCreateMemoryParserCtxt(void) {
15752 int test_ret = 0;
15753
15754 int mem_base;
15755 xmlParserCtxtPtr ret_val;
15756 char * buffer; /* a pointer to a char array */
15757 int n_buffer;
15758 int size; /* the size of the array */
15759 int n_size;
15760
15761 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15762 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15763 mem_base = xmlMemBlocks();
15764 buffer = gen_const_char_ptr(n_buffer, 0);
15765 size = gen_int(n_size, 1);
15766
15767 ret_val = xmlCreateMemoryParserCtxt(buffer, size);
15768 desret_xmlParserCtxtPtr(ret_val);
15769 call_tests++;
15770 des_const_char_ptr(n_buffer, buffer, 0);
15771 des_int(n_size, size, 1);
15772 xmlResetLastError();
15773 if (mem_base != xmlMemBlocks()) {
15774 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
15775 xmlMemBlocks() - mem_base);
15776 test_ret++;
15777 printf(" %d", n_buffer);
15778 printf(" %d", n_size);
15779 printf("\n");
15780 }
15781 }
15782 }
15783
15784 function_tests++;
15785 return(test_ret);
15786}
15787
15788
15789static int
15790test_xmlCreateURLParserCtxt(void) {
15791 int test_ret = 0;
15792
15793 int mem_base;
15794 xmlParserCtxtPtr ret_val;
15795 const char * filename; /* the filename or URL */
15796 int n_filename;
15797 int options; /* a combination of xmlParserOption */
15798 int n_options;
15799
15800 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15801 for (n_options = 0;n_options < gen_nb_int;n_options++) {
15802 mem_base = xmlMemBlocks();
15803 filename = gen_fileoutput(n_filename, 0);
15804 options = gen_int(n_options, 1);
15805
15806 ret_val = xmlCreateURLParserCtxt(filename, options);
15807 desret_xmlParserCtxtPtr(ret_val);
15808 call_tests++;
15809 des_fileoutput(n_filename, filename, 0);
15810 des_int(n_options, options, 1);
15811 xmlResetLastError();
15812 if (mem_base != xmlMemBlocks()) {
15813 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
15814 xmlMemBlocks() - mem_base);
15815 test_ret++;
15816 printf(" %d", n_filename);
15817 printf(" %d", n_options);
15818 printf("\n");
15819 }
15820 }
15821 }
15822
15823 function_tests++;
15824 return(test_ret);
15825}
15826
15827
15828static int
15829test_xmlCurrentChar(void) {
15830 int test_ret = 0;
15831
15832 int mem_base;
15833 int ret_val;
15834 xmlParserCtxtPtr ctxt; /* the XML parser context */
15835 int n_ctxt;
15836 int * len; /* pointer to the length of the char read */
15837 int n_len;
15838
15839 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15840 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
15841 mem_base = xmlMemBlocks();
15842 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15843 len = gen_int_ptr(n_len, 1);
15844
15845 ret_val = xmlCurrentChar(ctxt, len);
15846 desret_int(ret_val);
15847 call_tests++;
15848 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15849 des_int_ptr(n_len, len, 1);
15850 xmlResetLastError();
15851 if (mem_base != xmlMemBlocks()) {
15852 printf("Leak of %d blocks found in xmlCurrentChar",
15853 xmlMemBlocks() - mem_base);
15854 test_ret++;
15855 printf(" %d", n_ctxt);
15856 printf(" %d", n_len);
15857 printf("\n");
15858 }
15859 }
15860 }
15861
15862 function_tests++;
15863 return(test_ret);
15864}
15865
15866
15867static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015868test_xmlErrMemory(void) {
15869 int test_ret = 0;
15870
15871 int mem_base;
15872 xmlParserCtxtPtr ctxt; /* an XML parser context */
15873 int n_ctxt;
15874 char * extra; /* extra informations */
15875 int n_extra;
15876
15877 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15878 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
15879 mem_base = xmlMemBlocks();
15880 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15881 extra = gen_const_char_ptr(n_extra, 1);
15882
15883 xmlErrMemory(ctxt, extra);
15884 call_tests++;
15885 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15886 des_const_char_ptr(n_extra, extra, 1);
15887 xmlResetLastError();
15888 if (mem_base != xmlMemBlocks()) {
15889 printf("Leak of %d blocks found in xmlErrMemory",
15890 xmlMemBlocks() - mem_base);
15891 test_ret++;
15892 printf(" %d", n_ctxt);
15893 printf(" %d", n_extra);
15894 printf("\n");
15895 }
15896 }
15897 }
15898
15899 function_tests++;
15900 return(test_ret);
15901}
15902
15903
15904static int
15905test_xmlIsLetter(void) {
15906 int test_ret = 0;
15907
15908 int mem_base;
15909 int ret_val;
15910 int c; /* an unicode character (int) */
15911 int n_c;
15912
15913 for (n_c = 0;n_c < gen_nb_int;n_c++) {
15914 mem_base = xmlMemBlocks();
15915 c = gen_int(n_c, 0);
15916
15917 ret_val = xmlIsLetter(c);
15918 desret_int(ret_val);
15919 call_tests++;
15920 des_int(n_c, c, 0);
15921 xmlResetLastError();
15922 if (mem_base != xmlMemBlocks()) {
15923 printf("Leak of %d blocks found in xmlIsLetter",
15924 xmlMemBlocks() - mem_base);
15925 test_ret++;
15926 printf(" %d", n_c);
15927 printf("\n");
15928 }
15929 }
15930
15931 function_tests++;
15932 return(test_ret);
15933}
15934
15935
15936static int
15937test_xmlNewEntityInputStream(void) {
15938 int test_ret = 0;
15939
15940 int mem_base;
15941 xmlParserInputPtr ret_val;
15942 xmlParserCtxtPtr ctxt; /* an XML parser context */
15943 int n_ctxt;
15944 xmlEntityPtr entity; /* an Entity pointer */
15945 int n_entity;
15946
15947 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15948 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
15949 mem_base = xmlMemBlocks();
15950 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15951 entity = gen_xmlEntityPtr(n_entity, 1);
15952
15953 ret_val = xmlNewEntityInputStream(ctxt, entity);
15954 desret_xmlParserInputPtr(ret_val);
15955 call_tests++;
15956 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15957 des_xmlEntityPtr(n_entity, entity, 1);
15958 xmlResetLastError();
15959 if (mem_base != xmlMemBlocks()) {
15960 printf("Leak of %d blocks found in xmlNewEntityInputStream",
15961 xmlMemBlocks() - mem_base);
15962 test_ret++;
15963 printf(" %d", n_ctxt);
15964 printf(" %d", n_entity);
15965 printf("\n");
15966 }
15967 }
15968 }
15969
15970 function_tests++;
15971 return(test_ret);
15972}
15973
15974
15975static int
15976test_xmlNewInputFromFile(void) {
15977 int test_ret = 0;
15978
15979 int mem_base;
15980 xmlParserInputPtr ret_val;
15981 xmlParserCtxtPtr ctxt; /* an XML parser context */
15982 int n_ctxt;
15983 const char * filename; /* the filename to use as entity */
15984 int n_filename;
15985
15986 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15987 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15988 mem_base = xmlMemBlocks();
15989 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15990 filename = gen_filepath(n_filename, 1);
15991
15992 ret_val = xmlNewInputFromFile(ctxt, filename);
15993 desret_xmlParserInputPtr(ret_val);
15994 call_tests++;
15995 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15996 des_filepath(n_filename, filename, 1);
15997 xmlResetLastError();
15998 if (mem_base != xmlMemBlocks()) {
15999 printf("Leak of %d blocks found in xmlNewInputFromFile",
16000 xmlMemBlocks() - mem_base);
16001 test_ret++;
16002 printf(" %d", n_ctxt);
16003 printf(" %d", n_filename);
16004 printf("\n");
16005 }
16006 }
16007 }
16008
16009 function_tests++;
16010 return(test_ret);
16011}
16012
16013
16014static int
16015test_xmlNewInputStream(void) {
16016 int test_ret = 0;
16017
16018 int mem_base;
16019 xmlParserInputPtr ret_val;
16020 xmlParserCtxtPtr ctxt; /* an XML parser context */
16021 int n_ctxt;
16022
16023 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16024 mem_base = xmlMemBlocks();
16025 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16026
16027 ret_val = xmlNewInputStream(ctxt);
16028 desret_xmlParserInputPtr(ret_val);
16029 call_tests++;
16030 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16031 xmlResetLastError();
16032 if (mem_base != xmlMemBlocks()) {
16033 printf("Leak of %d blocks found in xmlNewInputStream",
16034 xmlMemBlocks() - mem_base);
16035 test_ret++;
16036 printf(" %d", n_ctxt);
16037 printf("\n");
16038 }
16039 }
16040
16041 function_tests++;
16042 return(test_ret);
16043}
16044
16045
16046static int
16047test_xmlNewStringInputStream(void) {
16048 int test_ret = 0;
16049
16050 int mem_base;
16051 xmlParserInputPtr ret_val;
16052 xmlParserCtxtPtr ctxt; /* an XML parser context */
16053 int n_ctxt;
16054 xmlChar * buffer; /* an memory buffer */
16055 int n_buffer;
16056
16057 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16058 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16059 mem_base = xmlMemBlocks();
16060 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16061 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16062
16063 ret_val = xmlNewStringInputStream(ctxt, buffer);
16064 desret_xmlParserInputPtr(ret_val);
16065 call_tests++;
16066 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16067 des_const_xmlChar_ptr(n_buffer, buffer, 1);
16068 xmlResetLastError();
16069 if (mem_base != xmlMemBlocks()) {
16070 printf("Leak of %d blocks found in xmlNewStringInputStream",
16071 xmlMemBlocks() - mem_base);
16072 test_ret++;
16073 printf(" %d", n_ctxt);
16074 printf(" %d", n_buffer);
16075 printf("\n");
16076 }
16077 }
16078 }
16079
16080 function_tests++;
16081 return(test_ret);
16082}
16083
16084
16085static int
16086test_xmlNextChar(void) {
16087 int test_ret = 0;
16088
16089 int mem_base;
16090 xmlParserCtxtPtr ctxt; /* the XML parser context */
16091 int n_ctxt;
16092
16093 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16094 mem_base = xmlMemBlocks();
16095 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16096
16097 xmlNextChar(ctxt);
16098 call_tests++;
16099 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16100 xmlResetLastError();
16101 if (mem_base != xmlMemBlocks()) {
16102 printf("Leak of %d blocks found in xmlNextChar",
16103 xmlMemBlocks() - mem_base);
16104 test_ret++;
16105 printf(" %d", n_ctxt);
16106 printf("\n");
16107 }
16108 }
16109
16110 function_tests++;
16111 return(test_ret);
16112}
16113
16114
16115static int
16116test_xmlParserInputShrink(void) {
16117 int test_ret = 0;
16118
16119 int mem_base;
16120 xmlParserInputPtr in; /* an XML parser input */
16121 int n_in;
16122
16123 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16124 mem_base = xmlMemBlocks();
16125 in = gen_xmlParserInputPtr(n_in, 0);
16126
16127 xmlParserInputShrink(in);
16128 call_tests++;
16129 des_xmlParserInputPtr(n_in, in, 0);
16130 xmlResetLastError();
16131 if (mem_base != xmlMemBlocks()) {
16132 printf("Leak of %d blocks found in xmlParserInputShrink",
16133 xmlMemBlocks() - mem_base);
16134 test_ret++;
16135 printf(" %d", n_in);
16136 printf("\n");
16137 }
16138 }
16139
16140 function_tests++;
16141 return(test_ret);
16142}
16143
16144
16145static int
16146test_xmlPopInput(void) {
16147 int test_ret = 0;
16148
16149
16150 /* missing type support */
16151 return(test_ret);
16152}
16153
16154
16155static int
16156test_xmlPushInput(void) {
16157 int test_ret = 0;
16158
16159 int mem_base;
16160 xmlParserCtxtPtr ctxt; /* an XML parser context */
16161 int n_ctxt;
16162 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16163 int n_input;
16164
16165 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16166 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16167 mem_base = xmlMemBlocks();
16168 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16169 input = gen_xmlParserInputPtr(n_input, 1);
16170
16171 xmlPushInput(ctxt, input);
16172 call_tests++;
16173 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16174 des_xmlParserInputPtr(n_input, input, 1);
16175 xmlResetLastError();
16176 if (mem_base != xmlMemBlocks()) {
16177 printf("Leak of %d blocks found in xmlPushInput",
16178 xmlMemBlocks() - mem_base);
16179 test_ret++;
16180 printf(" %d", n_ctxt);
16181 printf(" %d", n_input);
16182 printf("\n");
16183 }
16184 }
16185 }
16186
16187 function_tests++;
16188 return(test_ret);
16189}
16190
16191
16192static int
16193test_xmlSetEntityReferenceFunc(void) {
16194 int test_ret = 0;
16195
16196
16197 /* missing type support */
16198 return(test_ret);
16199}
16200
16201
16202static int
16203test_xmlSplitQName(void) {
16204 int test_ret = 0;
16205
16206 int mem_base;
16207 xmlChar * ret_val;
16208 xmlParserCtxtPtr ctxt; /* an XML parser context */
16209 int n_ctxt;
16210 xmlChar * name; /* an XML parser context */
16211 int n_name;
16212 xmlChar ** prefix; /* a xmlChar ** */
16213 int n_prefix;
16214
16215 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16216 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16217 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16218 mem_base = xmlMemBlocks();
16219 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16220 name = gen_const_xmlChar_ptr(n_name, 1);
16221 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16222
16223 ret_val = xmlSplitQName(ctxt, name, prefix);
16224 desret_xmlChar_ptr(ret_val);
16225 call_tests++;
16226 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16227 des_const_xmlChar_ptr(n_name, name, 1);
16228 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16229 xmlResetLastError();
16230 if (mem_base != xmlMemBlocks()) {
16231 printf("Leak of %d blocks found in xmlSplitQName",
16232 xmlMemBlocks() - mem_base);
16233 test_ret++;
16234 printf(" %d", n_ctxt);
16235 printf(" %d", n_name);
16236 printf(" %d", n_prefix);
16237 printf("\n");
16238 }
16239 }
16240 }
16241 }
16242
16243 function_tests++;
16244 return(test_ret);
16245}
16246
16247
16248static int
16249test_xmlStringCurrentChar(void) {
16250 int test_ret = 0;
16251
16252 int mem_base;
16253 int ret_val;
16254 xmlParserCtxtPtr ctxt; /* the XML parser context */
16255 int n_ctxt;
16256 xmlChar * cur; /* pointer to the beginning of the char */
16257 int n_cur;
16258 int * len; /* pointer to the length of the char read */
16259 int n_len;
16260
16261 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16262 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16263 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16264 mem_base = xmlMemBlocks();
16265 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16266 cur = gen_const_xmlChar_ptr(n_cur, 1);
16267 len = gen_int_ptr(n_len, 2);
16268
16269 ret_val = xmlStringCurrentChar(ctxt, cur, len);
16270 desret_int(ret_val);
16271 call_tests++;
16272 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16273 des_const_xmlChar_ptr(n_cur, cur, 1);
16274 des_int_ptr(n_len, len, 2);
16275 xmlResetLastError();
16276 if (mem_base != xmlMemBlocks()) {
16277 printf("Leak of %d blocks found in xmlStringCurrentChar",
16278 xmlMemBlocks() - mem_base);
16279 test_ret++;
16280 printf(" %d", n_ctxt);
16281 printf(" %d", n_cur);
16282 printf(" %d", n_len);
16283 printf("\n");
16284 }
16285 }
16286 }
16287 }
16288
16289 function_tests++;
16290 return(test_ret);
16291}
16292
16293
16294static int
16295test_xmlStringDecodeEntities(void) {
16296 int test_ret = 0;
16297
16298
16299 /* missing type support */
16300 return(test_ret);
16301}
16302
16303
16304static int
16305test_xmlStringLenDecodeEntities(void) {
16306 int test_ret = 0;
16307
16308
16309 /* missing type support */
16310 return(test_ret);
16311}
16312
16313
16314static int
16315test_xmlSwitchEncoding(void) {
16316 int test_ret = 0;
16317
16318 int mem_base;
16319 int ret_val;
16320 xmlParserCtxtPtr ctxt; /* the parser context */
16321 int n_ctxt;
16322 xmlCharEncoding enc; /* the encoding value (number) */
16323 int n_enc;
16324
16325 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16326 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16327 mem_base = xmlMemBlocks();
16328 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16329 enc = gen_xmlCharEncoding(n_enc, 1);
16330
16331 ret_val = xmlSwitchEncoding(ctxt, enc);
16332 desret_int(ret_val);
16333 call_tests++;
16334 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16335 des_xmlCharEncoding(n_enc, enc, 1);
16336 xmlResetLastError();
16337 if (mem_base != xmlMemBlocks()) {
16338 printf("Leak of %d blocks found in xmlSwitchEncoding",
16339 xmlMemBlocks() - mem_base);
16340 test_ret++;
16341 printf(" %d", n_ctxt);
16342 printf(" %d", n_enc);
16343 printf("\n");
16344 }
16345 }
16346 }
16347
16348 function_tests++;
16349 return(test_ret);
16350}
16351
16352
16353static int
16354test_xmlSwitchInputEncoding(void) {
16355 int test_ret = 0;
16356
16357 int mem_base;
16358 int ret_val;
16359 xmlParserCtxtPtr ctxt; /* the parser context */
16360 int n_ctxt;
16361 xmlParserInputPtr input; /* the input stream */
16362 int n_input;
16363 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16364 int n_handler;
16365
16366 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16367 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16368 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16369 mem_base = xmlMemBlocks();
16370 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16371 input = gen_xmlParserInputPtr(n_input, 1);
16372 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16373
16374 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16375 desret_int(ret_val);
16376 call_tests++;
16377 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16378 des_xmlParserInputPtr(n_input, input, 1);
16379 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16380 xmlResetLastError();
16381 if (mem_base != xmlMemBlocks()) {
16382 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16383 xmlMemBlocks() - mem_base);
16384 test_ret++;
16385 printf(" %d", n_ctxt);
16386 printf(" %d", n_input);
16387 printf(" %d", n_handler);
16388 printf("\n");
16389 }
16390 }
16391 }
16392 }
16393
16394 function_tests++;
16395 return(test_ret);
16396}
16397
16398
16399static int
16400test_xmlSwitchToEncoding(void) {
16401 int test_ret = 0;
16402
16403 int mem_base;
16404 int ret_val;
16405 xmlParserCtxtPtr ctxt; /* the parser context */
16406 int n_ctxt;
16407 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16408 int n_handler;
16409
16410 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16411 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16412 mem_base = xmlMemBlocks();
16413 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16414 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16415
16416 ret_val = xmlSwitchToEncoding(ctxt, handler);
16417 desret_int(ret_val);
16418 call_tests++;
16419 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16420 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16421 xmlResetLastError();
16422 if (mem_base != xmlMemBlocks()) {
16423 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16424 xmlMemBlocks() - mem_base);
16425 test_ret++;
16426 printf(" %d", n_ctxt);
16427 printf(" %d", n_handler);
16428 printf("\n");
16429 }
16430 }
16431 }
16432
16433 function_tests++;
16434 return(test_ret);
16435}
16436
16437static int
16438test_parserInternals(void) {
16439 int test_ret = 0;
16440
16441 printf("Testing parserInternals : 30 of 90 functions ...\n");
16442 test_ret += test_htmlCreateFileParserCtxt();
16443 test_ret += test_htmlInitAutoClose();
16444 test_ret += test_inputPop();
16445 test_ret += test_inputPush();
16446 test_ret += test_namePop();
16447 test_ret += test_namePush();
16448 test_ret += test_nodePop();
16449 test_ret += test_nodePush();
16450 test_ret += test_xmlCheckLanguageID();
16451 test_ret += test_xmlCopyChar();
16452 test_ret += test_xmlCopyCharMultiByte();
16453 test_ret += test_xmlCreateEntityParserCtxt();
16454 test_ret += test_xmlCreateFileParserCtxt();
16455 test_ret += test_xmlCreateMemoryParserCtxt();
16456 test_ret += test_xmlCreateURLParserCtxt();
16457 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016458 test_ret += test_xmlErrMemory();
16459 test_ret += test_xmlIsLetter();
16460 test_ret += test_xmlNewEntityInputStream();
16461 test_ret += test_xmlNewInputFromFile();
16462 test_ret += test_xmlNewInputStream();
16463 test_ret += test_xmlNewStringInputStream();
16464 test_ret += test_xmlNextChar();
16465 test_ret += test_xmlParserInputShrink();
16466 test_ret += test_xmlPopInput();
16467 test_ret += test_xmlPushInput();
16468 test_ret += test_xmlSetEntityReferenceFunc();
16469 test_ret += test_xmlSplitQName();
16470 test_ret += test_xmlStringCurrentChar();
16471 test_ret += test_xmlStringDecodeEntities();
16472 test_ret += test_xmlStringLenDecodeEntities();
16473 test_ret += test_xmlSwitchEncoding();
16474 test_ret += test_xmlSwitchInputEncoding();
16475 test_ret += test_xmlSwitchToEncoding();
16476
16477 if (test_ret != 0)
16478 printf("Module parserInternals: %d errors\n", test_ret);
16479 return(test_ret);
16480}
16481
Daniel Veillardce682bc2004-11-05 17:22:25 +000016482#define gen_nb_xmlPatternPtr 1
16483static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16484 return(NULL);
16485}
16486static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16487}
16488
Daniel Veillardd93f6252004-11-02 15:53:51 +000016489static int
16490test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016491 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016492
Daniel Veillardce682bc2004-11-05 17:22:25 +000016493#ifdef LIBXML_PATTERN_ENABLED
16494 int mem_base;
16495 int ret_val;
16496 xmlPatternPtr comp; /* the precompiled pattern */
16497 int n_comp;
16498 xmlNodePtr node; /* a node */
16499 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016500
Daniel Veillardce682bc2004-11-05 17:22:25 +000016501 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16502 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16503 mem_base = xmlMemBlocks();
16504 comp = gen_xmlPatternPtr(n_comp, 0);
16505 node = gen_xmlNodePtr(n_node, 1);
16506
16507 ret_val = xmlPatternMatch(comp, node);
16508 desret_int(ret_val);
16509 call_tests++;
16510 des_xmlPatternPtr(n_comp, comp, 0);
16511 des_xmlNodePtr(n_node, node, 1);
16512 xmlResetLastError();
16513 if (mem_base != xmlMemBlocks()) {
16514 printf("Leak of %d blocks found in xmlPatternMatch",
16515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016516 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016517 printf(" %d", n_comp);
16518 printf(" %d", n_node);
16519 printf("\n");
16520 }
16521 }
16522 }
16523#endif
16524
16525 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016527}
16528
16529
16530static int
16531test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016533
16534
16535 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016536 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016537}
16538
16539static int
16540test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016541 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016542
Daniel Veillardce682bc2004-11-05 17:22:25 +000016543 printf("Testing pattern : 1 of 4 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000016544 test_ret += test_xmlPatternMatch();
16545 test_ret += test_xmlPatterncompile();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016546
Daniel Veillard42595322004-11-08 10:52:06 +000016547 if (test_ret != 0)
16548 printf("Module pattern: %d errors\n", test_ret);
16549 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016550}
16551
Daniel Veillardce682bc2004-11-05 17:22:25 +000016552#define gen_nb_xmlRelaxNGPtr 1
16553static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16554 return(NULL);
16555}
16556static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16557}
16558
Daniel Veillardd93f6252004-11-02 15:53:51 +000016559static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016560test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016561 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016562
Daniel Veillardce682bc2004-11-05 17:22:25 +000016563#ifdef LIBXML_SCHEMAS_ENABLED
16564#ifdef LIBXML_OUTPUT_ENABLED
16565 int mem_base;
16566 FILE * output; /* the file output */
16567 int n_output;
16568 xmlRelaxNGPtr schema; /* a schema structure */
16569 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016570
Daniel Veillardce682bc2004-11-05 17:22:25 +000016571 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16572 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16573 mem_base = xmlMemBlocks();
16574 output = gen_FILE_ptr(n_output, 0);
16575 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16576
16577 xmlRelaxNGDump(output, schema);
16578 call_tests++;
16579 des_FILE_ptr(n_output, output, 0);
16580 des_xmlRelaxNGPtr(n_schema, schema, 1);
16581 xmlResetLastError();
16582 if (mem_base != xmlMemBlocks()) {
16583 printf("Leak of %d blocks found in xmlRelaxNGDump",
16584 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016585 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016586 printf(" %d", n_output);
16587 printf(" %d", n_schema);
16588 printf("\n");
16589 }
16590 }
16591 }
16592#endif
16593#endif
16594
16595 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016597}
16598
16599
16600static int
16601test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016603
Daniel Veillardce682bc2004-11-05 17:22:25 +000016604#ifdef LIBXML_SCHEMAS_ENABLED
16605#ifdef LIBXML_OUTPUT_ENABLED
16606 int mem_base;
16607 FILE * output; /* the file output */
16608 int n_output;
16609 xmlRelaxNGPtr schema; /* a schema structure */
16610 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016611
Daniel Veillardce682bc2004-11-05 17:22:25 +000016612 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16613 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16614 mem_base = xmlMemBlocks();
16615 output = gen_FILE_ptr(n_output, 0);
16616 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16617
16618 xmlRelaxNGDumpTree(output, schema);
16619 call_tests++;
16620 des_FILE_ptr(n_output, output, 0);
16621 des_xmlRelaxNGPtr(n_schema, schema, 1);
16622 xmlResetLastError();
16623 if (mem_base != xmlMemBlocks()) {
16624 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
16625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016626 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016627 printf(" %d", n_output);
16628 printf(" %d", n_schema);
16629 printf("\n");
16630 }
16631 }
16632 }
16633#endif
16634#endif
16635
16636 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016637 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016638}
16639
16640
Daniel Veillardce682bc2004-11-05 17:22:25 +000016641#define gen_nb_xmlRelaxNGParserCtxtPtr 1
16642static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16643 return(NULL);
16644}
16645static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16646}
16647
16648#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
16649static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16650 return(NULL);
16651}
16652static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16653}
16654
16655#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
16656static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16657 return(NULL);
16658}
16659static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16660}
16661
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016662#define gen_nb_void_ptr_ptr 1
16663static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16664 return(NULL);
16665}
16666static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16667}
16668
Daniel Veillardd93f6252004-11-02 15:53:51 +000016669static int
16670test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016672
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016673#ifdef LIBXML_SCHEMAS_ENABLED
16674 int mem_base;
16675 int ret_val;
16676 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
16677 int n_ctxt;
16678 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
16679 int n_err;
16680 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
16681 int n_warn;
16682 void ** ctx; /* contextual data for the callbacks result */
16683 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016684
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016685 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
16686 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16687 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16688 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16689 mem_base = xmlMemBlocks();
16690 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
16691 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16692 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16693 ctx = gen_void_ptr_ptr(n_ctx, 3);
16694
16695 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
16696 desret_int(ret_val);
16697 call_tests++;
16698 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
16699 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16700 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16701 des_void_ptr_ptr(n_ctx, ctx, 3);
16702 xmlResetLastError();
16703 if (mem_base != xmlMemBlocks()) {
16704 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
16705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016706 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016707 printf(" %d", n_ctxt);
16708 printf(" %d", n_err);
16709 printf(" %d", n_warn);
16710 printf(" %d", n_ctx);
16711 printf("\n");
16712 }
16713 }
16714 }
16715 }
16716 }
16717#endif
16718
16719 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016720 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016721}
16722
16723
Daniel Veillardce682bc2004-11-05 17:22:25 +000016724#define gen_nb_xmlRelaxNGValidCtxtPtr 1
16725static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16726 return(NULL);
16727}
16728static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16729}
16730
Daniel Veillardd93f6252004-11-02 15:53:51 +000016731static int
16732test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016734
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016735#ifdef LIBXML_SCHEMAS_ENABLED
16736 int mem_base;
16737 int ret_val;
16738 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
16739 int n_ctxt;
16740 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
16741 int n_err;
16742 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
16743 int n_warn;
16744 void ** ctx; /* the functions context result */
16745 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016746
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016747 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
16748 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16749 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16750 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16751 mem_base = xmlMemBlocks();
16752 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
16753 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16754 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16755 ctx = gen_void_ptr_ptr(n_ctx, 3);
16756
16757 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
16758 desret_int(ret_val);
16759 call_tests++;
16760 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
16761 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16762 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16763 des_void_ptr_ptr(n_ctx, ctx, 3);
16764 xmlResetLastError();
16765 if (mem_base != xmlMemBlocks()) {
16766 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
16767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016768 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016769 printf(" %d", n_ctxt);
16770 printf(" %d", n_err);
16771 printf(" %d", n_warn);
16772 printf(" %d", n_ctx);
16773 printf("\n");
16774 }
16775 }
16776 }
16777 }
16778 }
16779#endif
16780
16781 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016783}
16784
16785
16786static int
Daniel Veillard34099b42004-11-04 17:34:35 +000016787test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016788 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000016789
16790#ifdef LIBXML_SCHEMAS_ENABLED
16791 int mem_base;
16792 int ret_val;
16793
16794 mem_base = xmlMemBlocks();
16795
16796 ret_val = xmlRelaxNGInitTypes();
16797 desret_int(ret_val);
16798 call_tests++;
16799 xmlResetLastError();
16800 if (mem_base != xmlMemBlocks()) {
16801 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
16802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016803 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000016804 printf("\n");
16805 }
16806#endif
16807
16808 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016809 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000016810}
16811
16812
16813static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016814test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016816
Daniel Veillard42595322004-11-08 10:52:06 +000016817#ifdef LIBXML_SCHEMAS_ENABLED
16818 int mem_base;
16819 xmlRelaxNGParserCtxtPtr ret_val;
16820 xmlDocPtr doc; /* a preparsed document tree */
16821 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016822
Daniel Veillard42595322004-11-08 10:52:06 +000016823 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
16824 mem_base = xmlMemBlocks();
16825 doc = gen_xmlDocPtr(n_doc, 0);
16826
16827 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
16828 desret_xmlRelaxNGParserCtxtPtr(ret_val);
16829 call_tests++;
16830 des_xmlDocPtr(n_doc, doc, 0);
16831 xmlResetLastError();
16832 if (mem_base != xmlMemBlocks()) {
16833 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
16834 xmlMemBlocks() - mem_base);
16835 test_ret++;
16836 printf(" %d", n_doc);
16837 printf("\n");
16838 }
16839 }
16840#endif
16841
16842 function_tests++;
16843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016844}
16845
16846
16847static int
16848test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016850
Daniel Veillard42595322004-11-08 10:52:06 +000016851#ifdef LIBXML_SCHEMAS_ENABLED
16852 int mem_base;
16853 xmlRelaxNGParserCtxtPtr ret_val;
16854 char * buffer; /* a pointer to a char array containing the schemas */
16855 int n_buffer;
16856 int size; /* the size of the array */
16857 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016858
Daniel Veillard42595322004-11-08 10:52:06 +000016859 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
16860 for (n_size = 0;n_size < gen_nb_int;n_size++) {
16861 mem_base = xmlMemBlocks();
16862 buffer = gen_const_char_ptr(n_buffer, 0);
16863 size = gen_int(n_size, 1);
16864
16865 ret_val = xmlRelaxNGNewMemParserCtxt(buffer, size);
16866 desret_xmlRelaxNGParserCtxtPtr(ret_val);
16867 call_tests++;
16868 des_const_char_ptr(n_buffer, buffer, 0);
16869 des_int(n_size, size, 1);
16870 xmlResetLastError();
16871 if (mem_base != xmlMemBlocks()) {
16872 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
16873 xmlMemBlocks() - mem_base);
16874 test_ret++;
16875 printf(" %d", n_buffer);
16876 printf(" %d", n_size);
16877 printf("\n");
16878 }
16879 }
16880 }
16881#endif
16882
16883 function_tests++;
16884 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016885}
16886
16887
16888static int
16889test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016890 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016891
Daniel Veillard42595322004-11-08 10:52:06 +000016892#ifdef LIBXML_SCHEMAS_ENABLED
16893 int mem_base;
16894 xmlRelaxNGParserCtxtPtr ret_val;
16895 char * URL; /* the location of the schema */
16896 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016897
Daniel Veillard42595322004-11-08 10:52:06 +000016898 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
16899 mem_base = xmlMemBlocks();
16900 URL = gen_const_char_ptr(n_URL, 0);
16901
16902 ret_val = xmlRelaxNGNewParserCtxt(URL);
16903 desret_xmlRelaxNGParserCtxtPtr(ret_val);
16904 call_tests++;
16905 des_const_char_ptr(n_URL, URL, 0);
16906 xmlResetLastError();
16907 if (mem_base != xmlMemBlocks()) {
16908 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
16909 xmlMemBlocks() - mem_base);
16910 test_ret++;
16911 printf(" %d", n_URL);
16912 printf("\n");
16913 }
16914 }
16915#endif
16916
16917 function_tests++;
16918 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016919}
16920
16921
16922static int
16923test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016924 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016925
16926
16927 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016929}
16930
16931
16932static int
16933test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016935
16936
16937 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016938 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016939}
16940
16941
16942static int
16943test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016945
16946
16947 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016949}
16950
16951
16952static int
16953test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016954 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016955
16956
16957 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016958 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016959}
16960
16961
16962static int
16963test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016964 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016965
Daniel Veillardce682bc2004-11-05 17:22:25 +000016966#ifdef LIBXML_SCHEMAS_ENABLED
16967 int mem_base;
16968 int ret_val;
16969 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
16970 int n_ctxt;
16971 xmlDocPtr doc; /* a parsed document tree */
16972 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016973
Daniel Veillardce682bc2004-11-05 17:22:25 +000016974 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
16975 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
16976 mem_base = xmlMemBlocks();
16977 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
16978 doc = gen_xmlDocPtr(n_doc, 1);
16979
16980 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
16981 desret_int(ret_val);
16982 call_tests++;
16983 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
16984 des_xmlDocPtr(n_doc, doc, 1);
16985 xmlResetLastError();
16986 if (mem_base != xmlMemBlocks()) {
16987 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
16988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016989 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016990 printf(" %d", n_ctxt);
16991 printf(" %d", n_doc);
16992 printf("\n");
16993 }
16994 }
16995 }
16996#endif
16997
16998 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017000}
17001
17002
17003static int
17004test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017006
Daniel Veillardce682bc2004-11-05 17:22:25 +000017007#ifdef LIBXML_SCHEMAS_ENABLED
17008 int mem_base;
17009 int ret_val;
17010 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17011 int n_ctxt;
17012 xmlDocPtr doc; /* a document instance */
17013 int n_doc;
17014 xmlNodePtr elem; /* an element instance */
17015 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017016
Daniel Veillardce682bc2004-11-05 17:22:25 +000017017 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17018 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17019 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17020 mem_base = xmlMemBlocks();
17021 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17022 doc = gen_xmlDocPtr(n_doc, 1);
17023 elem = gen_xmlNodePtr(n_elem, 2);
17024
17025 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17026 desret_int(ret_val);
17027 call_tests++;
17028 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17029 des_xmlDocPtr(n_doc, doc, 1);
17030 des_xmlNodePtr(n_elem, elem, 2);
17031 xmlResetLastError();
17032 if (mem_base != xmlMemBlocks()) {
17033 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17034 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017035 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017036 printf(" %d", n_ctxt);
17037 printf(" %d", n_doc);
17038 printf(" %d", n_elem);
17039 printf("\n");
17040 }
17041 }
17042 }
17043 }
17044#endif
17045
17046 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017047 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017048}
17049
17050
17051static int
17052test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017053 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017054
Daniel Veillardce682bc2004-11-05 17:22:25 +000017055#ifdef LIBXML_SCHEMAS_ENABLED
17056 int mem_base;
17057 int ret_val;
17058 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17059 int n_ctxt;
17060 xmlDocPtr doc; /* a document instance */
17061 int n_doc;
17062 xmlNodePtr elem; /* an element instance */
17063 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017064
Daniel Veillardce682bc2004-11-05 17:22:25 +000017065 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17066 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17067 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17068 mem_base = xmlMemBlocks();
17069 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17070 doc = gen_xmlDocPtr(n_doc, 1);
17071 elem = gen_xmlNodePtr(n_elem, 2);
17072
17073 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17074 desret_int(ret_val);
17075 call_tests++;
17076 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17077 des_xmlDocPtr(n_doc, doc, 1);
17078 des_xmlNodePtr(n_elem, elem, 2);
17079 xmlResetLastError();
17080 if (mem_base != xmlMemBlocks()) {
17081 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17082 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017083 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017084 printf(" %d", n_ctxt);
17085 printf(" %d", n_doc);
17086 printf(" %d", n_elem);
17087 printf("\n");
17088 }
17089 }
17090 }
17091 }
17092#endif
17093
17094 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017096}
17097
17098
17099static int
17100test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017102
Daniel Veillardce682bc2004-11-05 17:22:25 +000017103#ifdef LIBXML_SCHEMAS_ENABLED
17104 int mem_base;
17105 int ret_val;
17106 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17107 int n_ctxt;
17108 xmlChar * data; /* some character data read */
17109 int n_data;
17110 int len; /* the lenght of the data */
17111 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017112
Daniel Veillardce682bc2004-11-05 17:22:25 +000017113 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17114 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17115 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17116 mem_base = xmlMemBlocks();
17117 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17118 data = gen_const_xmlChar_ptr(n_data, 1);
17119 len = gen_int(n_len, 2);
17120
17121 ret_val = xmlRelaxNGValidatePushCData(ctxt, data, len);
17122 desret_int(ret_val);
17123 call_tests++;
17124 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17125 des_const_xmlChar_ptr(n_data, data, 1);
17126 des_int(n_len, len, 2);
17127 xmlResetLastError();
17128 if (mem_base != xmlMemBlocks()) {
17129 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017131 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017132 printf(" %d", n_ctxt);
17133 printf(" %d", n_data);
17134 printf(" %d", n_len);
17135 printf("\n");
17136 }
17137 }
17138 }
17139 }
17140#endif
17141
17142 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017143 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017144}
17145
17146
17147static int
17148test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017149 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017150
Daniel Veillardce682bc2004-11-05 17:22:25 +000017151#ifdef LIBXML_SCHEMAS_ENABLED
17152 int mem_base;
17153 int ret_val;
17154 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17155 int n_ctxt;
17156 xmlDocPtr doc; /* a document instance */
17157 int n_doc;
17158 xmlNodePtr elem; /* an element instance */
17159 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017160
Daniel Veillardce682bc2004-11-05 17:22:25 +000017161 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17162 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17163 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17164 mem_base = xmlMemBlocks();
17165 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17166 doc = gen_xmlDocPtr(n_doc, 1);
17167 elem = gen_xmlNodePtr(n_elem, 2);
17168
17169 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17170 desret_int(ret_val);
17171 call_tests++;
17172 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17173 des_xmlDocPtr(n_doc, doc, 1);
17174 des_xmlNodePtr(n_elem, elem, 2);
17175 xmlResetLastError();
17176 if (mem_base != xmlMemBlocks()) {
17177 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17178 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017179 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017180 printf(" %d", n_ctxt);
17181 printf(" %d", n_doc);
17182 printf(" %d", n_elem);
17183 printf("\n");
17184 }
17185 }
17186 }
17187 }
17188#endif
17189
17190 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017191 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017192}
17193
17194
17195static int
17196test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017197 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017198
Daniel Veillardce682bc2004-11-05 17:22:25 +000017199#ifdef LIBXML_SCHEMAS_ENABLED
17200 int mem_base;
17201 int ret_val;
17202 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17203 int n_ctxt;
17204 int flags; /* a set of flags values */
17205 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017206
Daniel Veillardce682bc2004-11-05 17:22:25 +000017207 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17208 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17209 mem_base = xmlMemBlocks();
17210 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17211 flags = gen_int(n_flags, 1);
17212
17213 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17214 desret_int(ret_val);
17215 call_tests++;
17216 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17217 des_int(n_flags, flags, 1);
17218 xmlResetLastError();
17219 if (mem_base != xmlMemBlocks()) {
17220 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017222 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017223 printf(" %d", n_ctxt);
17224 printf(" %d", n_flags);
17225 printf("\n");
17226 }
17227 }
17228 }
17229#endif
17230
17231 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017233}
17234
17235static int
17236test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017238
Daniel Veillard42595322004-11-08 10:52:06 +000017239 printf("Testing relaxng : 14 of 22 functions ...\n");
17240 test_ret += test_xmlRelaxNGDump();
17241 test_ret += test_xmlRelaxNGDumpTree();
17242 test_ret += test_xmlRelaxNGGetParserErrors();
17243 test_ret += test_xmlRelaxNGGetValidErrors();
17244 test_ret += test_xmlRelaxNGInitTypes();
17245 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17246 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17247 test_ret += test_xmlRelaxNGNewParserCtxt();
17248 test_ret += test_xmlRelaxNGNewValidCtxt();
17249 test_ret += test_xmlRelaxNGParse();
17250 test_ret += test_xmlRelaxNGSetParserErrors();
17251 test_ret += test_xmlRelaxNGSetValidErrors();
17252 test_ret += test_xmlRelaxNGValidateDoc();
17253 test_ret += test_xmlRelaxNGValidateFullElement();
17254 test_ret += test_xmlRelaxNGValidatePopElement();
17255 test_ret += test_xmlRelaxNGValidatePushCData();
17256 test_ret += test_xmlRelaxNGValidatePushElement();
17257 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017258
Daniel Veillard42595322004-11-08 10:52:06 +000017259 if (test_ret != 0)
17260 printf("Module relaxng: %d errors\n", test_ret);
17261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017262}
17263static int
17264test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017265 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017266
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000017267 printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017268
Daniel Veillard42595322004-11-08 10:52:06 +000017269 if (test_ret != 0)
17270 printf("Module schemasInternals: %d errors\n", test_ret);
17271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017272}
17273
17274static int
17275test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017277
17278 int mem_base;
17279 xmlNodePtr ret_val;
17280 xmlNodePtr parent; /* the parent node */
17281 int n_parent;
17282 xmlNodePtr cur; /* the child node */
17283 int n_cur;
17284
Daniel Veillarda03e3652004-11-02 18:45:30 +000017285 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017286 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17287 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017288 parent = gen_xmlNodePtr(n_parent, 0);
17289 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017290
17291 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017292 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017293 desret_xmlNodePtr(ret_val);
17294 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017295 des_xmlNodePtr(n_parent, parent, 0);
17296 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017297 xmlResetLastError();
17298 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017299 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017300 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017301 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017302 printf(" %d", n_parent);
17303 printf(" %d", n_cur);
17304 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017305 }
17306 }
17307 }
17308
Daniel Veillard3d97e662004-11-04 10:49:00 +000017309 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017310 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017311}
17312
17313
17314static int
17315test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017316 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017317
17318 int mem_base;
17319 xmlNodePtr ret_val;
17320 xmlNodePtr parent; /* the parent node */
17321 int n_parent;
17322 xmlNodePtr cur; /* the first node in the list */
17323 int n_cur;
17324
Daniel Veillarda03e3652004-11-02 18:45:30 +000017325 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017326 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17327 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017328 parent = gen_xmlNodePtr(n_parent, 0);
17329 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017330
17331 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017332 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017333 desret_xmlNodePtr(ret_val);
17334 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017335 des_xmlNodePtr(n_parent, parent, 0);
17336 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017337 xmlResetLastError();
17338 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017339 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017341 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017342 printf(" %d", n_parent);
17343 printf(" %d", n_cur);
17344 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017345 }
17346 }
17347 }
17348
Daniel Veillard3d97e662004-11-04 10:49:00 +000017349 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017351}
17352
17353
17354static int
17355test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017357
17358 int mem_base;
17359 xmlNodePtr ret_val;
17360 xmlNodePtr cur; /* the child node */
17361 int n_cur;
17362 xmlNodePtr elem; /* the new node */
17363 int n_elem;
17364
17365 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017366 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017367 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017368 cur = gen_xmlNodePtr(n_cur, 0);
17369 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017370
17371 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017372 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017373 desret_xmlNodePtr(ret_val);
17374 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017375 des_xmlNodePtr(n_cur, cur, 0);
17376 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017377 xmlResetLastError();
17378 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017379 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017381 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017382 printf(" %d", n_cur);
17383 printf(" %d", n_elem);
17384 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017385 }
17386 }
17387 }
17388
Daniel Veillard3d97e662004-11-04 10:49:00 +000017389 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017390 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017391}
17392
17393
17394static int
17395test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017397
17398#ifdef LIBXML_TREE_ENABLED
17399 int mem_base;
17400 xmlNodePtr ret_val;
17401 xmlNodePtr cur; /* the child node */
17402 int n_cur;
17403 xmlNodePtr elem; /* the new node */
17404 int n_elem;
17405
17406 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017407 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017408 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017409 cur = gen_xmlNodePtr(n_cur, 0);
17410 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017411
17412 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017413 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017414 desret_xmlNodePtr(ret_val);
17415 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017416 des_xmlNodePtr(n_cur, cur, 0);
17417 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017418 xmlResetLastError();
17419 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017420 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017421 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017422 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017423 printf(" %d", n_cur);
17424 printf(" %d", n_elem);
17425 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017426 }
17427 }
17428 }
17429#endif
17430
Daniel Veillard3d97e662004-11-04 10:49:00 +000017431 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017433}
17434
17435
17436static int
17437test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017438 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017439
17440 int mem_base;
17441 xmlNodePtr ret_val;
17442 xmlNodePtr cur; /* the child node */
17443 int n_cur;
17444 xmlNodePtr elem; /* the new node */
17445 int n_elem;
17446
17447 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017448 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017449 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017450 cur = gen_xmlNodePtr(n_cur, 0);
17451 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017452
17453 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017454 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017455 desret_xmlNodePtr(ret_val);
17456 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017457 des_xmlNodePtr(n_cur, cur, 0);
17458 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017459 xmlResetLastError();
17460 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017461 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017463 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017464 printf(" %d", n_cur);
17465 printf(" %d", n_elem);
17466 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017467 }
17468 }
17469 }
17470
Daniel Veillard3d97e662004-11-04 10:49:00 +000017471 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017472 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017473}
17474
17475
17476static int
17477test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017478 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017479
Daniel Veillardce244ad2004-11-05 10:03:46 +000017480 int mem_base;
17481 xmlBufferPtr buf; /* the XML buffer output */
17482 int n_buf;
17483 xmlDocPtr doc; /* the document */
17484 int n_doc;
17485 xmlAttrPtr attr; /* the attribute node */
17486 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017487 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017488 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017489
Daniel Veillardce244ad2004-11-05 10:03:46 +000017490 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17491 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17492 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17493 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17494 mem_base = xmlMemBlocks();
17495 buf = gen_xmlBufferPtr(n_buf, 0);
17496 doc = gen_xmlDocPtr(n_doc, 1);
17497 attr = gen_xmlAttrPtr(n_attr, 2);
17498 string = gen_const_xmlChar_ptr(n_string, 3);
17499
17500 xmlAttrSerializeTxtContent(buf, doc, attr, string);
17501 call_tests++;
17502 des_xmlBufferPtr(n_buf, buf, 0);
17503 des_xmlDocPtr(n_doc, doc, 1);
17504 des_xmlAttrPtr(n_attr, attr, 2);
17505 des_const_xmlChar_ptr(n_string, string, 3);
17506 xmlResetLastError();
17507 if (mem_base != xmlMemBlocks()) {
17508 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017510 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017511 printf(" %d", n_buf);
17512 printf(" %d", n_doc);
17513 printf(" %d", n_attr);
17514 printf(" %d", n_string);
17515 printf("\n");
17516 }
17517 }
17518 }
17519 }
17520 }
17521
17522 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017524}
17525
17526
17527static int
17528test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017530
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017531 int mem_base;
17532 int ret_val;
17533 xmlBufferPtr buf; /* the buffer to dump */
17534 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017535 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017536 int n_str;
17537 int len; /* the number of #xmlChar to add */
17538 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017539
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017540 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17541 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17542 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17543 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017544 buf = gen_xmlBufferPtr(n_buf, 0);
17545 str = gen_const_xmlChar_ptr(n_str, 1);
17546 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017547
17548 ret_val = xmlBufferAdd(buf, str, len);
17549 desret_int(ret_val);
17550 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017551 des_xmlBufferPtr(n_buf, buf, 0);
17552 des_const_xmlChar_ptr(n_str, str, 1);
17553 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017554 xmlResetLastError();
17555 if (mem_base != xmlMemBlocks()) {
17556 printf("Leak of %d blocks found in xmlBufferAdd",
17557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017558 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017559 printf(" %d", n_buf);
17560 printf(" %d", n_str);
17561 printf(" %d", n_len);
17562 printf("\n");
17563 }
17564 }
17565 }
17566 }
17567
Daniel Veillard3d97e662004-11-04 10:49:00 +000017568 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017570}
17571
17572
17573static int
17574test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017576
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017577 int mem_base;
17578 int ret_val;
17579 xmlBufferPtr buf; /* the buffer */
17580 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017581 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017582 int n_str;
17583 int len; /* the number of #xmlChar to add */
17584 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017585
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017586 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17587 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17588 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17589 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017590 buf = gen_xmlBufferPtr(n_buf, 0);
17591 str = gen_const_xmlChar_ptr(n_str, 1);
17592 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017593
17594 ret_val = xmlBufferAddHead(buf, str, len);
17595 desret_int(ret_val);
17596 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017597 des_xmlBufferPtr(n_buf, buf, 0);
17598 des_const_xmlChar_ptr(n_str, str, 1);
17599 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017600 xmlResetLastError();
17601 if (mem_base != xmlMemBlocks()) {
17602 printf("Leak of %d blocks found in xmlBufferAddHead",
17603 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017604 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017605 printf(" %d", n_buf);
17606 printf(" %d", n_str);
17607 printf(" %d", n_len);
17608 printf("\n");
17609 }
17610 }
17611 }
17612 }
17613
Daniel Veillard3d97e662004-11-04 10:49:00 +000017614 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017615 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017616}
17617
17618
17619static int
17620test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017621 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017622
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017623 int mem_base;
17624 int ret_val;
17625 xmlBufferPtr buf; /* the buffer to dump */
17626 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017627 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017628 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017629
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017630 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17631 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
17632 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017633 buf = gen_xmlBufferPtr(n_buf, 0);
17634 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017635
17636 ret_val = xmlBufferCCat(buf, str);
17637 desret_int(ret_val);
17638 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017639 des_xmlBufferPtr(n_buf, buf, 0);
17640 des_const_char_ptr(n_str, str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017641 xmlResetLastError();
17642 if (mem_base != xmlMemBlocks()) {
17643 printf("Leak of %d blocks found in xmlBufferCCat",
17644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017645 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017646 printf(" %d", n_buf);
17647 printf(" %d", n_str);
17648 printf("\n");
17649 }
17650 }
17651 }
17652
Daniel Veillard3d97e662004-11-04 10:49:00 +000017653 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017655}
17656
17657
17658static int
17659test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017661
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017662 int mem_base;
17663 int ret_val;
17664 xmlBufferPtr buf; /* the buffer to add to */
17665 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017666 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017667 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017668
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017669 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17670 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17671 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017672 buf = gen_xmlBufferPtr(n_buf, 0);
17673 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017674
17675 ret_val = xmlBufferCat(buf, str);
17676 desret_int(ret_val);
17677 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017678 des_xmlBufferPtr(n_buf, buf, 0);
17679 des_const_xmlChar_ptr(n_str, str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017680 xmlResetLastError();
17681 if (mem_base != xmlMemBlocks()) {
17682 printf("Leak of %d blocks found in xmlBufferCat",
17683 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017684 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017685 printf(" %d", n_buf);
17686 printf(" %d", n_str);
17687 printf("\n");
17688 }
17689 }
17690 }
17691
Daniel Veillard3d97e662004-11-04 10:49:00 +000017692 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017693 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017694}
17695
17696
Daniel Veillardce682bc2004-11-05 17:22:25 +000017697#define gen_nb_const_xmlBufferPtr 1
17698static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17699 return(NULL);
17700}
17701static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17702}
17703
Daniel Veillardd93f6252004-11-02 15:53:51 +000017704static int
17705test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017707
Daniel Veillardce682bc2004-11-05 17:22:25 +000017708 int mem_base;
17709 const xmlChar * ret_val;
17710 xmlBufferPtr buf; /* the buffer */
17711 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017712
Daniel Veillardce682bc2004-11-05 17:22:25 +000017713 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
17714 mem_base = xmlMemBlocks();
17715 buf = gen_const_xmlBufferPtr(n_buf, 0);
17716
17717 ret_val = xmlBufferContent(buf);
17718 desret_const_xmlChar_ptr(ret_val);
17719 call_tests++;
17720 des_const_xmlBufferPtr(n_buf, buf, 0);
17721 xmlResetLastError();
17722 if (mem_base != xmlMemBlocks()) {
17723 printf("Leak of %d blocks found in xmlBufferContent",
17724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017725 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017726 printf(" %d", n_buf);
17727 printf("\n");
17728 }
17729 }
17730
17731 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017733}
17734
17735
17736static int
17737test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017739
Daniel Veillard3d95c732004-11-06 22:25:14 +000017740 int mem_base;
17741 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017742
Daniel Veillard3d95c732004-11-06 22:25:14 +000017743 mem_base = xmlMemBlocks();
17744
17745 ret_val = xmlBufferCreate();
17746 desret_xmlBufferPtr(ret_val);
17747 call_tests++;
17748 xmlResetLastError();
17749 if (mem_base != xmlMemBlocks()) {
17750 printf("Leak of %d blocks found in xmlBufferCreate",
17751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017752 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000017753 printf("\n");
17754 }
17755
17756 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017758}
17759
17760
17761static int
17762test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017764
17765
17766 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017767 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017768}
17769
17770
17771static int
17772test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017773 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017774
17775
17776 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017778}
17779
17780
17781static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017782test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017784
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017785 int mem_base;
17786 xmlBufferPtr buf; /* the buffer */
17787 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017788
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017789 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17790 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017791 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017792
17793 xmlBufferEmpty(buf);
17794 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017795 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017796 xmlResetLastError();
17797 if (mem_base != xmlMemBlocks()) {
17798 printf("Leak of %d blocks found in xmlBufferEmpty",
17799 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017800 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017801 printf(" %d", n_buf);
17802 printf("\n");
17803 }
17804 }
17805
Daniel Veillard3d97e662004-11-04 10:49:00 +000017806 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017807 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017808}
17809
17810
17811static int
17812test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017813 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017814
Daniel Veillard3d97e662004-11-04 10:49:00 +000017815 int mem_base;
17816 int ret_val;
17817 xmlBufferPtr buf; /* the buffer */
17818 int n_buf;
17819 unsigned int len; /* the minimum free size to allocate */
17820 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017821
Daniel Veillard3d97e662004-11-04 10:49:00 +000017822 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17823 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
17824 mem_base = xmlMemBlocks();
17825 buf = gen_xmlBufferPtr(n_buf, 0);
17826 len = gen_unsigned_int(n_len, 1);
17827
17828 ret_val = xmlBufferGrow(buf, len);
17829 desret_int(ret_val);
17830 call_tests++;
17831 des_xmlBufferPtr(n_buf, buf, 0);
17832 des_unsigned_int(n_len, len, 1);
17833 xmlResetLastError();
17834 if (mem_base != xmlMemBlocks()) {
17835 printf("Leak of %d blocks found in xmlBufferGrow",
17836 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017837 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017838 printf(" %d", n_buf);
17839 printf(" %d", n_len);
17840 printf("\n");
17841 }
17842 }
17843 }
17844
17845 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017846 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017847}
17848
17849
17850static int
17851test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017852 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017853
Daniel Veillardce682bc2004-11-05 17:22:25 +000017854 int mem_base;
17855 int ret_val;
17856 xmlBufferPtr buf; /* the buffer */
17857 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017858
Daniel Veillardce682bc2004-11-05 17:22:25 +000017859 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
17860 mem_base = xmlMemBlocks();
17861 buf = gen_const_xmlBufferPtr(n_buf, 0);
17862
17863 ret_val = xmlBufferLength(buf);
17864 desret_int(ret_val);
17865 call_tests++;
17866 des_const_xmlBufferPtr(n_buf, buf, 0);
17867 xmlResetLastError();
17868 if (mem_base != xmlMemBlocks()) {
17869 printf("Leak of %d blocks found in xmlBufferLength",
17870 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017871 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017872 printf(" %d", n_buf);
17873 printf("\n");
17874 }
17875 }
17876
17877 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017879}
17880
17881
17882static int
17883test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017885
Daniel Veillard3d97e662004-11-04 10:49:00 +000017886 int mem_base;
17887 int ret_val;
17888 xmlBufferPtr buf; /* the buffer to resize */
17889 int n_buf;
17890 unsigned int size; /* the desired size */
17891 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017892
Daniel Veillard3d97e662004-11-04 10:49:00 +000017893 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17894 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
17895 mem_base = xmlMemBlocks();
17896 buf = gen_xmlBufferPtr(n_buf, 0);
17897 size = gen_unsigned_int(n_size, 1);
17898
17899 ret_val = xmlBufferResize(buf, size);
17900 desret_int(ret_val);
17901 call_tests++;
17902 des_xmlBufferPtr(n_buf, buf, 0);
17903 des_unsigned_int(n_size, size, 1);
17904 xmlResetLastError();
17905 if (mem_base != xmlMemBlocks()) {
17906 printf("Leak of %d blocks found in xmlBufferResize",
17907 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017908 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017909 printf(" %d", n_buf);
17910 printf(" %d", n_size);
17911 printf("\n");
17912 }
17913 }
17914 }
17915
17916 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017918}
17919
17920
17921static int
17922test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017924
Daniel Veillard57b25162004-11-06 14:50:18 +000017925 int mem_base;
17926 xmlBufferPtr buf; /* the buffer to tune */
17927 int n_buf;
17928 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
17929 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017930
Daniel Veillard57b25162004-11-06 14:50:18 +000017931 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17932 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
17933 mem_base = xmlMemBlocks();
17934 buf = gen_xmlBufferPtr(n_buf, 0);
17935 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
17936
17937 xmlBufferSetAllocationScheme(buf, scheme);
17938 call_tests++;
17939 des_xmlBufferPtr(n_buf, buf, 0);
17940 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
17941 xmlResetLastError();
17942 if (mem_base != xmlMemBlocks()) {
17943 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
17944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017945 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000017946 printf(" %d", n_buf);
17947 printf(" %d", n_scheme);
17948 printf("\n");
17949 }
17950 }
17951 }
17952
17953 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017954 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017955}
17956
17957
17958static int
17959test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017960 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017961
Daniel Veillard3d97e662004-11-04 10:49:00 +000017962 int mem_base;
17963 int ret_val;
17964 xmlBufferPtr buf; /* the buffer to dump */
17965 int n_buf;
17966 unsigned int len; /* the number of xmlChar to remove */
17967 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017968
Daniel Veillard3d97e662004-11-04 10:49:00 +000017969 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17970 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
17971 mem_base = xmlMemBlocks();
17972 buf = gen_xmlBufferPtr(n_buf, 0);
17973 len = gen_unsigned_int(n_len, 1);
17974
17975 ret_val = xmlBufferShrink(buf, len);
17976 desret_int(ret_val);
17977 call_tests++;
17978 des_xmlBufferPtr(n_buf, buf, 0);
17979 des_unsigned_int(n_len, len, 1);
17980 xmlResetLastError();
17981 if (mem_base != xmlMemBlocks()) {
17982 printf("Leak of %d blocks found in xmlBufferShrink",
17983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017984 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017985 printf(" %d", n_buf);
17986 printf(" %d", n_len);
17987 printf("\n");
17988 }
17989 }
17990 }
17991
17992 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017993 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017994}
17995
17996
17997static int
17998test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017999 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018000
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018001 int mem_base;
18002 xmlBufferPtr buf; /* the XML buffer */
18003 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018004 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018005 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018006
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018007 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18008 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18009 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018010 buf = gen_xmlBufferPtr(n_buf, 0);
18011 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018012
18013 xmlBufferWriteCHAR(buf, string);
18014 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018015 des_xmlBufferPtr(n_buf, buf, 0);
18016 des_const_xmlChar_ptr(n_string, string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018017 xmlResetLastError();
18018 if (mem_base != xmlMemBlocks()) {
18019 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018021 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018022 printf(" %d", n_buf);
18023 printf(" %d", n_string);
18024 printf("\n");
18025 }
18026 }
18027 }
18028
Daniel Veillard3d97e662004-11-04 10:49:00 +000018029 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018031}
18032
18033
18034static int
18035test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018037
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018038 int mem_base;
18039 xmlBufferPtr buf; /* the XML buffer output */
18040 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018041 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018042 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018043
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018044 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18045 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18046 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018047 buf = gen_xmlBufferPtr(n_buf, 0);
18048 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018049
18050 xmlBufferWriteChar(buf, string);
18051 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018052 des_xmlBufferPtr(n_buf, buf, 0);
18053 des_const_char_ptr(n_string, string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018054 xmlResetLastError();
18055 if (mem_base != xmlMemBlocks()) {
18056 printf("Leak of %d blocks found in xmlBufferWriteChar",
18057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018058 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018059 printf(" %d", n_buf);
18060 printf(" %d", n_string);
18061 printf("\n");
18062 }
18063 }
18064 }
18065
Daniel Veillard3d97e662004-11-04 10:49:00 +000018066 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018068}
18069
18070
18071static int
18072test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018074
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018075 int mem_base;
18076 xmlBufferPtr buf; /* the XML buffer output */
18077 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018078 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018079 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018080
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018081 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18082 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18083 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018084 buf = gen_xmlBufferPtr(n_buf, 0);
18085 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018086
18087 xmlBufferWriteQuotedString(buf, string);
18088 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018089 des_xmlBufferPtr(n_buf, buf, 0);
18090 des_const_xmlChar_ptr(n_string, string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018091 xmlResetLastError();
18092 if (mem_base != xmlMemBlocks()) {
18093 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18094 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018095 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018096 printf(" %d", n_buf);
18097 printf(" %d", n_string);
18098 printf("\n");
18099 }
18100 }
18101 }
18102
Daniel Veillard3d97e662004-11-04 10:49:00 +000018103 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018105}
18106
18107
18108static int
18109test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018111
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018112 int mem_base;
18113 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018114 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018115 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018116 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018117 int n_prefix;
18118 xmlChar * memory; /* preallocated memory */
18119 int n_memory;
18120 int len; /* preallocated memory length */
18121 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018122
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018123 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18124 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18125 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18126 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18127 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018128 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18129 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18130 memory = gen_xmlChar_ptr(n_memory, 2);
18131 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018132
18133 ret_val = xmlBuildQName(ncname, prefix, memory, len);
18134 if ((ret_val != NULL) && (ret_val != ncname) &&
18135 (ret_val != prefix) && (ret_val != memory))
18136 xmlFree(ret_val);
18137 ret_val = NULL;
18138 desret_xmlChar_ptr(ret_val);
18139 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018140 des_const_xmlChar_ptr(n_ncname, ncname, 0);
18141 des_const_xmlChar_ptr(n_prefix, prefix, 1);
18142 des_xmlChar_ptr(n_memory, memory, 2);
18143 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018144 xmlResetLastError();
18145 if (mem_base != xmlMemBlocks()) {
18146 printf("Leak of %d blocks found in xmlBuildQName",
18147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018148 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018149 printf(" %d", n_ncname);
18150 printf(" %d", n_prefix);
18151 printf(" %d", n_memory);
18152 printf(" %d", n_len);
18153 printf("\n");
18154 }
18155 }
18156 }
18157 }
18158 }
18159
Daniel Veillard3d97e662004-11-04 10:49:00 +000018160 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018161 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018162}
18163
18164
18165static int
18166test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018167 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018168
18169#ifdef LIBXML_TREE_ENABLED
18170 int mem_base;
18171 xmlDocPtr ret_val;
18172 xmlDocPtr doc; /* the document */
18173 int n_doc;
18174 int recursive; /* if not zero do a recursive copy. */
18175 int n_recursive;
18176
18177 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18178 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18179 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018180 doc = gen_xmlDocPtr(n_doc, 0);
18181 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018182
18183 ret_val = xmlCopyDoc(doc, recursive);
18184 desret_xmlDocPtr(ret_val);
18185 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018186 des_xmlDocPtr(n_doc, doc, 0);
18187 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018188 xmlResetLastError();
18189 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018190 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018191 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018192 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018193 printf(" %d", n_doc);
18194 printf(" %d", n_recursive);
18195 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018196 }
18197 }
18198 }
18199#endif
18200
Daniel Veillard3d97e662004-11-04 10:49:00 +000018201 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018203}
18204
18205
18206static int
18207test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018209
Daniel Veillard27f20102004-11-05 11:50:11 +000018210#ifdef LIBXML_TREE_ENABLED
18211 int mem_base;
18212 xmlDtdPtr ret_val;
18213 xmlDtdPtr dtd; /* the dtd */
18214 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018215
Daniel Veillard27f20102004-11-05 11:50:11 +000018216 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18217 mem_base = xmlMemBlocks();
18218 dtd = gen_xmlDtdPtr(n_dtd, 0);
18219
18220 ret_val = xmlCopyDtd(dtd);
18221 desret_xmlDtdPtr(ret_val);
18222 call_tests++;
18223 des_xmlDtdPtr(n_dtd, dtd, 0);
18224 xmlResetLastError();
18225 if (mem_base != xmlMemBlocks()) {
18226 printf("Leak of %d blocks found in xmlCopyDtd",
18227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018228 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018229 printf(" %d", n_dtd);
18230 printf("\n");
18231 }
18232 }
18233#endif
18234
18235 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018236 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018237}
18238
18239
18240static int
18241test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018243
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018244 int mem_base;
18245 xmlNsPtr ret_val;
18246 xmlNsPtr cur; /* the namespace */
18247 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018248
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018249 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18250 mem_base = xmlMemBlocks();
18251 cur = gen_xmlNsPtr(n_cur, 0);
18252
18253 ret_val = xmlCopyNamespace(cur);
18254 if (ret_val != NULL) xmlFreeNs(ret_val);
18255 desret_xmlNsPtr(ret_val);
18256 call_tests++;
18257 des_xmlNsPtr(n_cur, cur, 0);
18258 xmlResetLastError();
18259 if (mem_base != xmlMemBlocks()) {
18260 printf("Leak of %d blocks found in xmlCopyNamespace",
18261 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018262 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018263 printf(" %d", n_cur);
18264 printf("\n");
18265 }
18266 }
18267
18268 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018270}
18271
18272
18273static int
18274test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018276
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018277 int mem_base;
18278 xmlNsPtr ret_val;
18279 xmlNsPtr cur; /* the first namespace */
18280 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018281
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018282 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18283 mem_base = xmlMemBlocks();
18284 cur = gen_xmlNsPtr(n_cur, 0);
18285
18286 ret_val = xmlCopyNamespaceList(cur);
18287 if (ret_val != NULL) xmlFreeNsList(ret_val);
18288 desret_xmlNsPtr(ret_val);
18289 call_tests++;
18290 des_xmlNsPtr(n_cur, cur, 0);
18291 xmlResetLastError();
18292 if (mem_base != xmlMemBlocks()) {
18293 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018295 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018296 printf(" %d", n_cur);
18297 printf("\n");
18298 }
18299 }
18300
18301 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018302 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018303}
18304
18305
18306static int
18307test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018309
Daniel Veillardce682bc2004-11-05 17:22:25 +000018310 int mem_base;
18311 xmlNodePtr ret_val;
18312 xmlNodePtr node; /* the node */
18313 int n_node;
18314 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18315 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018316
Daniel Veillardce682bc2004-11-05 17:22:25 +000018317 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18318 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18319 mem_base = xmlMemBlocks();
18320 node = gen_const_xmlNodePtr(n_node, 0);
18321 extended = gen_int(n_extended, 1);
18322
18323 ret_val = xmlCopyNode(node, extended);
18324 desret_xmlNodePtr(ret_val);
18325 call_tests++;
18326 des_const_xmlNodePtr(n_node, node, 0);
18327 des_int(n_extended, extended, 1);
18328 xmlResetLastError();
18329 if (mem_base != xmlMemBlocks()) {
18330 printf("Leak of %d blocks found in xmlCopyNode",
18331 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018332 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018333 printf(" %d", n_node);
18334 printf(" %d", n_extended);
18335 printf("\n");
18336 }
18337 }
18338 }
18339
18340 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018342}
18343
18344
18345static int
18346test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018348
Daniel Veillardce682bc2004-11-05 17:22:25 +000018349 int mem_base;
18350 xmlNodePtr ret_val;
18351 xmlNodePtr node; /* the first node in the list. */
18352 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018353
Daniel Veillardce682bc2004-11-05 17:22:25 +000018354 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18355 mem_base = xmlMemBlocks();
18356 node = gen_const_xmlNodePtr(n_node, 0);
18357
18358 ret_val = xmlCopyNodeList(node);
18359 desret_xmlNodePtr(ret_val);
18360 call_tests++;
18361 des_const_xmlNodePtr(n_node, node, 0);
18362 xmlResetLastError();
18363 if (mem_base != xmlMemBlocks()) {
18364 printf("Leak of %d blocks found in xmlCopyNodeList",
18365 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018366 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018367 printf(" %d", n_node);
18368 printf("\n");
18369 }
18370 }
18371
18372 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018374}
18375
18376
18377static int
18378test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018380
Daniel Veillard57b25162004-11-06 14:50:18 +000018381 int mem_base;
18382 xmlAttrPtr ret_val;
18383 xmlNodePtr target; /* the element where the attribute will be grafted */
18384 int n_target;
18385 xmlAttrPtr cur; /* the attribute */
18386 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018387
Daniel Veillard57b25162004-11-06 14:50:18 +000018388 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18389 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18390 mem_base = xmlMemBlocks();
18391 target = gen_xmlNodePtr(n_target, 0);
18392 cur = gen_xmlAttrPtr(n_cur, 1);
18393
18394 ret_val = xmlCopyProp(target, cur);
18395 desret_xmlAttrPtr(ret_val);
18396 call_tests++;
18397 des_xmlNodePtr(n_target, target, 0);
18398 des_xmlAttrPtr(n_cur, cur, 1);
18399 xmlResetLastError();
18400 if (mem_base != xmlMemBlocks()) {
18401 printf("Leak of %d blocks found in xmlCopyProp",
18402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018403 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018404 printf(" %d", n_target);
18405 printf(" %d", n_cur);
18406 printf("\n");
18407 }
18408 }
18409 }
18410
18411 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018413}
18414
18415
18416static int
18417test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018419
Daniel Veillard57b25162004-11-06 14:50:18 +000018420 int mem_base;
18421 xmlAttrPtr ret_val;
18422 xmlNodePtr target; /* the element where the attributes will be grafted */
18423 int n_target;
18424 xmlAttrPtr cur; /* the first attribute */
18425 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018426
Daniel Veillard57b25162004-11-06 14:50:18 +000018427 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18428 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18429 mem_base = xmlMemBlocks();
18430 target = gen_xmlNodePtr(n_target, 0);
18431 cur = gen_xmlAttrPtr(n_cur, 1);
18432
18433 ret_val = xmlCopyPropList(target, cur);
18434 desret_xmlAttrPtr(ret_val);
18435 call_tests++;
18436 des_xmlNodePtr(n_target, target, 0);
18437 des_xmlAttrPtr(n_cur, cur, 1);
18438 xmlResetLastError();
18439 if (mem_base != xmlMemBlocks()) {
18440 printf("Leak of %d blocks found in xmlCopyPropList",
18441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018442 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018443 printf(" %d", n_target);
18444 printf(" %d", n_cur);
18445 printf("\n");
18446 }
18447 }
18448 }
18449
18450 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018452}
18453
18454
18455static int
18456test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018458
Daniel Veillard34099b42004-11-04 17:34:35 +000018459 int mem_base;
18460 xmlDtdPtr ret_val;
18461 xmlDocPtr doc; /* the document pointer */
18462 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018463 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018464 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018465 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018466 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018467 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018468 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018469
Daniel Veillard34099b42004-11-04 17:34:35 +000018470 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18471 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18472 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18473 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18474 mem_base = xmlMemBlocks();
18475 doc = gen_xmlDocPtr(n_doc, 0);
18476 name = gen_const_xmlChar_ptr(n_name, 1);
18477 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18478 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18479
18480 ret_val = xmlCreateIntSubset(doc, name, ExternalID, SystemID);
18481 desret_xmlDtdPtr(ret_val);
18482 call_tests++;
18483 des_xmlDocPtr(n_doc, doc, 0);
18484 des_const_xmlChar_ptr(n_name, name, 1);
18485 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
18486 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
18487 xmlResetLastError();
18488 if (mem_base != xmlMemBlocks()) {
18489 printf("Leak of %d blocks found in xmlCreateIntSubset",
18490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018491 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018492 printf(" %d", n_doc);
18493 printf(" %d", n_name);
18494 printf(" %d", n_ExternalID);
18495 printf(" %d", n_SystemID);
18496 printf("\n");
18497 }
18498 }
18499 }
18500 }
18501 }
18502
18503 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018504 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018505}
18506
18507
18508static int
18509test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018510 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018511
Daniel Veillardce682bc2004-11-05 17:22:25 +000018512 int mem_base;
18513 xmlNodePtr ret_val;
18514 xmlNodePtr node; /* the node */
18515 int n_node;
18516 xmlDocPtr doc; /* the document */
18517 int n_doc;
18518 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18519 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018520
Daniel Veillardce682bc2004-11-05 17:22:25 +000018521 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18522 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18523 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18524 mem_base = xmlMemBlocks();
18525 node = gen_const_xmlNodePtr(n_node, 0);
18526 doc = gen_xmlDocPtr(n_doc, 1);
18527 extended = gen_int(n_extended, 2);
18528
18529 ret_val = xmlDocCopyNode(node, doc, extended);
18530 desret_xmlNodePtr(ret_val);
18531 call_tests++;
18532 des_const_xmlNodePtr(n_node, node, 0);
18533 des_xmlDocPtr(n_doc, doc, 1);
18534 des_int(n_extended, extended, 2);
18535 xmlResetLastError();
18536 if (mem_base != xmlMemBlocks()) {
18537 printf("Leak of %d blocks found in xmlDocCopyNode",
18538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018539 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018540 printf(" %d", n_node);
18541 printf(" %d", n_doc);
18542 printf(" %d", n_extended);
18543 printf("\n");
18544 }
18545 }
18546 }
18547 }
18548
18549 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018551}
18552
18553
18554static int
18555test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018557
Daniel Veillardce682bc2004-11-05 17:22:25 +000018558 int mem_base;
18559 xmlNodePtr ret_val;
18560 xmlDocPtr doc; /* the target document */
18561 int n_doc;
18562 xmlNodePtr node; /* the first node in the list. */
18563 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018564
Daniel Veillardce682bc2004-11-05 17:22:25 +000018565 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18566 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18567 mem_base = xmlMemBlocks();
18568 doc = gen_xmlDocPtr(n_doc, 0);
18569 node = gen_const_xmlNodePtr(n_node, 1);
18570
18571 ret_val = xmlDocCopyNodeList(doc, node);
18572 desret_xmlNodePtr(ret_val);
18573 call_tests++;
18574 des_xmlDocPtr(n_doc, doc, 0);
18575 des_const_xmlNodePtr(n_node, node, 1);
18576 xmlResetLastError();
18577 if (mem_base != xmlMemBlocks()) {
18578 printf("Leak of %d blocks found in xmlDocCopyNodeList",
18579 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018580 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018581 printf(" %d", n_doc);
18582 printf(" %d", n_node);
18583 printf("\n");
18584 }
18585 }
18586 }
18587
18588 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018589 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018590}
18591
18592
18593static int
18594test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018596
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018597#ifdef LIBXML_OUTPUT_ENABLED
18598 int mem_base;
18599 int ret_val;
18600 FILE * f; /* the FILE* */
18601 int n_f;
18602 xmlDocPtr cur; /* the document */
18603 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018604
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018605 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
18606 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18607 mem_base = xmlMemBlocks();
18608 f = gen_FILE_ptr(n_f, 0);
18609 cur = gen_xmlDocPtr(n_cur, 1);
18610
18611 ret_val = xmlDocDump(f, cur);
18612 desret_int(ret_val);
18613 call_tests++;
18614 des_FILE_ptr(n_f, f, 0);
18615 des_xmlDocPtr(n_cur, cur, 1);
18616 xmlResetLastError();
18617 if (mem_base != xmlMemBlocks()) {
18618 printf("Leak of %d blocks found in xmlDocDump",
18619 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018620 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018621 printf(" %d", n_f);
18622 printf(" %d", n_cur);
18623 printf("\n");
18624 }
18625 }
18626 }
18627#endif
18628
18629 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018631}
18632
18633
18634static int
18635test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018637
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018638#ifdef LIBXML_OUTPUT_ENABLED
18639 int mem_base;
18640 xmlDocPtr cur; /* the document */
18641 int n_cur;
18642 xmlChar ** mem; /* OUT: the memory pointer */
18643 int n_mem;
18644 int * size; /* OUT: the memory length */
18645 int n_size;
18646 int format; /* should formatting spaces been added */
18647 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018648
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018649 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18650 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18651 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18652 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18653 mem_base = xmlMemBlocks();
18654 cur = gen_xmlDocPtr(n_cur, 0);
18655 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18656 size = gen_int_ptr(n_size, 2);
18657 format = gen_int(n_format, 3);
18658
18659 xmlDocDumpFormatMemory(cur, mem, size, format);
18660 call_tests++;
18661 des_xmlDocPtr(n_cur, cur, 0);
18662 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18663 des_int_ptr(n_size, size, 2);
18664 des_int(n_format, format, 3);
18665 xmlResetLastError();
18666 if (mem_base != xmlMemBlocks()) {
18667 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
18668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018669 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018670 printf(" %d", n_cur);
18671 printf(" %d", n_mem);
18672 printf(" %d", n_size);
18673 printf(" %d", n_format);
18674 printf("\n");
18675 }
18676 }
18677 }
18678 }
18679 }
18680#endif
18681
18682 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018683 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018684}
18685
18686
18687static int
18688test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018689 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018690
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018691#ifdef LIBXML_OUTPUT_ENABLED
18692 int mem_base;
18693 xmlDocPtr out_doc; /* Document to generate XML text from */
18694 int n_out_doc;
18695 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18696 int n_doc_txt_ptr;
18697 int * doc_txt_len; /* Length of the generated XML text */
18698 int n_doc_txt_len;
18699 char * txt_encoding; /* Character encoding to use when generating XML text */
18700 int n_txt_encoding;
18701 int format; /* should formatting spaces been added */
18702 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018703
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018704 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18705 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
18706 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
18707 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
18708 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18709 mem_base = xmlMemBlocks();
18710 out_doc = gen_xmlDocPtr(n_out_doc, 0);
18711 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
18712 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
18713 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
18714 format = gen_int(n_format, 4);
18715
18716 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, txt_encoding, format);
18717 call_tests++;
18718 des_xmlDocPtr(n_out_doc, out_doc, 0);
18719 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
18720 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
18721 des_const_char_ptr(n_txt_encoding, txt_encoding, 3);
18722 des_int(n_format, format, 4);
18723 xmlResetLastError();
18724 if (mem_base != xmlMemBlocks()) {
18725 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
18726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018727 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018728 printf(" %d", n_out_doc);
18729 printf(" %d", n_doc_txt_ptr);
18730 printf(" %d", n_doc_txt_len);
18731 printf(" %d", n_txt_encoding);
18732 printf(" %d", n_format);
18733 printf("\n");
18734 }
18735 }
18736 }
18737 }
18738 }
18739 }
18740#endif
18741
18742 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018744}
18745
18746
18747static int
18748test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018750
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018751#ifdef LIBXML_OUTPUT_ENABLED
18752 int mem_base;
18753 xmlDocPtr cur; /* the document */
18754 int n_cur;
18755 xmlChar ** mem; /* OUT: the memory pointer */
18756 int n_mem;
18757 int * size; /* OUT: the memory length */
18758 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018759
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018760 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18761 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18762 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18763 mem_base = xmlMemBlocks();
18764 cur = gen_xmlDocPtr(n_cur, 0);
18765 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18766 size = gen_int_ptr(n_size, 2);
18767
18768 xmlDocDumpMemory(cur, mem, size);
18769 call_tests++;
18770 des_xmlDocPtr(n_cur, cur, 0);
18771 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18772 des_int_ptr(n_size, size, 2);
18773 xmlResetLastError();
18774 if (mem_base != xmlMemBlocks()) {
18775 printf("Leak of %d blocks found in xmlDocDumpMemory",
18776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018777 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018778 printf(" %d", n_cur);
18779 printf(" %d", n_mem);
18780 printf(" %d", n_size);
18781 printf("\n");
18782 }
18783 }
18784 }
18785 }
18786#endif
18787
18788 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018789 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018790}
18791
18792
18793static int
18794test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018795 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018796
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018797#ifdef LIBXML_OUTPUT_ENABLED
18798 int mem_base;
18799 xmlDocPtr out_doc; /* Document to generate XML text from */
18800 int n_out_doc;
18801 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18802 int n_doc_txt_ptr;
18803 int * doc_txt_len; /* Length of the generated XML text */
18804 int n_doc_txt_len;
18805 char * txt_encoding; /* Character encoding to use when generating XML text */
18806 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018807
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018808 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18809 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
18810 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
18811 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
18812 mem_base = xmlMemBlocks();
18813 out_doc = gen_xmlDocPtr(n_out_doc, 0);
18814 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
18815 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
18816 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
18817
18818 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, txt_encoding);
18819 call_tests++;
18820 des_xmlDocPtr(n_out_doc, out_doc, 0);
18821 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
18822 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
18823 des_const_char_ptr(n_txt_encoding, txt_encoding, 3);
18824 xmlResetLastError();
18825 if (mem_base != xmlMemBlocks()) {
18826 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
18827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018828 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018829 printf(" %d", n_out_doc);
18830 printf(" %d", n_doc_txt_ptr);
18831 printf(" %d", n_doc_txt_len);
18832 printf(" %d", n_txt_encoding);
18833 printf("\n");
18834 }
18835 }
18836 }
18837 }
18838 }
18839#endif
18840
18841 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018842 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018843}
18844
18845
18846static int
18847test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018848 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018849
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018850#ifdef LIBXML_OUTPUT_ENABLED
18851 int mem_base;
18852 int ret_val;
18853 FILE * f; /* the FILE* */
18854 int n_f;
18855 xmlDocPtr cur; /* the document */
18856 int n_cur;
18857 int format; /* should formatting spaces been added */
18858 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018859
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018860 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
18861 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18862 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18863 mem_base = xmlMemBlocks();
18864 f = gen_FILE_ptr(n_f, 0);
18865 cur = gen_xmlDocPtr(n_cur, 1);
18866 format = gen_int(n_format, 2);
18867
18868 ret_val = xmlDocFormatDump(f, cur, format);
18869 desret_int(ret_val);
18870 call_tests++;
18871 des_FILE_ptr(n_f, f, 0);
18872 des_xmlDocPtr(n_cur, cur, 1);
18873 des_int(n_format, format, 2);
18874 xmlResetLastError();
18875 if (mem_base != xmlMemBlocks()) {
18876 printf("Leak of %d blocks found in xmlDocFormatDump",
18877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018878 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018879 printf(" %d", n_f);
18880 printf(" %d", n_cur);
18881 printf(" %d", n_format);
18882 printf("\n");
18883 }
18884 }
18885 }
18886 }
18887#endif
18888
18889 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018891}
18892
18893
18894static int
18895test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018896 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018897
18898 int mem_base;
18899 xmlNodePtr ret_val;
18900 xmlDocPtr doc; /* the document */
18901 int n_doc;
18902
18903 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18904 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018905 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018906
18907 ret_val = xmlDocGetRootElement(doc);
18908 desret_xmlNodePtr(ret_val);
18909 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018910 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018911 xmlResetLastError();
18912 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018913 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018914 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018915 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018916 printf(" %d", n_doc);
18917 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018918 }
18919 }
18920
Daniel Veillard3d97e662004-11-04 10:49:00 +000018921 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018922 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018923}
18924
18925
18926static int
18927test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018928 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018929
18930#ifdef LIBXML_TREE_ENABLED
18931 int mem_base;
18932 xmlNodePtr ret_val;
18933 xmlDocPtr doc; /* the document */
18934 int n_doc;
18935 xmlNodePtr root; /* the new document root element */
18936 int n_root;
18937
18938 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018939 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000018940 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018941 doc = gen_xmlDocPtr(n_doc, 0);
18942 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018943
18944 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018945 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000018946 desret_xmlNodePtr(ret_val);
18947 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018948 des_xmlDocPtr(n_doc, doc, 0);
18949 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018950 xmlResetLastError();
18951 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018952 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018954 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018955 printf(" %d", n_doc);
18956 printf(" %d", n_root);
18957 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018958 }
18959 }
18960 }
18961#endif
18962
Daniel Veillard3d97e662004-11-04 10:49:00 +000018963 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018964 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018965}
18966
18967
18968static int
18969test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018970 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018971
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018972#ifdef LIBXML_OUTPUT_ENABLED
18973 int mem_base;
18974 FILE * f; /* the FILE * for the output */
18975 int n_f;
18976 xmlDocPtr doc; /* the document */
18977 int n_doc;
18978 xmlNodePtr cur; /* the current node */
18979 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018980
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018981 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
18982 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18983 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
18984 mem_base = xmlMemBlocks();
18985 f = gen_FILE_ptr(n_f, 0);
18986 doc = gen_xmlDocPtr(n_doc, 1);
18987 cur = gen_xmlNodePtr(n_cur, 2);
18988
18989 xmlElemDump(f, doc, cur);
18990 call_tests++;
18991 des_FILE_ptr(n_f, f, 0);
18992 des_xmlDocPtr(n_doc, doc, 1);
18993 des_xmlNodePtr(n_cur, cur, 2);
18994 xmlResetLastError();
18995 if (mem_base != xmlMemBlocks()) {
18996 printf("Leak of %d blocks found in xmlElemDump",
18997 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018998 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018999 printf(" %d", n_f);
19000 printf(" %d", n_doc);
19001 printf(" %d", n_cur);
19002 printf("\n");
19003 }
19004 }
19005 }
19006 }
19007#endif
19008
19009 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019011}
19012
19013
19014static int
19015test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019016 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019017
Daniel Veillard57b25162004-11-06 14:50:18 +000019018 int mem_base;
19019 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019020
Daniel Veillard57b25162004-11-06 14:50:18 +000019021 mem_base = xmlMemBlocks();
19022
19023 ret_val = xmlGetBufferAllocationScheme();
19024 desret_xmlBufferAllocationScheme(ret_val);
19025 call_tests++;
19026 xmlResetLastError();
19027 if (mem_base != xmlMemBlocks()) {
19028 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019030 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019031 printf("\n");
19032 }
19033
19034 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019036}
19037
19038
19039static int
19040test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019042
19043 int mem_base;
19044 int ret_val;
19045
19046 mem_base = xmlMemBlocks();
19047
19048 ret_val = xmlGetCompressMode();
19049 desret_int(ret_val);
19050 call_tests++;
19051 xmlResetLastError();
19052 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019053 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019055 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019056 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019057 }
19058
Daniel Veillard3d97e662004-11-04 10:49:00 +000019059 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019061}
19062
19063
19064static int
19065test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019067
19068 int mem_base;
19069 int ret_val;
19070 xmlDocPtr doc; /* the document */
19071 int n_doc;
19072
19073 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19074 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019075 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019076
19077 ret_val = xmlGetDocCompressMode(doc);
19078 desret_int(ret_val);
19079 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019080 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019081 xmlResetLastError();
19082 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019083 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019085 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019086 printf(" %d", n_doc);
19087 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019088 }
19089 }
19090
Daniel Veillard3d97e662004-11-04 10:49:00 +000019091 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019093}
19094
19095
19096static int
19097test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019099
Daniel Veillard34099b42004-11-04 17:34:35 +000019100 int mem_base;
19101 xmlDtdPtr ret_val;
19102 xmlDocPtr doc; /* the document pointer */
19103 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019104
Daniel Veillard34099b42004-11-04 17:34:35 +000019105 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19106 mem_base = xmlMemBlocks();
19107 doc = gen_xmlDocPtr(n_doc, 0);
19108
19109 ret_val = xmlGetIntSubset(doc);
19110 desret_xmlDtdPtr(ret_val);
19111 call_tests++;
19112 des_xmlDocPtr(n_doc, doc, 0);
19113 xmlResetLastError();
19114 if (mem_base != xmlMemBlocks()) {
19115 printf("Leak of %d blocks found in xmlGetIntSubset",
19116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019117 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019118 printf(" %d", n_doc);
19119 printf("\n");
19120 }
19121 }
19122
19123 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019125}
19126
19127
19128static int
19129test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019131
19132 int mem_base;
19133 xmlNodePtr ret_val;
19134 xmlNodePtr parent; /* the parent node */
19135 int n_parent;
19136
19137 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19138 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019139 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019140
19141 ret_val = xmlGetLastChild(parent);
19142 desret_xmlNodePtr(ret_val);
19143 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019144 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019145 xmlResetLastError();
19146 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019147 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019148 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019149 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019150 printf(" %d", n_parent);
19151 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019152 }
19153 }
19154
Daniel Veillard3d97e662004-11-04 10:49:00 +000019155 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019156 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019157}
19158
19159
19160static int
19161test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019162 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019163
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019164 int mem_base;
19165 long ret_val;
19166 xmlNodePtr node; /* valid node */
19167 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019168
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019169 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19170 mem_base = xmlMemBlocks();
19171 node = gen_xmlNodePtr(n_node, 0);
19172
19173 ret_val = xmlGetLineNo(node);
19174 desret_long(ret_val);
19175 call_tests++;
19176 des_xmlNodePtr(n_node, node, 0);
19177 xmlResetLastError();
19178 if (mem_base != xmlMemBlocks()) {
19179 printf("Leak of %d blocks found in xmlGetLineNo",
19180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019181 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019182 printf(" %d", n_node);
19183 printf("\n");
19184 }
19185 }
19186
19187 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019188 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019189}
19190
19191
19192static int
19193test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019195
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019196 int mem_base;
19197 xmlChar * ret_val;
19198 xmlNodePtr node; /* the node */
19199 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019200 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019201 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019202
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019203 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19204 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19205 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019206 node = gen_xmlNodePtr(n_node, 0);
19207 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019208
19209 ret_val = xmlGetNoNsProp(node, name);
19210 desret_xmlChar_ptr(ret_val);
19211 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019212 des_xmlNodePtr(n_node, node, 0);
19213 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019214 xmlResetLastError();
19215 if (mem_base != xmlMemBlocks()) {
19216 printf("Leak of %d blocks found in xmlGetNoNsProp",
19217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019218 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019219 printf(" %d", n_node);
19220 printf(" %d", n_name);
19221 printf("\n");
19222 }
19223 }
19224 }
19225
Daniel Veillard3d97e662004-11-04 10:49:00 +000019226 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019227 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019228}
19229
19230
19231static int
19232test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019234
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019235#ifdef LIBXML_TREE_ENABLED
19236 int mem_base;
19237 xmlChar * ret_val;
19238 xmlNodePtr node; /* a node */
19239 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019240
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019241 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19242 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019243 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019244
19245 ret_val = xmlGetNodePath(node);
19246 desret_xmlChar_ptr(ret_val);
19247 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019248 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019249 xmlResetLastError();
19250 if (mem_base != xmlMemBlocks()) {
19251 printf("Leak of %d blocks found in xmlGetNodePath",
19252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019253 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019254 printf(" %d", n_node);
19255 printf("\n");
19256 }
19257 }
19258#endif
19259
Daniel Veillard3d97e662004-11-04 10:49:00 +000019260 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019261 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019262}
19263
19264
19265static int
19266test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019267 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019268
19269
19270 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019272}
19273
19274
19275static int
19276test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019277 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019278
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019279 int mem_base;
19280 xmlChar * ret_val;
19281 xmlNodePtr node; /* the node */
19282 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019283 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019284 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019285 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019286 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019287
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019288 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19289 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19290 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19291 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019292 node = gen_xmlNodePtr(n_node, 0);
19293 name = gen_const_xmlChar_ptr(n_name, 1);
19294 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019295
19296 ret_val = xmlGetNsProp(node, name, nameSpace);
19297 desret_xmlChar_ptr(ret_val);
19298 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019299 des_xmlNodePtr(n_node, node, 0);
19300 des_const_xmlChar_ptr(n_name, name, 1);
19301 des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019302 xmlResetLastError();
19303 if (mem_base != xmlMemBlocks()) {
19304 printf("Leak of %d blocks found in xmlGetNsProp",
19305 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019306 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019307 printf(" %d", n_node);
19308 printf(" %d", n_name);
19309 printf(" %d", n_nameSpace);
19310 printf("\n");
19311 }
19312 }
19313 }
19314 }
19315
Daniel Veillard3d97e662004-11-04 10:49:00 +000019316 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019318}
19319
19320
19321static int
19322test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019324
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019325 int mem_base;
19326 xmlChar * ret_val;
19327 xmlNodePtr node; /* the node */
19328 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019329 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019330 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019331
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019332 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19333 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19334 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019335 node = gen_xmlNodePtr(n_node, 0);
19336 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019337
19338 ret_val = xmlGetProp(node, name);
19339 desret_xmlChar_ptr(ret_val);
19340 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019341 des_xmlNodePtr(n_node, node, 0);
19342 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019343 xmlResetLastError();
19344 if (mem_base != xmlMemBlocks()) {
19345 printf("Leak of %d blocks found in xmlGetProp",
19346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019347 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019348 printf(" %d", n_node);
19349 printf(" %d", n_name);
19350 printf("\n");
19351 }
19352 }
19353 }
19354
Daniel Veillard3d97e662004-11-04 10:49:00 +000019355 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019356 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019357}
19358
19359
19360static int
19361test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019362 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019363
Daniel Veillard57b25162004-11-06 14:50:18 +000019364 int mem_base;
19365 xmlAttrPtr ret_val;
19366 xmlNodePtr node; /* the node */
19367 int n_node;
19368 xmlChar * name; /* the attribute name */
19369 int n_name;
19370 xmlChar * nameSpace; /* the URI of the namespace */
19371 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019372
Daniel Veillard57b25162004-11-06 14:50:18 +000019373 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19374 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19375 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19376 mem_base = xmlMemBlocks();
19377 node = gen_xmlNodePtr(n_node, 0);
19378 name = gen_const_xmlChar_ptr(n_name, 1);
19379 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19380
19381 ret_val = xmlHasNsProp(node, name, nameSpace);
19382 desret_xmlAttrPtr(ret_val);
19383 call_tests++;
19384 des_xmlNodePtr(n_node, node, 0);
19385 des_const_xmlChar_ptr(n_name, name, 1);
19386 des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
19387 xmlResetLastError();
19388 if (mem_base != xmlMemBlocks()) {
19389 printf("Leak of %d blocks found in xmlHasNsProp",
19390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019391 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019392 printf(" %d", n_node);
19393 printf(" %d", n_name);
19394 printf(" %d", n_nameSpace);
19395 printf("\n");
19396 }
19397 }
19398 }
19399 }
19400
19401 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019402 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019403}
19404
19405
19406static int
19407test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019408 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019409
Daniel Veillard57b25162004-11-06 14:50:18 +000019410 int mem_base;
19411 xmlAttrPtr ret_val;
19412 xmlNodePtr node; /* the node */
19413 int n_node;
19414 xmlChar * name; /* the attribute name */
19415 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019416
Daniel Veillard57b25162004-11-06 14:50:18 +000019417 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19418 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19419 mem_base = xmlMemBlocks();
19420 node = gen_xmlNodePtr(n_node, 0);
19421 name = gen_const_xmlChar_ptr(n_name, 1);
19422
19423 ret_val = xmlHasProp(node, name);
19424 desret_xmlAttrPtr(ret_val);
19425 call_tests++;
19426 des_xmlNodePtr(n_node, node, 0);
19427 des_const_xmlChar_ptr(n_name, name, 1);
19428 xmlResetLastError();
19429 if (mem_base != xmlMemBlocks()) {
19430 printf("Leak of %d blocks found in xmlHasProp",
19431 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019432 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019433 printf(" %d", n_node);
19434 printf(" %d", n_name);
19435 printf("\n");
19436 }
19437 }
19438 }
19439
19440 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019441 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019442}
19443
19444
19445static int
19446test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019447 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019448
19449 int mem_base;
19450 int ret_val;
19451 xmlNodePtr node; /* the node */
19452 int n_node;
19453
19454 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19455 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019456 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019457
19458 ret_val = xmlIsBlankNode(node);
19459 desret_int(ret_val);
19460 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019461 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019462 xmlResetLastError();
19463 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019464 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019465 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019466 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019467 printf(" %d", n_node);
19468 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019469 }
19470 }
19471
Daniel Veillard3d97e662004-11-04 10:49:00 +000019472 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019474}
19475
19476
19477static int
19478test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019479 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019480
19481 int mem_base;
19482 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019483 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019484 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019485 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019486 int n_publicID;
19487
19488 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19489 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19490 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019491 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19492 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019493
19494 ret_val = xmlIsXHTML(systemID, publicID);
19495 desret_int(ret_val);
19496 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019497 des_const_xmlChar_ptr(n_systemID, systemID, 0);
19498 des_const_xmlChar_ptr(n_publicID, publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019499 xmlResetLastError();
19500 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019501 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019503 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019504 printf(" %d", n_systemID);
19505 printf(" %d", n_publicID);
19506 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019507 }
19508 }
19509 }
19510
Daniel Veillard3d97e662004-11-04 10:49:00 +000019511 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019513}
19514
19515
19516static int
19517test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019519
19520 int mem_base;
19521 xmlNodePtr ret_val;
19522 xmlDocPtr doc; /* the document */
19523 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019524 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019525 int n_content;
19526 int len; /* the length of the block */
19527 int n_len;
19528
19529 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19530 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19531 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19532 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019533 doc = gen_xmlDocPtr(n_doc, 0);
19534 content = gen_const_xmlChar_ptr(n_content, 1);
19535 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019536
19537 ret_val = xmlNewCDataBlock(doc, content, len);
19538 desret_xmlNodePtr(ret_val);
19539 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019540 des_xmlDocPtr(n_doc, doc, 0);
19541 des_const_xmlChar_ptr(n_content, content, 1);
19542 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019543 xmlResetLastError();
19544 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019545 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019546 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019547 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019548 printf(" %d", n_doc);
19549 printf(" %d", n_content);
19550 printf(" %d", n_len);
19551 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019552 }
19553 }
19554 }
19555 }
19556
Daniel Veillard3d97e662004-11-04 10:49:00 +000019557 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019559}
19560
19561
19562static int
19563test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019565
19566 int mem_base;
19567 xmlNodePtr ret_val;
19568 xmlDocPtr doc; /* the document */
19569 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019570 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019571 int n_name;
19572
19573 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19574 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19575 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019576 doc = gen_xmlDocPtr(n_doc, 0);
19577 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019578
19579 ret_val = xmlNewCharRef(doc, name);
19580 desret_xmlNodePtr(ret_val);
19581 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019582 des_xmlDocPtr(n_doc, doc, 0);
19583 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019584 xmlResetLastError();
19585 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019586 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019588 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019589 printf(" %d", n_doc);
19590 printf(" %d", n_name);
19591 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019592 }
19593 }
19594 }
19595
Daniel Veillard3d97e662004-11-04 10:49:00 +000019596 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019597 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019598}
19599
19600
19601static int
19602test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019603 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019604
Daniel Veillard27f20102004-11-05 11:50:11 +000019605 int mem_base;
19606 xmlNodePtr ret_val;
19607 xmlNodePtr parent; /* the parent node */
19608 int n_parent;
19609 xmlNsPtr ns; /* a namespace if any */
19610 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019611 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000019612 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019613 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000019614 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019615
Daniel Veillard27f20102004-11-05 11:50:11 +000019616 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19617 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19618 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19619 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19620 mem_base = xmlMemBlocks();
19621 parent = gen_xmlNodePtr(n_parent, 0);
19622 ns = gen_xmlNsPtr(n_ns, 1);
19623 name = gen_const_xmlChar_ptr(n_name, 2);
19624 content = gen_const_xmlChar_ptr(n_content, 3);
19625
19626 ret_val = xmlNewChild(parent, ns, name, content);
19627 desret_xmlNodePtr(ret_val);
19628 call_tests++;
19629 des_xmlNodePtr(n_parent, parent, 0);
19630 des_xmlNsPtr(n_ns, ns, 1);
19631 des_const_xmlChar_ptr(n_name, name, 2);
19632 des_const_xmlChar_ptr(n_content, content, 3);
19633 xmlResetLastError();
19634 if (mem_base != xmlMemBlocks()) {
19635 printf("Leak of %d blocks found in xmlNewChild",
19636 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019637 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000019638 printf(" %d", n_parent);
19639 printf(" %d", n_ns);
19640 printf(" %d", n_name);
19641 printf(" %d", n_content);
19642 printf("\n");
19643 }
19644 }
19645 }
19646 }
19647 }
19648
19649 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019651}
19652
19653
19654static int
19655test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019657
19658 int mem_base;
19659 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019660 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019661 int n_content;
19662
19663 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19664 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019665 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019666
19667 ret_val = xmlNewComment(content);
19668 desret_xmlNodePtr(ret_val);
19669 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019670 des_const_xmlChar_ptr(n_content, content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019671 xmlResetLastError();
19672 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019673 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019675 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019676 printf(" %d", n_content);
19677 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019678 }
19679 }
19680
Daniel Veillard3d97e662004-11-04 10:49:00 +000019681 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019682 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019683}
19684
19685
19686static int
19687test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019688 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019689
19690 int mem_base;
19691 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019692 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019693 int n_version;
19694
19695 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
19696 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019697 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019698
19699 ret_val = xmlNewDoc(version);
19700 desret_xmlDocPtr(ret_val);
19701 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019702 des_const_xmlChar_ptr(n_version, version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019703 xmlResetLastError();
19704 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019705 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019707 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019708 printf(" %d", n_version);
19709 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019710 }
19711 }
19712
Daniel Veillard3d97e662004-11-04 10:49:00 +000019713 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019714 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019715}
19716
19717
19718static int
19719test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019720 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019721
19722 int mem_base;
19723 xmlNodePtr ret_val;
19724 xmlDocPtr doc; /* the document */
19725 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019726 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019727 int n_content;
19728
19729 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19730 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19731 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019732 doc = gen_xmlDocPtr(n_doc, 0);
19733 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019734
19735 ret_val = xmlNewDocComment(doc, content);
19736 desret_xmlNodePtr(ret_val);
19737 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019738 des_xmlDocPtr(n_doc, doc, 0);
19739 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019740 xmlResetLastError();
19741 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019742 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019743 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019744 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019745 printf(" %d", n_doc);
19746 printf(" %d", n_content);
19747 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019748 }
19749 }
19750 }
19751
Daniel Veillard3d97e662004-11-04 10:49:00 +000019752 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019754}
19755
19756
19757static int
19758test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019760
19761#ifdef LIBXML_TREE_ENABLED
19762 int mem_base;
19763 xmlNodePtr ret_val;
19764 xmlDocPtr doc; /* the document owning the fragment */
19765 int n_doc;
19766
19767 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19768 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019769 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019770
19771 ret_val = xmlNewDocFragment(doc);
19772 desret_xmlNodePtr(ret_val);
19773 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019774 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019775 xmlResetLastError();
19776 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019777 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019779 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019780 printf(" %d", n_doc);
19781 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019782 }
19783 }
19784#endif
19785
Daniel Veillard3d97e662004-11-04 10:49:00 +000019786 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019788}
19789
19790
19791static int
19792test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019794
Daniel Veillard27f20102004-11-05 11:50:11 +000019795 int mem_base;
19796 xmlNodePtr ret_val;
19797 xmlDocPtr doc; /* the document */
19798 int n_doc;
19799 xmlNsPtr ns; /* namespace if any */
19800 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019801 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000019802 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019803 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000019804 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019805
Daniel Veillard27f20102004-11-05 11:50:11 +000019806 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19807 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19808 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19809 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19810 mem_base = xmlMemBlocks();
19811 doc = gen_xmlDocPtr(n_doc, 0);
19812 ns = gen_xmlNsPtr(n_ns, 1);
19813 name = gen_const_xmlChar_ptr(n_name, 2);
19814 content = gen_const_xmlChar_ptr(n_content, 3);
19815
19816 ret_val = xmlNewDocNode(doc, ns, name, content);
19817 desret_xmlNodePtr(ret_val);
19818 call_tests++;
19819 des_xmlDocPtr(n_doc, doc, 0);
19820 des_xmlNsPtr(n_ns, ns, 1);
19821 des_const_xmlChar_ptr(n_name, name, 2);
19822 des_const_xmlChar_ptr(n_content, content, 3);
19823 xmlResetLastError();
19824 if (mem_base != xmlMemBlocks()) {
19825 printf("Leak of %d blocks found in xmlNewDocNode",
19826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019827 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000019828 printf(" %d", n_doc);
19829 printf(" %d", n_ns);
19830 printf(" %d", n_name);
19831 printf(" %d", n_content);
19832 printf("\n");
19833 }
19834 }
19835 }
19836 }
19837 }
19838
19839 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019840 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019841}
19842
19843
19844static int
19845test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019846 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019847
Daniel Veillard27f20102004-11-05 11:50:11 +000019848 int mem_base;
19849 xmlNodePtr ret_val;
19850 xmlDocPtr doc; /* the document */
19851 int n_doc;
19852 xmlNsPtr ns; /* namespace if any */
19853 int n_ns;
19854 xmlChar * name; /* the node name */
19855 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019856 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000019857 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019858
Daniel Veillard27f20102004-11-05 11:50:11 +000019859 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19860 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19861 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
19862 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19863 mem_base = xmlMemBlocks();
19864 doc = gen_xmlDocPtr(n_doc, 0);
19865 ns = gen_xmlNsPtr(n_ns, 1);
19866 name = gen_eaten_name(n_name, 2);
19867 content = gen_const_xmlChar_ptr(n_content, 3);
19868
19869 ret_val = xmlNewDocNodeEatName(doc, ns, name, content);
19870 desret_xmlNodePtr(ret_val);
19871 call_tests++;
19872 des_xmlDocPtr(n_doc, doc, 0);
19873 des_xmlNsPtr(n_ns, ns, 1);
19874 des_eaten_name(n_name, name, 2);
19875 des_const_xmlChar_ptr(n_content, content, 3);
19876 xmlResetLastError();
19877 if (mem_base != xmlMemBlocks()) {
19878 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
19879 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019880 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000019881 printf(" %d", n_doc);
19882 printf(" %d", n_ns);
19883 printf(" %d", n_name);
19884 printf(" %d", n_content);
19885 printf("\n");
19886 }
19887 }
19888 }
19889 }
19890 }
19891
19892 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019894}
19895
19896
19897static int
19898test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019900
19901 int mem_base;
19902 xmlNodePtr ret_val;
19903 xmlDocPtr doc; /* the target document */
19904 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019905 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019906 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019907 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019908 int n_content;
19909
19910 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19911 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19912 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19913 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019914 doc = gen_xmlDocPtr(n_doc, 0);
19915 name = gen_const_xmlChar_ptr(n_name, 1);
19916 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019917
19918 ret_val = xmlNewDocPI(doc, name, content);
19919 desret_xmlNodePtr(ret_val);
19920 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019921 des_xmlDocPtr(n_doc, doc, 0);
19922 des_const_xmlChar_ptr(n_name, name, 1);
19923 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019924 xmlResetLastError();
19925 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019926 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019927 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019928 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019929 printf(" %d", n_doc);
19930 printf(" %d", n_name);
19931 printf(" %d", n_content);
19932 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019933 }
19934 }
19935 }
19936 }
19937
Daniel Veillard3d97e662004-11-04 10:49:00 +000019938 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019940}
19941
19942
19943static int
19944test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019946
Daniel Veillard57b25162004-11-06 14:50:18 +000019947 int mem_base;
19948 xmlAttrPtr ret_val;
19949 xmlDocPtr doc; /* the document */
19950 int n_doc;
19951 xmlChar * name; /* the name of the attribute */
19952 int n_name;
19953 xmlChar * value; /* the value of the attribute */
19954 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019955
Daniel Veillard57b25162004-11-06 14:50:18 +000019956 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19957 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19958 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
19959 mem_base = xmlMemBlocks();
19960 doc = gen_xmlDocPtr(n_doc, 0);
19961 name = gen_const_xmlChar_ptr(n_name, 1);
19962 value = gen_const_xmlChar_ptr(n_value, 2);
19963
19964 ret_val = xmlNewDocProp(doc, name, value);
19965 desret_xmlAttrPtr(ret_val);
19966 call_tests++;
19967 des_xmlDocPtr(n_doc, doc, 0);
19968 des_const_xmlChar_ptr(n_name, name, 1);
19969 des_const_xmlChar_ptr(n_value, value, 2);
19970 xmlResetLastError();
19971 if (mem_base != xmlMemBlocks()) {
19972 printf("Leak of %d blocks found in xmlNewDocProp",
19973 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019974 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019975 printf(" %d", n_doc);
19976 printf(" %d", n_name);
19977 printf(" %d", n_value);
19978 printf("\n");
19979 }
19980 }
19981 }
19982 }
19983
19984 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019985 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019986}
19987
19988
19989static int
19990test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019991 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019992
Daniel Veillard27f20102004-11-05 11:50:11 +000019993 int mem_base;
19994 xmlNodePtr ret_val;
19995 xmlDocPtr doc; /* the document */
19996 int n_doc;
19997 xmlNsPtr ns; /* namespace if any */
19998 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019999 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020000 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020001 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020002 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020003
Daniel Veillard27f20102004-11-05 11:50:11 +000020004 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20005 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20006 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20007 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20008 mem_base = xmlMemBlocks();
20009 doc = gen_xmlDocPtr(n_doc, 0);
20010 ns = gen_xmlNsPtr(n_ns, 1);
20011 name = gen_const_xmlChar_ptr(n_name, 2);
20012 content = gen_const_xmlChar_ptr(n_content, 3);
20013
20014 ret_val = xmlNewDocRawNode(doc, ns, name, content);
20015 desret_xmlNodePtr(ret_val);
20016 call_tests++;
20017 des_xmlDocPtr(n_doc, doc, 0);
20018 des_xmlNsPtr(n_ns, ns, 1);
20019 des_const_xmlChar_ptr(n_name, name, 2);
20020 des_const_xmlChar_ptr(n_content, content, 3);
20021 xmlResetLastError();
20022 if (mem_base != xmlMemBlocks()) {
20023 printf("Leak of %d blocks found in xmlNewDocRawNode",
20024 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020025 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020026 printf(" %d", n_doc);
20027 printf(" %d", n_ns);
20028 printf(" %d", n_name);
20029 printf(" %d", n_content);
20030 printf("\n");
20031 }
20032 }
20033 }
20034 }
20035 }
20036
20037 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020039}
20040
20041
20042static int
20043test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020045
20046 int mem_base;
20047 xmlNodePtr ret_val;
20048 xmlDocPtr doc; /* the document */
20049 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020050 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020051 int n_content;
20052
20053 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20054 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20055 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020056 doc = gen_xmlDocPtr(n_doc, 0);
20057 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020058
20059 ret_val = xmlNewDocText(doc, content);
20060 desret_xmlNodePtr(ret_val);
20061 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020062 des_xmlDocPtr(n_doc, doc, 0);
20063 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020064 xmlResetLastError();
20065 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020066 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020068 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020069 printf(" %d", n_doc);
20070 printf(" %d", n_content);
20071 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020072 }
20073 }
20074 }
20075
Daniel Veillard3d97e662004-11-04 10:49:00 +000020076 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020078}
20079
20080
20081static int
20082test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020084
20085 int mem_base;
20086 xmlNodePtr ret_val;
20087 xmlDocPtr doc; /* the document */
20088 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020089 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020090 int n_content;
20091 int len; /* the text len. */
20092 int n_len;
20093
20094 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20095 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20096 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20097 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020098 doc = gen_xmlDocPtr(n_doc, 0);
20099 content = gen_const_xmlChar_ptr(n_content, 1);
20100 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020101
20102 ret_val = xmlNewDocTextLen(doc, content, len);
20103 desret_xmlNodePtr(ret_val);
20104 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020105 des_xmlDocPtr(n_doc, doc, 0);
20106 des_const_xmlChar_ptr(n_content, content, 1);
20107 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020108 xmlResetLastError();
20109 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020110 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020112 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020113 printf(" %d", n_doc);
20114 printf(" %d", n_content);
20115 printf(" %d", n_len);
20116 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020117 }
20118 }
20119 }
20120 }
20121
Daniel Veillard3d97e662004-11-04 10:49:00 +000020122 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020124}
20125
20126
20127static int
20128test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020130
Daniel Veillard34099b42004-11-04 17:34:35 +000020131 int mem_base;
20132 xmlDtdPtr ret_val;
20133 xmlDocPtr doc; /* the document pointer */
20134 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020135 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020136 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020137 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020138 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020139 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020140 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020141
Daniel Veillard34099b42004-11-04 17:34:35 +000020142 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20143 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20144 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20145 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20146 mem_base = xmlMemBlocks();
20147 doc = gen_xmlDocPtr(n_doc, 0);
20148 name = gen_const_xmlChar_ptr(n_name, 1);
20149 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20150 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20151
20152 ret_val = xmlNewDtd(doc, name, ExternalID, SystemID);
20153 desret_xmlDtdPtr(ret_val);
20154 call_tests++;
20155 des_xmlDocPtr(n_doc, doc, 0);
20156 des_const_xmlChar_ptr(n_name, name, 1);
20157 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
20158 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
20159 xmlResetLastError();
20160 if (mem_base != xmlMemBlocks()) {
20161 printf("Leak of %d blocks found in xmlNewDtd",
20162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020163 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020164 printf(" %d", n_doc);
20165 printf(" %d", n_name);
20166 printf(" %d", n_ExternalID);
20167 printf(" %d", n_SystemID);
20168 printf("\n");
20169 }
20170 }
20171 }
20172 }
20173 }
20174
20175 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020177}
20178
20179
20180static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020181test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020182 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020183
Daniel Veillard27f20102004-11-05 11:50:11 +000020184 int mem_base;
20185 xmlNodePtr ret_val;
20186 xmlNsPtr ns; /* namespace if any */
20187 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020188 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020189 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020190
Daniel Veillard27f20102004-11-05 11:50:11 +000020191 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20192 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20193 mem_base = xmlMemBlocks();
20194 ns = gen_xmlNsPtr(n_ns, 0);
20195 name = gen_const_xmlChar_ptr(n_name, 1);
20196
20197 ret_val = xmlNewNode(ns, name);
20198 desret_xmlNodePtr(ret_val);
20199 call_tests++;
20200 des_xmlNsPtr(n_ns, ns, 0);
20201 des_const_xmlChar_ptr(n_name, name, 1);
20202 xmlResetLastError();
20203 if (mem_base != xmlMemBlocks()) {
20204 printf("Leak of %d blocks found in xmlNewNode",
20205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020206 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020207 printf(" %d", n_ns);
20208 printf(" %d", n_name);
20209 printf("\n");
20210 }
20211 }
20212 }
20213
20214 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020216}
20217
20218
20219static int
20220test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020222
Daniel Veillard27f20102004-11-05 11:50:11 +000020223 int mem_base;
20224 xmlNodePtr ret_val;
20225 xmlNsPtr ns; /* namespace if any */
20226 int n_ns;
20227 xmlChar * name; /* the node name */
20228 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020229
Daniel Veillard27f20102004-11-05 11:50:11 +000020230 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20231 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20232 mem_base = xmlMemBlocks();
20233 ns = gen_xmlNsPtr(n_ns, 0);
20234 name = gen_eaten_name(n_name, 1);
20235
20236 ret_val = xmlNewNodeEatName(ns, name);
20237 desret_xmlNodePtr(ret_val);
20238 call_tests++;
20239 des_xmlNsPtr(n_ns, ns, 0);
20240 des_eaten_name(n_name, name, 1);
20241 xmlResetLastError();
20242 if (mem_base != xmlMemBlocks()) {
20243 printf("Leak of %d blocks found in xmlNewNodeEatName",
20244 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020245 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020246 printf(" %d", n_ns);
20247 printf(" %d", n_name);
20248 printf("\n");
20249 }
20250 }
20251 }
20252
20253 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020254 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020255}
20256
20257
20258static int
20259test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020260 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020261
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020262 int mem_base;
20263 xmlNsPtr ret_val;
20264 xmlNodePtr node; /* the element carrying the namespace */
20265 int n_node;
20266 xmlChar * href; /* the URI associated */
20267 int n_href;
20268 xmlChar * prefix; /* the prefix for the namespace */
20269 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020270
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020271 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20272 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20273 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20274 mem_base = xmlMemBlocks();
20275 node = gen_xmlNodePtr(n_node, 0);
20276 href = gen_const_xmlChar_ptr(n_href, 1);
20277 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20278
20279 ret_val = xmlNewNs(node, href, prefix);
20280 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20281 desret_xmlNsPtr(ret_val);
20282 call_tests++;
20283 des_xmlNodePtr(n_node, node, 0);
20284 des_const_xmlChar_ptr(n_href, href, 1);
20285 des_const_xmlChar_ptr(n_prefix, prefix, 2);
20286 xmlResetLastError();
20287 if (mem_base != xmlMemBlocks()) {
20288 printf("Leak of %d blocks found in xmlNewNs",
20289 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020290 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020291 printf(" %d", n_node);
20292 printf(" %d", n_href);
20293 printf(" %d", n_prefix);
20294 printf("\n");
20295 }
20296 }
20297 }
20298 }
20299
20300 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020302}
20303
20304
20305static int
20306test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020308
Daniel Veillard57b25162004-11-06 14:50:18 +000020309 int mem_base;
20310 xmlAttrPtr ret_val;
20311 xmlNodePtr node; /* the holding node */
20312 int n_node;
20313 xmlNsPtr ns; /* the namespace */
20314 int n_ns;
20315 xmlChar * name; /* the name of the attribute */
20316 int n_name;
20317 xmlChar * value; /* the value of the attribute */
20318 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020319
Daniel Veillard57b25162004-11-06 14:50:18 +000020320 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20321 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20322 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20323 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20324 mem_base = xmlMemBlocks();
20325 node = gen_xmlNodePtr(n_node, 0);
20326 ns = gen_xmlNsPtr(n_ns, 1);
20327 name = gen_const_xmlChar_ptr(n_name, 2);
20328 value = gen_const_xmlChar_ptr(n_value, 3);
20329
20330 ret_val = xmlNewNsProp(node, ns, name, value);
20331 desret_xmlAttrPtr(ret_val);
20332 call_tests++;
20333 des_xmlNodePtr(n_node, node, 0);
20334 des_xmlNsPtr(n_ns, ns, 1);
20335 des_const_xmlChar_ptr(n_name, name, 2);
20336 des_const_xmlChar_ptr(n_value, value, 3);
20337 xmlResetLastError();
20338 if (mem_base != xmlMemBlocks()) {
20339 printf("Leak of %d blocks found in xmlNewNsProp",
20340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020341 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020342 printf(" %d", n_node);
20343 printf(" %d", n_ns);
20344 printf(" %d", n_name);
20345 printf(" %d", n_value);
20346 printf("\n");
20347 }
20348 }
20349 }
20350 }
20351 }
20352
20353 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020355}
20356
20357
20358static int
20359test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020361
Daniel Veillard57b25162004-11-06 14:50:18 +000020362 int mem_base;
20363 xmlAttrPtr ret_val;
20364 xmlNodePtr node; /* the holding node */
20365 int n_node;
20366 xmlNsPtr ns; /* the namespace */
20367 int n_ns;
20368 xmlChar * name; /* the name of the attribute */
20369 int n_name;
20370 xmlChar * value; /* the value of the attribute */
20371 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020372
Daniel Veillard57b25162004-11-06 14:50:18 +000020373 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20374 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20375 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20376 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20377 mem_base = xmlMemBlocks();
20378 node = gen_xmlNodePtr(n_node, 0);
20379 ns = gen_xmlNsPtr(n_ns, 1);
20380 name = gen_eaten_name(n_name, 2);
20381 value = gen_const_xmlChar_ptr(n_value, 3);
20382
20383 ret_val = xmlNewNsPropEatName(node, ns, name, value);
20384 desret_xmlAttrPtr(ret_val);
20385 call_tests++;
20386 des_xmlNodePtr(n_node, node, 0);
20387 des_xmlNsPtr(n_ns, ns, 1);
20388 des_eaten_name(n_name, name, 2);
20389 des_const_xmlChar_ptr(n_value, value, 3);
20390 xmlResetLastError();
20391 if (mem_base != xmlMemBlocks()) {
20392 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020394 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020395 printf(" %d", n_node);
20396 printf(" %d", n_ns);
20397 printf(" %d", n_name);
20398 printf(" %d", n_value);
20399 printf("\n");
20400 }
20401 }
20402 }
20403 }
20404 }
20405
20406 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020407 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020408}
20409
20410
20411static int
20412test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020414
20415 int mem_base;
20416 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020417 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020418 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020419 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020420 int n_content;
20421
20422 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20423 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20424 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020425 name = gen_const_xmlChar_ptr(n_name, 0);
20426 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020427
20428 ret_val = xmlNewPI(name, content);
20429 desret_xmlNodePtr(ret_val);
20430 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020431 des_const_xmlChar_ptr(n_name, name, 0);
20432 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020433 xmlResetLastError();
20434 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020435 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020437 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020438 printf(" %d", n_name);
20439 printf(" %d", n_content);
20440 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020441 }
20442 }
20443 }
20444
Daniel Veillard3d97e662004-11-04 10:49:00 +000020445 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020447}
20448
20449
20450static int
20451test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020453
Daniel Veillard57b25162004-11-06 14:50:18 +000020454 int mem_base;
20455 xmlAttrPtr ret_val;
20456 xmlNodePtr node; /* the holding node */
20457 int n_node;
20458 xmlChar * name; /* the name of the attribute */
20459 int n_name;
20460 xmlChar * value; /* the value of the attribute */
20461 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020462
Daniel Veillard57b25162004-11-06 14:50:18 +000020463 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20464 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20465 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20466 mem_base = xmlMemBlocks();
20467 node = gen_xmlNodePtr(n_node, 0);
20468 name = gen_const_xmlChar_ptr(n_name, 1);
20469 value = gen_const_xmlChar_ptr(n_value, 2);
20470
20471 ret_val = xmlNewProp(node, name, value);
20472 desret_xmlAttrPtr(ret_val);
20473 call_tests++;
20474 des_xmlNodePtr(n_node, node, 0);
20475 des_const_xmlChar_ptr(n_name, name, 1);
20476 des_const_xmlChar_ptr(n_value, value, 2);
20477 xmlResetLastError();
20478 if (mem_base != xmlMemBlocks()) {
20479 printf("Leak of %d blocks found in xmlNewProp",
20480 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020481 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020482 printf(" %d", n_node);
20483 printf(" %d", n_name);
20484 printf(" %d", n_value);
20485 printf("\n");
20486 }
20487 }
20488 }
20489 }
20490
20491 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020493}
20494
20495
20496static int
20497test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020499
20500 int mem_base;
20501 xmlNodePtr ret_val;
20502 xmlDocPtr doc; /* the document */
20503 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020504 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020505 int n_name;
20506
20507 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20508 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20509 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020510 doc = gen_xmlDocPtr(n_doc, 0);
20511 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020512
20513 ret_val = xmlNewReference(doc, name);
20514 desret_xmlNodePtr(ret_val);
20515 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020516 des_xmlDocPtr(n_doc, doc, 0);
20517 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020518 xmlResetLastError();
20519 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020520 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020522 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020523 printf(" %d", n_doc);
20524 printf(" %d", n_name);
20525 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020526 }
20527 }
20528 }
20529
Daniel Veillard3d97e662004-11-04 10:49:00 +000020530 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020532}
20533
20534
20535static int
20536test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020538
20539 int mem_base;
20540 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020541 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020542 int n_content;
20543
20544 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20545 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020546 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020547
20548 ret_val = xmlNewText(content);
20549 desret_xmlNodePtr(ret_val);
20550 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020551 des_const_xmlChar_ptr(n_content, content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020552 xmlResetLastError();
20553 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020554 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020556 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020557 printf(" %d", n_content);
20558 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020559 }
20560 }
20561
Daniel Veillard3d97e662004-11-04 10:49:00 +000020562 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020564}
20565
20566
20567static int
20568test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020570
Daniel Veillard27f20102004-11-05 11:50:11 +000020571 int mem_base;
20572 xmlNodePtr ret_val;
20573 xmlNodePtr parent; /* the parent node */
20574 int n_parent;
20575 xmlNsPtr ns; /* a namespace if any */
20576 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020577 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020578 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020579 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020580 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020581
Daniel Veillard27f20102004-11-05 11:50:11 +000020582 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20583 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20584 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20585 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20586 mem_base = xmlMemBlocks();
20587 parent = gen_xmlNodePtr(n_parent, 0);
20588 ns = gen_xmlNsPtr(n_ns, 1);
20589 name = gen_const_xmlChar_ptr(n_name, 2);
20590 content = gen_const_xmlChar_ptr(n_content, 3);
20591
20592 ret_val = xmlNewTextChild(parent, ns, name, content);
20593 desret_xmlNodePtr(ret_val);
20594 call_tests++;
20595 des_xmlNodePtr(n_parent, parent, 0);
20596 des_xmlNsPtr(n_ns, ns, 1);
20597 des_const_xmlChar_ptr(n_name, name, 2);
20598 des_const_xmlChar_ptr(n_content, content, 3);
20599 xmlResetLastError();
20600 if (mem_base != xmlMemBlocks()) {
20601 printf("Leak of %d blocks found in xmlNewTextChild",
20602 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020603 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020604 printf(" %d", n_parent);
20605 printf(" %d", n_ns);
20606 printf(" %d", n_name);
20607 printf(" %d", n_content);
20608 printf("\n");
20609 }
20610 }
20611 }
20612 }
20613 }
20614
20615 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020616 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020617}
20618
20619
20620static int
20621test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020622 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020623
20624 int mem_base;
20625 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020626 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020627 int n_content;
20628 int len; /* the text len. */
20629 int n_len;
20630
20631 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20632 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20633 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020634 content = gen_const_xmlChar_ptr(n_content, 0);
20635 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020636
20637 ret_val = xmlNewTextLen(content, len);
20638 desret_xmlNodePtr(ret_val);
20639 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020640 des_const_xmlChar_ptr(n_content, content, 0);
20641 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020642 xmlResetLastError();
20643 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020644 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020646 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020647 printf(" %d", n_content);
20648 printf(" %d", n_len);
20649 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020650 }
20651 }
20652 }
20653
Daniel Veillard3d97e662004-11-04 10:49:00 +000020654 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020656}
20657
20658
20659static int
20660test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020662
20663 int mem_base;
20664 xmlNodePtr cur; /* the node being modified */
20665 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020666 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020667 int n_content;
20668
20669 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20670 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20671 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020672 cur = gen_xmlNodePtr(n_cur, 0);
20673 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020674
20675 xmlNodeAddContent(cur, content);
20676 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020677 des_xmlNodePtr(n_cur, cur, 0);
20678 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020679 xmlResetLastError();
20680 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020681 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020683 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020684 printf(" %d", n_cur);
20685 printf(" %d", n_content);
20686 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020687 }
20688 }
20689 }
20690
Daniel Veillard3d97e662004-11-04 10:49:00 +000020691 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020693}
20694
20695
20696static int
20697test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020699
20700 int mem_base;
20701 xmlNodePtr cur; /* the node being modified */
20702 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020703 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020704 int n_content;
20705 int len; /* the size of @content */
20706 int n_len;
20707
20708 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20709 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20710 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20711 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020712 cur = gen_xmlNodePtr(n_cur, 0);
20713 content = gen_const_xmlChar_ptr(n_content, 1);
20714 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020715
20716 xmlNodeAddContentLen(cur, content, len);
20717 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020718 des_xmlNodePtr(n_cur, cur, 0);
20719 des_const_xmlChar_ptr(n_content, content, 1);
20720 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020721 xmlResetLastError();
20722 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020723 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020725 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020726 printf(" %d", n_cur);
20727 printf(" %d", n_content);
20728 printf(" %d", n_len);
20729 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020730 }
20731 }
20732 }
20733 }
20734
Daniel Veillard3d97e662004-11-04 10:49:00 +000020735 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020736 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020737}
20738
20739
20740static int
20741test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020742 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020743
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020744 int mem_base;
20745 int ret_val;
20746 xmlBufferPtr buffer; /* a buffer */
20747 int n_buffer;
20748 xmlNodePtr cur; /* the node being read */
20749 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020750
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020751 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
20752 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20753 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020754 buffer = gen_xmlBufferPtr(n_buffer, 0);
20755 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020756
20757 ret_val = xmlNodeBufGetContent(buffer, cur);
20758 desret_int(ret_val);
20759 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020760 des_xmlBufferPtr(n_buffer, buffer, 0);
20761 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020762 xmlResetLastError();
20763 if (mem_base != xmlMemBlocks()) {
20764 printf("Leak of %d blocks found in xmlNodeBufGetContent",
20765 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020766 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020767 printf(" %d", n_buffer);
20768 printf(" %d", n_cur);
20769 printf("\n");
20770 }
20771 }
20772 }
20773
Daniel Veillard3d97e662004-11-04 10:49:00 +000020774 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020776}
20777
20778
20779static int
20780test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020782
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020783#ifdef LIBXML_OUTPUT_ENABLED
20784 int mem_base;
20785 int ret_val;
20786 xmlBufferPtr buf; /* the XML buffer output */
20787 int n_buf;
20788 xmlDocPtr doc; /* the document */
20789 int n_doc;
20790 xmlNodePtr cur; /* the current node */
20791 int n_cur;
20792 int level; /* the imbrication level for indenting */
20793 int n_level;
20794 int format; /* is formatting allowed */
20795 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020796
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020797 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
20798 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20799 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20800 for (n_level = 0;n_level < gen_nb_int;n_level++) {
20801 for (n_format = 0;n_format < gen_nb_int;n_format++) {
20802 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020803 buf = gen_xmlBufferPtr(n_buf, 0);
20804 doc = gen_xmlDocPtr(n_doc, 1);
20805 cur = gen_xmlNodePtr(n_cur, 2);
20806 level = gen_int(n_level, 3);
20807 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020808
20809 ret_val = xmlNodeDump(buf, doc, cur, level, format);
20810 desret_int(ret_val);
20811 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020812 des_xmlBufferPtr(n_buf, buf, 0);
20813 des_xmlDocPtr(n_doc, doc, 1);
20814 des_xmlNodePtr(n_cur, cur, 2);
20815 des_int(n_level, level, 3);
20816 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020817 xmlResetLastError();
20818 if (mem_base != xmlMemBlocks()) {
20819 printf("Leak of %d blocks found in xmlNodeDump",
20820 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020821 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020822 printf(" %d", n_buf);
20823 printf(" %d", n_doc);
20824 printf(" %d", n_cur);
20825 printf(" %d", n_level);
20826 printf(" %d", n_format);
20827 printf("\n");
20828 }
20829 }
20830 }
20831 }
20832 }
20833 }
20834#endif
20835
Daniel Veillard3d97e662004-11-04 10:49:00 +000020836 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020838}
20839
20840
20841static int
20842test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020844
Daniel Veillard3d97e662004-11-04 10:49:00 +000020845#ifdef LIBXML_OUTPUT_ENABLED
20846 int mem_base;
20847 xmlOutputBufferPtr buf; /* the XML buffer output */
20848 int n_buf;
20849 xmlDocPtr doc; /* the document */
20850 int n_doc;
20851 xmlNodePtr cur; /* the current node */
20852 int n_cur;
20853 int level; /* the imbrication level for indenting */
20854 int n_level;
20855 int format; /* is formatting allowed */
20856 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020857 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000020858 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020859
Daniel Veillard3d97e662004-11-04 10:49:00 +000020860 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
20861 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20862 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20863 for (n_level = 0;n_level < gen_nb_int;n_level++) {
20864 for (n_format = 0;n_format < gen_nb_int;n_format++) {
20865 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
20866 mem_base = xmlMemBlocks();
20867 buf = gen_xmlOutputBufferPtr(n_buf, 0);
20868 doc = gen_xmlDocPtr(n_doc, 1);
20869 cur = gen_xmlNodePtr(n_cur, 2);
20870 level = gen_int(n_level, 3);
20871 format = gen_int(n_format, 4);
20872 encoding = gen_const_char_ptr(n_encoding, 5);
20873
20874 xmlNodeDumpOutput(buf, doc, cur, level, format, encoding);
20875 call_tests++;
20876 des_xmlOutputBufferPtr(n_buf, buf, 0);
20877 des_xmlDocPtr(n_doc, doc, 1);
20878 des_xmlNodePtr(n_cur, cur, 2);
20879 des_int(n_level, level, 3);
20880 des_int(n_format, format, 4);
20881 des_const_char_ptr(n_encoding, encoding, 5);
20882 xmlResetLastError();
20883 if (mem_base != xmlMemBlocks()) {
20884 printf("Leak of %d blocks found in xmlNodeDumpOutput",
20885 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020886 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020887 printf(" %d", n_buf);
20888 printf(" %d", n_doc);
20889 printf(" %d", n_cur);
20890 printf(" %d", n_level);
20891 printf(" %d", n_format);
20892 printf(" %d", n_encoding);
20893 printf("\n");
20894 }
20895 }
20896 }
20897 }
20898 }
20899 }
20900 }
20901#endif
20902
20903 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020904 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020905}
20906
20907
20908static int
20909test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020910 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020911
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020912 int mem_base;
20913 xmlChar * ret_val;
20914 xmlDocPtr doc; /* the document the node pertains to */
20915 int n_doc;
20916 xmlNodePtr cur; /* the node being checked */
20917 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020918
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020919 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20920 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20921 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020922 doc = gen_xmlDocPtr(n_doc, 0);
20923 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020924
20925 ret_val = xmlNodeGetBase(doc, cur);
20926 desret_xmlChar_ptr(ret_val);
20927 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020928 des_xmlDocPtr(n_doc, doc, 0);
20929 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020930 xmlResetLastError();
20931 if (mem_base != xmlMemBlocks()) {
20932 printf("Leak of %d blocks found in xmlNodeGetBase",
20933 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020934 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020935 printf(" %d", n_doc);
20936 printf(" %d", n_cur);
20937 printf("\n");
20938 }
20939 }
20940 }
20941
Daniel Veillard3d97e662004-11-04 10:49:00 +000020942 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020943 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020944}
20945
20946
20947static int
20948test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020950
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020951 int mem_base;
20952 xmlChar * ret_val;
20953 xmlNodePtr cur; /* the node being read */
20954 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020955
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020956 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20957 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020958 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020959
20960 ret_val = xmlNodeGetContent(cur);
20961 desret_xmlChar_ptr(ret_val);
20962 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020963 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020964 xmlResetLastError();
20965 if (mem_base != xmlMemBlocks()) {
20966 printf("Leak of %d blocks found in xmlNodeGetContent",
20967 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020968 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020969 printf(" %d", n_cur);
20970 printf("\n");
20971 }
20972 }
20973
Daniel Veillard3d97e662004-11-04 10:49:00 +000020974 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020976}
20977
20978
20979static int
20980test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020982
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020983 int mem_base;
20984 xmlChar * ret_val;
20985 xmlNodePtr cur; /* the node being checked */
20986 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020987
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020988 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20989 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020990 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020991
20992 ret_val = xmlNodeGetLang(cur);
20993 desret_xmlChar_ptr(ret_val);
20994 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020995 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020996 xmlResetLastError();
20997 if (mem_base != xmlMemBlocks()) {
20998 printf("Leak of %d blocks found in xmlNodeGetLang",
20999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021000 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021001 printf(" %d", n_cur);
21002 printf("\n");
21003 }
21004 }
21005
Daniel Veillard3d97e662004-11-04 10:49:00 +000021006 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021007 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021008}
21009
21010
21011static int
21012test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021013 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021014
21015 int mem_base;
21016 int ret_val;
21017 xmlNodePtr cur; /* the node being checked */
21018 int n_cur;
21019
21020 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21021 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021022 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021023
21024 ret_val = xmlNodeGetSpacePreserve(cur);
21025 desret_int(ret_val);
21026 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021027 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021028 xmlResetLastError();
21029 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021030 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021032 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021033 printf(" %d", n_cur);
21034 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021035 }
21036 }
21037
Daniel Veillard3d97e662004-11-04 10:49:00 +000021038 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021039 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021040}
21041
21042
21043static int
21044test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021045 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021046
21047 int mem_base;
21048 int ret_val;
21049 xmlNodePtr node; /* the node */
21050 int n_node;
21051
21052 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21053 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021054 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021055
21056 ret_val = xmlNodeIsText(node);
21057 desret_int(ret_val);
21058 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021059 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021060 xmlResetLastError();
21061 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021062 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021063 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021064 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021065 printf(" %d", n_node);
21066 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021067 }
21068 }
21069
Daniel Veillard3d97e662004-11-04 10:49:00 +000021070 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021071 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021072}
21073
21074
21075static int
21076test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021077 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021078
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021079#ifdef LIBXML_TREE_ENABLED
21080 int mem_base;
21081 xmlChar * ret_val;
21082 xmlDocPtr doc; /* the document */
21083 int n_doc;
21084 xmlNodePtr list; /* a Node list */
21085 int n_list;
21086 int inLine; /* should we replace entity contents or show their external form */
21087 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021088
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021089 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21090 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21091 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21092 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021093 doc = gen_xmlDocPtr(n_doc, 0);
21094 list = gen_xmlNodePtr(n_list, 1);
21095 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021096
21097 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21098 desret_xmlChar_ptr(ret_val);
21099 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021100 des_xmlDocPtr(n_doc, doc, 0);
21101 des_xmlNodePtr(n_list, list, 1);
21102 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021103 xmlResetLastError();
21104 if (mem_base != xmlMemBlocks()) {
21105 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021107 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021108 printf(" %d", n_doc);
21109 printf(" %d", n_list);
21110 printf(" %d", n_inLine);
21111 printf("\n");
21112 }
21113 }
21114 }
21115 }
21116#endif
21117
Daniel Veillard3d97e662004-11-04 10:49:00 +000021118 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021119 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021120}
21121
21122
21123static int
21124test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021126
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021127 int mem_base;
21128 xmlChar * ret_val;
21129 xmlDocPtr doc; /* the document */
21130 int n_doc;
21131 xmlNodePtr list; /* a Node list */
21132 int n_list;
21133 int inLine; /* should we replace entity contents or show their external form */
21134 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021135
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021136 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21137 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21138 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21139 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021140 doc = gen_xmlDocPtr(n_doc, 0);
21141 list = gen_xmlNodePtr(n_list, 1);
21142 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021143
21144 ret_val = xmlNodeListGetString(doc, list, inLine);
21145 desret_xmlChar_ptr(ret_val);
21146 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021147 des_xmlDocPtr(n_doc, doc, 0);
21148 des_xmlNodePtr(n_list, list, 1);
21149 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021150 xmlResetLastError();
21151 if (mem_base != xmlMemBlocks()) {
21152 printf("Leak of %d blocks found in xmlNodeListGetString",
21153 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021154 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021155 printf(" %d", n_doc);
21156 printf(" %d", n_list);
21157 printf(" %d", n_inLine);
21158 printf("\n");
21159 }
21160 }
21161 }
21162 }
21163
Daniel Veillard3d97e662004-11-04 10:49:00 +000021164 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021166}
21167
21168
21169static int
21170test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021172
21173#ifdef LIBXML_TREE_ENABLED
21174 int mem_base;
21175 xmlNodePtr cur; /* the node being changed */
21176 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021177 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021178 int n_uri;
21179
21180 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21181 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21182 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021183 cur = gen_xmlNodePtr(n_cur, 0);
21184 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021185
21186 xmlNodeSetBase(cur, uri);
21187 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021188 des_xmlNodePtr(n_cur, cur, 0);
21189 des_const_xmlChar_ptr(n_uri, uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021190 xmlResetLastError();
21191 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021192 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021193 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021194 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021195 printf(" %d", n_cur);
21196 printf(" %d", n_uri);
21197 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021198 }
21199 }
21200 }
21201#endif
21202
Daniel Veillard3d97e662004-11-04 10:49:00 +000021203 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021204 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021205}
21206
21207
21208static int
21209test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021210 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021211
21212 int mem_base;
21213 xmlNodePtr cur; /* the node being modified */
21214 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021215 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021216 int n_content;
21217
21218 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21219 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21220 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021221 cur = gen_xmlNodePtr(n_cur, 0);
21222 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021223
21224 xmlNodeSetContent(cur, content);
21225 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021226 des_xmlNodePtr(n_cur, cur, 0);
21227 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021228 xmlResetLastError();
21229 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021230 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021231 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021232 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021233 printf(" %d", n_cur);
21234 printf(" %d", n_content);
21235 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021236 }
21237 }
21238 }
21239
Daniel Veillard3d97e662004-11-04 10:49:00 +000021240 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021241 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021242}
21243
21244
21245static int
21246test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021247 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021248
21249#ifdef LIBXML_TREE_ENABLED
21250 int mem_base;
21251 xmlNodePtr cur; /* the node being modified */
21252 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021253 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021254 int n_content;
21255 int len; /* the size of @content */
21256 int n_len;
21257
21258 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21259 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21260 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21261 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021262 cur = gen_xmlNodePtr(n_cur, 0);
21263 content = gen_const_xmlChar_ptr(n_content, 1);
21264 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021265
21266 xmlNodeSetContentLen(cur, content, len);
21267 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021268 des_xmlNodePtr(n_cur, cur, 0);
21269 des_const_xmlChar_ptr(n_content, content, 1);
21270 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021271 xmlResetLastError();
21272 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021273 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021275 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021276 printf(" %d", n_cur);
21277 printf(" %d", n_content);
21278 printf(" %d", n_len);
21279 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021280 }
21281 }
21282 }
21283 }
21284#endif
21285
Daniel Veillard3d97e662004-11-04 10:49:00 +000021286 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021288}
21289
21290
21291static int
21292test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021294
21295#ifdef LIBXML_TREE_ENABLED
21296 int mem_base;
21297 xmlNodePtr cur; /* the node being changed */
21298 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021299 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021300 int n_lang;
21301
21302 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21303 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21304 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021305 cur = gen_xmlNodePtr(n_cur, 0);
21306 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021307
21308 xmlNodeSetLang(cur, lang);
21309 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021310 des_xmlNodePtr(n_cur, cur, 0);
21311 des_const_xmlChar_ptr(n_lang, lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021312 xmlResetLastError();
21313 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021314 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021316 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021317 printf(" %d", n_cur);
21318 printf(" %d", n_lang);
21319 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021320 }
21321 }
21322 }
21323#endif
21324
Daniel Veillard3d97e662004-11-04 10:49:00 +000021325 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021327}
21328
21329
21330static int
21331test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021333
21334#ifdef LIBXML_TREE_ENABLED
21335 int mem_base;
21336 xmlNodePtr cur; /* the node being changed */
21337 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021338 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021339 int n_name;
21340
21341 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21342 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21343 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021344 cur = gen_xmlNodePtr(n_cur, 0);
21345 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021346
21347 xmlNodeSetName(cur, name);
21348 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021349 des_xmlNodePtr(n_cur, cur, 0);
21350 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021351 xmlResetLastError();
21352 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021353 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021355 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021356 printf(" %d", n_cur);
21357 printf(" %d", n_name);
21358 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021359 }
21360 }
21361 }
21362#endif
21363
Daniel Veillard3d97e662004-11-04 10:49:00 +000021364 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021366}
21367
21368
21369static int
21370test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021371 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021372
21373#ifdef LIBXML_TREE_ENABLED
21374 int mem_base;
21375 xmlNodePtr cur; /* the node being changed */
21376 int n_cur;
21377 int val; /* the xml:space value ("0": default, 1: "preserve") */
21378 int n_val;
21379
21380 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21381 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21382 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021383 cur = gen_xmlNodePtr(n_cur, 0);
21384 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021385
21386 xmlNodeSetSpacePreserve(cur, val);
21387 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021388 des_xmlNodePtr(n_cur, cur, 0);
21389 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021390 xmlResetLastError();
21391 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021392 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021394 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021395 printf(" %d", n_cur);
21396 printf(" %d", n_val);
21397 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021398 }
21399 }
21400 }
21401#endif
21402
Daniel Veillard3d97e662004-11-04 10:49:00 +000021403 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021405}
21406
21407
21408static int
21409test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021411
21412 int mem_base;
21413 int ret_val;
21414 xmlDocPtr doc; /* the document */
21415 int n_doc;
21416 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21417 int n_tree;
21418
21419 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21420 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21421 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021422 doc = gen_xmlDocPtr(n_doc, 0);
21423 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021424
21425 ret_val = xmlReconciliateNs(doc, tree);
21426 desret_int(ret_val);
21427 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021428 des_xmlDocPtr(n_doc, doc, 0);
21429 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021430 xmlResetLastError();
21431 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021432 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021433 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021434 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021435 printf(" %d", n_doc);
21436 printf(" %d", n_tree);
21437 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021438 }
21439 }
21440 }
21441
Daniel Veillard3d97e662004-11-04 10:49:00 +000021442 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021443 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021444}
21445
21446
21447static int
21448test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021449 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021450
Daniel Veillardce244ad2004-11-05 10:03:46 +000021451#ifdef LIBXML_TREE_ENABLED
21452 int mem_base;
21453 int ret_val;
21454 xmlAttrPtr cur; /* an attribute */
21455 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021456
Daniel Veillardce244ad2004-11-05 10:03:46 +000021457 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21458 mem_base = xmlMemBlocks();
21459 cur = gen_xmlAttrPtr(n_cur, 0);
21460
21461 ret_val = xmlRemoveProp(cur);
21462 cur = NULL;
21463 desret_int(ret_val);
21464 call_tests++;
21465 des_xmlAttrPtr(n_cur, cur, 0);
21466 xmlResetLastError();
21467 if (mem_base != xmlMemBlocks()) {
21468 printf("Leak of %d blocks found in xmlRemoveProp",
21469 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021470 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021471 printf(" %d", n_cur);
21472 printf("\n");
21473 }
21474 }
21475#endif
21476
21477 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021478 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021479}
21480
21481
21482static int
21483test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021484 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021485
21486#ifdef LIBXML_TREE_ENABLED
21487 int mem_base;
21488 xmlNodePtr ret_val;
21489 xmlNodePtr old; /* the old node */
21490 int n_old;
21491 xmlNodePtr cur; /* the node */
21492 int n_cur;
21493
21494 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021495 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021496 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021497 old = gen_xmlNodePtr(n_old, 0);
21498 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021499
21500 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021501 if (cur != NULL) {
21502 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021503 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021504 if (old != NULL) {
21505 xmlUnlinkNode(old);
21506 xmlFreeNode(old) ; old = NULL ; }
21507 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021508 desret_xmlNodePtr(ret_val);
21509 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021510 des_xmlNodePtr(n_old, old, 0);
21511 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021512 xmlResetLastError();
21513 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021514 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021516 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021517 printf(" %d", n_old);
21518 printf(" %d", n_cur);
21519 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021520 }
21521 }
21522 }
21523#endif
21524
Daniel Veillard3d97e662004-11-04 10:49:00 +000021525 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021527}
21528
21529
21530static int
21531test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021533
21534#ifdef LIBXML_OUTPUT_ENABLED
21535 int mem_base;
21536 int ret_val;
21537 const char * filename; /* the filename (or URL) */
21538 int n_filename;
21539 xmlDocPtr cur; /* the document */
21540 int n_cur;
21541
21542 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21543 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21544 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021545 filename = gen_fileoutput(n_filename, 0);
21546 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021547
21548 ret_val = xmlSaveFile(filename, cur);
21549 desret_int(ret_val);
21550 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021551 des_fileoutput(n_filename, filename, 0);
21552 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021553 xmlResetLastError();
21554 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021555 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021556 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021557 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021558 printf(" %d", n_filename);
21559 printf(" %d", n_cur);
21560 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021561 }
21562 }
21563 }
21564#endif
21565
Daniel Veillard3d97e662004-11-04 10:49:00 +000021566 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021567 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021568}
21569
21570
21571static int
21572test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021573 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021574
21575#ifdef LIBXML_OUTPUT_ENABLED
21576 int mem_base;
21577 int ret_val;
21578 const char * filename; /* the filename (or URL) */
21579 int n_filename;
21580 xmlDocPtr cur; /* the document */
21581 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021582 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021583 int n_encoding;
21584
21585 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21586 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21587 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21588 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021589 filename = gen_fileoutput(n_filename, 0);
21590 cur = gen_xmlDocPtr(n_cur, 1);
21591 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021592
21593 ret_val = xmlSaveFileEnc(filename, cur, encoding);
21594 desret_int(ret_val);
21595 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021596 des_fileoutput(n_filename, filename, 0);
21597 des_xmlDocPtr(n_cur, cur, 1);
21598 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021599 xmlResetLastError();
21600 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021601 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021602 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021603 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021604 printf(" %d", n_filename);
21605 printf(" %d", n_cur);
21606 printf(" %d", n_encoding);
21607 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021608 }
21609 }
21610 }
21611 }
21612#endif
21613
Daniel Veillard3d97e662004-11-04 10:49:00 +000021614 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021615 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021616}
21617
21618
21619static int
21620test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021621 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021622
Daniel Veillard3d97e662004-11-04 10:49:00 +000021623#ifdef LIBXML_OUTPUT_ENABLED
21624 int mem_base;
21625 int ret_val;
21626 xmlOutputBufferPtr buf; /* an output I/O buffer */
21627 int n_buf;
21628 xmlDocPtr cur; /* the document */
21629 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021630 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021631 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021632
Daniel Veillard3d97e662004-11-04 10:49:00 +000021633 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21634 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21635 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21636 mem_base = xmlMemBlocks();
21637 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21638 cur = gen_xmlDocPtr(n_cur, 1);
21639 encoding = gen_const_char_ptr(n_encoding, 2);
21640
21641 ret_val = xmlSaveFileTo(buf, cur, encoding);
21642 buf = NULL;
21643 desret_int(ret_val);
21644 call_tests++;
21645 des_xmlOutputBufferPtr(n_buf, buf, 0);
21646 des_xmlDocPtr(n_cur, cur, 1);
21647 des_const_char_ptr(n_encoding, encoding, 2);
21648 xmlResetLastError();
21649 if (mem_base != xmlMemBlocks()) {
21650 printf("Leak of %d blocks found in xmlSaveFileTo",
21651 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021652 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021653 printf(" %d", n_buf);
21654 printf(" %d", n_cur);
21655 printf(" %d", n_encoding);
21656 printf("\n");
21657 }
21658 }
21659 }
21660 }
21661#endif
21662
21663 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021664 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021665}
21666
21667
21668static int
21669test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021670 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021671
21672#ifdef LIBXML_OUTPUT_ENABLED
21673 int mem_base;
21674 int ret_val;
21675 const char * filename; /* the filename (or URL) */
21676 int n_filename;
21677 xmlDocPtr cur; /* the document */
21678 int n_cur;
21679 int format; /* should formatting spaces been added */
21680 int n_format;
21681
21682 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21683 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21684 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21685 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021686 filename = gen_fileoutput(n_filename, 0);
21687 cur = gen_xmlDocPtr(n_cur, 1);
21688 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021689
21690 ret_val = xmlSaveFormatFile(filename, cur, format);
21691 desret_int(ret_val);
21692 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021693 des_fileoutput(n_filename, filename, 0);
21694 des_xmlDocPtr(n_cur, cur, 1);
21695 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021696 xmlResetLastError();
21697 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021698 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021700 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021701 printf(" %d", n_filename);
21702 printf(" %d", n_cur);
21703 printf(" %d", n_format);
21704 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021705 }
21706 }
21707 }
21708 }
21709#endif
21710
Daniel Veillard3d97e662004-11-04 10:49:00 +000021711 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021713}
21714
21715
21716static int
21717test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021719
21720#ifdef LIBXML_OUTPUT_ENABLED
21721 int mem_base;
21722 int ret_val;
21723 const char * filename; /* the filename or URL to output */
21724 int n_filename;
21725 xmlDocPtr cur; /* the document being saved */
21726 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021727 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021728 int n_encoding;
21729 int format; /* should formatting spaces be added. */
21730 int n_format;
21731
21732 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21733 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21734 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21735 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21736 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021737 filename = gen_fileoutput(n_filename, 0);
21738 cur = gen_xmlDocPtr(n_cur, 1);
21739 encoding = gen_const_char_ptr(n_encoding, 2);
21740 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021741
21742 ret_val = xmlSaveFormatFileEnc(filename, cur, encoding, format);
21743 desret_int(ret_val);
21744 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021745 des_fileoutput(n_filename, filename, 0);
21746 des_xmlDocPtr(n_cur, cur, 1);
21747 des_const_char_ptr(n_encoding, encoding, 2);
21748 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021749 xmlResetLastError();
21750 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021751 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021753 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021754 printf(" %d", n_filename);
21755 printf(" %d", n_cur);
21756 printf(" %d", n_encoding);
21757 printf(" %d", n_format);
21758 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021759 }
21760 }
21761 }
21762 }
21763 }
21764#endif
21765
Daniel Veillard3d97e662004-11-04 10:49:00 +000021766 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021767 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021768}
21769
21770
21771static int
21772test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021773 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021774
Daniel Veillard3d97e662004-11-04 10:49:00 +000021775#ifdef LIBXML_OUTPUT_ENABLED
21776 int mem_base;
21777 int ret_val;
21778 xmlOutputBufferPtr buf; /* an output I/O buffer */
21779 int n_buf;
21780 xmlDocPtr cur; /* the document */
21781 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021782 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021783 int n_encoding;
21784 int format; /* should formatting spaces been added */
21785 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021786
Daniel Veillard3d97e662004-11-04 10:49:00 +000021787 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21788 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21789 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21790 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21791 mem_base = xmlMemBlocks();
21792 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21793 cur = gen_xmlDocPtr(n_cur, 1);
21794 encoding = gen_const_char_ptr(n_encoding, 2);
21795 format = gen_int(n_format, 3);
21796
21797 ret_val = xmlSaveFormatFileTo(buf, cur, encoding, format);
21798 buf = NULL;
21799 desret_int(ret_val);
21800 call_tests++;
21801 des_xmlOutputBufferPtr(n_buf, buf, 0);
21802 des_xmlDocPtr(n_cur, cur, 1);
21803 des_const_char_ptr(n_encoding, encoding, 2);
21804 des_int(n_format, format, 3);
21805 xmlResetLastError();
21806 if (mem_base != xmlMemBlocks()) {
21807 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
21808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021809 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021810 printf(" %d", n_buf);
21811 printf(" %d", n_cur);
21812 printf(" %d", n_encoding);
21813 printf(" %d", n_format);
21814 printf("\n");
21815 }
21816 }
21817 }
21818 }
21819 }
21820#endif
21821
21822 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021824}
21825
21826
21827static int
21828test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021830
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000021831 int mem_base;
21832 xmlNsPtr ret_val;
21833 xmlDocPtr doc; /* the document */
21834 int n_doc;
21835 xmlNodePtr node; /* the current node */
21836 int n_node;
21837 xmlChar * nameSpace; /* the namespace prefix */
21838 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021839
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000021840 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21841 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21842 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
21843 mem_base = xmlMemBlocks();
21844 doc = gen_xmlDocPtr(n_doc, 0);
21845 node = gen_xmlNodePtr(n_node, 1);
21846 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
21847
21848 ret_val = xmlSearchNs(doc, node, nameSpace);
21849 desret_xmlNsPtr(ret_val);
21850 call_tests++;
21851 des_xmlDocPtr(n_doc, doc, 0);
21852 des_xmlNodePtr(n_node, node, 1);
21853 des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
21854 xmlResetLastError();
21855 if (mem_base != xmlMemBlocks()) {
21856 printf("Leak of %d blocks found in xmlSearchNs",
21857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021858 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000021859 printf(" %d", n_doc);
21860 printf(" %d", n_node);
21861 printf(" %d", n_nameSpace);
21862 printf("\n");
21863 }
21864 }
21865 }
21866 }
21867
21868 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021870}
21871
21872
21873static int
21874test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021876
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000021877 int mem_base;
21878 xmlNsPtr ret_val;
21879 xmlDocPtr doc; /* the document */
21880 int n_doc;
21881 xmlNodePtr node; /* the current node */
21882 int n_node;
21883 xmlChar * href; /* the namespace value */
21884 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021885
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000021886 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21887 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21888 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
21889 mem_base = xmlMemBlocks();
21890 doc = gen_xmlDocPtr(n_doc, 0);
21891 node = gen_xmlNodePtr(n_node, 1);
21892 href = gen_const_xmlChar_ptr(n_href, 2);
21893
21894 ret_val = xmlSearchNsByHref(doc, node, href);
21895 desret_xmlNsPtr(ret_val);
21896 call_tests++;
21897 des_xmlDocPtr(n_doc, doc, 0);
21898 des_xmlNodePtr(n_node, node, 1);
21899 des_const_xmlChar_ptr(n_href, href, 2);
21900 xmlResetLastError();
21901 if (mem_base != xmlMemBlocks()) {
21902 printf("Leak of %d blocks found in xmlSearchNsByHref",
21903 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021904 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000021905 printf(" %d", n_doc);
21906 printf(" %d", n_node);
21907 printf(" %d", n_href);
21908 printf("\n");
21909 }
21910 }
21911 }
21912 }
21913
21914 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021915 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021916}
21917
21918
21919static int
21920test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021921 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021922
Daniel Veillard57b25162004-11-06 14:50:18 +000021923 int mem_base;
21924 xmlBufferAllocationScheme scheme; /* allocation method to use */
21925 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021926
Daniel Veillard57b25162004-11-06 14:50:18 +000021927 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
21928 mem_base = xmlMemBlocks();
21929 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
21930
21931 xmlSetBufferAllocationScheme(scheme);
21932 call_tests++;
21933 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
21934 xmlResetLastError();
21935 if (mem_base != xmlMemBlocks()) {
21936 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
21937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021938 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000021939 printf(" %d", n_scheme);
21940 printf("\n");
21941 }
21942 }
21943
21944 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021945 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021946}
21947
21948
21949static int
21950test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021952
21953 int mem_base;
21954 int mode; /* the compression ratio */
21955 int n_mode;
21956
21957 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
21958 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021959 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021960
21961 xmlSetCompressMode(mode);
21962 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021963 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021964 xmlResetLastError();
21965 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021966 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021967 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021968 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021969 printf(" %d", n_mode);
21970 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021971 }
21972 }
21973
Daniel Veillard3d97e662004-11-04 10:49:00 +000021974 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021976}
21977
21978
21979static int
21980test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021982
21983 int mem_base;
21984 xmlDocPtr doc; /* the document */
21985 int n_doc;
21986 int mode; /* the compression ratio */
21987 int n_mode;
21988
21989 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21990 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
21991 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021992 doc = gen_xmlDocPtr(n_doc, 0);
21993 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021994
21995 xmlSetDocCompressMode(doc, mode);
21996 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021997 des_xmlDocPtr(n_doc, doc, 0);
21998 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021999 xmlResetLastError();
22000 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022001 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022003 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022004 printf(" %d", n_doc);
22005 printf(" %d", n_mode);
22006 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022007 }
22008 }
22009 }
22010
Daniel Veillard3d97e662004-11-04 10:49:00 +000022011 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022013}
22014
22015
22016static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022017test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022019
Daniel Veillard27f20102004-11-05 11:50:11 +000022020 int mem_base;
22021 xmlNodePtr node; /* a node in the document */
22022 int n_node;
22023 xmlNsPtr ns; /* a namespace pointer */
22024 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022025
Daniel Veillard27f20102004-11-05 11:50:11 +000022026 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22027 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22028 mem_base = xmlMemBlocks();
22029 node = gen_xmlNodePtr(n_node, 0);
22030 ns = gen_xmlNsPtr(n_ns, 1);
22031
22032 xmlSetNs(node, ns);
22033 call_tests++;
22034 des_xmlNodePtr(n_node, node, 0);
22035 des_xmlNsPtr(n_ns, ns, 1);
22036 xmlResetLastError();
22037 if (mem_base != xmlMemBlocks()) {
22038 printf("Leak of %d blocks found in xmlSetNs",
22039 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022040 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022041 printf(" %d", n_node);
22042 printf(" %d", n_ns);
22043 printf("\n");
22044 }
22045 }
22046 }
22047
22048 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022050}
22051
22052
22053static int
22054test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022056
Daniel Veillard57b25162004-11-06 14:50:18 +000022057#ifdef LIBXML_TREE_ENABLED
22058 int mem_base;
22059 xmlAttrPtr ret_val;
22060 xmlNodePtr node; /* the node */
22061 int n_node;
22062 xmlNsPtr ns; /* the namespace definition */
22063 int n_ns;
22064 xmlChar * name; /* the attribute name */
22065 int n_name;
22066 xmlChar * value; /* the attribute value */
22067 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022068
Daniel Veillard57b25162004-11-06 14:50:18 +000022069 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22070 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22071 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22072 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22073 mem_base = xmlMemBlocks();
22074 node = gen_xmlNodePtr(n_node, 0);
22075 ns = gen_xmlNsPtr(n_ns, 1);
22076 name = gen_const_xmlChar_ptr(n_name, 2);
22077 value = gen_const_xmlChar_ptr(n_value, 3);
22078
22079 ret_val = xmlSetNsProp(node, ns, name, value);
22080 desret_xmlAttrPtr(ret_val);
22081 call_tests++;
22082 des_xmlNodePtr(n_node, node, 0);
22083 des_xmlNsPtr(n_ns, ns, 1);
22084 des_const_xmlChar_ptr(n_name, name, 2);
22085 des_const_xmlChar_ptr(n_value, value, 3);
22086 xmlResetLastError();
22087 if (mem_base != xmlMemBlocks()) {
22088 printf("Leak of %d blocks found in xmlSetNsProp",
22089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022090 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022091 printf(" %d", n_node);
22092 printf(" %d", n_ns);
22093 printf(" %d", n_name);
22094 printf(" %d", n_value);
22095 printf("\n");
22096 }
22097 }
22098 }
22099 }
22100 }
22101#endif
22102
22103 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022105}
22106
22107
22108static int
22109test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022111
Daniel Veillard57b25162004-11-06 14:50:18 +000022112#ifdef LIBXML_TREE_ENABLED
22113 int mem_base;
22114 xmlAttrPtr ret_val;
22115 xmlNodePtr node; /* the node */
22116 int n_node;
22117 xmlChar * name; /* the attribute name */
22118 int n_name;
22119 xmlChar * value; /* the attribute value */
22120 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022121
Daniel Veillard57b25162004-11-06 14:50:18 +000022122 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22123 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22124 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22125 mem_base = xmlMemBlocks();
22126 node = gen_xmlNodePtr(n_node, 0);
22127 name = gen_const_xmlChar_ptr(n_name, 1);
22128 value = gen_const_xmlChar_ptr(n_value, 2);
22129
22130 ret_val = xmlSetProp(node, name, value);
22131 desret_xmlAttrPtr(ret_val);
22132 call_tests++;
22133 des_xmlNodePtr(n_node, node, 0);
22134 des_const_xmlChar_ptr(n_name, name, 1);
22135 des_const_xmlChar_ptr(n_value, value, 2);
22136 xmlResetLastError();
22137 if (mem_base != xmlMemBlocks()) {
22138 printf("Leak of %d blocks found in xmlSetProp",
22139 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022140 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022141 printf(" %d", n_node);
22142 printf(" %d", n_name);
22143 printf(" %d", n_value);
22144 printf("\n");
22145 }
22146 }
22147 }
22148 }
22149#endif
22150
22151 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022153}
22154
22155
22156static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022157test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022159
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022160 int mem_base;
22161 xmlChar * ret_val;
22162 xmlChar * name; /* the full QName */
22163 int n_name;
22164 xmlChar ** prefix; /* a xmlChar ** */
22165 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022166
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022167 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22168 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22169 mem_base = xmlMemBlocks();
22170 name = gen_const_xmlChar_ptr(n_name, 0);
22171 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22172
22173 ret_val = xmlSplitQName2(name, prefix);
22174 desret_xmlChar_ptr(ret_val);
22175 call_tests++;
22176 des_const_xmlChar_ptr(n_name, name, 0);
22177 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22178 xmlResetLastError();
22179 if (mem_base != xmlMemBlocks()) {
22180 printf("Leak of %d blocks found in xmlSplitQName2",
22181 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022182 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022183 printf(" %d", n_name);
22184 printf(" %d", n_prefix);
22185 printf("\n");
22186 }
22187 }
22188 }
22189
22190 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022191 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022192}
22193
22194
22195static int
22196test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022197 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022198
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022199 int mem_base;
22200 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022201 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022202 int n_name;
22203 int * len; /* an int * */
22204 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022205
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022206 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22207 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22208 mem_base = xmlMemBlocks();
22209 name = gen_const_xmlChar_ptr(n_name, 0);
22210 len = gen_int_ptr(n_len, 1);
22211
22212 ret_val = xmlSplitQName3(name, len);
22213 desret_const_xmlChar_ptr(ret_val);
22214 call_tests++;
22215 des_const_xmlChar_ptr(n_name, name, 0);
22216 des_int_ptr(n_len, len, 1);
22217 xmlResetLastError();
22218 if (mem_base != xmlMemBlocks()) {
22219 printf("Leak of %d blocks found in xmlSplitQName3",
22220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022221 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022222 printf(" %d", n_name);
22223 printf(" %d", n_len);
22224 printf("\n");
22225 }
22226 }
22227 }
22228
22229 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022231}
22232
22233
22234static int
22235test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022237
22238 int mem_base;
22239 xmlNodePtr ret_val;
22240 xmlDocPtr doc; /* the document */
22241 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022242 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022243 int n_value;
22244
22245 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22246 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22247 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022248 doc = gen_xmlDocPtr(n_doc, 0);
22249 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022250
22251 ret_val = xmlStringGetNodeList(doc, value);
22252 desret_xmlNodePtr(ret_val);
22253 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022254 des_xmlDocPtr(n_doc, doc, 0);
22255 des_const_xmlChar_ptr(n_value, value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022256 xmlResetLastError();
22257 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022258 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022259 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022260 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022261 printf(" %d", n_doc);
22262 printf(" %d", n_value);
22263 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022264 }
22265 }
22266 }
22267
Daniel Veillard3d97e662004-11-04 10:49:00 +000022268 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022270}
22271
22272
22273static int
22274test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022276
22277 int mem_base;
22278 xmlNodePtr ret_val;
22279 xmlDocPtr doc; /* the document */
22280 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022281 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022282 int n_value;
22283 int len; /* the length of the string value */
22284 int n_len;
22285
22286 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22287 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22288 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22289 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022290 doc = gen_xmlDocPtr(n_doc, 0);
22291 value = gen_const_xmlChar_ptr(n_value, 1);
22292 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022293
22294 ret_val = xmlStringLenGetNodeList(doc, value, len);
22295 desret_xmlNodePtr(ret_val);
22296 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022297 des_xmlDocPtr(n_doc, doc, 0);
22298 des_const_xmlChar_ptr(n_value, value, 1);
22299 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022300 xmlResetLastError();
22301 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022302 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022303 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022304 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022305 printf(" %d", n_doc);
22306 printf(" %d", n_value);
22307 printf(" %d", n_len);
22308 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022309 }
22310 }
22311 }
22312 }
22313
Daniel Veillard3d97e662004-11-04 10:49:00 +000022314 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022315 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022316}
22317
22318
22319static int
22320test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022321 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022322
22323 int mem_base;
22324 int ret_val;
22325 xmlNodePtr node; /* the node */
22326 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022327 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022328 int n_content;
22329 int len; /* @content length */
22330 int n_len;
22331
22332 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22333 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22334 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22335 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022336 node = gen_xmlNodePtr(n_node, 0);
22337 content = gen_const_xmlChar_ptr(n_content, 1);
22338 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022339
22340 ret_val = xmlTextConcat(node, content, len);
22341 desret_int(ret_val);
22342 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022343 des_xmlNodePtr(n_node, node, 0);
22344 des_const_xmlChar_ptr(n_content, content, 1);
22345 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022346 xmlResetLastError();
22347 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022348 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022350 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022351 printf(" %d", n_node);
22352 printf(" %d", n_content);
22353 printf(" %d", n_len);
22354 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022355 }
22356 }
22357 }
22358 }
22359
Daniel Veillard3d97e662004-11-04 10:49:00 +000022360 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022361 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022362}
22363
22364
22365static int
22366test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022367 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022368
22369 int mem_base;
22370 xmlNodePtr ret_val;
22371 xmlNodePtr first; /* the first text node */
22372 int n_first;
22373 xmlNodePtr second; /* the second text node being merged */
22374 int n_second;
22375
Daniel Veillarda03e3652004-11-02 18:45:30 +000022376 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22377 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022378 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022379 first = gen_xmlNodePtr_in(n_first, 0);
22380 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022381
22382 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022383 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022384 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022385 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022386 desret_xmlNodePtr(ret_val);
22387 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022388 des_xmlNodePtr_in(n_first, first, 0);
22389 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022390 xmlResetLastError();
22391 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022392 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022394 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022395 printf(" %d", n_first);
22396 printf(" %d", n_second);
22397 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022398 }
22399 }
22400 }
22401
Daniel Veillard3d97e662004-11-04 10:49:00 +000022402 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022403 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022404}
22405
22406
22407static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022408test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022409 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022410
Daniel Veillard27f20102004-11-05 11:50:11 +000022411#ifdef LIBXML_TREE_ENABLED
22412 int mem_base;
22413 int ret_val;
22414 xmlNodePtr node; /* the node */
22415 int n_node;
22416 xmlNsPtr ns; /* the namespace definition */
22417 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022418 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022419 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022420
Daniel Veillard27f20102004-11-05 11:50:11 +000022421 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22422 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22423 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22424 mem_base = xmlMemBlocks();
22425 node = gen_xmlNodePtr(n_node, 0);
22426 ns = gen_xmlNsPtr(n_ns, 1);
22427 name = gen_const_xmlChar_ptr(n_name, 2);
22428
22429 ret_val = xmlUnsetNsProp(node, ns, name);
22430 desret_int(ret_val);
22431 call_tests++;
22432 des_xmlNodePtr(n_node, node, 0);
22433 des_xmlNsPtr(n_ns, ns, 1);
22434 des_const_xmlChar_ptr(n_name, name, 2);
22435 xmlResetLastError();
22436 if (mem_base != xmlMemBlocks()) {
22437 printf("Leak of %d blocks found in xmlUnsetNsProp",
22438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022439 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022440 printf(" %d", n_node);
22441 printf(" %d", n_ns);
22442 printf(" %d", n_name);
22443 printf("\n");
22444 }
22445 }
22446 }
22447 }
22448#endif
22449
22450 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022452}
22453
22454
22455static int
22456test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022458
22459#ifdef LIBXML_TREE_ENABLED
22460 int mem_base;
22461 int ret_val;
22462 xmlNodePtr node; /* the node */
22463 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022464 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022465 int n_name;
22466
22467 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22468 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22469 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022470 node = gen_xmlNodePtr(n_node, 0);
22471 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022472
22473 ret_val = xmlUnsetProp(node, name);
22474 desret_int(ret_val);
22475 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022476 des_xmlNodePtr(n_node, node, 0);
22477 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022478 xmlResetLastError();
22479 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022480 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022482 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022483 printf(" %d", n_node);
22484 printf(" %d", n_name);
22485 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022486 }
22487 }
22488 }
22489#endif
22490
Daniel Veillard3d97e662004-11-04 10:49:00 +000022491 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022493}
22494
22495
22496static int
22497test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022499
22500 int mem_base;
22501 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022502 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022503 int n_value;
22504 int space; /* allow spaces in front and end of the string */
22505 int n_space;
22506
22507 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22508 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22509 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022510 value = gen_const_xmlChar_ptr(n_value, 0);
22511 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022512
22513 ret_val = xmlValidateNCName(value, space);
22514 desret_int(ret_val);
22515 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022516 des_const_xmlChar_ptr(n_value, value, 0);
22517 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022518 xmlResetLastError();
22519 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022520 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022522 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022523 printf(" %d", n_value);
22524 printf(" %d", n_space);
22525 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022526 }
22527 }
22528 }
22529
Daniel Veillard3d97e662004-11-04 10:49:00 +000022530 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022532}
22533
22534
22535static int
22536test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022538
22539 int mem_base;
22540 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022541 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022542 int n_value;
22543 int space; /* allow spaces in front and end of the string */
22544 int n_space;
22545
22546 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22547 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22548 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022549 value = gen_const_xmlChar_ptr(n_value, 0);
22550 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022551
22552 ret_val = xmlValidateNMToken(value, space);
22553 desret_int(ret_val);
22554 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022555 des_const_xmlChar_ptr(n_value, value, 0);
22556 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022557 xmlResetLastError();
22558 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022559 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022561 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022562 printf(" %d", n_value);
22563 printf(" %d", n_space);
22564 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022565 }
22566 }
22567 }
22568
Daniel Veillard3d97e662004-11-04 10:49:00 +000022569 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022570 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022571}
22572
22573
22574static int
22575test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022577
22578 int mem_base;
22579 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022580 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022581 int n_value;
22582 int space; /* allow spaces in front and end of the string */
22583 int n_space;
22584
22585 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22586 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22587 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022588 value = gen_const_xmlChar_ptr(n_value, 0);
22589 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022590
22591 ret_val = xmlValidateName(value, space);
22592 desret_int(ret_val);
22593 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022594 des_const_xmlChar_ptr(n_value, value, 0);
22595 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022596 xmlResetLastError();
22597 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022598 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022600 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022601 printf(" %d", n_value);
22602 printf(" %d", n_space);
22603 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022604 }
22605 }
22606 }
22607
Daniel Veillard3d97e662004-11-04 10:49:00 +000022608 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022610}
22611
22612
22613static int
22614test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022616
22617 int mem_base;
22618 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022619 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022620 int n_value;
22621 int space; /* allow spaces in front and end of the string */
22622 int n_space;
22623
22624 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22625 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22626 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022627 value = gen_const_xmlChar_ptr(n_value, 0);
22628 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022629
22630 ret_val = xmlValidateQName(value, space);
22631 desret_int(ret_val);
22632 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022633 des_const_xmlChar_ptr(n_value, value, 0);
22634 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022635 xmlResetLastError();
22636 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022637 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022639 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022640 printf(" %d", n_value);
22641 printf(" %d", n_space);
22642 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022643 }
22644 }
22645 }
22646
Daniel Veillard3d97e662004-11-04 10:49:00 +000022647 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022649}
22650
22651static int
22652test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022653 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022654
Daniel Veillard3d95c732004-11-06 22:25:14 +000022655 printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000022656 test_ret += test_xmlAddChild();
22657 test_ret += test_xmlAddChildList();
22658 test_ret += test_xmlAddNextSibling();
22659 test_ret += test_xmlAddPrevSibling();
22660 test_ret += test_xmlAddSibling();
22661 test_ret += test_xmlAttrSerializeTxtContent();
22662 test_ret += test_xmlBufferAdd();
22663 test_ret += test_xmlBufferAddHead();
22664 test_ret += test_xmlBufferCCat();
22665 test_ret += test_xmlBufferCat();
22666 test_ret += test_xmlBufferContent();
22667 test_ret += test_xmlBufferCreate();
22668 test_ret += test_xmlBufferCreateSize();
22669 test_ret += test_xmlBufferCreateStatic();
22670 test_ret += test_xmlBufferEmpty();
22671 test_ret += test_xmlBufferGrow();
22672 test_ret += test_xmlBufferLength();
22673 test_ret += test_xmlBufferResize();
22674 test_ret += test_xmlBufferSetAllocationScheme();
22675 test_ret += test_xmlBufferShrink();
22676 test_ret += test_xmlBufferWriteCHAR();
22677 test_ret += test_xmlBufferWriteChar();
22678 test_ret += test_xmlBufferWriteQuotedString();
22679 test_ret += test_xmlBuildQName();
22680 test_ret += test_xmlCopyDoc();
22681 test_ret += test_xmlCopyDtd();
22682 test_ret += test_xmlCopyNamespace();
22683 test_ret += test_xmlCopyNamespaceList();
22684 test_ret += test_xmlCopyNode();
22685 test_ret += test_xmlCopyNodeList();
22686 test_ret += test_xmlCopyProp();
22687 test_ret += test_xmlCopyPropList();
22688 test_ret += test_xmlCreateIntSubset();
22689 test_ret += test_xmlDocCopyNode();
22690 test_ret += test_xmlDocCopyNodeList();
22691 test_ret += test_xmlDocDump();
22692 test_ret += test_xmlDocDumpFormatMemory();
22693 test_ret += test_xmlDocDumpFormatMemoryEnc();
22694 test_ret += test_xmlDocDumpMemory();
22695 test_ret += test_xmlDocDumpMemoryEnc();
22696 test_ret += test_xmlDocFormatDump();
22697 test_ret += test_xmlDocGetRootElement();
22698 test_ret += test_xmlDocSetRootElement();
22699 test_ret += test_xmlElemDump();
22700 test_ret += test_xmlGetBufferAllocationScheme();
22701 test_ret += test_xmlGetCompressMode();
22702 test_ret += test_xmlGetDocCompressMode();
22703 test_ret += test_xmlGetIntSubset();
22704 test_ret += test_xmlGetLastChild();
22705 test_ret += test_xmlGetLineNo();
22706 test_ret += test_xmlGetNoNsProp();
22707 test_ret += test_xmlGetNodePath();
22708 test_ret += test_xmlGetNsList();
22709 test_ret += test_xmlGetNsProp();
22710 test_ret += test_xmlGetProp();
22711 test_ret += test_xmlHasNsProp();
22712 test_ret += test_xmlHasProp();
22713 test_ret += test_xmlIsBlankNode();
22714 test_ret += test_xmlIsXHTML();
22715 test_ret += test_xmlNewCDataBlock();
22716 test_ret += test_xmlNewCharRef();
22717 test_ret += test_xmlNewChild();
22718 test_ret += test_xmlNewComment();
22719 test_ret += test_xmlNewDoc();
22720 test_ret += test_xmlNewDocComment();
22721 test_ret += test_xmlNewDocFragment();
22722 test_ret += test_xmlNewDocNode();
22723 test_ret += test_xmlNewDocNodeEatName();
22724 test_ret += test_xmlNewDocPI();
22725 test_ret += test_xmlNewDocProp();
22726 test_ret += test_xmlNewDocRawNode();
22727 test_ret += test_xmlNewDocText();
22728 test_ret += test_xmlNewDocTextLen();
22729 test_ret += test_xmlNewDtd();
22730 test_ret += test_xmlNewNode();
22731 test_ret += test_xmlNewNodeEatName();
22732 test_ret += test_xmlNewNs();
22733 test_ret += test_xmlNewNsProp();
22734 test_ret += test_xmlNewNsPropEatName();
22735 test_ret += test_xmlNewPI();
22736 test_ret += test_xmlNewProp();
22737 test_ret += test_xmlNewReference();
22738 test_ret += test_xmlNewText();
22739 test_ret += test_xmlNewTextChild();
22740 test_ret += test_xmlNewTextLen();
22741 test_ret += test_xmlNodeAddContent();
22742 test_ret += test_xmlNodeAddContentLen();
22743 test_ret += test_xmlNodeBufGetContent();
22744 test_ret += test_xmlNodeDump();
22745 test_ret += test_xmlNodeDumpOutput();
22746 test_ret += test_xmlNodeGetBase();
22747 test_ret += test_xmlNodeGetContent();
22748 test_ret += test_xmlNodeGetLang();
22749 test_ret += test_xmlNodeGetSpacePreserve();
22750 test_ret += test_xmlNodeIsText();
22751 test_ret += test_xmlNodeListGetRawString();
22752 test_ret += test_xmlNodeListGetString();
22753 test_ret += test_xmlNodeSetBase();
22754 test_ret += test_xmlNodeSetContent();
22755 test_ret += test_xmlNodeSetContentLen();
22756 test_ret += test_xmlNodeSetLang();
22757 test_ret += test_xmlNodeSetName();
22758 test_ret += test_xmlNodeSetSpacePreserve();
22759 test_ret += test_xmlReconciliateNs();
22760 test_ret += test_xmlRemoveProp();
22761 test_ret += test_xmlReplaceNode();
22762 test_ret += test_xmlSaveFile();
22763 test_ret += test_xmlSaveFileEnc();
22764 test_ret += test_xmlSaveFileTo();
22765 test_ret += test_xmlSaveFormatFile();
22766 test_ret += test_xmlSaveFormatFileEnc();
22767 test_ret += test_xmlSaveFormatFileTo();
22768 test_ret += test_xmlSearchNs();
22769 test_ret += test_xmlSearchNsByHref();
22770 test_ret += test_xmlSetBufferAllocationScheme();
22771 test_ret += test_xmlSetCompressMode();
22772 test_ret += test_xmlSetDocCompressMode();
22773 test_ret += test_xmlSetNs();
22774 test_ret += test_xmlSetNsProp();
22775 test_ret += test_xmlSetProp();
22776 test_ret += test_xmlSplitQName2();
22777 test_ret += test_xmlSplitQName3();
22778 test_ret += test_xmlStringGetNodeList();
22779 test_ret += test_xmlStringLenGetNodeList();
22780 test_ret += test_xmlTextConcat();
22781 test_ret += test_xmlTextMerge();
22782 test_ret += test_xmlUnsetNsProp();
22783 test_ret += test_xmlUnsetProp();
22784 test_ret += test_xmlValidateNCName();
22785 test_ret += test_xmlValidateNMToken();
22786 test_ret += test_xmlValidateName();
22787 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000022788
Daniel Veillard42595322004-11-08 10:52:06 +000022789 if (test_ret != 0)
22790 printf("Module tree: %d errors\n", test_ret);
22791 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022792}
22793
22794static int
22795test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022796 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022797
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022798 int mem_base;
22799 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022800 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022801 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022802 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022803 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022804
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022805 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
22806 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
22807 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022808 URI = gen_const_xmlChar_ptr(n_URI, 0);
22809 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022810
22811 ret_val = xmlBuildRelativeURI(URI, base);
22812 desret_xmlChar_ptr(ret_val);
22813 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022814 des_const_xmlChar_ptr(n_URI, URI, 0);
22815 des_const_xmlChar_ptr(n_base, base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022816 xmlResetLastError();
22817 if (mem_base != xmlMemBlocks()) {
22818 printf("Leak of %d blocks found in xmlBuildRelativeURI",
22819 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022820 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022821 printf(" %d", n_URI);
22822 printf(" %d", n_base);
22823 printf("\n");
22824 }
22825 }
22826 }
22827
Daniel Veillard3d97e662004-11-04 10:49:00 +000022828 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022829 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022830}
22831
22832
22833static int
22834test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022835 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022836
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022837 int mem_base;
22838 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022839 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022840 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022841 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022842 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022843
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022844 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
22845 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
22846 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022847 URI = gen_const_xmlChar_ptr(n_URI, 0);
22848 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022849
22850 ret_val = xmlBuildURI(URI, base);
22851 desret_xmlChar_ptr(ret_val);
22852 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022853 des_const_xmlChar_ptr(n_URI, URI, 0);
22854 des_const_xmlChar_ptr(n_base, base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022855 xmlResetLastError();
22856 if (mem_base != xmlMemBlocks()) {
22857 printf("Leak of %d blocks found in xmlBuildURI",
22858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022859 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022860 printf(" %d", n_URI);
22861 printf(" %d", n_base);
22862 printf("\n");
22863 }
22864 }
22865 }
22866
Daniel Veillard3d97e662004-11-04 10:49:00 +000022867 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022869}
22870
22871
22872static int
22873test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022875
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022876 int mem_base;
22877 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022878 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022879 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022880
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022881 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
22882 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022883 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022884
22885 ret_val = xmlCanonicPath(path);
22886 desret_xmlChar_ptr(ret_val);
22887 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022888 des_const_xmlChar_ptr(n_path, path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022889 xmlResetLastError();
22890 if (mem_base != xmlMemBlocks()) {
22891 printf("Leak of %d blocks found in xmlCanonicPath",
22892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022893 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022894 printf(" %d", n_path);
22895 printf("\n");
22896 }
22897 }
22898
Daniel Veillard3d97e662004-11-04 10:49:00 +000022899 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022900 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022901}
22902
22903
22904static int
22905test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022907
22908
22909 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000022910 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022911}
22912
22913
22914static int
22915test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022916 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022917
Daniel Veillardce682bc2004-11-05 17:22:25 +000022918 int mem_base;
22919 int ret_val;
22920 char * path; /* pointer to the path string */
22921 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022922
Daniel Veillardce682bc2004-11-05 17:22:25 +000022923 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
22924 mem_base = xmlMemBlocks();
22925 path = gen_char_ptr(n_path, 0);
22926
22927 ret_val = xmlNormalizeURIPath(path);
22928 desret_int(ret_val);
22929 call_tests++;
22930 des_char_ptr(n_path, path, 0);
22931 xmlResetLastError();
22932 if (mem_base != xmlMemBlocks()) {
22933 printf("Leak of %d blocks found in xmlNormalizeURIPath",
22934 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022935 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022936 printf(" %d", n_path);
22937 printf("\n");
22938 }
22939 }
22940
22941 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022942 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022943}
22944
22945
22946static int
22947test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022948 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022949
22950
22951 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000022952 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022953}
22954
22955
Daniel Veillardce682bc2004-11-05 17:22:25 +000022956#define gen_nb_xmlURIPtr 1
22957static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
22958 return(NULL);
22959}
22960static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
22961}
22962
Daniel Veillardd93f6252004-11-02 15:53:51 +000022963static int
22964test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022965 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022966
Daniel Veillardce682bc2004-11-05 17:22:25 +000022967 int mem_base;
22968 int ret_val;
22969 xmlURIPtr uri; /* pointer to an URI structure */
22970 int n_uri;
22971 char * str; /* the string to analyze */
22972 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022973
Daniel Veillardce682bc2004-11-05 17:22:25 +000022974 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
22975 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
22976 mem_base = xmlMemBlocks();
22977 uri = gen_xmlURIPtr(n_uri, 0);
22978 str = gen_const_char_ptr(n_str, 1);
22979
22980 ret_val = xmlParseURIReference(uri, str);
22981 desret_int(ret_val);
22982 call_tests++;
22983 des_xmlURIPtr(n_uri, uri, 0);
22984 des_const_char_ptr(n_str, str, 1);
22985 xmlResetLastError();
22986 if (mem_base != xmlMemBlocks()) {
22987 printf("Leak of %d blocks found in xmlParseURIReference",
22988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022989 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022990 printf(" %d", n_uri);
22991 printf(" %d", n_str);
22992 printf("\n");
22993 }
22994 }
22995 }
22996
22997 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022999}
23000
23001
23002static int
23003test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023005
Daniel Veillardce682bc2004-11-05 17:22:25 +000023006 int mem_base;
23007 FILE * stream; /* a FILE* for the output */
23008 int n_stream;
23009 xmlURIPtr uri; /* pointer to an xmlURI */
23010 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023011
Daniel Veillardce682bc2004-11-05 17:22:25 +000023012 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23013 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23014 mem_base = xmlMemBlocks();
23015 stream = gen_FILE_ptr(n_stream, 0);
23016 uri = gen_xmlURIPtr(n_uri, 1);
23017
23018 xmlPrintURI(stream, uri);
23019 call_tests++;
23020 des_FILE_ptr(n_stream, stream, 0);
23021 des_xmlURIPtr(n_uri, uri, 1);
23022 xmlResetLastError();
23023 if (mem_base != xmlMemBlocks()) {
23024 printf("Leak of %d blocks found in xmlPrintURI",
23025 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023026 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023027 printf(" %d", n_stream);
23028 printf(" %d", n_uri);
23029 printf("\n");
23030 }
23031 }
23032 }
23033
23034 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023036}
23037
23038
23039static int
23040test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023042
Daniel Veillardce682bc2004-11-05 17:22:25 +000023043 int mem_base;
23044 xmlChar * ret_val;
23045 xmlURIPtr uri; /* pointer to an xmlURI */
23046 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023047
Daniel Veillardce682bc2004-11-05 17:22:25 +000023048 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23049 mem_base = xmlMemBlocks();
23050 uri = gen_xmlURIPtr(n_uri, 0);
23051
23052 ret_val = xmlSaveUri(uri);
23053 desret_xmlChar_ptr(ret_val);
23054 call_tests++;
23055 des_xmlURIPtr(n_uri, uri, 0);
23056 xmlResetLastError();
23057 if (mem_base != xmlMemBlocks()) {
23058 printf("Leak of %d blocks found in xmlSaveUri",
23059 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023060 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023061 printf(" %d", n_uri);
23062 printf("\n");
23063 }
23064 }
23065
23066 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023068}
23069
23070
23071static int
23072test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023074
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023075 int mem_base;
23076 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023077 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023078 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023079
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023080 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23081 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023082 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023083
23084 ret_val = xmlURIEscape(str);
23085 desret_xmlChar_ptr(ret_val);
23086 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023087 des_const_xmlChar_ptr(n_str, str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023088 xmlResetLastError();
23089 if (mem_base != xmlMemBlocks()) {
23090 printf("Leak of %d blocks found in xmlURIEscape",
23091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023092 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023093 printf(" %d", n_str);
23094 printf("\n");
23095 }
23096 }
23097
Daniel Veillard3d97e662004-11-04 10:49:00 +000023098 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023099 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023100}
23101
23102
23103static int
23104test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023105 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023106
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023107 int mem_base;
23108 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023109 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023110 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023111 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023112 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023113
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023114 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23115 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23116 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023117 str = gen_const_xmlChar_ptr(n_str, 0);
23118 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023119
23120 ret_val = xmlURIEscapeStr(str, list);
23121 desret_xmlChar_ptr(ret_val);
23122 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023123 des_const_xmlChar_ptr(n_str, str, 0);
23124 des_const_xmlChar_ptr(n_list, list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023125 xmlResetLastError();
23126 if (mem_base != xmlMemBlocks()) {
23127 printf("Leak of %d blocks found in xmlURIEscapeStr",
23128 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023129 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023130 printf(" %d", n_str);
23131 printf(" %d", n_list);
23132 printf("\n");
23133 }
23134 }
23135 }
23136
Daniel Veillard3d97e662004-11-04 10:49:00 +000023137 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023139}
23140
23141
23142static int
23143test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023145
23146
23147 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023148 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023149}
23150
23151static int
23152test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023154
Daniel Veillardce682bc2004-11-05 17:22:25 +000023155 printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023156 test_ret += test_xmlBuildRelativeURI();
23157 test_ret += test_xmlBuildURI();
23158 test_ret += test_xmlCanonicPath();
23159 test_ret += test_xmlCreateURI();
23160 test_ret += test_xmlNormalizeURIPath();
23161 test_ret += test_xmlParseURI();
23162 test_ret += test_xmlParseURIReference();
23163 test_ret += test_xmlPrintURI();
23164 test_ret += test_xmlSaveUri();
23165 test_ret += test_xmlURIEscape();
23166 test_ret += test_xmlURIEscapeStr();
23167 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023168
Daniel Veillard42595322004-11-08 10:52:06 +000023169 if (test_ret != 0)
23170 printf("Module uri: %d errors\n", test_ret);
23171 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023172}
23173
23174static int
23175test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023177
Daniel Veillard42595322004-11-08 10:52:06 +000023178 int mem_base;
23179 xmlAttributePtr ret_val;
23180 xmlValidCtxtPtr ctxt; /* the validation context */
23181 int n_ctxt;
23182 xmlDtdPtr dtd; /* pointer to the DTD */
23183 int n_dtd;
23184 xmlChar * elem; /* the element name */
23185 int n_elem;
23186 xmlChar * name; /* the attribute name */
23187 int n_name;
23188 xmlChar * ns; /* the attribute namespace prefix */
23189 int n_ns;
23190 xmlAttributeType type; /* the attribute type */
23191 int n_type;
23192 xmlAttributeDefault def; /* the attribute default type */
23193 int n_def;
23194 xmlChar * defaultValue; /* the attribute default value */
23195 int n_defaultValue;
23196 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23197 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023198
Daniel Veillard42595322004-11-08 10:52:06 +000023199 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23200 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23201 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23202 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23203 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23204 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23205 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23206 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23207 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23208 mem_base = xmlMemBlocks();
23209 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23210 dtd = gen_xmlDtdPtr(n_dtd, 1);
23211 elem = gen_const_xmlChar_ptr(n_elem, 2);
23212 name = gen_const_xmlChar_ptr(n_name, 3);
23213 ns = gen_const_xmlChar_ptr(n_ns, 4);
23214 type = gen_xmlAttributeType(n_type, 5);
23215 def = gen_xmlAttributeDefault(n_def, 6);
23216 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23217 tree = gen_xmlEnumerationPtr(n_tree, 8);
23218
23219 ret_val = xmlAddAttributeDecl(ctxt, dtd, elem, name, ns, type, def, defaultValue, tree);
23220 desret_xmlAttributePtr(ret_val);
23221 call_tests++;
23222 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23223 des_xmlDtdPtr(n_dtd, dtd, 1);
23224 des_const_xmlChar_ptr(n_elem, elem, 2);
23225 des_const_xmlChar_ptr(n_name, name, 3);
23226 des_const_xmlChar_ptr(n_ns, ns, 4);
23227 des_xmlAttributeType(n_type, type, 5);
23228 des_xmlAttributeDefault(n_def, def, 6);
23229 des_const_xmlChar_ptr(n_defaultValue, defaultValue, 7);
23230 des_xmlEnumerationPtr(n_tree, tree, 8);
23231 xmlResetLastError();
23232 if (mem_base != xmlMemBlocks()) {
23233 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23234 xmlMemBlocks() - mem_base);
23235 test_ret++;
23236 printf(" %d", n_ctxt);
23237 printf(" %d", n_dtd);
23238 printf(" %d", n_elem);
23239 printf(" %d", n_name);
23240 printf(" %d", n_ns);
23241 printf(" %d", n_type);
23242 printf(" %d", n_def);
23243 printf(" %d", n_defaultValue);
23244 printf(" %d", n_tree);
23245 printf("\n");
23246 }
23247 }
23248 }
23249 }
23250 }
23251 }
23252 }
23253 }
23254 }
23255 }
23256
23257 function_tests++;
23258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023259}
23260
23261
23262static int
23263test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023264 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023265
Daniel Veillard42595322004-11-08 10:52:06 +000023266 int mem_base;
23267 xmlElementPtr ret_val;
23268 xmlValidCtxtPtr ctxt; /* the validation context */
23269 int n_ctxt;
23270 xmlDtdPtr dtd; /* pointer to the DTD */
23271 int n_dtd;
23272 xmlChar * name; /* the entity name */
23273 int n_name;
23274 xmlElementTypeVal type; /* the element type */
23275 int n_type;
23276 xmlElementContentPtr content; /* the element content tree or NULL */
23277 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023278
Daniel Veillard42595322004-11-08 10:52:06 +000023279 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23280 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23281 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23282 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23283 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23284 mem_base = xmlMemBlocks();
23285 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23286 dtd = gen_xmlDtdPtr(n_dtd, 1);
23287 name = gen_const_xmlChar_ptr(n_name, 2);
23288 type = gen_xmlElementTypeVal(n_type, 3);
23289 content = gen_xmlElementContentPtr(n_content, 4);
23290
23291 ret_val = xmlAddElementDecl(ctxt, dtd, name, type, content);
23292 desret_xmlElementPtr(ret_val);
23293 call_tests++;
23294 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23295 des_xmlDtdPtr(n_dtd, dtd, 1);
23296 des_const_xmlChar_ptr(n_name, name, 2);
23297 des_xmlElementTypeVal(n_type, type, 3);
23298 des_xmlElementContentPtr(n_content, content, 4);
23299 xmlResetLastError();
23300 if (mem_base != xmlMemBlocks()) {
23301 printf("Leak of %d blocks found in xmlAddElementDecl",
23302 xmlMemBlocks() - mem_base);
23303 test_ret++;
23304 printf(" %d", n_ctxt);
23305 printf(" %d", n_dtd);
23306 printf(" %d", n_name);
23307 printf(" %d", n_type);
23308 printf(" %d", n_content);
23309 printf("\n");
23310 }
23311 }
23312 }
23313 }
23314 }
23315 }
23316
23317 function_tests++;
23318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023319}
23320
23321
23322static int
23323test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023325
23326
23327 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023328 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023329}
23330
23331
23332static int
23333test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023334 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023335
23336
23337 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023338 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023339}
23340
23341
23342static int
23343test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023344 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023345
23346
23347 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023349}
23350
23351
Daniel Veillardce682bc2004-11-05 17:22:25 +000023352#define gen_nb_xmlAttributeTablePtr 1
23353static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23354 return(NULL);
23355}
23356static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23357}
23358
Daniel Veillardd93f6252004-11-02 15:53:51 +000023359static int
23360test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023361 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023362
23363
23364 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023366}
23367
23368
23369static int
23370test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023371 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023372
23373
23374 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023376}
23377
23378
Daniel Veillardce682bc2004-11-05 17:22:25 +000023379#define gen_nb_xmlElementTablePtr 1
23380static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23381 return(NULL);
23382}
23383static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23384}
23385
Daniel Veillardd93f6252004-11-02 15:53:51 +000023386static int
23387test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023388 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023389
23390
23391 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023393}
23394
23395
23396static int
23397test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023399
23400
23401 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023402 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023403}
23404
23405
Daniel Veillardce682bc2004-11-05 17:22:25 +000023406#define gen_nb_xmlNotationTablePtr 1
23407static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23408 return(NULL);
23409}
23410static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23411}
23412
Daniel Veillardd93f6252004-11-02 15:53:51 +000023413static int
23414test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023415 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023416
23417
23418 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023420}
23421
23422
23423static int
23424test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023426
23427
23428 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023430}
23431
23432
Daniel Veillardce682bc2004-11-05 17:22:25 +000023433#define gen_nb_xmlAttributePtr 1
23434static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23435 return(NULL);
23436}
23437static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23438}
23439
Daniel Veillardd93f6252004-11-02 15:53:51 +000023440static int
23441test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023442 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023443
Daniel Veillardce682bc2004-11-05 17:22:25 +000023444#ifdef LIBXML_OUTPUT_ENABLED
23445 int mem_base;
23446 xmlBufferPtr buf; /* the XML buffer output */
23447 int n_buf;
23448 xmlAttributePtr attr; /* An attribute declaration */
23449 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023450
Daniel Veillardce682bc2004-11-05 17:22:25 +000023451 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23452 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23453 mem_base = xmlMemBlocks();
23454 buf = gen_xmlBufferPtr(n_buf, 0);
23455 attr = gen_xmlAttributePtr(n_attr, 1);
23456
23457 xmlDumpAttributeDecl(buf, attr);
23458 call_tests++;
23459 des_xmlBufferPtr(n_buf, buf, 0);
23460 des_xmlAttributePtr(n_attr, attr, 1);
23461 xmlResetLastError();
23462 if (mem_base != xmlMemBlocks()) {
23463 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023465 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023466 printf(" %d", n_buf);
23467 printf(" %d", n_attr);
23468 printf("\n");
23469 }
23470 }
23471 }
23472#endif
23473
23474 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023475 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023476}
23477
23478
23479static int
23480test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023481 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023482
Daniel Veillardce682bc2004-11-05 17:22:25 +000023483#ifdef LIBXML_OUTPUT_ENABLED
23484 int mem_base;
23485 xmlBufferPtr buf; /* the XML buffer output */
23486 int n_buf;
23487 xmlAttributeTablePtr table; /* An attribute table */
23488 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023489
Daniel Veillardce682bc2004-11-05 17:22:25 +000023490 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23491 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23492 mem_base = xmlMemBlocks();
23493 buf = gen_xmlBufferPtr(n_buf, 0);
23494 table = gen_xmlAttributeTablePtr(n_table, 1);
23495
23496 xmlDumpAttributeTable(buf, table);
23497 call_tests++;
23498 des_xmlBufferPtr(n_buf, buf, 0);
23499 des_xmlAttributeTablePtr(n_table, table, 1);
23500 xmlResetLastError();
23501 if (mem_base != xmlMemBlocks()) {
23502 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23503 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023504 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023505 printf(" %d", n_buf);
23506 printf(" %d", n_table);
23507 printf("\n");
23508 }
23509 }
23510 }
23511#endif
23512
23513 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023515}
23516
23517
Daniel Veillardce682bc2004-11-05 17:22:25 +000023518#define gen_nb_xmlElementPtr 1
23519static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23520 return(NULL);
23521}
23522static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23523}
23524
Daniel Veillardd93f6252004-11-02 15:53:51 +000023525static int
23526test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023527 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023528
Daniel Veillardce682bc2004-11-05 17:22:25 +000023529#ifdef LIBXML_OUTPUT_ENABLED
23530 int mem_base;
23531 xmlBufferPtr buf; /* the XML buffer output */
23532 int n_buf;
23533 xmlElementPtr elem; /* An element table */
23534 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023535
Daniel Veillardce682bc2004-11-05 17:22:25 +000023536 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23537 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
23538 mem_base = xmlMemBlocks();
23539 buf = gen_xmlBufferPtr(n_buf, 0);
23540 elem = gen_xmlElementPtr(n_elem, 1);
23541
23542 xmlDumpElementDecl(buf, elem);
23543 call_tests++;
23544 des_xmlBufferPtr(n_buf, buf, 0);
23545 des_xmlElementPtr(n_elem, elem, 1);
23546 xmlResetLastError();
23547 if (mem_base != xmlMemBlocks()) {
23548 printf("Leak of %d blocks found in xmlDumpElementDecl",
23549 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023550 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023551 printf(" %d", n_buf);
23552 printf(" %d", n_elem);
23553 printf("\n");
23554 }
23555 }
23556 }
23557#endif
23558
23559 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023560 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023561}
23562
23563
23564static int
23565test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023566 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023567
Daniel Veillardce682bc2004-11-05 17:22:25 +000023568#ifdef LIBXML_OUTPUT_ENABLED
23569 int mem_base;
23570 xmlBufferPtr buf; /* the XML buffer output */
23571 int n_buf;
23572 xmlElementTablePtr table; /* An element table */
23573 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023574
Daniel Veillardce682bc2004-11-05 17:22:25 +000023575 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23576 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
23577 mem_base = xmlMemBlocks();
23578 buf = gen_xmlBufferPtr(n_buf, 0);
23579 table = gen_xmlElementTablePtr(n_table, 1);
23580
23581 xmlDumpElementTable(buf, table);
23582 call_tests++;
23583 des_xmlBufferPtr(n_buf, buf, 0);
23584 des_xmlElementTablePtr(n_table, table, 1);
23585 xmlResetLastError();
23586 if (mem_base != xmlMemBlocks()) {
23587 printf("Leak of %d blocks found in xmlDumpElementTable",
23588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023589 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023590 printf(" %d", n_buf);
23591 printf(" %d", n_table);
23592 printf("\n");
23593 }
23594 }
23595 }
23596#endif
23597
23598 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023599 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023600}
23601
23602
Daniel Veillardce682bc2004-11-05 17:22:25 +000023603#define gen_nb_xmlNotationPtr 1
23604static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23605 return(NULL);
23606}
23607static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23608}
23609
Daniel Veillardd93f6252004-11-02 15:53:51 +000023610static int
23611test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023612 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023613
Daniel Veillardce682bc2004-11-05 17:22:25 +000023614#ifdef LIBXML_OUTPUT_ENABLED
23615 int mem_base;
23616 xmlBufferPtr buf; /* the XML buffer output */
23617 int n_buf;
23618 xmlNotationPtr nota; /* A notation declaration */
23619 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023620
Daniel Veillardce682bc2004-11-05 17:22:25 +000023621 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23622 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
23623 mem_base = xmlMemBlocks();
23624 buf = gen_xmlBufferPtr(n_buf, 0);
23625 nota = gen_xmlNotationPtr(n_nota, 1);
23626
23627 xmlDumpNotationDecl(buf, nota);
23628 call_tests++;
23629 des_xmlBufferPtr(n_buf, buf, 0);
23630 des_xmlNotationPtr(n_nota, nota, 1);
23631 xmlResetLastError();
23632 if (mem_base != xmlMemBlocks()) {
23633 printf("Leak of %d blocks found in xmlDumpNotationDecl",
23634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023635 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023636 printf(" %d", n_buf);
23637 printf(" %d", n_nota);
23638 printf("\n");
23639 }
23640 }
23641 }
23642#endif
23643
23644 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023646}
23647
23648
23649static int
23650test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023652
Daniel Veillardce682bc2004-11-05 17:22:25 +000023653#ifdef LIBXML_OUTPUT_ENABLED
23654 int mem_base;
23655 xmlBufferPtr buf; /* the XML buffer output */
23656 int n_buf;
23657 xmlNotationTablePtr table; /* A notation table */
23658 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023659
Daniel Veillardce682bc2004-11-05 17:22:25 +000023660 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23661 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
23662 mem_base = xmlMemBlocks();
23663 buf = gen_xmlBufferPtr(n_buf, 0);
23664 table = gen_xmlNotationTablePtr(n_table, 1);
23665
23666 xmlDumpNotationTable(buf, table);
23667 call_tests++;
23668 des_xmlBufferPtr(n_buf, buf, 0);
23669 des_xmlNotationTablePtr(n_table, table, 1);
23670 xmlResetLastError();
23671 if (mem_base != xmlMemBlocks()) {
23672 printf("Leak of %d blocks found in xmlDumpNotationTable",
23673 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023674 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023675 printf(" %d", n_buf);
23676 printf(" %d", n_table);
23677 printf("\n");
23678 }
23679 }
23680 }
23681#endif
23682
23683 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023684 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023685}
23686
23687
23688static int
23689test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023690 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023691
Daniel Veillard42595322004-11-08 10:52:06 +000023692 int mem_base;
23693 xmlAttributePtr ret_val;
23694 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23695 int n_dtd;
23696 xmlChar * elem; /* the element name */
23697 int n_elem;
23698 xmlChar * name; /* the attribute name */
23699 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023700
Daniel Veillard42595322004-11-08 10:52:06 +000023701 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23702 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23703 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23704 mem_base = xmlMemBlocks();
23705 dtd = gen_xmlDtdPtr(n_dtd, 0);
23706 elem = gen_const_xmlChar_ptr(n_elem, 1);
23707 name = gen_const_xmlChar_ptr(n_name, 2);
23708
23709 ret_val = xmlGetDtdAttrDesc(dtd, elem, name);
23710 desret_xmlAttributePtr(ret_val);
23711 call_tests++;
23712 des_xmlDtdPtr(n_dtd, dtd, 0);
23713 des_const_xmlChar_ptr(n_elem, elem, 1);
23714 des_const_xmlChar_ptr(n_name, name, 2);
23715 xmlResetLastError();
23716 if (mem_base != xmlMemBlocks()) {
23717 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
23718 xmlMemBlocks() - mem_base);
23719 test_ret++;
23720 printf(" %d", n_dtd);
23721 printf(" %d", n_elem);
23722 printf(" %d", n_name);
23723 printf("\n");
23724 }
23725 }
23726 }
23727 }
23728
23729 function_tests++;
23730 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023731}
23732
23733
23734static int
23735test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023736 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023737
Daniel Veillard42595322004-11-08 10:52:06 +000023738 int mem_base;
23739 xmlElementPtr ret_val;
23740 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23741 int n_dtd;
23742 xmlChar * name; /* the element name */
23743 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023744
Daniel Veillard42595322004-11-08 10:52:06 +000023745 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23746 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23747 mem_base = xmlMemBlocks();
23748 dtd = gen_xmlDtdPtr(n_dtd, 0);
23749 name = gen_const_xmlChar_ptr(n_name, 1);
23750
23751 ret_val = xmlGetDtdElementDesc(dtd, name);
23752 desret_xmlElementPtr(ret_val);
23753 call_tests++;
23754 des_xmlDtdPtr(n_dtd, dtd, 0);
23755 des_const_xmlChar_ptr(n_name, name, 1);
23756 xmlResetLastError();
23757 if (mem_base != xmlMemBlocks()) {
23758 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
23759 xmlMemBlocks() - mem_base);
23760 test_ret++;
23761 printf(" %d", n_dtd);
23762 printf(" %d", n_name);
23763 printf("\n");
23764 }
23765 }
23766 }
23767
23768 function_tests++;
23769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023770}
23771
23772
23773static int
23774test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023776
23777
23778 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023780}
23781
23782
23783static int
23784test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023786
Daniel Veillard42595322004-11-08 10:52:06 +000023787 int mem_base;
23788 xmlAttributePtr ret_val;
23789 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23790 int n_dtd;
23791 xmlChar * elem; /* the element name */
23792 int n_elem;
23793 xmlChar * name; /* the attribute name */
23794 int n_name;
23795 xmlChar * prefix; /* the attribute namespace prefix */
23796 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023797
Daniel Veillard42595322004-11-08 10:52:06 +000023798 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23799 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23800 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23801 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
23802 mem_base = xmlMemBlocks();
23803 dtd = gen_xmlDtdPtr(n_dtd, 0);
23804 elem = gen_const_xmlChar_ptr(n_elem, 1);
23805 name = gen_const_xmlChar_ptr(n_name, 2);
23806 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
23807
23808 ret_val = xmlGetDtdQAttrDesc(dtd, elem, name, prefix);
23809 desret_xmlAttributePtr(ret_val);
23810 call_tests++;
23811 des_xmlDtdPtr(n_dtd, dtd, 0);
23812 des_const_xmlChar_ptr(n_elem, elem, 1);
23813 des_const_xmlChar_ptr(n_name, name, 2);
23814 des_const_xmlChar_ptr(n_prefix, prefix, 3);
23815 xmlResetLastError();
23816 if (mem_base != xmlMemBlocks()) {
23817 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
23818 xmlMemBlocks() - mem_base);
23819 test_ret++;
23820 printf(" %d", n_dtd);
23821 printf(" %d", n_elem);
23822 printf(" %d", n_name);
23823 printf(" %d", n_prefix);
23824 printf("\n");
23825 }
23826 }
23827 }
23828 }
23829 }
23830
23831 function_tests++;
23832 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023833}
23834
23835
23836static int
23837test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023838 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023839
Daniel Veillard42595322004-11-08 10:52:06 +000023840 int mem_base;
23841 xmlElementPtr ret_val;
23842 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23843 int n_dtd;
23844 xmlChar * name; /* the element name */
23845 int n_name;
23846 xmlChar * prefix; /* the element namespace prefix */
23847 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023848
Daniel Veillard42595322004-11-08 10:52:06 +000023849 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23850 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23851 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
23852 mem_base = xmlMemBlocks();
23853 dtd = gen_xmlDtdPtr(n_dtd, 0);
23854 name = gen_const_xmlChar_ptr(n_name, 1);
23855 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
23856
23857 ret_val = xmlGetDtdQElementDesc(dtd, name, prefix);
23858 desret_xmlElementPtr(ret_val);
23859 call_tests++;
23860 des_xmlDtdPtr(n_dtd, dtd, 0);
23861 des_const_xmlChar_ptr(n_name, name, 1);
23862 des_const_xmlChar_ptr(n_prefix, prefix, 2);
23863 xmlResetLastError();
23864 if (mem_base != xmlMemBlocks()) {
23865 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
23866 xmlMemBlocks() - mem_base);
23867 test_ret++;
23868 printf(" %d", n_dtd);
23869 printf(" %d", n_name);
23870 printf(" %d", n_prefix);
23871 printf("\n");
23872 }
23873 }
23874 }
23875 }
23876
23877 function_tests++;
23878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023879}
23880
23881
23882static int
23883test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023885
Daniel Veillard57b25162004-11-06 14:50:18 +000023886 int mem_base;
23887 xmlAttrPtr ret_val;
23888 xmlDocPtr doc; /* pointer to the document */
23889 int n_doc;
23890 xmlChar * ID; /* the ID value */
23891 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023892
Daniel Veillard57b25162004-11-06 14:50:18 +000023893 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23894 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
23895 mem_base = xmlMemBlocks();
23896 doc = gen_xmlDocPtr(n_doc, 0);
23897 ID = gen_const_xmlChar_ptr(n_ID, 1);
23898
23899 ret_val = xmlGetID(doc, ID);
23900 desret_xmlAttrPtr(ret_val);
23901 call_tests++;
23902 des_xmlDocPtr(n_doc, doc, 0);
23903 des_const_xmlChar_ptr(n_ID, ID, 1);
23904 xmlResetLastError();
23905 if (mem_base != xmlMemBlocks()) {
23906 printf("Leak of %d blocks found in xmlGetID",
23907 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023908 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000023909 printf(" %d", n_doc);
23910 printf(" %d", n_ID);
23911 printf("\n");
23912 }
23913 }
23914 }
23915
23916 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023918}
23919
23920
23921static int
23922test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023924
23925
23926 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023927 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023928}
23929
23930
23931static int
23932test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023933 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023934
Daniel Veillardce244ad2004-11-05 10:03:46 +000023935 int mem_base;
23936 int ret_val;
23937 xmlDocPtr doc; /* the document */
23938 int n_doc;
23939 xmlNodePtr elem; /* the element carrying the attribute */
23940 int n_elem;
23941 xmlAttrPtr attr; /* the attribute */
23942 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023943
Daniel Veillardce244ad2004-11-05 10:03:46 +000023944 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23945 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
23946 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
23947 mem_base = xmlMemBlocks();
23948 doc = gen_xmlDocPtr(n_doc, 0);
23949 elem = gen_xmlNodePtr(n_elem, 1);
23950 attr = gen_xmlAttrPtr(n_attr, 2);
23951
23952 ret_val = xmlIsID(doc, elem, attr);
23953 desret_int(ret_val);
23954 call_tests++;
23955 des_xmlDocPtr(n_doc, doc, 0);
23956 des_xmlNodePtr(n_elem, elem, 1);
23957 des_xmlAttrPtr(n_attr, attr, 2);
23958 xmlResetLastError();
23959 if (mem_base != xmlMemBlocks()) {
23960 printf("Leak of %d blocks found in xmlIsID",
23961 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023962 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000023963 printf(" %d", n_doc);
23964 printf(" %d", n_elem);
23965 printf(" %d", n_attr);
23966 printf("\n");
23967 }
23968 }
23969 }
23970 }
23971
23972 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023973 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023974}
23975
23976
23977static int
23978test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023979 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023980
23981 int mem_base;
23982 int ret_val;
23983 xmlDocPtr doc; /* the document */
23984 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023985 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023986 int n_name;
23987
23988 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23989 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23990 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023991 doc = gen_xmlDocPtr(n_doc, 0);
23992 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023993
23994 ret_val = xmlIsMixedElement(doc, name);
23995 desret_int(ret_val);
23996 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023997 des_xmlDocPtr(n_doc, doc, 0);
23998 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023999 xmlResetLastError();
24000 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024001 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024003 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024004 printf(" %d", n_doc);
24005 printf(" %d", n_name);
24006 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024007 }
24008 }
24009 }
24010
Daniel Veillard3d97e662004-11-04 10:49:00 +000024011 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024013}
24014
24015
24016static int
24017test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024019
Daniel Veillardce244ad2004-11-05 10:03:46 +000024020 int mem_base;
24021 int ret_val;
24022 xmlDocPtr doc; /* the document */
24023 int n_doc;
24024 xmlNodePtr elem; /* the element carrying the attribute */
24025 int n_elem;
24026 xmlAttrPtr attr; /* the attribute */
24027 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024028
Daniel Veillardce244ad2004-11-05 10:03:46 +000024029 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24030 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24031 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24032 mem_base = xmlMemBlocks();
24033 doc = gen_xmlDocPtr(n_doc, 0);
24034 elem = gen_xmlNodePtr(n_elem, 1);
24035 attr = gen_xmlAttrPtr(n_attr, 2);
24036
24037 ret_val = xmlIsRef(doc, elem, attr);
24038 desret_int(ret_val);
24039 call_tests++;
24040 des_xmlDocPtr(n_doc, doc, 0);
24041 des_xmlNodePtr(n_elem, elem, 1);
24042 des_xmlAttrPtr(n_attr, attr, 2);
24043 xmlResetLastError();
24044 if (mem_base != xmlMemBlocks()) {
24045 printf("Leak of %d blocks found in xmlIsRef",
24046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024047 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024048 printf(" %d", n_doc);
24049 printf(" %d", n_elem);
24050 printf(" %d", n_attr);
24051 printf("\n");
24052 }
24053 }
24054 }
24055 }
24056
24057 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024058 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024059}
24060
24061
24062static int
24063test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024064 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024065
24066
24067 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024069}
24070
24071
24072static int
24073test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024075
24076
24077 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024079}
24080
24081
24082static int
24083test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024085
Daniel Veillardce244ad2004-11-05 10:03:46 +000024086 int mem_base;
24087 int ret_val;
24088 xmlDocPtr doc; /* the document */
24089 int n_doc;
24090 xmlAttrPtr attr; /* the attribute */
24091 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024092
Daniel Veillardce244ad2004-11-05 10:03:46 +000024093 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24094 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24095 mem_base = xmlMemBlocks();
24096 doc = gen_xmlDocPtr(n_doc, 0);
24097 attr = gen_xmlAttrPtr(n_attr, 1);
24098
24099 ret_val = xmlRemoveID(doc, attr);
24100 desret_int(ret_val);
24101 call_tests++;
24102 des_xmlDocPtr(n_doc, doc, 0);
24103 des_xmlAttrPtr(n_attr, attr, 1);
24104 xmlResetLastError();
24105 if (mem_base != xmlMemBlocks()) {
24106 printf("Leak of %d blocks found in xmlRemoveID",
24107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024108 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024109 printf(" %d", n_doc);
24110 printf(" %d", n_attr);
24111 printf("\n");
24112 }
24113 }
24114 }
24115
24116 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024118}
24119
24120
24121static int
24122test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024124
Daniel Veillardce244ad2004-11-05 10:03:46 +000024125 int mem_base;
24126 int ret_val;
24127 xmlDocPtr doc; /* the document */
24128 int n_doc;
24129 xmlAttrPtr attr; /* the attribute */
24130 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024131
Daniel Veillardce244ad2004-11-05 10:03:46 +000024132 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24133 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24134 mem_base = xmlMemBlocks();
24135 doc = gen_xmlDocPtr(n_doc, 0);
24136 attr = gen_xmlAttrPtr(n_attr, 1);
24137
24138 ret_val = xmlRemoveRef(doc, attr);
24139 desret_int(ret_val);
24140 call_tests++;
24141 des_xmlDocPtr(n_doc, doc, 0);
24142 des_xmlAttrPtr(n_attr, attr, 1);
24143 xmlResetLastError();
24144 if (mem_base != xmlMemBlocks()) {
24145 printf("Leak of %d blocks found in xmlRemoveRef",
24146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024147 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024148 printf(" %d", n_doc);
24149 printf(" %d", n_attr);
24150 printf("\n");
24151 }
24152 }
24153 }
24154
24155 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024156 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024157}
24158
24159
24160static int
24161test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024162 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024163
Daniel Veillardce682bc2004-11-05 17:22:25 +000024164 int mem_base;
24165 char * buf; /* an output buffer */
24166 int n_buf;
24167 int size; /* the buffer size */
24168 int n_size;
24169 xmlElementContentPtr content; /* An element table */
24170 int n_content;
24171 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24172 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024173
Daniel Veillardce682bc2004-11-05 17:22:25 +000024174 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24175 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24176 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24177 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24178 mem_base = xmlMemBlocks();
24179 buf = gen_char_ptr(n_buf, 0);
24180 size = gen_int(n_size, 1);
24181 content = gen_xmlElementContentPtr(n_content, 2);
24182 glob = gen_int(n_glob, 3);
24183
24184 xmlSnprintfElementContent(buf, size, content, glob);
24185 call_tests++;
24186 des_char_ptr(n_buf, buf, 0);
24187 des_int(n_size, size, 1);
24188 des_xmlElementContentPtr(n_content, content, 2);
24189 des_int(n_glob, glob, 3);
24190 xmlResetLastError();
24191 if (mem_base != xmlMemBlocks()) {
24192 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24193 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024194 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024195 printf(" %d", n_buf);
24196 printf(" %d", n_size);
24197 printf(" %d", n_content);
24198 printf(" %d", n_glob);
24199 printf("\n");
24200 }
24201 }
24202 }
24203 }
24204 }
24205
24206 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024207 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024208}
24209
24210
24211static int
24212test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024213 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024214
Daniel Veillardce682bc2004-11-05 17:22:25 +000024215 int mem_base;
24216 char * buf; /* an output buffer */
24217 int n_buf;
24218 xmlElementContentPtr content; /* An element table */
24219 int n_content;
24220 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24221 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024222
Daniel Veillardce682bc2004-11-05 17:22:25 +000024223 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24224 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24225 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24226 mem_base = xmlMemBlocks();
24227 buf = gen_char_ptr(n_buf, 0);
24228 content = gen_xmlElementContentPtr(n_content, 1);
24229 glob = gen_int(n_glob, 2);
24230
24231 xmlSprintfElementContent(buf, content, glob);
24232 call_tests++;
24233 des_char_ptr(n_buf, buf, 0);
24234 des_xmlElementContentPtr(n_content, content, 1);
24235 des_int(n_glob, glob, 2);
24236 xmlResetLastError();
24237 if (mem_base != xmlMemBlocks()) {
24238 printf("Leak of %d blocks found in xmlSprintfElementContent",
24239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024240 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024241 printf(" %d", n_buf);
24242 printf(" %d", n_content);
24243 printf(" %d", n_glob);
24244 printf("\n");
24245 }
24246 }
24247 }
24248 }
24249
24250 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024252}
24253
24254
24255static int
24256test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024258
Daniel Veillardce682bc2004-11-05 17:22:25 +000024259#ifdef LIBXML_REGEXP_ENABLED
24260 int mem_base;
24261 int ret_val;
24262 xmlValidCtxtPtr ctxt; /* a validation context */
24263 int n_ctxt;
24264 xmlElementPtr elem; /* an element declaration node */
24265 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024266
Daniel Veillardce682bc2004-11-05 17:22:25 +000024267 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24268 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24269 mem_base = xmlMemBlocks();
24270 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24271 elem = gen_xmlElementPtr(n_elem, 1);
24272
24273 ret_val = xmlValidBuildContentModel(ctxt, elem);
24274 desret_int(ret_val);
24275 call_tests++;
24276 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24277 des_xmlElementPtr(n_elem, elem, 1);
24278 xmlResetLastError();
24279 if (mem_base != xmlMemBlocks()) {
24280 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024282 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024283 printf(" %d", n_ctxt);
24284 printf(" %d", n_elem);
24285 printf("\n");
24286 }
24287 }
24288 }
24289#endif
24290
24291 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024293}
24294
24295
24296static int
24297test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024299
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024300#ifdef LIBXML_VALID_ENABLED
24301 int mem_base;
24302 xmlChar * ret_val;
24303 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24304 int n_ctxt;
24305 xmlDocPtr doc; /* the document */
24306 int n_doc;
24307 xmlNodePtr elem; /* the parent */
24308 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024309 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024310 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024311 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024312 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024313
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024314 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24315 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24316 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24317 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24318 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24319 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024320 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24321 doc = gen_xmlDocPtr(n_doc, 1);
24322 elem = gen_xmlNodePtr(n_elem, 2);
24323 name = gen_const_xmlChar_ptr(n_name, 3);
24324 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024325
24326 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, name, value);
24327 desret_xmlChar_ptr(ret_val);
24328 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024329 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24330 des_xmlDocPtr(n_doc, doc, 1);
24331 des_xmlNodePtr(n_elem, elem, 2);
24332 des_const_xmlChar_ptr(n_name, name, 3);
24333 des_const_xmlChar_ptr(n_value, value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024334 xmlResetLastError();
24335 if (mem_base != xmlMemBlocks()) {
24336 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024338 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024339 printf(" %d", n_ctxt);
24340 printf(" %d", n_doc);
24341 printf(" %d", n_elem);
24342 printf(" %d", n_name);
24343 printf(" %d", n_value);
24344 printf("\n");
24345 }
24346 }
24347 }
24348 }
24349 }
24350 }
24351#endif
24352
Daniel Veillard3d97e662004-11-04 10:49:00 +000024353 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024355}
24356
24357
Daniel Veillardce682bc2004-11-05 17:22:25 +000024358#define gen_nb_xmlElementContent_ptr 1
24359static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24360 return(NULL);
24361}
24362static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24363}
24364
Daniel Veillardd93f6252004-11-02 15:53:51 +000024365static int
24366test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024367 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024368
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024369 int mem_base;
24370 int ret_val;
24371 xmlElementContent * ctree; /* an element content tree */
24372 int n_ctree;
24373 xmlChar ** list; /* an array to store the list of child names */
24374 int n_list;
24375 int * len; /* a pointer to the number of element in the list */
24376 int n_len;
24377 int max; /* the size of the array */
24378 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024379
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024380 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24381 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24382 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24383 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24384 mem_base = xmlMemBlocks();
24385 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24386 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24387 len = gen_int_ptr(n_len, 2);
24388 max = gen_int(n_max, 3);
24389
24390 ret_val = xmlValidGetPotentialChildren(ctree, list, len, max);
24391 desret_int(ret_val);
24392 call_tests++;
24393 des_xmlElementContent_ptr(n_ctree, ctree, 0);
24394 des_const_xmlChar_ptr_ptr(n_list, list, 1);
24395 des_int_ptr(n_len, len, 2);
24396 des_int(n_max, max, 3);
24397 xmlResetLastError();
24398 if (mem_base != xmlMemBlocks()) {
24399 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024401 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024402 printf(" %d", n_ctree);
24403 printf(" %d", n_list);
24404 printf(" %d", n_len);
24405 printf(" %d", n_max);
24406 printf("\n");
24407 }
24408 }
24409 }
24410 }
24411 }
24412
24413 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024414 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024415}
24416
24417
24418static int
24419test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024421
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024422 int mem_base;
24423 int ret_val;
24424 xmlNode * prev; /* an element to insert after */
24425 int n_prev;
24426 xmlNode * next; /* an element to insert next */
24427 int n_next;
24428 xmlChar ** names; /* an array to store the list of child names */
24429 int n_names;
24430 int max; /* the size of the array */
24431 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024432
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024433 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24434 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
24435 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
24436 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24437 mem_base = xmlMemBlocks();
24438 prev = gen_xmlNodePtr(n_prev, 0);
24439 next = gen_xmlNodePtr(n_next, 1);
24440 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
24441 max = gen_int(n_max, 3);
24442
24443 ret_val = xmlValidGetValidElements(prev, next, names, max);
24444 desret_int(ret_val);
24445 call_tests++;
24446 des_xmlNodePtr(n_prev, prev, 0);
24447 des_xmlNodePtr(n_next, next, 1);
24448 des_const_xmlChar_ptr_ptr(n_names, names, 2);
24449 des_int(n_max, max, 3);
24450 xmlResetLastError();
24451 if (mem_base != xmlMemBlocks()) {
24452 printf("Leak of %d blocks found in xmlValidGetValidElements",
24453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024454 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024455 printf(" %d", n_prev);
24456 printf(" %d", n_next);
24457 printf(" %d", n_names);
24458 printf(" %d", n_max);
24459 printf("\n");
24460 }
24461 }
24462 }
24463 }
24464 }
24465
24466 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024467 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024468}
24469
24470
24471static int
24472test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024473 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024474
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024475#ifdef LIBXML_VALID_ENABLED
24476 int mem_base;
24477 xmlChar * ret_val;
24478 xmlDocPtr doc; /* the document */
24479 int n_doc;
24480 xmlNodePtr elem; /* the parent */
24481 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024482 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024483 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024484 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024485 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024486
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024487 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24488 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24489 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24490 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24491 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024492 doc = gen_xmlDocPtr(n_doc, 0);
24493 elem = gen_xmlNodePtr(n_elem, 1);
24494 name = gen_const_xmlChar_ptr(n_name, 2);
24495 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024496
24497 ret_val = xmlValidNormalizeAttributeValue(doc, elem, name, value);
24498 desret_xmlChar_ptr(ret_val);
24499 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024500 des_xmlDocPtr(n_doc, doc, 0);
24501 des_xmlNodePtr(n_elem, elem, 1);
24502 des_const_xmlChar_ptr(n_name, name, 2);
24503 des_const_xmlChar_ptr(n_value, value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024504 xmlResetLastError();
24505 if (mem_base != xmlMemBlocks()) {
24506 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
24507 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024508 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024509 printf(" %d", n_doc);
24510 printf(" %d", n_elem);
24511 printf(" %d", n_name);
24512 printf(" %d", n_value);
24513 printf("\n");
24514 }
24515 }
24516 }
24517 }
24518 }
24519#endif
24520
Daniel Veillard3d97e662004-11-04 10:49:00 +000024521 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024523}
24524
24525
24526static int
24527test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024529
Daniel Veillardce682bc2004-11-05 17:22:25 +000024530#ifdef LIBXML_VALID_ENABLED
24531 int mem_base;
24532 int ret_val;
24533 xmlValidCtxtPtr ctxt; /* the validation context */
24534 int n_ctxt;
24535 xmlDocPtr doc; /* a document instance */
24536 int n_doc;
24537 xmlAttributePtr attr; /* an attribute definition */
24538 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024539
Daniel Veillardce682bc2004-11-05 17:22:25 +000024540 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24541 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24542 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
24543 mem_base = xmlMemBlocks();
24544 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24545 doc = gen_xmlDocPtr(n_doc, 1);
24546 attr = gen_xmlAttributePtr(n_attr, 2);
24547
24548 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
24549 desret_int(ret_val);
24550 call_tests++;
24551 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24552 des_xmlDocPtr(n_doc, doc, 1);
24553 des_xmlAttributePtr(n_attr, attr, 2);
24554 xmlResetLastError();
24555 if (mem_base != xmlMemBlocks()) {
24556 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
24557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024558 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024559 printf(" %d", n_ctxt);
24560 printf(" %d", n_doc);
24561 printf(" %d", n_attr);
24562 printf("\n");
24563 }
24564 }
24565 }
24566 }
24567#endif
24568
24569 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024570 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024571}
24572
24573
24574static int
24575test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024577
Daniel Veillard57b25162004-11-06 14:50:18 +000024578#ifdef LIBXML_VALID_ENABLED
24579 int mem_base;
24580 int ret_val;
24581 xmlAttributeType type; /* an attribute type */
24582 int n_type;
24583 xmlChar * value; /* an attribute value */
24584 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024585
Daniel Veillard57b25162004-11-06 14:50:18 +000024586 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
24587 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24588 mem_base = xmlMemBlocks();
24589 type = gen_xmlAttributeType(n_type, 0);
24590 value = gen_const_xmlChar_ptr(n_value, 1);
24591
24592 ret_val = xmlValidateAttributeValue(type, value);
24593 desret_int(ret_val);
24594 call_tests++;
24595 des_xmlAttributeType(n_type, type, 0);
24596 des_const_xmlChar_ptr(n_value, value, 1);
24597 xmlResetLastError();
24598 if (mem_base != xmlMemBlocks()) {
24599 printf("Leak of %d blocks found in xmlValidateAttributeValue",
24600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024601 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024602 printf(" %d", n_type);
24603 printf(" %d", n_value);
24604 printf("\n");
24605 }
24606 }
24607 }
24608#endif
24609
24610 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024612}
24613
24614
24615static int
24616test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024618
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024619#ifdef LIBXML_VALID_ENABLED
24620 int mem_base;
24621 int ret_val;
24622 xmlValidCtxtPtr ctxt; /* the validation context */
24623 int n_ctxt;
24624 xmlDocPtr doc; /* a document instance */
24625 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024626
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024627 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24628 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24629 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024630 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24631 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024632
24633 ret_val = xmlValidateDocument(ctxt, doc);
24634 desret_int(ret_val);
24635 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024636 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24637 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024638 xmlResetLastError();
24639 if (mem_base != xmlMemBlocks()) {
24640 printf("Leak of %d blocks found in xmlValidateDocument",
24641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024642 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024643 printf(" %d", n_ctxt);
24644 printf(" %d", n_doc);
24645 printf("\n");
24646 }
24647 }
24648 }
24649#endif
24650
Daniel Veillard3d97e662004-11-04 10:49:00 +000024651 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024653}
24654
24655
24656static int
24657test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024659
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024660#ifdef LIBXML_VALID_ENABLED
24661 int mem_base;
24662 int ret_val;
24663 xmlValidCtxtPtr ctxt; /* the validation context */
24664 int n_ctxt;
24665 xmlDocPtr doc; /* a document instance */
24666 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024667
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024668 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24669 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24670 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024671 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24672 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024673
24674 ret_val = xmlValidateDocumentFinal(ctxt, doc);
24675 desret_int(ret_val);
24676 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024677 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24678 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024679 xmlResetLastError();
24680 if (mem_base != xmlMemBlocks()) {
24681 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
24682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024683 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024684 printf(" %d", n_ctxt);
24685 printf(" %d", n_doc);
24686 printf("\n");
24687 }
24688 }
24689 }
24690#endif
24691
Daniel Veillard3d97e662004-11-04 10:49:00 +000024692 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024693 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024694}
24695
24696
24697static int
24698test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024699 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024700
Daniel Veillard27f20102004-11-05 11:50:11 +000024701#ifdef LIBXML_VALID_ENABLED
24702 int mem_base;
24703 int ret_val;
24704 xmlValidCtxtPtr ctxt; /* the validation context */
24705 int n_ctxt;
24706 xmlDocPtr doc; /* a document instance */
24707 int n_doc;
24708 xmlDtdPtr dtd; /* a dtd instance */
24709 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024710
Daniel Veillard27f20102004-11-05 11:50:11 +000024711 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24712 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24713 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24714 mem_base = xmlMemBlocks();
24715 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24716 doc = gen_xmlDocPtr(n_doc, 1);
24717 dtd = gen_xmlDtdPtr(n_dtd, 2);
24718
24719 ret_val = xmlValidateDtd(ctxt, doc, dtd);
24720 desret_int(ret_val);
24721 call_tests++;
24722 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24723 des_xmlDocPtr(n_doc, doc, 1);
24724 des_xmlDtdPtr(n_dtd, dtd, 2);
24725 xmlResetLastError();
24726 if (mem_base != xmlMemBlocks()) {
24727 printf("Leak of %d blocks found in xmlValidateDtd",
24728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024729 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000024730 printf(" %d", n_ctxt);
24731 printf(" %d", n_doc);
24732 printf(" %d", n_dtd);
24733 printf("\n");
24734 }
24735 }
24736 }
24737 }
24738#endif
24739
24740 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024741 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024742}
24743
24744
24745static int
24746test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024747 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024748
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024749#ifdef LIBXML_VALID_ENABLED
24750 int mem_base;
24751 int ret_val;
24752 xmlValidCtxtPtr ctxt; /* the validation context */
24753 int n_ctxt;
24754 xmlDocPtr doc; /* a document instance */
24755 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024756
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024757 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24758 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24759 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024760 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24761 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024762
24763 ret_val = xmlValidateDtdFinal(ctxt, doc);
24764 desret_int(ret_val);
24765 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024766 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24767 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024768 xmlResetLastError();
24769 if (mem_base != xmlMemBlocks()) {
24770 printf("Leak of %d blocks found in xmlValidateDtdFinal",
24771 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024772 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024773 printf(" %d", n_ctxt);
24774 printf(" %d", n_doc);
24775 printf("\n");
24776 }
24777 }
24778 }
24779#endif
24780
Daniel Veillard3d97e662004-11-04 10:49:00 +000024781 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024783}
24784
24785
24786static int
24787test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024789
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024790#ifdef LIBXML_VALID_ENABLED
24791 int mem_base;
24792 int ret_val;
24793 xmlValidCtxtPtr ctxt; /* the validation context */
24794 int n_ctxt;
24795 xmlDocPtr doc; /* a document instance */
24796 int n_doc;
24797 xmlNodePtr elem; /* an element instance */
24798 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024799
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024800 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24801 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24802 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24803 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024804 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24805 doc = gen_xmlDocPtr(n_doc, 1);
24806 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024807
24808 ret_val = xmlValidateElement(ctxt, doc, elem);
24809 desret_int(ret_val);
24810 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024811 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24812 des_xmlDocPtr(n_doc, doc, 1);
24813 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024814 xmlResetLastError();
24815 if (mem_base != xmlMemBlocks()) {
24816 printf("Leak of %d blocks found in xmlValidateElement",
24817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024818 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024819 printf(" %d", n_ctxt);
24820 printf(" %d", n_doc);
24821 printf(" %d", n_elem);
24822 printf("\n");
24823 }
24824 }
24825 }
24826 }
24827#endif
24828
Daniel Veillard3d97e662004-11-04 10:49:00 +000024829 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024831}
24832
24833
24834static int
24835test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024837
Daniel Veillardce682bc2004-11-05 17:22:25 +000024838#ifdef LIBXML_VALID_ENABLED
24839 int mem_base;
24840 int ret_val;
24841 xmlValidCtxtPtr ctxt; /* the validation context */
24842 int n_ctxt;
24843 xmlDocPtr doc; /* a document instance */
24844 int n_doc;
24845 xmlElementPtr elem; /* an element definition */
24846 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024847
Daniel Veillardce682bc2004-11-05 17:22:25 +000024848 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24849 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24850 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24851 mem_base = xmlMemBlocks();
24852 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24853 doc = gen_xmlDocPtr(n_doc, 1);
24854 elem = gen_xmlElementPtr(n_elem, 2);
24855
24856 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
24857 desret_int(ret_val);
24858 call_tests++;
24859 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24860 des_xmlDocPtr(n_doc, doc, 1);
24861 des_xmlElementPtr(n_elem, elem, 2);
24862 xmlResetLastError();
24863 if (mem_base != xmlMemBlocks()) {
24864 printf("Leak of %d blocks found in xmlValidateElementDecl",
24865 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024866 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024867 printf(" %d", n_ctxt);
24868 printf(" %d", n_doc);
24869 printf(" %d", n_elem);
24870 printf("\n");
24871 }
24872 }
24873 }
24874 }
24875#endif
24876
24877 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024879}
24880
24881
24882static int
24883test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024885
24886#ifdef LIBXML_VALID_ENABLED
24887 int mem_base;
24888 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024889 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024890 int n_value;
24891
24892 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24893 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024894 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024895
24896 ret_val = xmlValidateNameValue(value);
24897 desret_int(ret_val);
24898 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024899 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024900 xmlResetLastError();
24901 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024902 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024903 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024904 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024905 printf(" %d", n_value);
24906 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024907 }
24908 }
24909#endif
24910
Daniel Veillard3d97e662004-11-04 10:49:00 +000024911 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024913}
24914
24915
24916static int
24917test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024919
24920#ifdef LIBXML_VALID_ENABLED
24921 int mem_base;
24922 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024923 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024924 int n_value;
24925
24926 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24927 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024928 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024929
24930 ret_val = xmlValidateNamesValue(value);
24931 desret_int(ret_val);
24932 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024933 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024934 xmlResetLastError();
24935 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024936 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024938 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024939 printf(" %d", n_value);
24940 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024941 }
24942 }
24943#endif
24944
Daniel Veillard3d97e662004-11-04 10:49:00 +000024945 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024947}
24948
24949
24950static int
24951test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024952 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024953
24954#ifdef LIBXML_VALID_ENABLED
24955 int mem_base;
24956 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024957 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024958 int n_value;
24959
24960 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24961 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024962 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024963
24964 ret_val = xmlValidateNmtokenValue(value);
24965 desret_int(ret_val);
24966 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024967 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024968 xmlResetLastError();
24969 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024970 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024971 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024972 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024973 printf(" %d", n_value);
24974 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024975 }
24976 }
24977#endif
24978
Daniel Veillard3d97e662004-11-04 10:49:00 +000024979 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024981}
24982
24983
24984static int
24985test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024987
24988#ifdef LIBXML_VALID_ENABLED
24989 int mem_base;
24990 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024991 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024992 int n_value;
24993
24994 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24995 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024996 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024997
24998 ret_val = xmlValidateNmtokensValue(value);
24999 desret_int(ret_val);
25000 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025001 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025002 xmlResetLastError();
25003 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025004 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025005 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025006 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025007 printf(" %d", n_value);
25008 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025009 }
25010 }
25011#endif
25012
Daniel Veillard3d97e662004-11-04 10:49:00 +000025013 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025015}
25016
25017
25018static int
25019test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025021
Daniel Veillardce682bc2004-11-05 17:22:25 +000025022#ifdef LIBXML_VALID_ENABLED
25023 int mem_base;
25024 int ret_val;
25025 xmlValidCtxtPtr ctxt; /* the validation context */
25026 int n_ctxt;
25027 xmlDocPtr doc; /* a document instance */
25028 int n_doc;
25029 xmlNotationPtr nota; /* a notation definition */
25030 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025031
Daniel Veillardce682bc2004-11-05 17:22:25 +000025032 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25033 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25034 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25035 mem_base = xmlMemBlocks();
25036 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25037 doc = gen_xmlDocPtr(n_doc, 1);
25038 nota = gen_xmlNotationPtr(n_nota, 2);
25039
25040 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25041 desret_int(ret_val);
25042 call_tests++;
25043 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25044 des_xmlDocPtr(n_doc, doc, 1);
25045 des_xmlNotationPtr(n_nota, nota, 2);
25046 xmlResetLastError();
25047 if (mem_base != xmlMemBlocks()) {
25048 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25049 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025050 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025051 printf(" %d", n_ctxt);
25052 printf(" %d", n_doc);
25053 printf(" %d", n_nota);
25054 printf("\n");
25055 }
25056 }
25057 }
25058 }
25059#endif
25060
25061 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025063}
25064
25065
25066static int
25067test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025069
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025070#ifdef LIBXML_VALID_ENABLED
25071 int mem_base;
25072 int ret_val;
25073 xmlValidCtxtPtr ctxt; /* the validation context */
25074 int n_ctxt;
25075 xmlDocPtr doc; /* the document */
25076 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025077 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025078 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025079
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025080 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25081 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25082 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25083 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025084 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25085 doc = gen_xmlDocPtr(n_doc, 1);
25086 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025087
25088 ret_val = xmlValidateNotationUse(ctxt, doc, notationName);
25089 desret_int(ret_val);
25090 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025091 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25092 des_xmlDocPtr(n_doc, doc, 1);
25093 des_const_xmlChar_ptr(n_notationName, notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025094 xmlResetLastError();
25095 if (mem_base != xmlMemBlocks()) {
25096 printf("Leak of %d blocks found in xmlValidateNotationUse",
25097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025098 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025099 printf(" %d", n_ctxt);
25100 printf(" %d", n_doc);
25101 printf(" %d", n_notationName);
25102 printf("\n");
25103 }
25104 }
25105 }
25106 }
25107#endif
25108
Daniel Veillard3d97e662004-11-04 10:49:00 +000025109 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025111}
25112
25113
25114static int
25115test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025117
Daniel Veillardce244ad2004-11-05 10:03:46 +000025118#ifdef LIBXML_VALID_ENABLED
25119 int mem_base;
25120 int ret_val;
25121 xmlValidCtxtPtr ctxt; /* the validation context */
25122 int n_ctxt;
25123 xmlDocPtr doc; /* a document instance */
25124 int n_doc;
25125 xmlNodePtr elem; /* an element instance */
25126 int n_elem;
25127 xmlAttrPtr attr; /* an attribute instance */
25128 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025129 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025130 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025131
Daniel Veillardce244ad2004-11-05 10:03:46 +000025132 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25133 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25134 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25135 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25136 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25137 mem_base = xmlMemBlocks();
25138 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25139 doc = gen_xmlDocPtr(n_doc, 1);
25140 elem = gen_xmlNodePtr(n_elem, 2);
25141 attr = gen_xmlAttrPtr(n_attr, 3);
25142 value = gen_const_xmlChar_ptr(n_value, 4);
25143
25144 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
25145 desret_int(ret_val);
25146 call_tests++;
25147 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25148 des_xmlDocPtr(n_doc, doc, 1);
25149 des_xmlNodePtr(n_elem, elem, 2);
25150 des_xmlAttrPtr(n_attr, attr, 3);
25151 des_const_xmlChar_ptr(n_value, value, 4);
25152 xmlResetLastError();
25153 if (mem_base != xmlMemBlocks()) {
25154 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025156 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025157 printf(" %d", n_ctxt);
25158 printf(" %d", n_doc);
25159 printf(" %d", n_elem);
25160 printf(" %d", n_attr);
25161 printf(" %d", n_value);
25162 printf("\n");
25163 }
25164 }
25165 }
25166 }
25167 }
25168 }
25169#endif
25170
25171 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025173}
25174
25175
25176static int
25177test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025179
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025180#ifdef LIBXML_VALID_ENABLED
25181 int mem_base;
25182 int ret_val;
25183 xmlValidCtxtPtr ctxt; /* the validation context */
25184 int n_ctxt;
25185 xmlDocPtr doc; /* a document instance */
25186 int n_doc;
25187 xmlNodePtr elem; /* an element instance */
25188 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025189
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025190 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25191 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25192 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25193 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025194 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25195 doc = gen_xmlDocPtr(n_doc, 1);
25196 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025197
25198 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25199 desret_int(ret_val);
25200 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025201 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25202 des_xmlDocPtr(n_doc, doc, 1);
25203 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025204 xmlResetLastError();
25205 if (mem_base != xmlMemBlocks()) {
25206 printf("Leak of %d blocks found in xmlValidateOneElement",
25207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025208 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025209 printf(" %d", n_ctxt);
25210 printf(" %d", n_doc);
25211 printf(" %d", n_elem);
25212 printf("\n");
25213 }
25214 }
25215 }
25216 }
25217#endif
25218
Daniel Veillard3d97e662004-11-04 10:49:00 +000025219 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025221}
25222
25223
25224static int
25225test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025227
Daniel Veillard27f20102004-11-05 11:50:11 +000025228#ifdef LIBXML_VALID_ENABLED
25229 int mem_base;
25230 int ret_val;
25231 xmlValidCtxtPtr ctxt; /* the validation context */
25232 int n_ctxt;
25233 xmlDocPtr doc; /* a document instance */
25234 int n_doc;
25235 xmlNodePtr elem; /* an element instance */
25236 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025237 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025238 int n_prefix;
25239 xmlNsPtr ns; /* an namespace declaration instance */
25240 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025241 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025242 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025243
Daniel Veillard27f20102004-11-05 11:50:11 +000025244 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25245 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25246 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25247 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25248 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25249 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25250 mem_base = xmlMemBlocks();
25251 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25252 doc = gen_xmlDocPtr(n_doc, 1);
25253 elem = gen_xmlNodePtr(n_elem, 2);
25254 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25255 ns = gen_xmlNsPtr(n_ns, 4);
25256 value = gen_const_xmlChar_ptr(n_value, 5);
25257
25258 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, prefix, ns, value);
25259 desret_int(ret_val);
25260 call_tests++;
25261 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25262 des_xmlDocPtr(n_doc, doc, 1);
25263 des_xmlNodePtr(n_elem, elem, 2);
25264 des_const_xmlChar_ptr(n_prefix, prefix, 3);
25265 des_xmlNsPtr(n_ns, ns, 4);
25266 des_const_xmlChar_ptr(n_value, value, 5);
25267 xmlResetLastError();
25268 if (mem_base != xmlMemBlocks()) {
25269 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25270 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025271 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025272 printf(" %d", n_ctxt);
25273 printf(" %d", n_doc);
25274 printf(" %d", n_elem);
25275 printf(" %d", n_prefix);
25276 printf(" %d", n_ns);
25277 printf(" %d", n_value);
25278 printf("\n");
25279 }
25280 }
25281 }
25282 }
25283 }
25284 }
25285 }
25286#endif
25287
25288 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025290}
25291
25292
25293static int
25294test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025296
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025297#ifdef LIBXML_REGEXP_ENABLED
25298 int mem_base;
25299 int ret_val;
25300 xmlValidCtxtPtr ctxt; /* the validation context */
25301 int n_ctxt;
25302 xmlDocPtr doc; /* a document instance */
25303 int n_doc;
25304 xmlNodePtr elem; /* an element instance */
25305 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025306 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025307 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025308
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025309 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25310 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25311 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25312 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25313 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025314 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25315 doc = gen_xmlDocPtr(n_doc, 1);
25316 elem = gen_xmlNodePtr(n_elem, 2);
25317 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025318
25319 ret_val = xmlValidatePopElement(ctxt, doc, elem, qname);
25320 desret_int(ret_val);
25321 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025322 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25323 des_xmlDocPtr(n_doc, doc, 1);
25324 des_xmlNodePtr(n_elem, elem, 2);
25325 des_const_xmlChar_ptr(n_qname, qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025326 xmlResetLastError();
25327 if (mem_base != xmlMemBlocks()) {
25328 printf("Leak of %d blocks found in xmlValidatePopElement",
25329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025330 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025331 printf(" %d", n_ctxt);
25332 printf(" %d", n_doc);
25333 printf(" %d", n_elem);
25334 printf(" %d", n_qname);
25335 printf("\n");
25336 }
25337 }
25338 }
25339 }
25340 }
25341#endif
25342
Daniel Veillard3d97e662004-11-04 10:49:00 +000025343 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025344 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025345}
25346
25347
25348static int
25349test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025350 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025351
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025352#ifdef LIBXML_REGEXP_ENABLED
25353 int mem_base;
25354 int ret_val;
25355 xmlValidCtxtPtr ctxt; /* the validation context */
25356 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025357 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025358 int n_data;
25359 int len; /* the lenght of the data */
25360 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025361
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025362 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25363 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25364 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25365 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025366 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25367 data = gen_const_xmlChar_ptr(n_data, 1);
25368 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025369
25370 ret_val = xmlValidatePushCData(ctxt, data, len);
25371 desret_int(ret_val);
25372 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025373 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25374 des_const_xmlChar_ptr(n_data, data, 1);
25375 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025376 xmlResetLastError();
25377 if (mem_base != xmlMemBlocks()) {
25378 printf("Leak of %d blocks found in xmlValidatePushCData",
25379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025380 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025381 printf(" %d", n_ctxt);
25382 printf(" %d", n_data);
25383 printf(" %d", n_len);
25384 printf("\n");
25385 }
25386 }
25387 }
25388 }
25389#endif
25390
Daniel Veillard3d97e662004-11-04 10:49:00 +000025391 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025393}
25394
25395
25396static int
25397test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025399
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025400#ifdef LIBXML_REGEXP_ENABLED
25401 int mem_base;
25402 int ret_val;
25403 xmlValidCtxtPtr ctxt; /* the validation context */
25404 int n_ctxt;
25405 xmlDocPtr doc; /* a document instance */
25406 int n_doc;
25407 xmlNodePtr elem; /* an element instance */
25408 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025409 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025410 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025411
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025412 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25413 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25414 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25415 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25416 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025417 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25418 doc = gen_xmlDocPtr(n_doc, 1);
25419 elem = gen_xmlNodePtr(n_elem, 2);
25420 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025421
25422 ret_val = xmlValidatePushElement(ctxt, doc, elem, qname);
25423 desret_int(ret_val);
25424 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025425 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25426 des_xmlDocPtr(n_doc, doc, 1);
25427 des_xmlNodePtr(n_elem, elem, 2);
25428 des_const_xmlChar_ptr(n_qname, qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025429 xmlResetLastError();
25430 if (mem_base != xmlMemBlocks()) {
25431 printf("Leak of %d blocks found in xmlValidatePushElement",
25432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025433 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025434 printf(" %d", n_ctxt);
25435 printf(" %d", n_doc);
25436 printf(" %d", n_elem);
25437 printf(" %d", n_qname);
25438 printf("\n");
25439 }
25440 }
25441 }
25442 }
25443 }
25444#endif
25445
Daniel Veillard3d97e662004-11-04 10:49:00 +000025446 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025448}
25449
25450
25451static int
25452test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025454
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025455#ifdef LIBXML_VALID_ENABLED
25456 int mem_base;
25457 int ret_val;
25458 xmlValidCtxtPtr ctxt; /* the validation context */
25459 int n_ctxt;
25460 xmlDocPtr doc; /* a document instance */
25461 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025462
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025463 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25464 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25465 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025466 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25467 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025468
25469 ret_val = xmlValidateRoot(ctxt, doc);
25470 desret_int(ret_val);
25471 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025472 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25473 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025474 xmlResetLastError();
25475 if (mem_base != xmlMemBlocks()) {
25476 printf("Leak of %d blocks found in xmlValidateRoot",
25477 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025478 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025479 printf(" %d", n_ctxt);
25480 printf(" %d", n_doc);
25481 printf("\n");
25482 }
25483 }
25484 }
25485#endif
25486
Daniel Veillard3d97e662004-11-04 10:49:00 +000025487 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025489}
25490
25491static int
25492test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025494
Daniel Veillard42595322004-11-08 10:52:06 +000025495 printf("Testing valid : 46 of 67 functions ...\n");
25496 test_ret += test_xmlAddAttributeDecl();
25497 test_ret += test_xmlAddElementDecl();
25498 test_ret += test_xmlAddID();
25499 test_ret += test_xmlAddNotationDecl();
25500 test_ret += test_xmlAddRef();
25501 test_ret += test_xmlCopyAttributeTable();
25502 test_ret += test_xmlCopyElementContent();
25503 test_ret += test_xmlCopyElementTable();
25504 test_ret += test_xmlCopyEnumeration();
25505 test_ret += test_xmlCopyNotationTable();
25506 test_ret += test_xmlCreateEnumeration();
25507 test_ret += test_xmlDumpAttributeDecl();
25508 test_ret += test_xmlDumpAttributeTable();
25509 test_ret += test_xmlDumpElementDecl();
25510 test_ret += test_xmlDumpElementTable();
25511 test_ret += test_xmlDumpNotationDecl();
25512 test_ret += test_xmlDumpNotationTable();
25513 test_ret += test_xmlGetDtdAttrDesc();
25514 test_ret += test_xmlGetDtdElementDesc();
25515 test_ret += test_xmlGetDtdNotationDesc();
25516 test_ret += test_xmlGetDtdQAttrDesc();
25517 test_ret += test_xmlGetDtdQElementDesc();
25518 test_ret += test_xmlGetID();
25519 test_ret += test_xmlGetRefs();
25520 test_ret += test_xmlIsID();
25521 test_ret += test_xmlIsMixedElement();
25522 test_ret += test_xmlIsRef();
25523 test_ret += test_xmlNewElementContent();
25524 test_ret += test_xmlNewValidCtxt();
25525 test_ret += test_xmlRemoveID();
25526 test_ret += test_xmlRemoveRef();
25527 test_ret += test_xmlSnprintfElementContent();
25528 test_ret += test_xmlSprintfElementContent();
25529 test_ret += test_xmlValidBuildContentModel();
25530 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
25531 test_ret += test_xmlValidGetPotentialChildren();
25532 test_ret += test_xmlValidGetValidElements();
25533 test_ret += test_xmlValidNormalizeAttributeValue();
25534 test_ret += test_xmlValidateAttributeDecl();
25535 test_ret += test_xmlValidateAttributeValue();
25536 test_ret += test_xmlValidateDocument();
25537 test_ret += test_xmlValidateDocumentFinal();
25538 test_ret += test_xmlValidateDtd();
25539 test_ret += test_xmlValidateDtdFinal();
25540 test_ret += test_xmlValidateElement();
25541 test_ret += test_xmlValidateElementDecl();
25542 test_ret += test_xmlValidateNameValue();
25543 test_ret += test_xmlValidateNamesValue();
25544 test_ret += test_xmlValidateNmtokenValue();
25545 test_ret += test_xmlValidateNmtokensValue();
25546 test_ret += test_xmlValidateNotationDecl();
25547 test_ret += test_xmlValidateNotationUse();
25548 test_ret += test_xmlValidateOneAttribute();
25549 test_ret += test_xmlValidateOneElement();
25550 test_ret += test_xmlValidateOneNamespace();
25551 test_ret += test_xmlValidatePopElement();
25552 test_ret += test_xmlValidatePushCData();
25553 test_ret += test_xmlValidatePushElement();
25554 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000025555
Daniel Veillard42595322004-11-08 10:52:06 +000025556 if (test_ret != 0)
25557 printf("Module valid: %d errors\n", test_ret);
25558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025559}
25560
25561static int
25562test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025563 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025564
25565
25566 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000025567 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025568}
25569
25570
25571static int
25572test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025573 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025574
25575#ifdef LIBXML_XINCLUDE_ENABLED
25576 int mem_base;
25577 int ret_val;
25578 xmlDocPtr doc; /* an XML document */
25579 int n_doc;
25580
25581 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25582 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025583 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025584
25585 ret_val = xmlXIncludeProcess(doc);
25586 desret_int(ret_val);
25587 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025588 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025589 xmlResetLastError();
25590 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025591 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025593 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025594 printf(" %d", n_doc);
25595 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025596 }
25597 }
25598#endif
25599
Daniel Veillard3d97e662004-11-04 10:49:00 +000025600 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025602}
25603
25604
25605static int
25606test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025607 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025608
25609#ifdef LIBXML_XINCLUDE_ENABLED
25610 int mem_base;
25611 int ret_val;
25612 xmlDocPtr doc; /* an XML document */
25613 int n_doc;
25614 int flags; /* a set of xmlParserOption used for parsing XML includes */
25615 int n_flags;
25616
25617 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25618 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
25619 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025620 doc = gen_xmlDocPtr(n_doc, 0);
25621 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025622
25623 ret_val = xmlXIncludeProcessFlags(doc, flags);
25624 desret_int(ret_val);
25625 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025626 des_xmlDocPtr(n_doc, doc, 0);
25627 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025628 xmlResetLastError();
25629 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025630 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025632 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025633 printf(" %d", n_doc);
25634 printf(" %d", n_flags);
25635 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025636 }
25637 }
25638 }
25639#endif
25640
Daniel Veillard3d97e662004-11-04 10:49:00 +000025641 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025643}
25644
25645
Daniel Veillardce682bc2004-11-05 17:22:25 +000025646#define gen_nb_xmlXIncludeCtxtPtr 1
25647static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
25648 return(NULL);
25649}
25650static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
25651}
25652
Daniel Veillardd93f6252004-11-02 15:53:51 +000025653static int
25654test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025655 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025656
Daniel Veillardce682bc2004-11-05 17:22:25 +000025657#ifdef LIBXML_XINCLUDE_ENABLED
25658 int mem_base;
25659 int ret_val;
25660 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
25661 int n_ctxt;
25662 xmlNodePtr node; /* a node in an XML document */
25663 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025664
Daniel Veillardce682bc2004-11-05 17:22:25 +000025665 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
25666 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
25667 mem_base = xmlMemBlocks();
25668 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
25669 node = gen_xmlNodePtr(n_node, 1);
25670
25671 ret_val = xmlXIncludeProcessNode(ctxt, node);
25672 desret_int(ret_val);
25673 call_tests++;
25674 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
25675 des_xmlNodePtr(n_node, node, 1);
25676 xmlResetLastError();
25677 if (mem_base != xmlMemBlocks()) {
25678 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
25679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025680 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025681 printf(" %d", n_ctxt);
25682 printf(" %d", n_node);
25683 printf("\n");
25684 }
25685 }
25686 }
25687#endif
25688
25689 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025690 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025691}
25692
25693
25694static int
25695test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025696 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025697
25698#ifdef LIBXML_XINCLUDE_ENABLED
25699 int mem_base;
25700 int ret_val;
25701 xmlNodePtr tree; /* a node in an XML document */
25702 int n_tree;
25703
25704 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
25705 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025706 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025707
25708 ret_val = xmlXIncludeProcessTree(tree);
25709 desret_int(ret_val);
25710 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025711 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025712 xmlResetLastError();
25713 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025714 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025715 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025716 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025717 printf(" %d", n_tree);
25718 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025719 }
25720 }
25721#endif
25722
Daniel Veillard3d97e662004-11-04 10:49:00 +000025723 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025724 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025725}
25726
25727
25728static int
25729test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025730 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025731
25732#ifdef LIBXML_XINCLUDE_ENABLED
25733 int mem_base;
25734 int ret_val;
25735 xmlNodePtr tree; /* a node in an XML document */
25736 int n_tree;
25737 int flags; /* a set of xmlParserOption used for parsing XML includes */
25738 int n_flags;
25739
25740 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
25741 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
25742 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025743 tree = gen_xmlNodePtr(n_tree, 0);
25744 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025745
25746 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
25747 desret_int(ret_val);
25748 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025749 des_xmlNodePtr(n_tree, tree, 0);
25750 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025751 xmlResetLastError();
25752 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025753 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025754 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025755 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025756 printf(" %d", n_tree);
25757 printf(" %d", n_flags);
25758 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025759 }
25760 }
25761 }
25762#endif
25763
Daniel Veillard3d97e662004-11-04 10:49:00 +000025764 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025766}
25767
25768
25769static int
25770test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025772
Daniel Veillardce682bc2004-11-05 17:22:25 +000025773#ifdef LIBXML_XINCLUDE_ENABLED
25774 int mem_base;
25775 int ret_val;
25776 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
25777 int n_ctxt;
25778 int flags; /* a set of xmlParserOption used for parsing XML includes */
25779 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025780
Daniel Veillardce682bc2004-11-05 17:22:25 +000025781 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
25782 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
25783 mem_base = xmlMemBlocks();
25784 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
25785 flags = gen_int(n_flags, 1);
25786
25787 ret_val = xmlXIncludeSetFlags(ctxt, flags);
25788 desret_int(ret_val);
25789 call_tests++;
25790 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
25791 des_int(n_flags, flags, 1);
25792 xmlResetLastError();
25793 if (mem_base != xmlMemBlocks()) {
25794 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
25795 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025796 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025797 printf(" %d", n_ctxt);
25798 printf(" %d", n_flags);
25799 printf("\n");
25800 }
25801 }
25802 }
25803#endif
25804
25805 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025806 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025807}
25808
25809static int
25810test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025811 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025812
Daniel Veillardce682bc2004-11-05 17:22:25 +000025813 printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000025814 test_ret += test_xmlXIncludeNewContext();
25815 test_ret += test_xmlXIncludeProcess();
25816 test_ret += test_xmlXIncludeProcessFlags();
25817 test_ret += test_xmlXIncludeProcessNode();
25818 test_ret += test_xmlXIncludeProcessTree();
25819 test_ret += test_xmlXIncludeProcessTreeFlags();
25820 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000025821
Daniel Veillard42595322004-11-08 10:52:06 +000025822 if (test_ret != 0)
25823 printf("Module xinclude: %d errors\n", test_ret);
25824 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025825}
25826
25827static int
25828test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025830
Daniel Veillard3d95c732004-11-06 22:25:14 +000025831#ifdef LIBXML_OUTPUT_ENABLED
25832 int mem_base;
25833 xmlOutputBufferPtr ret_val;
25834 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
25835 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025836
Daniel Veillard3d95c732004-11-06 22:25:14 +000025837 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
25838 mem_base = xmlMemBlocks();
25839 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
25840
25841 ret_val = xmlAllocOutputBuffer(encoder);
25842 desret_xmlOutputBufferPtr(ret_val);
25843 call_tests++;
25844 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
25845 xmlResetLastError();
25846 if (mem_base != xmlMemBlocks()) {
25847 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
25848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025849 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000025850 printf(" %d", n_encoder);
25851 printf("\n");
25852 }
25853 }
25854#endif
25855
25856 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025858}
25859
25860
25861static int
25862test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025864
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025865 int mem_base;
25866 xmlParserInputBufferPtr ret_val;
25867 xmlCharEncoding enc; /* the charset encoding if known */
25868 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025869
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025870 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
25871 mem_base = xmlMemBlocks();
25872 enc = gen_xmlCharEncoding(n_enc, 0);
25873
25874 ret_val = xmlAllocParserInputBuffer(enc);
25875 desret_xmlParserInputBufferPtr(ret_val);
25876 call_tests++;
25877 des_xmlCharEncoding(n_enc, enc, 0);
25878 xmlResetLastError();
25879 if (mem_base != xmlMemBlocks()) {
25880 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
25881 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025882 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025883 printf(" %d", n_enc);
25884 printf("\n");
25885 }
25886 }
25887
25888 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025889 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025890}
25891
25892
25893static int
25894test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025895 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025896
25897 int mem_base;
25898 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025899 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025900 int n_path;
25901
25902 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
25903 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025904 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025905
25906 ret_val = xmlCheckFilename(path);
25907 desret_int(ret_val);
25908 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025909 des_const_char_ptr(n_path, path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025910 xmlResetLastError();
25911 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025912 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025913 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025914 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025915 printf(" %d", n_path);
25916 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025917 }
25918 }
25919
Daniel Veillard3d97e662004-11-04 10:49:00 +000025920 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025921 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025922}
25923
25924
25925static int
25926test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025927 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025928
Daniel Veillard42595322004-11-08 10:52:06 +000025929 int mem_base;
25930 xmlParserInputPtr ret_val;
25931 xmlParserCtxtPtr ctxt; /* an XML parser context */
25932 int n_ctxt;
25933 xmlParserInputPtr ret; /* an XML parser input */
25934 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025935
Daniel Veillard42595322004-11-08 10:52:06 +000025936 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
25937 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
25938 mem_base = xmlMemBlocks();
25939 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
25940 ret = gen_xmlParserInputPtr(n_ret, 1);
25941
25942 ret_val = xmlCheckHTTPInput(ctxt, ret);
25943 desret_xmlParserInputPtr(ret_val);
25944 call_tests++;
25945 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
25946 des_xmlParserInputPtr(n_ret, ret, 1);
25947 xmlResetLastError();
25948 if (mem_base != xmlMemBlocks()) {
25949 printf("Leak of %d blocks found in xmlCheckHTTPInput",
25950 xmlMemBlocks() - mem_base);
25951 test_ret++;
25952 printf(" %d", n_ctxt);
25953 printf(" %d", n_ret);
25954 printf("\n");
25955 }
25956 }
25957 }
25958
25959 function_tests++;
25960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025961}
25962
25963
25964static int
25965test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025967
25968 int mem_base;
25969
25970 mem_base = xmlMemBlocks();
25971
25972 xmlCleanupInputCallbacks();
25973 call_tests++;
25974 xmlResetLastError();
25975 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025976 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025977 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025978 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025979 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025980 }
25981
Daniel Veillard3d97e662004-11-04 10:49:00 +000025982 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025983 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025984}
25985
25986
25987static int
25988test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025989 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025990
25991#ifdef LIBXML_OUTPUT_ENABLED
25992 int mem_base;
25993
25994 mem_base = xmlMemBlocks();
25995
25996 xmlCleanupOutputCallbacks();
25997 call_tests++;
25998 xmlResetLastError();
25999 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026000 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026001 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026002 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026003 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026004 }
26005#endif
26006
Daniel Veillard3d97e662004-11-04 10:49:00 +000026007 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026008 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026009}
26010
26011
26012static int
26013test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026015
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026016 int mem_base;
26017 int ret_val;
26018 void * context; /* the I/O context */
26019 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026020
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026021 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26022 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026023 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026024
26025 ret_val = xmlFileClose(context);
26026 desret_int(ret_val);
26027 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026028 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026029 xmlResetLastError();
26030 if (mem_base != xmlMemBlocks()) {
26031 printf("Leak of %d blocks found in xmlFileClose",
26032 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026033 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026034 printf(" %d", n_context);
26035 printf("\n");
26036 }
26037 }
26038
Daniel Veillard3d97e662004-11-04 10:49:00 +000026039 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026041}
26042
26043
26044static int
26045test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026047
26048 int mem_base;
26049 int ret_val;
26050 const char * filename; /* the URI for matching */
26051 int n_filename;
26052
26053 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26054 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026055 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026056
26057 ret_val = xmlFileMatch(filename);
26058 desret_int(ret_val);
26059 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026060 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026061 xmlResetLastError();
26062 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026063 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026064 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026065 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026066 printf(" %d", n_filename);
26067 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026068 }
26069 }
26070
Daniel Veillard3d97e662004-11-04 10:49:00 +000026071 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026073}
26074
26075
26076static int
26077test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026078 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026079
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026080 int mem_base;
26081 void * ret_val;
26082 const char * filename; /* the URI for matching */
26083 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026084
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026085 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26086 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026087 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026088
26089 ret_val = xmlFileOpen(filename);
26090 desret_void_ptr(ret_val);
26091 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026092 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026093 xmlResetLastError();
26094 if (mem_base != xmlMemBlocks()) {
26095 printf("Leak of %d blocks found in xmlFileOpen",
26096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026097 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026098 printf(" %d", n_filename);
26099 printf("\n");
26100 }
26101 }
26102
Daniel Veillard3d97e662004-11-04 10:49:00 +000026103 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026105}
26106
26107
26108static int
26109test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026111
Daniel Veillardce682bc2004-11-05 17:22:25 +000026112 int mem_base;
26113 int ret_val;
26114 void * context; /* the I/O context */
26115 int n_context;
26116 char * buffer; /* where to drop data */
26117 int n_buffer;
26118 int len; /* number of bytes to write */
26119 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026120
Daniel Veillardce682bc2004-11-05 17:22:25 +000026121 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26122 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26123 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26124 mem_base = xmlMemBlocks();
26125 context = gen_void_ptr(n_context, 0);
26126 buffer = gen_char_ptr(n_buffer, 1);
26127 len = gen_int(n_len, 2);
26128
26129 ret_val = xmlFileRead(context, buffer, len);
26130 desret_int(ret_val);
26131 call_tests++;
26132 des_void_ptr(n_context, context, 0);
26133 des_char_ptr(n_buffer, buffer, 1);
26134 des_int(n_len, len, 2);
26135 xmlResetLastError();
26136 if (mem_base != xmlMemBlocks()) {
26137 printf("Leak of %d blocks found in xmlFileRead",
26138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026139 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026140 printf(" %d", n_context);
26141 printf(" %d", n_buffer);
26142 printf(" %d", n_len);
26143 printf("\n");
26144 }
26145 }
26146 }
26147 }
26148
26149 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026151}
26152
26153
26154static int
26155test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026157
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026158#ifdef LIBXML_FTP_ENABLED
26159 int mem_base;
26160 int ret_val;
26161 void * context; /* the I/O context */
26162 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026163
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026164 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26165 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026166 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026167
26168 ret_val = xmlIOFTPClose(context);
26169 desret_int(ret_val);
26170 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026171 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026172 xmlResetLastError();
26173 if (mem_base != xmlMemBlocks()) {
26174 printf("Leak of %d blocks found in xmlIOFTPClose",
26175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026176 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026177 printf(" %d", n_context);
26178 printf("\n");
26179 }
26180 }
26181#endif
26182
Daniel Veillard3d97e662004-11-04 10:49:00 +000026183 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026185}
26186
26187
26188static int
26189test_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026191
26192#ifdef LIBXML_FTP_ENABLED
26193 int mem_base;
26194 int ret_val;
26195 const char * filename; /* the URI for matching */
26196 int n_filename;
26197
26198 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26199 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026200 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026201
26202 ret_val = xmlIOFTPMatch(filename);
26203 desret_int(ret_val);
26204 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026205 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026206 xmlResetLastError();
26207 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026208 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026209 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026210 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026211 printf(" %d", n_filename);
26212 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026213 }
26214 }
26215#endif
26216
Daniel Veillard3d97e662004-11-04 10:49:00 +000026217 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026219}
26220
26221
26222static int
26223test_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026225
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026226#ifdef LIBXML_FTP_ENABLED
26227 int mem_base;
26228 void * ret_val;
26229 const char * filename; /* the URI for matching */
26230 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026231
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026232 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26233 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026234 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026235
26236 ret_val = xmlIOFTPOpen(filename);
26237 desret_void_ptr(ret_val);
26238 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026239 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026240 xmlResetLastError();
26241 if (mem_base != xmlMemBlocks()) {
26242 printf("Leak of %d blocks found in xmlIOFTPOpen",
26243 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026244 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026245 printf(" %d", n_filename);
26246 printf("\n");
26247 }
26248 }
26249#endif
26250
Daniel Veillard3d97e662004-11-04 10:49:00 +000026251 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026253}
26254
26255
26256static int
26257test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026259
Daniel Veillardce682bc2004-11-05 17:22:25 +000026260#ifdef LIBXML_FTP_ENABLED
26261 int mem_base;
26262 int ret_val;
26263 void * context; /* the I/O context */
26264 int n_context;
26265 char * buffer; /* where to drop data */
26266 int n_buffer;
26267 int len; /* number of bytes to write */
26268 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026269
Daniel Veillardce682bc2004-11-05 17:22:25 +000026270 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26271 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26272 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26273 mem_base = xmlMemBlocks();
26274 context = gen_void_ptr(n_context, 0);
26275 buffer = gen_char_ptr(n_buffer, 1);
26276 len = gen_int(n_len, 2);
26277
26278 ret_val = xmlIOFTPRead(context, buffer, len);
26279 desret_int(ret_val);
26280 call_tests++;
26281 des_void_ptr(n_context, context, 0);
26282 des_char_ptr(n_buffer, buffer, 1);
26283 des_int(n_len, len, 2);
26284 xmlResetLastError();
26285 if (mem_base != xmlMemBlocks()) {
26286 printf("Leak of %d blocks found in xmlIOFTPRead",
26287 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026288 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026289 printf(" %d", n_context);
26290 printf(" %d", n_buffer);
26291 printf(" %d", n_len);
26292 printf("\n");
26293 }
26294 }
26295 }
26296 }
26297#endif
26298
26299 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026300 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026301}
26302
26303
26304static int
26305test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026307
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026308#ifdef LIBXML_HTTP_ENABLED
26309 int mem_base;
26310 int ret_val;
26311 void * context; /* the I/O context */
26312 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026313
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026314 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26315 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026316 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026317
26318 ret_val = xmlIOHTTPClose(context);
26319 desret_int(ret_val);
26320 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026321 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026322 xmlResetLastError();
26323 if (mem_base != xmlMemBlocks()) {
26324 printf("Leak of %d blocks found in xmlIOHTTPClose",
26325 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026326 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026327 printf(" %d", n_context);
26328 printf("\n");
26329 }
26330 }
26331#endif
26332
Daniel Veillard3d97e662004-11-04 10:49:00 +000026333 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026335}
26336
26337
26338static int
26339test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026341
26342#ifdef LIBXML_HTTP_ENABLED
26343 int mem_base;
26344 int ret_val;
26345 const char * filename; /* the URI for matching */
26346 int n_filename;
26347
26348 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26349 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026350 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026351
26352 ret_val = xmlIOHTTPMatch(filename);
26353 desret_int(ret_val);
26354 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026355 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026356 xmlResetLastError();
26357 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026358 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026360 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026361 printf(" %d", n_filename);
26362 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026363 }
26364 }
26365#endif
26366
Daniel Veillard3d97e662004-11-04 10:49:00 +000026367 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026368 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026369}
26370
26371
26372static int
26373test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026374 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026375
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026376#ifdef LIBXML_HTTP_ENABLED
26377 int mem_base;
26378 void * ret_val;
26379 const char * filename; /* the URI for matching */
26380 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026381
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026382 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26383 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026384 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026385
26386 ret_val = xmlIOHTTPOpen(filename);
26387 desret_void_ptr(ret_val);
26388 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026389 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026390 xmlResetLastError();
26391 if (mem_base != xmlMemBlocks()) {
26392 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026394 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026395 printf(" %d", n_filename);
26396 printf("\n");
26397 }
26398 }
26399#endif
26400
Daniel Veillard3d97e662004-11-04 10:49:00 +000026401 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026402 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026403}
26404
26405
26406static int
26407test_xmlIOHTTPOpenW(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026408 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026409
26410
26411 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026413}
26414
26415
26416static int
26417test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026419
Daniel Veillardce682bc2004-11-05 17:22:25 +000026420#ifdef LIBXML_HTTP_ENABLED
26421 int mem_base;
26422 int ret_val;
26423 void * context; /* the I/O context */
26424 int n_context;
26425 char * buffer; /* where to drop data */
26426 int n_buffer;
26427 int len; /* number of bytes to write */
26428 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026429
Daniel Veillardce682bc2004-11-05 17:22:25 +000026430 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26431 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26432 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26433 mem_base = xmlMemBlocks();
26434 context = gen_void_ptr(n_context, 0);
26435 buffer = gen_char_ptr(n_buffer, 1);
26436 len = gen_int(n_len, 2);
26437
26438 ret_val = xmlIOHTTPRead(context, buffer, len);
26439 desret_int(ret_val);
26440 call_tests++;
26441 des_void_ptr(n_context, context, 0);
26442 des_char_ptr(n_buffer, buffer, 1);
26443 des_int(n_len, len, 2);
26444 xmlResetLastError();
26445 if (mem_base != xmlMemBlocks()) {
26446 printf("Leak of %d blocks found in xmlIOHTTPRead",
26447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026448 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026449 printf(" %d", n_context);
26450 printf(" %d", n_buffer);
26451 printf(" %d", n_len);
26452 printf("\n");
26453 }
26454 }
26455 }
26456 }
26457#endif
26458
26459 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026460 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026461}
26462
26463
26464static int
26465test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026467
Daniel Veillard42595322004-11-08 10:52:06 +000026468 int mem_base;
26469 xmlParserInputPtr ret_val;
26470 const char * URL; /* the URL for the entity to load */
26471 int n_URL;
26472 char * ID; /* the System ID for the entity to load */
26473 int n_ID;
26474 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
26475 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026476
Daniel Veillard42595322004-11-08 10:52:06 +000026477 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
26478 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
26479 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26480 mem_base = xmlMemBlocks();
26481 URL = gen_filepath(n_URL, 0);
26482 ID = gen_const_char_ptr(n_ID, 1);
26483 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
26484
26485 ret_val = xmlNoNetExternalEntityLoader(URL, ID, ctxt);
26486 desret_xmlParserInputPtr(ret_val);
26487 call_tests++;
26488 des_filepath(n_URL, URL, 0);
26489 des_const_char_ptr(n_ID, ID, 1);
26490 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
26491 xmlResetLastError();
26492 if (mem_base != xmlMemBlocks()) {
26493 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
26494 xmlMemBlocks() - mem_base);
26495 test_ret++;
26496 printf(" %d", n_URL);
26497 printf(" %d", n_ID);
26498 printf(" %d", n_ctxt);
26499 printf("\n");
26500 }
26501 }
26502 }
26503 }
26504
26505 function_tests++;
26506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026507}
26508
26509
26510static int
26511test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026513
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026514 int mem_base;
26515 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026516 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026517 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026518
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026519 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
26520 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026521 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026522
26523 ret_val = xmlNormalizeWindowsPath(path);
26524 desret_xmlChar_ptr(ret_val);
26525 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026526 des_const_xmlChar_ptr(n_path, path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026527 xmlResetLastError();
26528 if (mem_base != xmlMemBlocks()) {
26529 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
26530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026531 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026532 printf(" %d", n_path);
26533 printf("\n");
26534 }
26535 }
26536
Daniel Veillard3d97e662004-11-04 10:49:00 +000026537 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026539}
26540
26541
26542static int
26543test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026545
Daniel Veillard3d95c732004-11-06 22:25:14 +000026546#ifdef LIBXML_OUTPUT_ENABLED
26547 int mem_base;
26548 xmlOutputBufferPtr ret_val;
26549 int fd; /* a file descriptor number */
26550 int n_fd;
26551 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26552 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026553
Daniel Veillard3d95c732004-11-06 22:25:14 +000026554 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
26555 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26556 mem_base = xmlMemBlocks();
26557 fd = gen_int(n_fd, 0);
26558 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26559
26560 ret_val = xmlOutputBufferCreateFd(fd, encoder);
26561 desret_xmlOutputBufferPtr(ret_val);
26562 call_tests++;
26563 des_int(n_fd, fd, 0);
26564 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26565 xmlResetLastError();
26566 if (mem_base != xmlMemBlocks()) {
26567 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
26568 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026569 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026570 printf(" %d", n_fd);
26571 printf(" %d", n_encoder);
26572 printf("\n");
26573 }
26574 }
26575 }
26576#endif
26577
26578 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026579 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026580}
26581
26582
26583static int
26584test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026585 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026586
Daniel Veillard3d95c732004-11-06 22:25:14 +000026587#ifdef LIBXML_OUTPUT_ENABLED
26588 int mem_base;
26589 xmlOutputBufferPtr ret_val;
26590 FILE * file; /* a FILE* */
26591 int n_file;
26592 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26593 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026594
Daniel Veillard3d95c732004-11-06 22:25:14 +000026595 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
26596 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26597 mem_base = xmlMemBlocks();
26598 file = gen_FILE_ptr(n_file, 0);
26599 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26600
26601 ret_val = xmlOutputBufferCreateFile(file, encoder);
26602 desret_xmlOutputBufferPtr(ret_val);
26603 call_tests++;
26604 des_FILE_ptr(n_file, file, 0);
26605 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26606 xmlResetLastError();
26607 if (mem_base != xmlMemBlocks()) {
26608 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
26609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026610 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026611 printf(" %d", n_file);
26612 printf(" %d", n_encoder);
26613 printf("\n");
26614 }
26615 }
26616 }
26617#endif
26618
26619 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026620 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026621}
26622
26623
26624static int
26625test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026626 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026627
Daniel Veillard3d95c732004-11-06 22:25:14 +000026628#ifdef LIBXML_OUTPUT_ENABLED
26629 int mem_base;
26630 xmlOutputBufferPtr ret_val;
26631 const char * URI; /* a C string containing the URI or filename */
26632 int n_URI;
26633 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26634 int n_encoder;
26635 int compression; /* the compression ration (0 none, 9 max). */
26636 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026637
Daniel Veillard42595322004-11-08 10:52:06 +000026638 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000026639 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26640 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
26641 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000026642 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000026643 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26644 compression = gen_int(n_compression, 2);
26645
26646 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
26647 desret_xmlOutputBufferPtr(ret_val);
26648 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026649 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000026650 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26651 des_int(n_compression, compression, 2);
26652 xmlResetLastError();
26653 if (mem_base != xmlMemBlocks()) {
26654 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
26655 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026656 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026657 printf(" %d", n_URI);
26658 printf(" %d", n_encoder);
26659 printf(" %d", n_compression);
26660 printf("\n");
26661 }
26662 }
26663 }
26664 }
26665#endif
26666
26667 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026668 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026669}
26670
26671
26672static int
26673test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026674 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026675
Daniel Veillard3d97e662004-11-04 10:49:00 +000026676#ifdef LIBXML_OUTPUT_ENABLED
26677 int mem_base;
26678 int ret_val;
26679 xmlOutputBufferPtr out; /* a buffered output */
26680 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026681
Daniel Veillard3d97e662004-11-04 10:49:00 +000026682 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
26683 mem_base = xmlMemBlocks();
26684 out = gen_xmlOutputBufferPtr(n_out, 0);
26685
26686 ret_val = xmlOutputBufferFlush(out);
26687 desret_int(ret_val);
26688 call_tests++;
26689 des_xmlOutputBufferPtr(n_out, out, 0);
26690 xmlResetLastError();
26691 if (mem_base != xmlMemBlocks()) {
26692 printf("Leak of %d blocks found in xmlOutputBufferFlush",
26693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026694 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026695 printf(" %d", n_out);
26696 printf("\n");
26697 }
26698 }
26699#endif
26700
26701 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026703}
26704
26705
26706static int
26707test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026709
Daniel Veillard3d97e662004-11-04 10:49:00 +000026710#ifdef LIBXML_OUTPUT_ENABLED
26711 int mem_base;
26712 int ret_val;
26713 xmlOutputBufferPtr out; /* a buffered parser output */
26714 int n_out;
26715 int len; /* the size in bytes of the array. */
26716 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026717 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000026718 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026719
Daniel Veillard3d97e662004-11-04 10:49:00 +000026720 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
26721 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26722 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
26723 mem_base = xmlMemBlocks();
26724 out = gen_xmlOutputBufferPtr(n_out, 0);
26725 len = gen_int(n_len, 1);
26726 buf = gen_const_char_ptr(n_buf, 2);
26727
26728 ret_val = xmlOutputBufferWrite(out, len, buf);
26729 desret_int(ret_val);
26730 call_tests++;
26731 des_xmlOutputBufferPtr(n_out, out, 0);
26732 des_int(n_len, len, 1);
26733 des_const_char_ptr(n_buf, buf, 2);
26734 xmlResetLastError();
26735 if (mem_base != xmlMemBlocks()) {
26736 printf("Leak of %d blocks found in xmlOutputBufferWrite",
26737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026738 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026739 printf(" %d", n_out);
26740 printf(" %d", n_len);
26741 printf(" %d", n_buf);
26742 printf("\n");
26743 }
26744 }
26745 }
26746 }
26747#endif
26748
26749 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026751}
26752
26753
26754static int
26755test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026757
26758
26759 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026760 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026761}
26762
26763
26764static int
26765test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026766 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026767
Daniel Veillard3d97e662004-11-04 10:49:00 +000026768#ifdef LIBXML_OUTPUT_ENABLED
26769 int mem_base;
26770 int ret_val;
26771 xmlOutputBufferPtr out; /* a buffered parser output */
26772 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026773 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000026774 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026775
Daniel Veillard3d97e662004-11-04 10:49:00 +000026776 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
26777 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
26778 mem_base = xmlMemBlocks();
26779 out = gen_xmlOutputBufferPtr(n_out, 0);
26780 str = gen_const_char_ptr(n_str, 1);
26781
26782 ret_val = xmlOutputBufferWriteString(out, str);
26783 desret_int(ret_val);
26784 call_tests++;
26785 des_xmlOutputBufferPtr(n_out, out, 0);
26786 des_const_char_ptr(n_str, str, 1);
26787 xmlResetLastError();
26788 if (mem_base != xmlMemBlocks()) {
26789 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
26790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026791 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026792 printf(" %d", n_out);
26793 printf(" %d", n_str);
26794 printf("\n");
26795 }
26796 }
26797 }
26798#endif
26799
26800 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026802}
26803
26804
26805static int
26806test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026808
26809
26810 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026812}
26813
26814
26815static int
26816test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026818
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026819 int mem_base;
26820 xmlParserInputBufferPtr ret_val;
26821 int fd; /* a file descriptor number */
26822 int n_fd;
26823 xmlCharEncoding enc; /* the charset encoding if known */
26824 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026825
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026826 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
26827 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26828 mem_base = xmlMemBlocks();
26829 fd = gen_int(n_fd, 0);
26830 enc = gen_xmlCharEncoding(n_enc, 1);
26831 if (fd >= 0) fd = -1;
26832
26833 ret_val = xmlParserInputBufferCreateFd(fd, enc);
26834 desret_xmlParserInputBufferPtr(ret_val);
26835 call_tests++;
26836 des_int(n_fd, fd, 0);
26837 des_xmlCharEncoding(n_enc, enc, 1);
26838 xmlResetLastError();
26839 if (mem_base != xmlMemBlocks()) {
26840 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
26841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026842 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026843 printf(" %d", n_fd);
26844 printf(" %d", n_enc);
26845 printf("\n");
26846 }
26847 }
26848 }
26849
26850 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026852}
26853
26854
26855static int
26856test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026858
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026859 int mem_base;
26860 xmlParserInputBufferPtr ret_val;
26861 FILE * file; /* a FILE* */
26862 int n_file;
26863 xmlCharEncoding enc; /* the charset encoding if known */
26864 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026865
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026866 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
26867 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26868 mem_base = xmlMemBlocks();
26869 file = gen_FILE_ptr(n_file, 0);
26870 enc = gen_xmlCharEncoding(n_enc, 1);
26871
26872 ret_val = xmlParserInputBufferCreateFile(file, enc);
26873 desret_xmlParserInputBufferPtr(ret_val);
26874 call_tests++;
26875 des_FILE_ptr(n_file, file, 0);
26876 des_xmlCharEncoding(n_enc, enc, 1);
26877 xmlResetLastError();
26878 if (mem_base != xmlMemBlocks()) {
26879 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
26880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026881 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026882 printf(" %d", n_file);
26883 printf(" %d", n_enc);
26884 printf("\n");
26885 }
26886 }
26887 }
26888
26889 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026891}
26892
26893
26894static int
26895test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026896 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026897
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026898 int mem_base;
26899 xmlParserInputBufferPtr ret_val;
26900 const char * URI; /* a C string containing the URI or filename */
26901 int n_URI;
26902 xmlCharEncoding enc; /* the charset encoding if known */
26903 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026904
Daniel Veillard42595322004-11-08 10:52:06 +000026905 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026906 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26907 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000026908 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026909 enc = gen_xmlCharEncoding(n_enc, 1);
26910
26911 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
26912 desret_xmlParserInputBufferPtr(ret_val);
26913 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026914 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026915 des_xmlCharEncoding(n_enc, enc, 1);
26916 xmlResetLastError();
26917 if (mem_base != xmlMemBlocks()) {
26918 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
26919 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026920 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026921 printf(" %d", n_URI);
26922 printf(" %d", n_enc);
26923 printf("\n");
26924 }
26925 }
26926 }
26927
26928 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026930}
26931
26932
26933static int
26934test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026936
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026937 int mem_base;
26938 xmlParserInputBufferPtr ret_val;
26939 char * mem; /* the memory input */
26940 int n_mem;
26941 int size; /* the length of the memory block */
26942 int n_size;
26943 xmlCharEncoding enc; /* the charset encoding if known */
26944 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026945
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026946 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
26947 for (n_size = 0;n_size < gen_nb_int;n_size++) {
26948 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26949 mem_base = xmlMemBlocks();
26950 mem = gen_const_char_ptr(n_mem, 0);
26951 size = gen_int(n_size, 1);
26952 enc = gen_xmlCharEncoding(n_enc, 2);
26953
26954 ret_val = xmlParserInputBufferCreateMem(mem, size, enc);
26955 desret_xmlParserInputBufferPtr(ret_val);
26956 call_tests++;
26957 des_const_char_ptr(n_mem, mem, 0);
26958 des_int(n_size, size, 1);
26959 des_xmlCharEncoding(n_enc, enc, 2);
26960 xmlResetLastError();
26961 if (mem_base != xmlMemBlocks()) {
26962 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
26963 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026964 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026965 printf(" %d", n_mem);
26966 printf(" %d", n_size);
26967 printf(" %d", n_enc);
26968 printf("\n");
26969 }
26970 }
26971 }
26972 }
26973
26974 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026976}
26977
26978
26979static int
26980test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026982
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026983 int mem_base;
26984 xmlParserInputBufferPtr ret_val;
26985 char * mem; /* the memory input */
26986 int n_mem;
26987 int size; /* the length of the memory block */
26988 int n_size;
26989 xmlCharEncoding enc; /* the charset encoding if known */
26990 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026991
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026992 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
26993 for (n_size = 0;n_size < gen_nb_int;n_size++) {
26994 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26995 mem_base = xmlMemBlocks();
26996 mem = gen_const_char_ptr(n_mem, 0);
26997 size = gen_int(n_size, 1);
26998 enc = gen_xmlCharEncoding(n_enc, 2);
26999
27000 ret_val = xmlParserInputBufferCreateStatic(mem, size, enc);
27001 desret_xmlParserInputBufferPtr(ret_val);
27002 call_tests++;
27003 des_const_char_ptr(n_mem, mem, 0);
27004 des_int(n_size, size, 1);
27005 des_xmlCharEncoding(n_enc, enc, 2);
27006 xmlResetLastError();
27007 if (mem_base != xmlMemBlocks()) {
27008 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27009 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027010 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027011 printf(" %d", n_mem);
27012 printf(" %d", n_size);
27013 printf(" %d", n_enc);
27014 printf("\n");
27015 }
27016 }
27017 }
27018 }
27019
27020 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027021 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027022}
27023
27024
27025static int
27026test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027027 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027028
Daniel Veillard34099b42004-11-04 17:34:35 +000027029 int mem_base;
27030 int ret_val;
27031 xmlParserInputBufferPtr in; /* a buffered parser input */
27032 int n_in;
27033 int len; /* indicative value of the amount of chars to read */
27034 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027035
Daniel Veillard34099b42004-11-04 17:34:35 +000027036 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27037 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27038 mem_base = xmlMemBlocks();
27039 in = gen_xmlParserInputBufferPtr(n_in, 0);
27040 len = gen_int(n_len, 1);
27041
27042 ret_val = xmlParserInputBufferGrow(in, len);
27043 desret_int(ret_val);
27044 call_tests++;
27045 des_xmlParserInputBufferPtr(n_in, in, 0);
27046 des_int(n_len, len, 1);
27047 xmlResetLastError();
27048 if (mem_base != xmlMemBlocks()) {
27049 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027051 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027052 printf(" %d", n_in);
27053 printf(" %d", n_len);
27054 printf("\n");
27055 }
27056 }
27057 }
27058
27059 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027061}
27062
27063
27064static int
27065test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027067
Daniel Veillard34099b42004-11-04 17:34:35 +000027068 int mem_base;
27069 int ret_val;
27070 xmlParserInputBufferPtr in; /* a buffered parser input */
27071 int n_in;
27072 int len; /* the size in bytes of the array. */
27073 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027074 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027075 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027076
Daniel Veillard34099b42004-11-04 17:34:35 +000027077 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27078 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27079 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27080 mem_base = xmlMemBlocks();
27081 in = gen_xmlParserInputBufferPtr(n_in, 0);
27082 len = gen_int(n_len, 1);
27083 buf = gen_const_char_ptr(n_buf, 2);
27084
27085 ret_val = xmlParserInputBufferPush(in, len, buf);
27086 desret_int(ret_val);
27087 call_tests++;
27088 des_xmlParserInputBufferPtr(n_in, in, 0);
27089 des_int(n_len, len, 1);
27090 des_const_char_ptr(n_buf, buf, 2);
27091 xmlResetLastError();
27092 if (mem_base != xmlMemBlocks()) {
27093 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27094 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027095 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027096 printf(" %d", n_in);
27097 printf(" %d", n_len);
27098 printf(" %d", n_buf);
27099 printf("\n");
27100 }
27101 }
27102 }
27103 }
27104
27105 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027106 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027107}
27108
27109
27110static int
27111test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027112 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027113
Daniel Veillard34099b42004-11-04 17:34:35 +000027114 int mem_base;
27115 int ret_val;
27116 xmlParserInputBufferPtr in; /* a buffered parser input */
27117 int n_in;
27118 int len; /* indicative value of the amount of chars to read */
27119 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027120
Daniel Veillard34099b42004-11-04 17:34:35 +000027121 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27122 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27123 mem_base = xmlMemBlocks();
27124 in = gen_xmlParserInputBufferPtr(n_in, 0);
27125 len = gen_int(n_len, 1);
27126
27127 ret_val = xmlParserInputBufferRead(in, len);
27128 desret_int(ret_val);
27129 call_tests++;
27130 des_xmlParserInputBufferPtr(n_in, in, 0);
27131 des_int(n_len, len, 1);
27132 xmlResetLastError();
27133 if (mem_base != xmlMemBlocks()) {
27134 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27135 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027136 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027137 printf(" %d", n_in);
27138 printf(" %d", n_len);
27139 printf("\n");
27140 }
27141 }
27142 }
27143
27144 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027145 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027146}
27147
27148
27149static int
27150test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027151 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027152
27153 int mem_base;
27154 int ret_val;
27155
27156 mem_base = xmlMemBlocks();
27157
27158 ret_val = xmlPopInputCallbacks();
27159 desret_int(ret_val);
27160 call_tests++;
27161 xmlResetLastError();
27162 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027163 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027165 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027166 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027167 }
27168
Daniel Veillard3d97e662004-11-04 10:49:00 +000027169 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027171}
27172
27173
27174static int
27175test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027177
27178 int mem_base;
27179
27180 mem_base = xmlMemBlocks();
27181
27182 xmlRegisterDefaultInputCallbacks();
27183 call_tests++;
27184 xmlResetLastError();
27185 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027186 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027188 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027189 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027190 }
27191
Daniel Veillard3d97e662004-11-04 10:49:00 +000027192 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027194}
27195
27196
27197static int
27198test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027200
27201#ifdef LIBXML_OUTPUT_ENABLED
27202 int mem_base;
27203
27204 mem_base = xmlMemBlocks();
27205
27206 xmlRegisterDefaultOutputCallbacks();
27207 call_tests++;
27208 xmlResetLastError();
27209 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027210 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027212 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027213 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027214 }
27215#endif
27216
Daniel Veillard3d97e662004-11-04 10:49:00 +000027217 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027219}
27220
27221
27222static int
27223test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027225
27226#ifdef LIBXML_HTTP_ENABLED
27227 int mem_base;
27228
27229 mem_base = xmlMemBlocks();
27230
27231 xmlRegisterHTTPPostCallbacks();
27232 call_tests++;
27233 xmlResetLastError();
27234 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027235 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027237 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027238 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027239 }
27240#endif
27241
Daniel Veillard3d97e662004-11-04 10:49:00 +000027242 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027243 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027244}
27245
27246static int
27247test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027248 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027249
Daniel Veillard42595322004-11-08 10:52:06 +000027250 printf("Testing xmlIO : 38 of 47 functions ...\n");
27251 test_ret += test_xmlAllocOutputBuffer();
27252 test_ret += test_xmlAllocParserInputBuffer();
27253 test_ret += test_xmlCheckFilename();
27254 test_ret += test_xmlCheckHTTPInput();
27255 test_ret += test_xmlCleanupInputCallbacks();
27256 test_ret += test_xmlCleanupOutputCallbacks();
27257 test_ret += test_xmlFileClose();
27258 test_ret += test_xmlFileMatch();
27259 test_ret += test_xmlFileOpen();
27260 test_ret += test_xmlFileRead();
27261 test_ret += test_xmlIOFTPClose();
27262 test_ret += test_xmlIOFTPMatch();
27263 test_ret += test_xmlIOFTPOpen();
27264 test_ret += test_xmlIOFTPRead();
27265 test_ret += test_xmlIOHTTPClose();
27266 test_ret += test_xmlIOHTTPMatch();
27267 test_ret += test_xmlIOHTTPOpen();
27268 test_ret += test_xmlIOHTTPOpenW();
27269 test_ret += test_xmlIOHTTPRead();
27270 test_ret += test_xmlNoNetExternalEntityLoader();
27271 test_ret += test_xmlNormalizeWindowsPath();
27272 test_ret += test_xmlOutputBufferCreateFd();
27273 test_ret += test_xmlOutputBufferCreateFile();
27274 test_ret += test_xmlOutputBufferCreateFilename();
27275 test_ret += test_xmlOutputBufferFlush();
27276 test_ret += test_xmlOutputBufferWrite();
27277 test_ret += test_xmlOutputBufferWriteEscape();
27278 test_ret += test_xmlOutputBufferWriteString();
27279 test_ret += test_xmlParserGetDirectory();
27280 test_ret += test_xmlParserInputBufferCreateFd();
27281 test_ret += test_xmlParserInputBufferCreateFile();
27282 test_ret += test_xmlParserInputBufferCreateFilename();
27283 test_ret += test_xmlParserInputBufferCreateMem();
27284 test_ret += test_xmlParserInputBufferCreateStatic();
27285 test_ret += test_xmlParserInputBufferGrow();
27286 test_ret += test_xmlParserInputBufferPush();
27287 test_ret += test_xmlParserInputBufferRead();
27288 test_ret += test_xmlPopInputCallbacks();
27289 test_ret += test_xmlRegisterDefaultInputCallbacks();
27290 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27291 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027292
Daniel Veillard42595322004-11-08 10:52:06 +000027293 if (test_ret != 0)
27294 printf("Module xmlIO: %d errors\n", test_ret);
27295 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027296}
27297
Daniel Veillarda82b1822004-11-08 16:24:57 +000027298#define gen_nb_xmlAutomataPtr 1
27299static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27300 return(NULL);
27301}
27302static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27303}
27304
27305static int
27306test_xmlAutomataCompile(void) {
27307 int test_ret = 0;
27308
27309
27310 /* missing type support */
27311 return(test_ret);
27312}
27313
27314
27315static int
27316test_xmlAutomataGetInitState(void) {
27317 int test_ret = 0;
27318
27319
27320 /* missing type support */
27321 return(test_ret);
27322}
27323
27324
27325static int
27326test_xmlAutomataIsDeterminist(void) {
27327 int test_ret = 0;
27328
27329#ifdef LIBXML_AUTOMATA_ENABLED
27330 int mem_base;
27331 int ret_val;
27332 xmlAutomataPtr am; /* an automata */
27333 int n_am;
27334
27335 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27336 mem_base = xmlMemBlocks();
27337 am = gen_xmlAutomataPtr(n_am, 0);
27338
27339 ret_val = xmlAutomataIsDeterminist(am);
27340 desret_int(ret_val);
27341 call_tests++;
27342 des_xmlAutomataPtr(n_am, am, 0);
27343 xmlResetLastError();
27344 if (mem_base != xmlMemBlocks()) {
27345 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27346 xmlMemBlocks() - mem_base);
27347 test_ret++;
27348 printf(" %d", n_am);
27349 printf("\n");
27350 }
27351 }
27352#endif
27353
27354 function_tests++;
27355 return(test_ret);
27356}
27357
27358
27359#define gen_nb_xmlAutomataStatePtr 1
27360static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27361 return(NULL);
27362}
27363static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27364}
27365
27366static int
27367test_xmlAutomataNewAllTrans(void) {
27368 int test_ret = 0;
27369
27370
27371 /* missing type support */
27372 return(test_ret);
27373}
27374
27375
27376static int
27377test_xmlAutomataNewCountTrans(void) {
27378 int test_ret = 0;
27379
27380
27381 /* missing type support */
27382 return(test_ret);
27383}
27384
27385
27386static int
27387test_xmlAutomataNewCountTrans2(void) {
27388 int test_ret = 0;
27389
27390
27391 /* missing type support */
27392 return(test_ret);
27393}
27394
27395
27396static int
27397test_xmlAutomataNewCountedTrans(void) {
27398 int test_ret = 0;
27399
27400
27401 /* missing type support */
27402 return(test_ret);
27403}
27404
27405
27406static int
27407test_xmlAutomataNewCounter(void) {
27408 int test_ret = 0;
27409
27410#ifdef LIBXML_AUTOMATA_ENABLED
27411 int mem_base;
27412 int ret_val;
27413 xmlAutomataPtr am; /* an automata */
27414 int n_am;
27415 int min; /* the minimal value on the counter */
27416 int n_min;
27417 int max; /* the maximal value on the counter */
27418 int n_max;
27419
27420 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27421 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27422 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27423 mem_base = xmlMemBlocks();
27424 am = gen_xmlAutomataPtr(n_am, 0);
27425 min = gen_int(n_min, 1);
27426 max = gen_int(n_max, 2);
27427
27428 ret_val = xmlAutomataNewCounter(am, min, max);
27429 desret_int(ret_val);
27430 call_tests++;
27431 des_xmlAutomataPtr(n_am, am, 0);
27432 des_int(n_min, min, 1);
27433 des_int(n_max, max, 2);
27434 xmlResetLastError();
27435 if (mem_base != xmlMemBlocks()) {
27436 printf("Leak of %d blocks found in xmlAutomataNewCounter",
27437 xmlMemBlocks() - mem_base);
27438 test_ret++;
27439 printf(" %d", n_am);
27440 printf(" %d", n_min);
27441 printf(" %d", n_max);
27442 printf("\n");
27443 }
27444 }
27445 }
27446 }
27447#endif
27448
27449 function_tests++;
27450 return(test_ret);
27451}
27452
27453
27454static int
27455test_xmlAutomataNewCounterTrans(void) {
27456 int test_ret = 0;
27457
27458
27459 /* missing type support */
27460 return(test_ret);
27461}
27462
27463
27464static int
27465test_xmlAutomataNewEpsilon(void) {
27466 int test_ret = 0;
27467
27468
27469 /* missing type support */
27470 return(test_ret);
27471}
27472
27473
27474static int
27475test_xmlAutomataNewOnceTrans(void) {
27476 int test_ret = 0;
27477
27478
27479 /* missing type support */
27480 return(test_ret);
27481}
27482
27483
27484static int
27485test_xmlAutomataNewOnceTrans2(void) {
27486 int test_ret = 0;
27487
27488
27489 /* missing type support */
27490 return(test_ret);
27491}
27492
27493
27494static int
27495test_xmlAutomataNewState(void) {
27496 int test_ret = 0;
27497
27498
27499 /* missing type support */
27500 return(test_ret);
27501}
27502
27503
27504static int
27505test_xmlAutomataNewTransition(void) {
27506 int test_ret = 0;
27507
27508
27509 /* missing type support */
27510 return(test_ret);
27511}
27512
27513
27514static int
27515test_xmlAutomataNewTransition2(void) {
27516 int test_ret = 0;
27517
27518
27519 /* missing type support */
27520 return(test_ret);
27521}
27522
27523
27524static int
27525test_xmlAutomataSetFinalState(void) {
27526 int test_ret = 0;
27527
27528#ifdef LIBXML_AUTOMATA_ENABLED
27529 int mem_base;
27530 int ret_val;
27531 xmlAutomataPtr am; /* an automata */
27532 int n_am;
27533 xmlAutomataStatePtr state; /* a state in this automata */
27534 int n_state;
27535
27536 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27537 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
27538 mem_base = xmlMemBlocks();
27539 am = gen_xmlAutomataPtr(n_am, 0);
27540 state = gen_xmlAutomataStatePtr(n_state, 1);
27541
27542 ret_val = xmlAutomataSetFinalState(am, state);
27543 desret_int(ret_val);
27544 call_tests++;
27545 des_xmlAutomataPtr(n_am, am, 0);
27546 des_xmlAutomataStatePtr(n_state, state, 1);
27547 xmlResetLastError();
27548 if (mem_base != xmlMemBlocks()) {
27549 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
27550 xmlMemBlocks() - mem_base);
27551 test_ret++;
27552 printf(" %d", n_am);
27553 printf(" %d", n_state);
27554 printf("\n");
27555 }
27556 }
27557 }
27558#endif
27559
27560 function_tests++;
27561 return(test_ret);
27562}
27563
27564
27565static int
27566test_xmlNewAutomata(void) {
27567 int test_ret = 0;
27568
27569
27570 /* missing type support */
27571 return(test_ret);
27572}
27573
27574static int
27575test_xmlautomata(void) {
27576 int test_ret = 0;
27577
27578 printf("Testing xmlautomata : 3 of 18 functions ...\n");
27579 test_ret += test_xmlAutomataCompile();
27580 test_ret += test_xmlAutomataGetInitState();
27581 test_ret += test_xmlAutomataIsDeterminist();
27582 test_ret += test_xmlAutomataNewAllTrans();
27583 test_ret += test_xmlAutomataNewCountTrans();
27584 test_ret += test_xmlAutomataNewCountTrans2();
27585 test_ret += test_xmlAutomataNewCountedTrans();
27586 test_ret += test_xmlAutomataNewCounter();
27587 test_ret += test_xmlAutomataNewCounterTrans();
27588 test_ret += test_xmlAutomataNewEpsilon();
27589 test_ret += test_xmlAutomataNewOnceTrans();
27590 test_ret += test_xmlAutomataNewOnceTrans2();
27591 test_ret += test_xmlAutomataNewState();
27592 test_ret += test_xmlAutomataNewTransition();
27593 test_ret += test_xmlAutomataNewTransition2();
27594 test_ret += test_xmlAutomataSetFinalState();
27595 test_ret += test_xmlNewAutomata();
27596
27597 if (test_ret != 0)
27598 printf("Module xmlautomata: %d errors\n", test_ret);
27599 return(test_ret);
27600}
27601
Daniel Veillardce682bc2004-11-05 17:22:25 +000027602#define gen_nb_xmlGenericErrorFunc_ptr 1
27603static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27604 return(NULL);
27605}
27606static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27607}
27608
Daniel Veillardd93f6252004-11-02 15:53:51 +000027609static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000027610test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027612
Daniel Veillardce682bc2004-11-05 17:22:25 +000027613 int mem_base;
27614 xmlGenericErrorFunc * handler; /* the handler */
27615 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027616
Daniel Veillardce682bc2004-11-05 17:22:25 +000027617 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
27618 mem_base = xmlMemBlocks();
27619 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
27620
27621 initGenericErrorDefaultFunc(handler);
27622 call_tests++;
27623 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
27624 xmlResetLastError();
27625 if (mem_base != xmlMemBlocks()) {
27626 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
27627 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027628 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027629 printf(" %d", n_handler);
27630 printf("\n");
27631 }
27632 }
27633
27634 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027636}
27637
27638
Daniel Veillardce682bc2004-11-05 17:22:25 +000027639#define gen_nb_xmlErrorPtr 1
27640static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27641 return(NULL);
27642}
27643static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27644}
27645
Daniel Veillardd93f6252004-11-02 15:53:51 +000027646static int
27647test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027649
Daniel Veillardce682bc2004-11-05 17:22:25 +000027650 int mem_base;
27651 int ret_val;
27652 xmlErrorPtr from; /* a source error */
27653 int n_from;
27654 xmlErrorPtr to; /* a target error */
27655 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027656
Daniel Veillardce682bc2004-11-05 17:22:25 +000027657 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
27658 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
27659 mem_base = xmlMemBlocks();
27660 from = gen_xmlErrorPtr(n_from, 0);
27661 to = gen_xmlErrorPtr(n_to, 1);
27662
27663 ret_val = xmlCopyError(from, to);
27664 desret_int(ret_val);
27665 call_tests++;
27666 des_xmlErrorPtr(n_from, from, 0);
27667 des_xmlErrorPtr(n_to, to, 1);
27668 xmlResetLastError();
27669 if (mem_base != xmlMemBlocks()) {
27670 printf("Leak of %d blocks found in xmlCopyError",
27671 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027672 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027673 printf(" %d", n_from);
27674 printf(" %d", n_to);
27675 printf("\n");
27676 }
27677 }
27678 }
27679
27680 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027681 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027682}
27683
27684
27685static int
27686test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027688
27689
27690 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027692}
27693
27694
27695static int
27696test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027698
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027699 int mem_base;
27700 void * ctx; /* an XML parser context */
27701 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027702
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027703 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
27704 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027705 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027706
27707 xmlCtxtResetLastError(ctx);
27708 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027709 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027710 xmlResetLastError();
27711 if (mem_base != xmlMemBlocks()) {
27712 printf("Leak of %d blocks found in xmlCtxtResetLastError",
27713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027714 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027715 printf(" %d", n_ctx);
27716 printf("\n");
27717 }
27718 }
27719
Daniel Veillard3d97e662004-11-04 10:49:00 +000027720 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027721 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027722}
27723
27724
27725static int
27726test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027727 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027728
27729
27730 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027732}
27733
27734
27735static int
27736test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027738
27739
27740 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027741 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027742}
27743
27744
27745static int
27746test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027747 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027748
Daniel Veillardce682bc2004-11-05 17:22:25 +000027749 int mem_base;
27750 xmlParserInputPtr input; /* an xmlParserInputPtr input */
27751 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027752
Daniel Veillardce682bc2004-11-05 17:22:25 +000027753 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
27754 mem_base = xmlMemBlocks();
27755 input = gen_xmlParserInputPtr(n_input, 0);
27756
27757 xmlParserPrintFileContext(input);
27758 call_tests++;
27759 des_xmlParserInputPtr(n_input, input, 0);
27760 xmlResetLastError();
27761 if (mem_base != xmlMemBlocks()) {
27762 printf("Leak of %d blocks found in xmlParserPrintFileContext",
27763 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027764 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027765 printf(" %d", n_input);
27766 printf("\n");
27767 }
27768 }
27769
27770 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027771 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027772}
27773
27774
27775static int
27776test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027777 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027778
Daniel Veillardce682bc2004-11-05 17:22:25 +000027779 int mem_base;
27780 xmlParserInputPtr input; /* an xmlParserInputPtr input */
27781 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027782
Daniel Veillardce682bc2004-11-05 17:22:25 +000027783 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
27784 mem_base = xmlMemBlocks();
27785 input = gen_xmlParserInputPtr(n_input, 0);
27786
27787 xmlParserPrintFileInfo(input);
27788 call_tests++;
27789 des_xmlParserInputPtr(n_input, input, 0);
27790 xmlResetLastError();
27791 if (mem_base != xmlMemBlocks()) {
27792 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
27793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027794 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027795 printf(" %d", n_input);
27796 printf("\n");
27797 }
27798 }
27799
27800 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027802}
27803
27804
27805static int
27806test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027808
27809
27810 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027812}
27813
27814
27815static int
27816test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027818
27819
27820 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027821 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027822}
27823
27824
27825static int
27826test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027827 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027828
27829
27830 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027831 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027832}
27833
27834
27835static int
27836test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027837 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027838
Daniel Veillardce682bc2004-11-05 17:22:25 +000027839 int mem_base;
27840 xmlErrorPtr err; /* pointer to the error. */
27841 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027842
Daniel Veillardce682bc2004-11-05 17:22:25 +000027843 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
27844 mem_base = xmlMemBlocks();
27845 err = gen_xmlErrorPtr(n_err, 0);
27846
27847 xmlResetError(err);
27848 call_tests++;
27849 des_xmlErrorPtr(n_err, err, 0);
27850 xmlResetLastError();
27851 if (mem_base != xmlMemBlocks()) {
27852 printf("Leak of %d blocks found in xmlResetError",
27853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027854 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027855 printf(" %d", n_err);
27856 printf("\n");
27857 }
27858 }
27859
27860 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027862}
27863
27864
27865static int
27866test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027868
27869
27870
27871 xmlResetLastError();
27872 call_tests++;
27873 xmlResetLastError();
27874
Daniel Veillard3d97e662004-11-04 10:49:00 +000027875 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027876 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027877}
27878
27879
27880static int
27881test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027882 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027883
27884
27885 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027886 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027887}
27888
27889
27890static int
27891test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027892 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027893
27894
27895 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027897}
27898
27899static int
27900test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027902
Daniel Veillardce682bc2004-11-05 17:22:25 +000027903 printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000027904 test_ret += test_initGenericErrorDefaultFunc();
27905 test_ret += test_xmlCopyError();
27906 test_ret += test_xmlCtxtGetLastError();
27907 test_ret += test_xmlCtxtResetLastError();
27908 test_ret += test_xmlGetLastError();
27909 test_ret += test_xmlParserError();
27910 test_ret += test_xmlParserPrintFileContext();
27911 test_ret += test_xmlParserPrintFileInfo();
27912 test_ret += test_xmlParserValidityError();
27913 test_ret += test_xmlParserValidityWarning();
27914 test_ret += test_xmlParserWarning();
27915 test_ret += test_xmlResetError();
27916 test_ret += test_xmlResetLastError();
27917 test_ret += test_xmlSetGenericErrorFunc();
27918 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027919
Daniel Veillard42595322004-11-08 10:52:06 +000027920 if (test_ret != 0)
27921 printf("Module xmlerror: %d errors\n", test_ret);
27922 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027923}
Daniel Veillardd93f6252004-11-02 15:53:51 +000027924
27925static int
27926test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027927 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027928
Daniel Veillard34099b42004-11-04 17:34:35 +000027929#ifdef LIBXML_READER_ENABLED
27930 int mem_base;
27931 xmlTextReaderPtr ret_val;
27932 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
27933 int n_input;
27934 const char * URI; /* the URI information for the source if available */
27935 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027936
Daniel Veillard34099b42004-11-04 17:34:35 +000027937 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
27938 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
27939 mem_base = xmlMemBlocks();
27940 input = gen_xmlParserInputBufferPtr(n_input, 0);
27941 URI = gen_filepath(n_URI, 1);
27942
27943 ret_val = xmlNewTextReader(input, URI);
27944 desret_xmlTextReaderPtr(ret_val);
27945 call_tests++;
27946 des_xmlParserInputBufferPtr(n_input, input, 0);
27947 des_filepath(n_URI, URI, 1);
27948 xmlResetLastError();
27949 if (mem_base != xmlMemBlocks()) {
27950 printf("Leak of %d blocks found in xmlNewTextReader",
27951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027952 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027953 printf(" %d", n_input);
27954 printf(" %d", n_URI);
27955 printf("\n");
27956 }
27957 }
27958 }
27959#endif
27960
27961 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027963}
27964
27965
27966static int
27967test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027969
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000027970#ifdef LIBXML_READER_ENABLED
27971 int mem_base;
27972 xmlTextReaderPtr ret_val;
27973 const char * URI; /* the URI of the resource to process */
27974 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027975
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000027976 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
27977 mem_base = xmlMemBlocks();
27978 URI = gen_filepath(n_URI, 0);
27979
27980 ret_val = xmlNewTextReaderFilename(URI);
27981 desret_xmlTextReaderPtr(ret_val);
27982 call_tests++;
27983 des_filepath(n_URI, URI, 0);
27984 xmlResetLastError();
27985 if (mem_base != xmlMemBlocks()) {
27986 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
27987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027988 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000027989 printf(" %d", n_URI);
27990 printf("\n");
27991 }
27992 }
27993#endif
27994
27995 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027996 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027997}
27998
27999
28000static int
28001test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028002 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028003
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028004#ifdef LIBXML_READER_ENABLED
28005 int mem_base;
28006 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028007 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028008 int n_cur;
28009 const char * URL; /* the base URL to use for the document */
28010 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028011 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028012 int n_encoding;
28013 int options; /* a combination of xmlParserOption */
28014 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028015
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028016 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28017 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28018 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
28019 for (n_options = 0;n_options < gen_nb_int;n_options++) {
28020 mem_base = xmlMemBlocks();
28021 cur = gen_const_xmlChar_ptr(n_cur, 0);
28022 URL = gen_filepath(n_URL, 1);
28023 encoding = gen_const_char_ptr(n_encoding, 2);
28024 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028025
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028026 ret_val = xmlReaderForDoc(cur, URL, encoding, options);
28027 desret_xmlTextReaderPtr(ret_val);
28028 call_tests++;
28029 des_const_xmlChar_ptr(n_cur, cur, 0);
28030 des_filepath(n_URL, URL, 1);
28031 des_const_char_ptr(n_encoding, encoding, 2);
28032 des_int(n_options, options, 3);
28033 xmlResetLastError();
28034 if (mem_base != xmlMemBlocks()) {
28035 printf("Leak of %d blocks found in xmlReaderForDoc",
28036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028037 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028038 printf(" %d", n_cur);
28039 printf(" %d", n_URL);
28040 printf(" %d", n_encoding);
28041 printf(" %d", n_options);
28042 printf("\n");
28043 }
28044 }
28045 }
28046 }
28047 }
28048#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028049
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028050 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028051 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028052}
28053
28054
28055static int
28056test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028057 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028058
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028059#ifdef LIBXML_READER_ENABLED
28060 int mem_base;
28061 xmlTextReaderPtr ret_val;
28062 const char * filename; /* a file or URL */
28063 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028064 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028065 int n_encoding;
28066 int options; /* a combination of xmlParserOption */
28067 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028068
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028069 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28070 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
28071 for (n_options = 0;n_options < gen_nb_int;n_options++) {
28072 mem_base = xmlMemBlocks();
28073 filename = gen_filepath(n_filename, 0);
28074 encoding = gen_const_char_ptr(n_encoding, 1);
28075 options = gen_int(n_options, 2);
28076
28077 ret_val = xmlReaderForFile(filename, encoding, options);
28078 desret_xmlTextReaderPtr(ret_val);
28079 call_tests++;
28080 des_filepath(n_filename, filename, 0);
28081 des_const_char_ptr(n_encoding, encoding, 1);
28082 des_int(n_options, options, 2);
28083 xmlResetLastError();
28084 if (mem_base != xmlMemBlocks()) {
28085 printf("Leak of %d blocks found in xmlReaderForFile",
28086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028087 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028088 printf(" %d", n_filename);
28089 printf(" %d", n_encoding);
28090 printf(" %d", n_options);
28091 printf("\n");
28092 }
28093 }
28094 }
28095 }
28096#endif
28097
28098 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028099 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028100}
28101
28102
28103static int
28104test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028105 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028106
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028107#ifdef LIBXML_READER_ENABLED
28108 int mem_base;
28109 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028110 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028111 int n_buffer;
28112 int size; /* the size of the array */
28113 int n_size;
28114 const char * URL; /* the base URL to use for the document */
28115 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028116 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028117 int n_encoding;
28118 int options; /* a combination of xmlParserOption */
28119 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028120
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028121 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28122 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28123 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28124 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
28125 for (n_options = 0;n_options < gen_nb_int;n_options++) {
28126 mem_base = xmlMemBlocks();
28127 buffer = gen_const_char_ptr(n_buffer, 0);
28128 size = gen_int(n_size, 1);
28129 URL = gen_filepath(n_URL, 2);
28130 encoding = gen_const_char_ptr(n_encoding, 3);
28131 options = gen_int(n_options, 4);
28132
28133 ret_val = xmlReaderForMemory(buffer, size, URL, encoding, options);
28134 desret_xmlTextReaderPtr(ret_val);
28135 call_tests++;
28136 des_const_char_ptr(n_buffer, buffer, 0);
28137 des_int(n_size, size, 1);
28138 des_filepath(n_URL, URL, 2);
28139 des_const_char_ptr(n_encoding, encoding, 3);
28140 des_int(n_options, options, 4);
28141 xmlResetLastError();
28142 if (mem_base != xmlMemBlocks()) {
28143 printf("Leak of %d blocks found in xmlReaderForMemory",
28144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028145 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028146 printf(" %d", n_buffer);
28147 printf(" %d", n_size);
28148 printf(" %d", n_URL);
28149 printf(" %d", n_encoding);
28150 printf(" %d", n_options);
28151 printf("\n");
28152 }
28153 }
28154 }
28155 }
28156 }
28157 }
28158#endif
28159
28160 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028161 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028162}
28163
28164
28165static int
28166test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028167 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028168
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028169#ifdef LIBXML_READER_ENABLED
28170 int mem_base;
28171 int ret_val;
28172 xmlTextReaderPtr reader; /* an XML reader */
28173 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028174 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028175 int n_cur;
28176 const char * URL; /* the base URL to use for the document */
28177 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028178 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028179 int n_encoding;
28180 int options; /* a combination of xmlParserOption */
28181 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028182
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028183 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28184 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28185 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28186 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
28187 for (n_options = 0;n_options < gen_nb_int;n_options++) {
28188 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028189 reader = gen_xmlTextReaderPtr(n_reader, 0);
28190 cur = gen_const_xmlChar_ptr(n_cur, 1);
28191 URL = gen_filepath(n_URL, 2);
28192 encoding = gen_const_char_ptr(n_encoding, 3);
28193 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028194
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028195 ret_val = xmlReaderNewDoc(reader, cur, URL, encoding, options);
28196 desret_int(ret_val);
28197 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028198 des_xmlTextReaderPtr(n_reader, reader, 0);
28199 des_const_xmlChar_ptr(n_cur, cur, 1);
28200 des_filepath(n_URL, URL, 2);
28201 des_const_char_ptr(n_encoding, encoding, 3);
28202 des_int(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028203 xmlResetLastError();
28204 if (mem_base != xmlMemBlocks()) {
28205 printf("Leak of %d blocks found in xmlReaderNewDoc",
28206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028207 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028208 printf(" %d", n_reader);
28209 printf(" %d", n_cur);
28210 printf(" %d", n_URL);
28211 printf(" %d", n_encoding);
28212 printf(" %d", n_options);
28213 printf("\n");
28214 }
28215 }
28216 }
28217 }
28218 }
28219 }
28220#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028221
Daniel Veillard3d97e662004-11-04 10:49:00 +000028222 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028223 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028224}
28225
28226
28227static int
28228test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028229 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028230
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028231#ifdef LIBXML_READER_ENABLED
28232 int mem_base;
28233 int ret_val;
28234 xmlTextReaderPtr reader; /* an XML reader */
28235 int n_reader;
28236 const char * filename; /* a file or URL */
28237 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028238 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028239 int n_encoding;
28240 int options; /* a combination of xmlParserOption */
28241 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028242
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028243 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28244 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28245 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
28246 for (n_options = 0;n_options < gen_nb_int;n_options++) {
28247 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028248 reader = gen_xmlTextReaderPtr(n_reader, 0);
28249 filename = gen_filepath(n_filename, 1);
28250 encoding = gen_const_char_ptr(n_encoding, 2);
28251 options = gen_int(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028252
28253 ret_val = xmlReaderNewFile(reader, filename, encoding, options);
28254 desret_int(ret_val);
28255 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028256 des_xmlTextReaderPtr(n_reader, reader, 0);
28257 des_filepath(n_filename, filename, 1);
28258 des_const_char_ptr(n_encoding, encoding, 2);
28259 des_int(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028260 xmlResetLastError();
28261 if (mem_base != xmlMemBlocks()) {
28262 printf("Leak of %d blocks found in xmlReaderNewFile",
28263 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028264 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028265 printf(" %d", n_reader);
28266 printf(" %d", n_filename);
28267 printf(" %d", n_encoding);
28268 printf(" %d", n_options);
28269 printf("\n");
28270 }
28271 }
28272 }
28273 }
28274 }
28275#endif
28276
Daniel Veillard3d97e662004-11-04 10:49:00 +000028277 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028278 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028279}
28280
28281
28282static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028283test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028284 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028285
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028286#ifdef LIBXML_READER_ENABLED
28287 int mem_base;
28288 int ret_val;
28289 xmlTextReaderPtr reader; /* an XML reader */
28290 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028291 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028292 int n_buffer;
28293 int size; /* the size of the array */
28294 int n_size;
28295 const char * URL; /* the base URL to use for the document */
28296 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028297 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028298 int n_encoding;
28299 int options; /* a combination of xmlParserOption */
28300 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028301
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028302 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28303 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28304 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28305 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28306 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
28307 for (n_options = 0;n_options < gen_nb_int;n_options++) {
28308 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028309 reader = gen_xmlTextReaderPtr(n_reader, 0);
28310 buffer = gen_const_char_ptr(n_buffer, 1);
28311 size = gen_int(n_size, 2);
28312 URL = gen_filepath(n_URL, 3);
28313 encoding = gen_const_char_ptr(n_encoding, 4);
28314 options = gen_int(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028315
28316 ret_val = xmlReaderNewMemory(reader, buffer, size, URL, encoding, options);
28317 desret_int(ret_val);
28318 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028319 des_xmlTextReaderPtr(n_reader, reader, 0);
28320 des_const_char_ptr(n_buffer, buffer, 1);
28321 des_int(n_size, size, 2);
28322 des_filepath(n_URL, URL, 3);
28323 des_const_char_ptr(n_encoding, encoding, 4);
28324 des_int(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028325 xmlResetLastError();
28326 if (mem_base != xmlMemBlocks()) {
28327 printf("Leak of %d blocks found in xmlReaderNewMemory",
28328 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028329 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028330 printf(" %d", n_reader);
28331 printf(" %d", n_buffer);
28332 printf(" %d", n_size);
28333 printf(" %d", n_URL);
28334 printf(" %d", n_encoding);
28335 printf(" %d", n_options);
28336 printf("\n");
28337 }
28338 }
28339 }
28340 }
28341 }
28342 }
28343 }
28344#endif
28345
Daniel Veillard3d97e662004-11-04 10:49:00 +000028346 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028348}
28349
28350
28351static int
28352test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028354
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028355#ifdef LIBXML_READER_ENABLED
28356 int mem_base;
28357 int ret_val;
28358 xmlTextReaderPtr reader; /* an XML reader */
28359 int n_reader;
28360 xmlDocPtr doc; /* a preparsed document */
28361 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028362
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028363 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28364 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28365 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028366 reader = gen_xmlTextReaderPtr(n_reader, 0);
28367 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028368
28369 ret_val = xmlReaderNewWalker(reader, doc);
28370 desret_int(ret_val);
28371 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028372 des_xmlTextReaderPtr(n_reader, reader, 0);
28373 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028374 xmlResetLastError();
28375 if (mem_base != xmlMemBlocks()) {
28376 printf("Leak of %d blocks found in xmlReaderNewWalker",
28377 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028378 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028379 printf(" %d", n_reader);
28380 printf(" %d", n_doc);
28381 printf("\n");
28382 }
28383 }
28384 }
28385#endif
28386
Daniel Veillard3d97e662004-11-04 10:49:00 +000028387 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028388 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028389}
28390
28391
28392static int
28393test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028394 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028395
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028396#ifdef LIBXML_READER_ENABLED
28397 int mem_base;
28398 xmlTextReaderPtr ret_val;
28399 xmlDocPtr doc; /* a preparsed document */
28400 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028401
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028402 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28403 mem_base = xmlMemBlocks();
28404 doc = gen_xmlDocPtr(n_doc, 0);
28405
28406 ret_val = xmlReaderWalker(doc);
28407 desret_xmlTextReaderPtr(ret_val);
28408 call_tests++;
28409 des_xmlDocPtr(n_doc, doc, 0);
28410 xmlResetLastError();
28411 if (mem_base != xmlMemBlocks()) {
28412 printf("Leak of %d blocks found in xmlReaderWalker",
28413 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028414 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028415 printf(" %d", n_doc);
28416 printf("\n");
28417 }
28418 }
28419#endif
28420
28421 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028422 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028423}
28424
28425
28426static int
28427test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028428 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028429
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028430#ifdef LIBXML_READER_ENABLED
28431 int mem_base;
28432 int ret_val;
28433 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28434 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028435
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028436 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28437 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028438 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028439
28440 ret_val = xmlTextReaderAttributeCount(reader);
28441 desret_int(ret_val);
28442 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028443 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028444 xmlResetLastError();
28445 if (mem_base != xmlMemBlocks()) {
28446 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
28447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028448 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028449 printf(" %d", n_reader);
28450 printf("\n");
28451 }
28452 }
28453#endif
28454
Daniel Veillard3d97e662004-11-04 10:49:00 +000028455 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028457}
28458
28459
28460static int
28461test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028463
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028464#ifdef LIBXML_READER_ENABLED
28465 int mem_base;
28466 xmlChar * ret_val;
28467 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28468 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028469
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028470 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28471 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028472 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028473
28474 ret_val = xmlTextReaderBaseUri(reader);
28475 desret_xmlChar_ptr(ret_val);
28476 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028477 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028478 xmlResetLastError();
28479 if (mem_base != xmlMemBlocks()) {
28480 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
28481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028482 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028483 printf(" %d", n_reader);
28484 printf("\n");
28485 }
28486 }
28487#endif
28488
Daniel Veillard3d97e662004-11-04 10:49:00 +000028489 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028491}
28492
28493
28494static int
28495test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028497
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028498#ifdef LIBXML_READER_ENABLED
28499 int mem_base;
28500 int ret_val;
28501 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28502 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028503
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028504 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28505 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028506 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028507
28508 ret_val = xmlTextReaderClose(reader);
28509 desret_int(ret_val);
28510 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028511 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028512 xmlResetLastError();
28513 if (mem_base != xmlMemBlocks()) {
28514 printf("Leak of %d blocks found in xmlTextReaderClose",
28515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028516 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028517 printf(" %d", n_reader);
28518 printf("\n");
28519 }
28520 }
28521#endif
28522
Daniel Veillard3d97e662004-11-04 10:49:00 +000028523 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028524 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028525}
28526
28527
28528static int
28529test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028530 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028531
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028532#ifdef LIBXML_READER_ENABLED
28533 int mem_base;
28534 const xmlChar * ret_val;
28535 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28536 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028537
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028538 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28539 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028540 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028541
28542 ret_val = xmlTextReaderConstBaseUri(reader);
28543 desret_const_xmlChar_ptr(ret_val);
28544 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028545 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028546 xmlResetLastError();
28547 if (mem_base != xmlMemBlocks()) {
28548 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
28549 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028550 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028551 printf(" %d", n_reader);
28552 printf("\n");
28553 }
28554 }
28555#endif
28556
Daniel Veillard3d97e662004-11-04 10:49:00 +000028557 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028559}
28560
28561
28562static int
28563test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028565
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028566#ifdef LIBXML_READER_ENABLED
28567 int mem_base;
28568 const xmlChar * ret_val;
28569 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28570 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028571
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028572 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28573 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028574 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028575
28576 ret_val = xmlTextReaderConstEncoding(reader);
28577 desret_const_xmlChar_ptr(ret_val);
28578 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028579 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028580 xmlResetLastError();
28581 if (mem_base != xmlMemBlocks()) {
28582 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
28583 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028584 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028585 printf(" %d", n_reader);
28586 printf("\n");
28587 }
28588 }
28589#endif
28590
Daniel Veillard3d97e662004-11-04 10:49:00 +000028591 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028593}
28594
28595
28596static int
28597test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028598 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028599
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028600#ifdef LIBXML_READER_ENABLED
28601 int mem_base;
28602 const xmlChar * ret_val;
28603 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28604 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028605
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028606 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28607 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028608 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028609
28610 ret_val = xmlTextReaderConstLocalName(reader);
28611 desret_const_xmlChar_ptr(ret_val);
28612 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028613 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028614 xmlResetLastError();
28615 if (mem_base != xmlMemBlocks()) {
28616 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
28617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028618 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028619 printf(" %d", n_reader);
28620 printf("\n");
28621 }
28622 }
28623#endif
28624
Daniel Veillard3d97e662004-11-04 10:49:00 +000028625 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028626 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028627}
28628
28629
28630static int
28631test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028632 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028633
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028634#ifdef LIBXML_READER_ENABLED
28635 int mem_base;
28636 const xmlChar * ret_val;
28637 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28638 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028639
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028640 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28641 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028642 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028643
28644 ret_val = xmlTextReaderConstName(reader);
28645 desret_const_xmlChar_ptr(ret_val);
28646 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028647 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028648 xmlResetLastError();
28649 if (mem_base != xmlMemBlocks()) {
28650 printf("Leak of %d blocks found in xmlTextReaderConstName",
28651 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028652 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028653 printf(" %d", n_reader);
28654 printf("\n");
28655 }
28656 }
28657#endif
28658
Daniel Veillard3d97e662004-11-04 10:49:00 +000028659 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028661}
28662
28663
28664static int
28665test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028667
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028668#ifdef LIBXML_READER_ENABLED
28669 int mem_base;
28670 const xmlChar * ret_val;
28671 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28672 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028673
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028674 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28675 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028676 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028677
28678 ret_val = xmlTextReaderConstNamespaceUri(reader);
28679 desret_const_xmlChar_ptr(ret_val);
28680 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028681 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028682 xmlResetLastError();
28683 if (mem_base != xmlMemBlocks()) {
28684 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
28685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028686 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028687 printf(" %d", n_reader);
28688 printf("\n");
28689 }
28690 }
28691#endif
28692
Daniel Veillard3d97e662004-11-04 10:49:00 +000028693 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028694 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028695}
28696
28697
28698static int
28699test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028700 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028701
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028702#ifdef LIBXML_READER_ENABLED
28703 int mem_base;
28704 const xmlChar * ret_val;
28705 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28706 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028707
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028708 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28709 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028710 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028711
28712 ret_val = xmlTextReaderConstPrefix(reader);
28713 desret_const_xmlChar_ptr(ret_val);
28714 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028715 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028716 xmlResetLastError();
28717 if (mem_base != xmlMemBlocks()) {
28718 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
28719 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028720 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028721 printf(" %d", n_reader);
28722 printf("\n");
28723 }
28724 }
28725#endif
28726
Daniel Veillard3d97e662004-11-04 10:49:00 +000028727 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028728 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028729}
28730
28731
28732static int
28733test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028735
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028736#ifdef LIBXML_READER_ENABLED
28737 int mem_base;
28738 const xmlChar * ret_val;
28739 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28740 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028741 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028742 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028743
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028744 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28745 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
28746 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028747 reader = gen_xmlTextReaderPtr(n_reader, 0);
28748 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028749
28750 ret_val = xmlTextReaderConstString(reader, str);
28751 desret_const_xmlChar_ptr(ret_val);
28752 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028753 des_xmlTextReaderPtr(n_reader, reader, 0);
28754 des_const_xmlChar_ptr(n_str, str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028755 xmlResetLastError();
28756 if (mem_base != xmlMemBlocks()) {
28757 printf("Leak of %d blocks found in xmlTextReaderConstString",
28758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028759 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028760 printf(" %d", n_reader);
28761 printf(" %d", n_str);
28762 printf("\n");
28763 }
28764 }
28765 }
28766#endif
28767
Daniel Veillard3d97e662004-11-04 10:49:00 +000028768 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028770}
28771
28772
28773static int
28774test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028776
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028777#ifdef LIBXML_READER_ENABLED
28778 int mem_base;
28779 const xmlChar * ret_val;
28780 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28781 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028782
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028783 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28784 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028785 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028786
28787 ret_val = xmlTextReaderConstValue(reader);
28788 desret_const_xmlChar_ptr(ret_val);
28789 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028790 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028791 xmlResetLastError();
28792 if (mem_base != xmlMemBlocks()) {
28793 printf("Leak of %d blocks found in xmlTextReaderConstValue",
28794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028795 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028796 printf(" %d", n_reader);
28797 printf("\n");
28798 }
28799 }
28800#endif
28801
Daniel Veillard3d97e662004-11-04 10:49:00 +000028802 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028803 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028804}
28805
28806
28807static int
28808test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028809 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028810
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028811#ifdef LIBXML_READER_ENABLED
28812 int mem_base;
28813 const xmlChar * ret_val;
28814 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28815 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028816
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028817 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28818 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028819 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028820
28821 ret_val = xmlTextReaderConstXmlLang(reader);
28822 desret_const_xmlChar_ptr(ret_val);
28823 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028824 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028825 xmlResetLastError();
28826 if (mem_base != xmlMemBlocks()) {
28827 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
28828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028829 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028830 printf(" %d", n_reader);
28831 printf("\n");
28832 }
28833 }
28834#endif
28835
Daniel Veillard3d97e662004-11-04 10:49:00 +000028836 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028838}
28839
28840
28841static int
28842test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028844
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028845#ifdef LIBXML_READER_ENABLED
28846 int mem_base;
28847 const xmlChar * ret_val;
28848 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28849 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028850
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028851 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28852 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028853 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028854
28855 ret_val = xmlTextReaderConstXmlVersion(reader);
28856 desret_const_xmlChar_ptr(ret_val);
28857 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028858 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028859 xmlResetLastError();
28860 if (mem_base != xmlMemBlocks()) {
28861 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
28862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028863 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028864 printf(" %d", n_reader);
28865 printf("\n");
28866 }
28867 }
28868#endif
28869
Daniel Veillard3d97e662004-11-04 10:49:00 +000028870 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028872}
28873
28874
28875static int
28876test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028878
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028879#ifdef LIBXML_READER_ENABLED
28880 int mem_base;
28881 xmlDocPtr ret_val;
28882 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28883 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028884
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028885 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28886 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028887 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028888
28889 ret_val = xmlTextReaderCurrentDoc(reader);
28890 desret_xmlDocPtr(ret_val);
28891 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028892 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028893 xmlResetLastError();
28894 if (mem_base != xmlMemBlocks()) {
28895 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
28896 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028897 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028898 printf(" %d", n_reader);
28899 printf("\n");
28900 }
28901 }
28902#endif
28903
Daniel Veillard3d97e662004-11-04 10:49:00 +000028904 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028906}
28907
28908
28909static int
28910test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028912
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028913#ifdef LIBXML_READER_ENABLED
28914 int mem_base;
28915 xmlNodePtr ret_val;
28916 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28917 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028918
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028919 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28920 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028921 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028922
28923 ret_val = xmlTextReaderCurrentNode(reader);
28924 desret_xmlNodePtr(ret_val);
28925 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028926 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028927 xmlResetLastError();
28928 if (mem_base != xmlMemBlocks()) {
28929 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
28930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028931 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028932 printf(" %d", n_reader);
28933 printf("\n");
28934 }
28935 }
28936#endif
28937
Daniel Veillard3d97e662004-11-04 10:49:00 +000028938 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028940}
28941
28942
28943static int
28944test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028946
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028947#ifdef LIBXML_READER_ENABLED
28948 int mem_base;
28949 int ret_val;
28950 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28951 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028952
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028953 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28954 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028955 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028956
28957 ret_val = xmlTextReaderDepth(reader);
28958 desret_int(ret_val);
28959 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028960 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028961 xmlResetLastError();
28962 if (mem_base != xmlMemBlocks()) {
28963 printf("Leak of %d blocks found in xmlTextReaderDepth",
28964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028965 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028966 printf(" %d", n_reader);
28967 printf("\n");
28968 }
28969 }
28970#endif
28971
Daniel Veillard3d97e662004-11-04 10:49:00 +000028972 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028973 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028974}
28975
28976
28977static int
28978test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028979 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028980
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028981#ifdef LIBXML_READER_ENABLED
28982 int mem_base;
28983 xmlNodePtr ret_val;
28984 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28985 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028986
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028987 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28988 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028989 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028990
28991 ret_val = xmlTextReaderExpand(reader);
28992 desret_xmlNodePtr(ret_val);
28993 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028994 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028995 xmlResetLastError();
28996 if (mem_base != xmlMemBlocks()) {
28997 printf("Leak of %d blocks found in xmlTextReaderExpand",
28998 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028999 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029000 printf(" %d", n_reader);
29001 printf("\n");
29002 }
29003 }
29004#endif
29005
Daniel Veillard3d97e662004-11-04 10:49:00 +000029006 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029007 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029008}
29009
29010
29011static int
29012test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029013 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029014
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029015#ifdef LIBXML_READER_ENABLED
29016 int mem_base;
29017 xmlChar * ret_val;
29018 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29019 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029020 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029021 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029022
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029023 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29024 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29025 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029026 reader = gen_xmlTextReaderPtr(n_reader, 0);
29027 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029028
29029 ret_val = xmlTextReaderGetAttribute(reader, name);
29030 desret_xmlChar_ptr(ret_val);
29031 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029032 des_xmlTextReaderPtr(n_reader, reader, 0);
29033 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029034 xmlResetLastError();
29035 if (mem_base != xmlMemBlocks()) {
29036 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29037 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029038 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029039 printf(" %d", n_reader);
29040 printf(" %d", n_name);
29041 printf("\n");
29042 }
29043 }
29044 }
29045#endif
29046
Daniel Veillard3d97e662004-11-04 10:49:00 +000029047 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029048 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029049}
29050
29051
29052static int
29053test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029054 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029055
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029056#ifdef LIBXML_READER_ENABLED
29057 int mem_base;
29058 xmlChar * ret_val;
29059 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29060 int n_reader;
29061 int no; /* the zero-based index of the attribute relative to the containing element */
29062 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029063
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029064 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29065 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29066 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029067 reader = gen_xmlTextReaderPtr(n_reader, 0);
29068 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029069
29070 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29071 desret_xmlChar_ptr(ret_val);
29072 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029073 des_xmlTextReaderPtr(n_reader, reader, 0);
29074 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029075 xmlResetLastError();
29076 if (mem_base != xmlMemBlocks()) {
29077 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29078 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029079 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029080 printf(" %d", n_reader);
29081 printf(" %d", n_no);
29082 printf("\n");
29083 }
29084 }
29085 }
29086#endif
29087
Daniel Veillard3d97e662004-11-04 10:49:00 +000029088 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029089 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029090}
29091
29092
29093static int
29094test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029095 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029096
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029097#ifdef LIBXML_READER_ENABLED
29098 int mem_base;
29099 xmlChar * ret_val;
29100 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29101 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029102 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029103 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029104 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029105 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029106
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029107 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29108 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29109 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29110 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029111 reader = gen_xmlTextReaderPtr(n_reader, 0);
29112 localName = gen_const_xmlChar_ptr(n_localName, 1);
29113 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029114
29115 ret_val = xmlTextReaderGetAttributeNs(reader, localName, namespaceURI);
29116 desret_xmlChar_ptr(ret_val);
29117 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029118 des_xmlTextReaderPtr(n_reader, reader, 0);
29119 des_const_xmlChar_ptr(n_localName, localName, 1);
29120 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029121 xmlResetLastError();
29122 if (mem_base != xmlMemBlocks()) {
29123 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029125 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029126 printf(" %d", n_reader);
29127 printf(" %d", n_localName);
29128 printf(" %d", n_namespaceURI);
29129 printf("\n");
29130 }
29131 }
29132 }
29133 }
29134#endif
29135
Daniel Veillard3d97e662004-11-04 10:49:00 +000029136 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029137 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029138}
29139
29140
Daniel Veillardce682bc2004-11-05 17:22:25 +000029141#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29142static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29143 return(NULL);
29144}
29145static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29146}
29147
Daniel Veillardd93f6252004-11-02 15:53:51 +000029148static int
29149test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029150 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029151
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029152#ifdef LIBXML_READER_ENABLED
29153 int mem_base;
29154 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29155 int n_reader;
29156 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29157 int n_f;
29158 void ** arg; /* a user argument */
29159 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029160
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029161 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29162 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29163 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29164 mem_base = xmlMemBlocks();
29165 reader = gen_xmlTextReaderPtr(n_reader, 0);
29166 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29167 arg = gen_void_ptr_ptr(n_arg, 2);
29168
29169 xmlTextReaderGetErrorHandler(reader, f, arg);
29170 call_tests++;
29171 des_xmlTextReaderPtr(n_reader, reader, 0);
29172 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29173 des_void_ptr_ptr(n_arg, arg, 2);
29174 xmlResetLastError();
29175 if (mem_base != xmlMemBlocks()) {
29176 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029178 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029179 printf(" %d", n_reader);
29180 printf(" %d", n_f);
29181 printf(" %d", n_arg);
29182 printf("\n");
29183 }
29184 }
29185 }
29186 }
29187#endif
29188
29189 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029190 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029191}
29192
29193
29194static int
29195test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029197
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029198#ifdef LIBXML_READER_ENABLED
29199 int mem_base;
29200 int ret_val;
29201 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29202 int n_reader;
29203 int prop; /* the xmlParserProperties to get */
29204 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029205
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029206 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29207 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29208 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029209 reader = gen_xmlTextReaderPtr(n_reader, 0);
29210 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029211
29212 ret_val = xmlTextReaderGetParserProp(reader, prop);
29213 desret_int(ret_val);
29214 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029215 des_xmlTextReaderPtr(n_reader, reader, 0);
29216 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029217 xmlResetLastError();
29218 if (mem_base != xmlMemBlocks()) {
29219 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
29220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029221 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029222 printf(" %d", n_reader);
29223 printf(" %d", n_prop);
29224 printf("\n");
29225 }
29226 }
29227 }
29228#endif
29229
Daniel Veillard3d97e662004-11-04 10:49:00 +000029230 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029232}
29233
29234
29235static int
29236test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029238
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029239#ifdef LIBXML_READER_ENABLED
29240 int mem_base;
29241 xmlParserInputBufferPtr ret_val;
29242 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29243 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029244
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029245 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29246 mem_base = xmlMemBlocks();
29247 reader = gen_xmlTextReaderPtr(n_reader, 0);
29248
29249 ret_val = xmlTextReaderGetRemainder(reader);
29250 desret_xmlParserInputBufferPtr(ret_val);
29251 call_tests++;
29252 des_xmlTextReaderPtr(n_reader, reader, 0);
29253 xmlResetLastError();
29254 if (mem_base != xmlMemBlocks()) {
29255 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
29256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029257 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029258 printf(" %d", n_reader);
29259 printf("\n");
29260 }
29261 }
29262#endif
29263
29264 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029266}
29267
29268
29269static int
29270test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029272
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029273#ifdef LIBXML_READER_ENABLED
29274 int mem_base;
29275 int ret_val;
29276 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29277 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029278
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029279 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29280 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029281 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029282
29283 ret_val = xmlTextReaderHasAttributes(reader);
29284 desret_int(ret_val);
29285 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029286 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029287 xmlResetLastError();
29288 if (mem_base != xmlMemBlocks()) {
29289 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
29290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029291 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029292 printf(" %d", n_reader);
29293 printf("\n");
29294 }
29295 }
29296#endif
29297
Daniel Veillard3d97e662004-11-04 10:49:00 +000029298 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029300}
29301
29302
29303static int
29304test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029306
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029307#ifdef LIBXML_READER_ENABLED
29308 int mem_base;
29309 int ret_val;
29310 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29311 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029312
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029313 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29314 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029315 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029316
29317 ret_val = xmlTextReaderHasValue(reader);
29318 desret_int(ret_val);
29319 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029320 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029321 xmlResetLastError();
29322 if (mem_base != xmlMemBlocks()) {
29323 printf("Leak of %d blocks found in xmlTextReaderHasValue",
29324 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029325 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029326 printf(" %d", n_reader);
29327 printf("\n");
29328 }
29329 }
29330#endif
29331
Daniel Veillard3d97e662004-11-04 10:49:00 +000029332 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029334}
29335
29336
29337static int
29338test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029340
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029341#ifdef LIBXML_READER_ENABLED
29342 int mem_base;
29343 int ret_val;
29344 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29345 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029346
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029347 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29348 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029349 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029350
29351 ret_val = xmlTextReaderIsDefault(reader);
29352 desret_int(ret_val);
29353 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029354 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029355 xmlResetLastError();
29356 if (mem_base != xmlMemBlocks()) {
29357 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
29358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029359 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029360 printf(" %d", n_reader);
29361 printf("\n");
29362 }
29363 }
29364#endif
29365
Daniel Veillard3d97e662004-11-04 10:49:00 +000029366 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029368}
29369
29370
29371static int
29372test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029373 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029374
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029375#ifdef LIBXML_READER_ENABLED
29376 int mem_base;
29377 int ret_val;
29378 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29379 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029380
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029381 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29382 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029383 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029384
29385 ret_val = xmlTextReaderIsEmptyElement(reader);
29386 desret_int(ret_val);
29387 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029388 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029389 xmlResetLastError();
29390 if (mem_base != xmlMemBlocks()) {
29391 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
29392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029393 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029394 printf(" %d", n_reader);
29395 printf("\n");
29396 }
29397 }
29398#endif
29399
Daniel Veillard3d97e662004-11-04 10:49:00 +000029400 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029402}
29403
29404
29405static int
29406test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029408
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029409#ifdef LIBXML_READER_ENABLED
29410 int mem_base;
29411 int ret_val;
29412 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29413 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029414
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029415 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29416 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029417 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029418
29419 ret_val = xmlTextReaderIsNamespaceDecl(reader);
29420 desret_int(ret_val);
29421 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029422 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029423 xmlResetLastError();
29424 if (mem_base != xmlMemBlocks()) {
29425 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
29426 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029427 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029428 printf(" %d", n_reader);
29429 printf("\n");
29430 }
29431 }
29432#endif
29433
Daniel Veillard3d97e662004-11-04 10:49:00 +000029434 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029435 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029436}
29437
29438
29439static int
29440test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029441 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029442
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029443#ifdef LIBXML_READER_ENABLED
29444 int mem_base;
29445 int ret_val;
29446 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29447 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029448
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029449 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29450 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029451 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029452
29453 ret_val = xmlTextReaderIsValid(reader);
29454 desret_int(ret_val);
29455 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029456 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029457 xmlResetLastError();
29458 if (mem_base != xmlMemBlocks()) {
29459 printf("Leak of %d blocks found in xmlTextReaderIsValid",
29460 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029461 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029462 printf(" %d", n_reader);
29463 printf("\n");
29464 }
29465 }
29466#endif
29467
Daniel Veillard3d97e662004-11-04 10:49:00 +000029468 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029469 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029470}
29471
29472
29473static int
29474test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029475 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029476
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029477#ifdef LIBXML_READER_ENABLED
29478 int mem_base;
29479 xmlChar * ret_val;
29480 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29481 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029482
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029483 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29484 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029485 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029486
29487 ret_val = xmlTextReaderLocalName(reader);
29488 desret_xmlChar_ptr(ret_val);
29489 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029490 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029491 xmlResetLastError();
29492 if (mem_base != xmlMemBlocks()) {
29493 printf("Leak of %d blocks found in xmlTextReaderLocalName",
29494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029495 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029496 printf(" %d", n_reader);
29497 printf("\n");
29498 }
29499 }
29500#endif
29501
Daniel Veillard3d97e662004-11-04 10:49:00 +000029502 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029503 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029504}
29505
29506
Daniel Veillardce682bc2004-11-05 17:22:25 +000029507#define gen_nb_xmlTextReaderLocatorPtr 1
29508static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29509 return(NULL);
29510}
29511static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29512}
29513
Daniel Veillardd93f6252004-11-02 15:53:51 +000029514static int
29515test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029516 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029517
Daniel Veillardce682bc2004-11-05 17:22:25 +000029518#ifdef LIBXML_READER_ENABLED
29519 int mem_base;
29520 xmlChar * ret_val;
29521 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
29522 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029523
Daniel Veillardce682bc2004-11-05 17:22:25 +000029524 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
29525 mem_base = xmlMemBlocks();
29526 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
29527
29528 ret_val = xmlTextReaderLocatorBaseURI(locator);
29529 desret_xmlChar_ptr(ret_val);
29530 call_tests++;
29531 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
29532 xmlResetLastError();
29533 if (mem_base != xmlMemBlocks()) {
29534 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
29535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029536 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029537 printf(" %d", n_locator);
29538 printf("\n");
29539 }
29540 }
29541#endif
29542
29543 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029545}
29546
29547
29548static int
29549test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029551
Daniel Veillardce682bc2004-11-05 17:22:25 +000029552#ifdef LIBXML_READER_ENABLED
29553 int mem_base;
29554 int ret_val;
29555 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
29556 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029557
Daniel Veillardce682bc2004-11-05 17:22:25 +000029558 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
29559 mem_base = xmlMemBlocks();
29560 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
29561
29562 ret_val = xmlTextReaderLocatorLineNumber(locator);
29563 desret_int(ret_val);
29564 call_tests++;
29565 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
29566 xmlResetLastError();
29567 if (mem_base != xmlMemBlocks()) {
29568 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
29569 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029570 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029571 printf(" %d", n_locator);
29572 printf("\n");
29573 }
29574 }
29575#endif
29576
29577 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029578 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029579}
29580
29581
29582static int
29583test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029584 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029585
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029586#ifdef LIBXML_READER_ENABLED
29587 int mem_base;
29588 xmlChar * ret_val;
29589 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29590 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029591 xmlChar * prefix; /* the prefix whose namespace URI is to be resolved. To return the default namespace, specify NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029592 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029593
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029594 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29595 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
29596 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029597 reader = gen_xmlTextReaderPtr(n_reader, 0);
29598 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029599
29600 ret_val = xmlTextReaderLookupNamespace(reader, prefix);
29601 desret_xmlChar_ptr(ret_val);
29602 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029603 des_xmlTextReaderPtr(n_reader, reader, 0);
29604 des_const_xmlChar_ptr(n_prefix, prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029605 xmlResetLastError();
29606 if (mem_base != xmlMemBlocks()) {
29607 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
29608 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029609 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029610 printf(" %d", n_reader);
29611 printf(" %d", n_prefix);
29612 printf("\n");
29613 }
29614 }
29615 }
29616#endif
29617
Daniel Veillard3d97e662004-11-04 10:49:00 +000029618 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029620}
29621
29622
29623static int
29624test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029626
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029627#ifdef LIBXML_READER_ENABLED
29628 int mem_base;
29629 int ret_val;
29630 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29631 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029632 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029633 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029634
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029635 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29636 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29637 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029638 reader = gen_xmlTextReaderPtr(n_reader, 0);
29639 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029640
29641 ret_val = xmlTextReaderMoveToAttribute(reader, name);
29642 desret_int(ret_val);
29643 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029644 des_xmlTextReaderPtr(n_reader, reader, 0);
29645 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029646 xmlResetLastError();
29647 if (mem_base != xmlMemBlocks()) {
29648 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
29649 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029650 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029651 printf(" %d", n_reader);
29652 printf(" %d", n_name);
29653 printf("\n");
29654 }
29655 }
29656 }
29657#endif
29658
Daniel Veillard3d97e662004-11-04 10:49:00 +000029659 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029661}
29662
29663
29664static int
29665test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029667
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029668#ifdef LIBXML_READER_ENABLED
29669 int mem_base;
29670 int ret_val;
29671 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29672 int n_reader;
29673 int no; /* the zero-based index of the attribute relative to the containing element. */
29674 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029675
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029676 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29677 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29678 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029679 reader = gen_xmlTextReaderPtr(n_reader, 0);
29680 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029681
29682 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
29683 desret_int(ret_val);
29684 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029685 des_xmlTextReaderPtr(n_reader, reader, 0);
29686 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029687 xmlResetLastError();
29688 if (mem_base != xmlMemBlocks()) {
29689 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
29690 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029691 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029692 printf(" %d", n_reader);
29693 printf(" %d", n_no);
29694 printf("\n");
29695 }
29696 }
29697 }
29698#endif
29699
Daniel Veillard3d97e662004-11-04 10:49:00 +000029700 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029701 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029702}
29703
29704
29705static int
29706test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029707 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029708
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029709#ifdef LIBXML_READER_ENABLED
29710 int mem_base;
29711 int ret_val;
29712 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29713 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029714 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029715 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029716 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029717 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029718
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029719 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29720 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29721 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29722 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029723 reader = gen_xmlTextReaderPtr(n_reader, 0);
29724 localName = gen_const_xmlChar_ptr(n_localName, 1);
29725 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029726
29727 ret_val = xmlTextReaderMoveToAttributeNs(reader, localName, namespaceURI);
29728 desret_int(ret_val);
29729 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029730 des_xmlTextReaderPtr(n_reader, reader, 0);
29731 des_const_xmlChar_ptr(n_localName, localName, 1);
29732 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029733 xmlResetLastError();
29734 if (mem_base != xmlMemBlocks()) {
29735 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
29736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029737 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029738 printf(" %d", n_reader);
29739 printf(" %d", n_localName);
29740 printf(" %d", n_namespaceURI);
29741 printf("\n");
29742 }
29743 }
29744 }
29745 }
29746#endif
29747
Daniel Veillard3d97e662004-11-04 10:49:00 +000029748 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029749 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029750}
29751
29752
29753static int
29754test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029755 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029756
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029757#ifdef LIBXML_READER_ENABLED
29758 int mem_base;
29759 int ret_val;
29760 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29761 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029762
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029763 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29764 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029765 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029766
29767 ret_val = xmlTextReaderMoveToElement(reader);
29768 desret_int(ret_val);
29769 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029770 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029771 xmlResetLastError();
29772 if (mem_base != xmlMemBlocks()) {
29773 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
29774 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029775 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029776 printf(" %d", n_reader);
29777 printf("\n");
29778 }
29779 }
29780#endif
29781
Daniel Veillard3d97e662004-11-04 10:49:00 +000029782 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029783 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029784}
29785
29786
29787static int
29788test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029789 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029790
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029791#ifdef LIBXML_READER_ENABLED
29792 int mem_base;
29793 int ret_val;
29794 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29795 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029796
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029797 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29798 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029799 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029800
29801 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
29802 desret_int(ret_val);
29803 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029804 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029805 xmlResetLastError();
29806 if (mem_base != xmlMemBlocks()) {
29807 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
29808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029809 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029810 printf(" %d", n_reader);
29811 printf("\n");
29812 }
29813 }
29814#endif
29815
Daniel Veillard3d97e662004-11-04 10:49:00 +000029816 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029817 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029818}
29819
29820
29821static int
29822test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029823 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029824
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029825#ifdef LIBXML_READER_ENABLED
29826 int mem_base;
29827 int ret_val;
29828 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29829 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029830
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029831 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29832 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029833 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029834
29835 ret_val = xmlTextReaderMoveToNextAttribute(reader);
29836 desret_int(ret_val);
29837 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029838 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029839 xmlResetLastError();
29840 if (mem_base != xmlMemBlocks()) {
29841 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
29842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029843 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029844 printf(" %d", n_reader);
29845 printf("\n");
29846 }
29847 }
29848#endif
29849
Daniel Veillard3d97e662004-11-04 10:49:00 +000029850 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029852}
29853
29854
29855static int
29856test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029858
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029859#ifdef LIBXML_READER_ENABLED
29860 int mem_base;
29861 xmlChar * ret_val;
29862 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29863 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029864
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029865 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29866 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029867 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029868
29869 ret_val = xmlTextReaderName(reader);
29870 desret_xmlChar_ptr(ret_val);
29871 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029872 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029873 xmlResetLastError();
29874 if (mem_base != xmlMemBlocks()) {
29875 printf("Leak of %d blocks found in xmlTextReaderName",
29876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029877 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029878 printf(" %d", n_reader);
29879 printf("\n");
29880 }
29881 }
29882#endif
29883
Daniel Veillard3d97e662004-11-04 10:49:00 +000029884 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029885 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029886}
29887
29888
29889static int
29890test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029892
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029893#ifdef LIBXML_READER_ENABLED
29894 int mem_base;
29895 xmlChar * ret_val;
29896 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29897 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029898
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029899 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29900 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029901 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029902
29903 ret_val = xmlTextReaderNamespaceUri(reader);
29904 desret_xmlChar_ptr(ret_val);
29905 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029906 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029907 xmlResetLastError();
29908 if (mem_base != xmlMemBlocks()) {
29909 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
29910 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029911 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029912 printf(" %d", n_reader);
29913 printf("\n");
29914 }
29915 }
29916#endif
29917
Daniel Veillard3d97e662004-11-04 10:49:00 +000029918 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029919 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029920}
29921
29922
29923static int
29924test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029925 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029926
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029927#ifdef LIBXML_READER_ENABLED
29928 int mem_base;
29929 int ret_val;
29930 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29931 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029932
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029933 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29934 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029935 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029936
29937 ret_val = xmlTextReaderNext(reader);
29938 desret_int(ret_val);
29939 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029940 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029941 xmlResetLastError();
29942 if (mem_base != xmlMemBlocks()) {
29943 printf("Leak of %d blocks found in xmlTextReaderNext",
29944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029945 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029946 printf(" %d", n_reader);
29947 printf("\n");
29948 }
29949 }
29950#endif
29951
Daniel Veillard3d97e662004-11-04 10:49:00 +000029952 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029954}
29955
29956
29957static int
29958test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029960
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029961#ifdef LIBXML_READER_ENABLED
29962 int mem_base;
29963 int ret_val;
29964 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29965 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029966
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029967 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29968 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029969 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029970
29971 ret_val = xmlTextReaderNextSibling(reader);
29972 desret_int(ret_val);
29973 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029974 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029975 xmlResetLastError();
29976 if (mem_base != xmlMemBlocks()) {
29977 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
29978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029979 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029980 printf(" %d", n_reader);
29981 printf("\n");
29982 }
29983 }
29984#endif
29985
Daniel Veillard3d97e662004-11-04 10:49:00 +000029986 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029988}
29989
29990
29991static int
29992test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029994
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029995#ifdef LIBXML_READER_ENABLED
29996 int mem_base;
29997 int ret_val;
29998 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29999 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030000
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030001 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30002 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030003 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030004
30005 ret_val = xmlTextReaderNodeType(reader);
30006 desret_int(ret_val);
30007 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030008 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030009 xmlResetLastError();
30010 if (mem_base != xmlMemBlocks()) {
30011 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30012 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030013 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030014 printf(" %d", n_reader);
30015 printf("\n");
30016 }
30017 }
30018#endif
30019
Daniel Veillard3d97e662004-11-04 10:49:00 +000030020 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030021 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030022}
30023
30024
30025static int
30026test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030027 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030028
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030029#ifdef LIBXML_READER_ENABLED
30030 int mem_base;
30031 int ret_val;
30032 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30033 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030034
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030035 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30036 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030037 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030038
30039 ret_val = xmlTextReaderNormalization(reader);
30040 desret_int(ret_val);
30041 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030042 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030043 xmlResetLastError();
30044 if (mem_base != xmlMemBlocks()) {
30045 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030047 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030048 printf(" %d", n_reader);
30049 printf("\n");
30050 }
30051 }
30052#endif
30053
Daniel Veillard3d97e662004-11-04 10:49:00 +000030054 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030056}
30057
30058
30059static int
30060test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030062
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030063#ifdef LIBXML_READER_ENABLED
30064 int mem_base;
30065 xmlChar * ret_val;
30066 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30067 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030068
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030069 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30070 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030071 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030072
30073 ret_val = xmlTextReaderPrefix(reader);
30074 desret_xmlChar_ptr(ret_val);
30075 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030076 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030077 xmlResetLastError();
30078 if (mem_base != xmlMemBlocks()) {
30079 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030081 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030082 printf(" %d", n_reader);
30083 printf("\n");
30084 }
30085 }
30086#endif
30087
Daniel Veillard3d97e662004-11-04 10:49:00 +000030088 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030089 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030090}
30091
30092
30093static int
30094test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030095 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030096
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030097#ifdef LIBXML_READER_ENABLED
30098 int mem_base;
30099 xmlNodePtr ret_val;
30100 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30101 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030102
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030103 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30104 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030105 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030106
30107 ret_val = xmlTextReaderPreserve(reader);
30108 desret_xmlNodePtr(ret_val);
30109 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030110 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030111 xmlResetLastError();
30112 if (mem_base != xmlMemBlocks()) {
30113 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30114 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030115 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030116 printf(" %d", n_reader);
30117 printf("\n");
30118 }
30119 }
30120#endif
30121
Daniel Veillard3d97e662004-11-04 10:49:00 +000030122 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030124}
30125
30126
30127static int
30128test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030130
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030131#ifdef LIBXML_READER_ENABLED
30132 int mem_base;
30133 int ret_val;
30134 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30135 int n_reader;
30136 xmlChar * pattern; /* an XPath subset pattern */
30137 int n_pattern;
30138 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30139 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030140
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030141 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30142 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30143 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30144 mem_base = xmlMemBlocks();
30145 reader = gen_xmlTextReaderPtr(n_reader, 0);
30146 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30147 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30148
30149 ret_val = xmlTextReaderPreservePattern(reader, pattern, namespaces);
30150 desret_int(ret_val);
30151 call_tests++;
30152 des_xmlTextReaderPtr(n_reader, reader, 0);
30153 des_const_xmlChar_ptr(n_pattern, pattern, 1);
30154 des_const_xmlChar_ptr_ptr(n_namespaces, namespaces, 2);
30155 xmlResetLastError();
30156 if (mem_base != xmlMemBlocks()) {
30157 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030159 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030160 printf(" %d", n_reader);
30161 printf(" %d", n_pattern);
30162 printf(" %d", n_namespaces);
30163 printf("\n");
30164 }
30165 }
30166 }
30167 }
30168#endif
30169
30170 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030171 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030172}
30173
30174
30175static int
30176test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030177 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030178
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030179#ifdef LIBXML_READER_ENABLED
30180 int mem_base;
30181 int ret_val;
30182 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30183 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030184
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030185 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30186 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030187 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030188
30189 ret_val = xmlTextReaderQuoteChar(reader);
30190 desret_int(ret_val);
30191 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030192 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030193 xmlResetLastError();
30194 if (mem_base != xmlMemBlocks()) {
30195 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030197 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030198 printf(" %d", n_reader);
30199 printf("\n");
30200 }
30201 }
30202#endif
30203
Daniel Veillard3d97e662004-11-04 10:49:00 +000030204 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030206}
30207
30208
30209static int
30210test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030212
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030213#ifdef LIBXML_READER_ENABLED
30214 int mem_base;
30215 int ret_val;
30216 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30217 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030218
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030219 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30220 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030221 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030222
30223 ret_val = xmlTextReaderRead(reader);
30224 desret_int(ret_val);
30225 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030226 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030227 xmlResetLastError();
30228 if (mem_base != xmlMemBlocks()) {
30229 printf("Leak of %d blocks found in xmlTextReaderRead",
30230 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030231 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030232 printf(" %d", n_reader);
30233 printf("\n");
30234 }
30235 }
30236#endif
30237
Daniel Veillard3d97e662004-11-04 10:49:00 +000030238 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030239 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030240}
30241
30242
30243static int
30244test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030245 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030246
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030247#ifdef LIBXML_READER_ENABLED
30248 int mem_base;
30249 int ret_val;
30250 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30251 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030252
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030253 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30254 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030255 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030256
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030257 ret_val = xmlTextReaderReadAttributeValue(reader);
30258 desret_int(ret_val);
30259 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030260 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030261 xmlResetLastError();
30262 if (mem_base != xmlMemBlocks()) {
30263 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
30264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030265 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030266 printf(" %d", n_reader);
30267 printf("\n");
30268 }
30269 }
30270#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030271
Daniel Veillard3d97e662004-11-04 10:49:00 +000030272 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030274}
30275
30276
30277static int
30278test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030280
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030281#ifdef LIBXML_READER_ENABLED
30282 int mem_base;
30283 int ret_val;
30284 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30285 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030286
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030287 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30288 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030289 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030290
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030291 ret_val = xmlTextReaderReadState(reader);
30292 desret_int(ret_val);
30293 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030294 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030295 xmlResetLastError();
30296 if (mem_base != xmlMemBlocks()) {
30297 printf("Leak of %d blocks found in xmlTextReaderReadState",
30298 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030299 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030300 printf(" %d", n_reader);
30301 printf("\n");
30302 }
30303 }
30304#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030305
Daniel Veillard3d97e662004-11-04 10:49:00 +000030306 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030308}
30309
30310
30311static int
30312test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030314
Daniel Veillardce682bc2004-11-05 17:22:25 +000030315#ifdef LIBXML_READER_ENABLED
30316#ifdef LIBXML_SCHEMAS_ENABLED
30317 int mem_base;
30318 int ret_val;
30319 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30320 int n_reader;
30321 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
30322 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030323
Daniel Veillardce682bc2004-11-05 17:22:25 +000030324 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30325 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
30326 mem_base = xmlMemBlocks();
30327 reader = gen_xmlTextReaderPtr(n_reader, 0);
30328 schema = gen_xmlRelaxNGPtr(n_schema, 1);
30329
30330 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
30331 desret_int(ret_val);
30332 call_tests++;
30333 des_xmlTextReaderPtr(n_reader, reader, 0);
30334 des_xmlRelaxNGPtr(n_schema, schema, 1);
30335 xmlResetLastError();
30336 if (mem_base != xmlMemBlocks()) {
30337 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
30338 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030339 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030340 printf(" %d", n_reader);
30341 printf(" %d", n_schema);
30342 printf("\n");
30343 }
30344 }
30345 }
30346#endif
30347#endif
30348
30349 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030351}
30352
30353
30354static int
30355test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030357
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030358#ifdef LIBXML_READER_ENABLED
30359#ifdef LIBXML_SCHEMAS_ENABLED
30360 int mem_base;
30361 int ret_val;
30362 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30363 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030364 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030365 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030366
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030367 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30368 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
30369 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030370 reader = gen_xmlTextReaderPtr(n_reader, 0);
30371 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030372
30373 ret_val = xmlTextReaderRelaxNGValidate(reader, rng);
30374 desret_int(ret_val);
30375 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030376 des_xmlTextReaderPtr(n_reader, reader, 0);
30377 des_const_char_ptr(n_rng, rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030378 xmlResetLastError();
30379 if (mem_base != xmlMemBlocks()) {
30380 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
30381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030382 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030383 printf(" %d", n_reader);
30384 printf(" %d", n_rng);
30385 printf("\n");
30386 }
30387 }
30388 }
30389#endif
30390#endif
30391
Daniel Veillard3d97e662004-11-04 10:49:00 +000030392 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030394}
30395
30396
30397static int
30398test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030399 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030400
30401
30402 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030403 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030404}
30405
30406
30407static int
30408test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030409 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030410
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030411#ifdef LIBXML_READER_ENABLED
30412 int mem_base;
30413 int ret_val;
30414 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30415 int n_reader;
30416 int prop; /* the xmlParserProperties to set */
30417 int n_prop;
30418 int value; /* usually 0 or 1 to (de)activate it */
30419 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030420
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030421 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30422 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
30423 for (n_value = 0;n_value < gen_nb_int;n_value++) {
30424 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030425 reader = gen_xmlTextReaderPtr(n_reader, 0);
30426 prop = gen_int(n_prop, 1);
30427 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030428
30429 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
30430 desret_int(ret_val);
30431 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030432 des_xmlTextReaderPtr(n_reader, reader, 0);
30433 des_int(n_prop, prop, 1);
30434 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030435 xmlResetLastError();
30436 if (mem_base != xmlMemBlocks()) {
30437 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
30438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030439 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030440 printf(" %d", n_reader);
30441 printf(" %d", n_prop);
30442 printf(" %d", n_value);
30443 printf("\n");
30444 }
30445 }
30446 }
30447 }
30448#endif
30449
Daniel Veillard3d97e662004-11-04 10:49:00 +000030450 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030452}
30453
30454
30455static int
30456test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030458
30459
30460 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030461 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030462}
30463
30464
30465static int
30466test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030467 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030468
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030469#ifdef LIBXML_READER_ENABLED
30470 int mem_base;
30471 int ret_val;
30472 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30473 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030474
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030475 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30476 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030477 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030478
30479 ret_val = xmlTextReaderStandalone(reader);
30480 desret_int(ret_val);
30481 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030482 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030483 xmlResetLastError();
30484 if (mem_base != xmlMemBlocks()) {
30485 printf("Leak of %d blocks found in xmlTextReaderStandalone",
30486 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030487 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030488 printf(" %d", n_reader);
30489 printf("\n");
30490 }
30491 }
30492#endif
30493
Daniel Veillard3d97e662004-11-04 10:49:00 +000030494 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030495 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030496}
30497
30498
30499static int
30500test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030501 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030502
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030503#ifdef LIBXML_READER_ENABLED
30504 int mem_base;
30505 xmlChar * ret_val;
30506 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30507 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030508
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030509 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30510 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030511 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030512
30513 ret_val = xmlTextReaderValue(reader);
30514 desret_xmlChar_ptr(ret_val);
30515 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030516 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030517 xmlResetLastError();
30518 if (mem_base != xmlMemBlocks()) {
30519 printf("Leak of %d blocks found in xmlTextReaderValue",
30520 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030521 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030522 printf(" %d", n_reader);
30523 printf("\n");
30524 }
30525 }
30526#endif
30527
Daniel Veillard3d97e662004-11-04 10:49:00 +000030528 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030530}
30531
30532
30533static int
30534test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030536
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030537#ifdef LIBXML_READER_ENABLED
30538 int mem_base;
30539 xmlChar * ret_val;
30540 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30541 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030542
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030543 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30544 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030545 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030546
30547 ret_val = xmlTextReaderXmlLang(reader);
30548 desret_xmlChar_ptr(ret_val);
30549 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030550 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030551 xmlResetLastError();
30552 if (mem_base != xmlMemBlocks()) {
30553 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
30554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030555 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030556 printf(" %d", n_reader);
30557 printf("\n");
30558 }
30559 }
30560#endif
30561
Daniel Veillard3d97e662004-11-04 10:49:00 +000030562 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030564}
30565
30566static int
30567test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030569
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030570 printf("Testing xmlreader : 68 of 78 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000030571 test_ret += test_xmlNewTextReader();
30572 test_ret += test_xmlNewTextReaderFilename();
30573 test_ret += test_xmlReaderForDoc();
30574 test_ret += test_xmlReaderForFile();
30575 test_ret += test_xmlReaderForMemory();
30576 test_ret += test_xmlReaderNewDoc();
30577 test_ret += test_xmlReaderNewFile();
30578 test_ret += test_xmlReaderNewMemory();
30579 test_ret += test_xmlReaderNewWalker();
30580 test_ret += test_xmlReaderWalker();
30581 test_ret += test_xmlTextReaderAttributeCount();
30582 test_ret += test_xmlTextReaderBaseUri();
30583 test_ret += test_xmlTextReaderClose();
30584 test_ret += test_xmlTextReaderConstBaseUri();
30585 test_ret += test_xmlTextReaderConstEncoding();
30586 test_ret += test_xmlTextReaderConstLocalName();
30587 test_ret += test_xmlTextReaderConstName();
30588 test_ret += test_xmlTextReaderConstNamespaceUri();
30589 test_ret += test_xmlTextReaderConstPrefix();
30590 test_ret += test_xmlTextReaderConstString();
30591 test_ret += test_xmlTextReaderConstValue();
30592 test_ret += test_xmlTextReaderConstXmlLang();
30593 test_ret += test_xmlTextReaderConstXmlVersion();
30594 test_ret += test_xmlTextReaderCurrentDoc();
30595 test_ret += test_xmlTextReaderCurrentNode();
30596 test_ret += test_xmlTextReaderDepth();
30597 test_ret += test_xmlTextReaderExpand();
30598 test_ret += test_xmlTextReaderGetAttribute();
30599 test_ret += test_xmlTextReaderGetAttributeNo();
30600 test_ret += test_xmlTextReaderGetAttributeNs();
30601 test_ret += test_xmlTextReaderGetErrorHandler();
30602 test_ret += test_xmlTextReaderGetParserProp();
30603 test_ret += test_xmlTextReaderGetRemainder();
30604 test_ret += test_xmlTextReaderHasAttributes();
30605 test_ret += test_xmlTextReaderHasValue();
30606 test_ret += test_xmlTextReaderIsDefault();
30607 test_ret += test_xmlTextReaderIsEmptyElement();
30608 test_ret += test_xmlTextReaderIsNamespaceDecl();
30609 test_ret += test_xmlTextReaderIsValid();
30610 test_ret += test_xmlTextReaderLocalName();
30611 test_ret += test_xmlTextReaderLocatorBaseURI();
30612 test_ret += test_xmlTextReaderLocatorLineNumber();
30613 test_ret += test_xmlTextReaderLookupNamespace();
30614 test_ret += test_xmlTextReaderMoveToAttribute();
30615 test_ret += test_xmlTextReaderMoveToAttributeNo();
30616 test_ret += test_xmlTextReaderMoveToAttributeNs();
30617 test_ret += test_xmlTextReaderMoveToElement();
30618 test_ret += test_xmlTextReaderMoveToFirstAttribute();
30619 test_ret += test_xmlTextReaderMoveToNextAttribute();
30620 test_ret += test_xmlTextReaderName();
30621 test_ret += test_xmlTextReaderNamespaceUri();
30622 test_ret += test_xmlTextReaderNext();
30623 test_ret += test_xmlTextReaderNextSibling();
30624 test_ret += test_xmlTextReaderNodeType();
30625 test_ret += test_xmlTextReaderNormalization();
30626 test_ret += test_xmlTextReaderPrefix();
30627 test_ret += test_xmlTextReaderPreserve();
30628 test_ret += test_xmlTextReaderPreservePattern();
30629 test_ret += test_xmlTextReaderQuoteChar();
30630 test_ret += test_xmlTextReaderRead();
30631 test_ret += test_xmlTextReaderReadAttributeValue();
30632 test_ret += test_xmlTextReaderReadState();
30633 test_ret += test_xmlTextReaderRelaxNGSetSchema();
30634 test_ret += test_xmlTextReaderRelaxNGValidate();
30635 test_ret += test_xmlTextReaderSetErrorHandler();
30636 test_ret += test_xmlTextReaderSetParserProp();
30637 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
30638 test_ret += test_xmlTextReaderStandalone();
30639 test_ret += test_xmlTextReaderValue();
30640 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000030641
Daniel Veillard42595322004-11-08 10:52:06 +000030642 if (test_ret != 0)
30643 printf("Module xmlreader: %d errors\n", test_ret);
30644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030645}
30646
Daniel Veillarda82b1822004-11-08 16:24:57 +000030647#define gen_nb_xmlRegExecCtxtPtr 1
30648static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30649 return(NULL);
30650}
30651static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30652}
30653
30654static int
30655test_xmlRegExecPushString(void) {
30656 int test_ret = 0;
30657
30658#ifdef LIBXML_REGEXP_ENABLED
30659 int mem_base;
30660 int ret_val;
30661 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
30662 int n_exec;
30663 xmlChar * value; /* a string token input */
30664 int n_value;
30665 void * data; /* data associated to the token to reuse in callbacks */
30666 int n_data;
30667
30668 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
30669 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
30670 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
30671 mem_base = xmlMemBlocks();
30672 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
30673 value = gen_const_xmlChar_ptr(n_value, 1);
30674 data = gen_userdata(n_data, 2);
30675
30676 ret_val = xmlRegExecPushString(exec, value, data);
30677 desret_int(ret_val);
30678 call_tests++;
30679 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
30680 des_const_xmlChar_ptr(n_value, value, 1);
30681 des_userdata(n_data, data, 2);
30682 xmlResetLastError();
30683 if (mem_base != xmlMemBlocks()) {
30684 printf("Leak of %d blocks found in xmlRegExecPushString",
30685 xmlMemBlocks() - mem_base);
30686 test_ret++;
30687 printf(" %d", n_exec);
30688 printf(" %d", n_value);
30689 printf(" %d", n_data);
30690 printf("\n");
30691 }
30692 }
30693 }
30694 }
30695#endif
30696
30697 function_tests++;
30698 return(test_ret);
30699}
30700
30701
30702static int
30703test_xmlRegExecPushString2(void) {
30704 int test_ret = 0;
30705
30706#ifdef LIBXML_REGEXP_ENABLED
30707 int mem_base;
30708 int ret_val;
30709 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
30710 int n_exec;
30711 xmlChar * value; /* the first string token input */
30712 int n_value;
30713 xmlChar * value2; /* the second string token input */
30714 int n_value2;
30715 void * data; /* data associated to the token to reuse in callbacks */
30716 int n_data;
30717
30718 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
30719 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
30720 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
30721 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
30722 mem_base = xmlMemBlocks();
30723 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
30724 value = gen_const_xmlChar_ptr(n_value, 1);
30725 value2 = gen_const_xmlChar_ptr(n_value2, 2);
30726 data = gen_userdata(n_data, 3);
30727
30728 ret_val = xmlRegExecPushString2(exec, value, value2, data);
30729 desret_int(ret_val);
30730 call_tests++;
30731 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
30732 des_const_xmlChar_ptr(n_value, value, 1);
30733 des_const_xmlChar_ptr(n_value2, value2, 2);
30734 des_userdata(n_data, data, 3);
30735 xmlResetLastError();
30736 if (mem_base != xmlMemBlocks()) {
30737 printf("Leak of %d blocks found in xmlRegExecPushString2",
30738 xmlMemBlocks() - mem_base);
30739 test_ret++;
30740 printf(" %d", n_exec);
30741 printf(" %d", n_value);
30742 printf(" %d", n_value2);
30743 printf(" %d", n_data);
30744 printf("\n");
30745 }
30746 }
30747 }
30748 }
30749 }
30750#endif
30751
30752 function_tests++;
30753 return(test_ret);
30754}
30755
30756
30757#define gen_nb_xmlRegexpPtr 1
30758static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30759 return(NULL);
30760}
30761static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30762}
30763
30764static int
30765test_xmlRegNewExecCtxt(void) {
30766 int test_ret = 0;
30767
30768
30769 /* missing type support */
30770 return(test_ret);
30771}
30772
30773
30774static int
30775test_xmlRegexpCompile(void) {
30776 int test_ret = 0;
30777
30778
30779 /* missing type support */
30780 return(test_ret);
30781}
30782
30783
30784static int
30785test_xmlRegexpExec(void) {
30786 int test_ret = 0;
30787
30788#ifdef LIBXML_REGEXP_ENABLED
30789 int mem_base;
30790 int ret_val;
30791 xmlRegexpPtr comp; /* the compiled regular expression */
30792 int n_comp;
30793 xmlChar * content; /* the value to check against the regular expression */
30794 int n_content;
30795
30796 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
30797 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
30798 mem_base = xmlMemBlocks();
30799 comp = gen_xmlRegexpPtr(n_comp, 0);
30800 content = gen_const_xmlChar_ptr(n_content, 1);
30801
30802 ret_val = xmlRegexpExec(comp, content);
30803 desret_int(ret_val);
30804 call_tests++;
30805 des_xmlRegexpPtr(n_comp, comp, 0);
30806 des_const_xmlChar_ptr(n_content, content, 1);
30807 xmlResetLastError();
30808 if (mem_base != xmlMemBlocks()) {
30809 printf("Leak of %d blocks found in xmlRegexpExec",
30810 xmlMemBlocks() - mem_base);
30811 test_ret++;
30812 printf(" %d", n_comp);
30813 printf(" %d", n_content);
30814 printf("\n");
30815 }
30816 }
30817 }
30818#endif
30819
30820 function_tests++;
30821 return(test_ret);
30822}
30823
30824
30825static int
30826test_xmlRegexpIsDeterminist(void) {
30827 int test_ret = 0;
30828
30829#ifdef LIBXML_REGEXP_ENABLED
30830 int mem_base;
30831 int ret_val;
30832 xmlRegexpPtr comp; /* the compiled regular expression */
30833 int n_comp;
30834
30835 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
30836 mem_base = xmlMemBlocks();
30837 comp = gen_xmlRegexpPtr(n_comp, 0);
30838
30839 ret_val = xmlRegexpIsDeterminist(comp);
30840 desret_int(ret_val);
30841 call_tests++;
30842 des_xmlRegexpPtr(n_comp, comp, 0);
30843 xmlResetLastError();
30844 if (mem_base != xmlMemBlocks()) {
30845 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
30846 xmlMemBlocks() - mem_base);
30847 test_ret++;
30848 printf(" %d", n_comp);
30849 printf("\n");
30850 }
30851 }
30852#endif
30853
30854 function_tests++;
30855 return(test_ret);
30856}
30857
30858
30859static int
30860test_xmlRegexpPrint(void) {
30861 int test_ret = 0;
30862
30863#ifdef LIBXML_REGEXP_ENABLED
30864 int mem_base;
30865 FILE * output; /* the file for the output debug */
30866 int n_output;
30867 xmlRegexpPtr regexp; /* the compiled regexp */
30868 int n_regexp;
30869
30870 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
30871 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
30872 mem_base = xmlMemBlocks();
30873 output = gen_FILE_ptr(n_output, 0);
30874 regexp = gen_xmlRegexpPtr(n_regexp, 1);
30875
30876 xmlRegexpPrint(output, regexp);
30877 call_tests++;
30878 des_FILE_ptr(n_output, output, 0);
30879 des_xmlRegexpPtr(n_regexp, regexp, 1);
30880 xmlResetLastError();
30881 if (mem_base != xmlMemBlocks()) {
30882 printf("Leak of %d blocks found in xmlRegexpPrint",
30883 xmlMemBlocks() - mem_base);
30884 test_ret++;
30885 printf(" %d", n_output);
30886 printf(" %d", n_regexp);
30887 printf("\n");
30888 }
30889 }
30890 }
30891#endif
30892
30893 function_tests++;
30894 return(test_ret);
30895}
30896
30897static int
30898test_xmlregexp(void) {
30899 int test_ret = 0;
30900
30901 printf("Testing xmlregexp : 5 of 9 functions ...\n");
30902 test_ret += test_xmlRegExecPushString();
30903 test_ret += test_xmlRegExecPushString2();
30904 test_ret += test_xmlRegNewExecCtxt();
30905 test_ret += test_xmlRegexpCompile();
30906 test_ret += test_xmlRegexpExec();
30907 test_ret += test_xmlRegexpIsDeterminist();
30908 test_ret += test_xmlRegexpPrint();
30909
30910 if (test_ret != 0)
30911 printf("Module xmlregexp: %d errors\n", test_ret);
30912 return(test_ret);
30913}
30914
Daniel Veillardce682bc2004-11-05 17:22:25 +000030915#define gen_nb_xmlSaveCtxtPtr 1
30916static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30917 return(NULL);
30918}
30919static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30920}
30921
Daniel Veillardd93f6252004-11-02 15:53:51 +000030922static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000030923test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030924 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030925
Daniel Veillardce682bc2004-11-05 17:22:25 +000030926#ifdef LIBXML_OUTPUT_ENABLED
30927 int mem_base;
30928 int ret_val;
30929 xmlSaveCtxtPtr ctxt; /* a document saving context */
30930 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030931
Daniel Veillardce682bc2004-11-05 17:22:25 +000030932 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
30933 mem_base = xmlMemBlocks();
30934 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
30935
30936 ret_val = xmlSaveClose(ctxt);
30937 desret_int(ret_val);
30938 call_tests++;
30939 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
30940 xmlResetLastError();
30941 if (mem_base != xmlMemBlocks()) {
30942 printf("Leak of %d blocks found in xmlSaveClose",
30943 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030944 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030945 printf(" %d", n_ctxt);
30946 printf("\n");
30947 }
30948 }
30949#endif
30950
30951 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030952 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030953}
30954
30955
30956static int
30957test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030958 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030959
Daniel Veillardce682bc2004-11-05 17:22:25 +000030960#ifdef LIBXML_OUTPUT_ENABLED
30961 int mem_base;
30962 long ret_val;
30963 xmlSaveCtxtPtr ctxt; /* a document saving context */
30964 int n_ctxt;
30965 xmlDocPtr doc; /* a document */
30966 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030967
Daniel Veillardce682bc2004-11-05 17:22:25 +000030968 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
30969 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
30970 mem_base = xmlMemBlocks();
30971 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
30972 doc = gen_xmlDocPtr(n_doc, 1);
30973
30974 ret_val = xmlSaveDoc(ctxt, doc);
30975 desret_long(ret_val);
30976 call_tests++;
30977 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
30978 des_xmlDocPtr(n_doc, doc, 1);
30979 xmlResetLastError();
30980 if (mem_base != xmlMemBlocks()) {
30981 printf("Leak of %d blocks found in xmlSaveDoc",
30982 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030983 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030984 printf(" %d", n_ctxt);
30985 printf(" %d", n_doc);
30986 printf("\n");
30987 }
30988 }
30989 }
30990#endif
30991
30992 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030993 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030994}
30995
30996
30997static int
30998test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030999 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031000
Daniel Veillardce682bc2004-11-05 17:22:25 +000031001#ifdef LIBXML_OUTPUT_ENABLED
31002 int mem_base;
31003 int ret_val;
31004 xmlSaveCtxtPtr ctxt; /* a document saving context */
31005 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031006
Daniel Veillardce682bc2004-11-05 17:22:25 +000031007 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31008 mem_base = xmlMemBlocks();
31009 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31010
31011 ret_val = xmlSaveFlush(ctxt);
31012 desret_int(ret_val);
31013 call_tests++;
31014 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31015 xmlResetLastError();
31016 if (mem_base != xmlMemBlocks()) {
31017 printf("Leak of %d blocks found in xmlSaveFlush",
31018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031019 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031020 printf(" %d", n_ctxt);
31021 printf("\n");
31022 }
31023 }
31024#endif
31025
31026 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031027 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031028}
31029
31030
31031static int
31032test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031033 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031034
31035
31036 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031038}
31039
31040
31041static int
31042test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031043 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031044
31045
31046 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031047 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031048}
31049
31050
31051static int
31052test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031053 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031054
31055
31056 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031057 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031058}
31059
31060
31061static int
31062test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031064
31065
31066 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031068}
31069
31070
31071static int
31072test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031074
Daniel Veillardce682bc2004-11-05 17:22:25 +000031075#ifdef LIBXML_OUTPUT_ENABLED
31076 int mem_base;
31077 long ret_val;
31078 xmlSaveCtxtPtr ctxt; /* a document saving context */
31079 int n_ctxt;
31080 xmlNodePtr node; /* a document */
31081 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031082
Daniel Veillardce682bc2004-11-05 17:22:25 +000031083 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31084 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31085 mem_base = xmlMemBlocks();
31086 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31087 node = gen_xmlNodePtr(n_node, 1);
31088
31089 ret_val = xmlSaveTree(ctxt, node);
31090 desret_long(ret_val);
31091 call_tests++;
31092 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31093 des_xmlNodePtr(n_node, node, 1);
31094 xmlResetLastError();
31095 if (mem_base != xmlMemBlocks()) {
31096 printf("Leak of %d blocks found in xmlSaveTree",
31097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031098 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031099 printf(" %d", n_ctxt);
31100 printf(" %d", n_node);
31101 printf("\n");
31102 }
31103 }
31104 }
31105#endif
31106
31107 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031109}
31110
31111static int
31112test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031114
Daniel Veillardce682bc2004-11-05 17:22:25 +000031115 printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031116 test_ret += test_xmlSaveClose();
31117 test_ret += test_xmlSaveDoc();
31118 test_ret += test_xmlSaveFlush();
31119 test_ret += test_xmlSaveSetAttrEscape();
31120 test_ret += test_xmlSaveSetEscape();
31121 test_ret += test_xmlSaveToFd();
31122 test_ret += test_xmlSaveToFilename();
31123 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031124
Daniel Veillard42595322004-11-08 10:52:06 +000031125 if (test_ret != 0)
31126 printf("Module xmlsave: %d errors\n", test_ret);
31127 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031128}
31129
Daniel Veillardce682bc2004-11-05 17:22:25 +000031130#define gen_nb_xmlSchemaPtr 1
31131static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31132 return(NULL);
31133}
31134static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31135}
31136
Daniel Veillardd93f6252004-11-02 15:53:51 +000031137static int
31138test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031140
Daniel Veillardce682bc2004-11-05 17:22:25 +000031141#ifdef LIBXML_SCHEMAS_ENABLED
31142#ifdef LIBXML_OUTPUT_ENABLED
31143 int mem_base;
31144 FILE * output; /* the file output */
31145 int n_output;
31146 xmlSchemaPtr schema; /* a schema structure */
31147 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031148
Daniel Veillardce682bc2004-11-05 17:22:25 +000031149 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31150 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
31151 mem_base = xmlMemBlocks();
31152 output = gen_FILE_ptr(n_output, 0);
31153 schema = gen_xmlSchemaPtr(n_schema, 1);
31154
31155 xmlSchemaDump(output, schema);
31156 call_tests++;
31157 des_FILE_ptr(n_output, output, 0);
31158 des_xmlSchemaPtr(n_schema, schema, 1);
31159 xmlResetLastError();
31160 if (mem_base != xmlMemBlocks()) {
31161 printf("Leak of %d blocks found in xmlSchemaDump",
31162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031163 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031164 printf(" %d", n_output);
31165 printf(" %d", n_schema);
31166 printf("\n");
31167 }
31168 }
31169 }
31170#endif
31171#endif
31172
31173 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031174 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031175}
31176
31177
Daniel Veillardce682bc2004-11-05 17:22:25 +000031178#define gen_nb_xmlSchemaParserCtxtPtr 1
31179static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31180 return(NULL);
31181}
31182static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31183}
31184
31185#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
31186static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31187 return(NULL);
31188}
31189static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31190}
31191
31192#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
31193static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31194 return(NULL);
31195}
31196static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31197}
31198
Daniel Veillardd93f6252004-11-02 15:53:51 +000031199static int
31200test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031202
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031203#ifdef LIBXML_SCHEMAS_ENABLED
31204 int mem_base;
31205 int ret_val;
31206 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
31207 int n_ctxt;
31208 xmlSchemaValidityErrorFunc * err; /* the error callback result */
31209 int n_err;
31210 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
31211 int n_warn;
31212 void ** ctx; /* contextual data for the callbacks result */
31213 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031214
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031215 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
31216 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31217 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31218 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31219 mem_base = xmlMemBlocks();
31220 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
31221 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31222 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31223 ctx = gen_void_ptr_ptr(n_ctx, 3);
31224
31225 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
31226 desret_int(ret_val);
31227 call_tests++;
31228 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
31229 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31230 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31231 des_void_ptr_ptr(n_ctx, ctx, 3);
31232 xmlResetLastError();
31233 if (mem_base != xmlMemBlocks()) {
31234 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
31235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031236 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031237 printf(" %d", n_ctxt);
31238 printf(" %d", n_err);
31239 printf(" %d", n_warn);
31240 printf(" %d", n_ctx);
31241 printf("\n");
31242 }
31243 }
31244 }
31245 }
31246 }
31247#endif
31248
31249 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031251}
31252
31253
Daniel Veillardce682bc2004-11-05 17:22:25 +000031254#define gen_nb_xmlSchemaValidCtxtPtr 1
31255static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31256 return(NULL);
31257}
31258static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31259}
31260
Daniel Veillardd93f6252004-11-02 15:53:51 +000031261static int
31262test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031264
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031265#ifdef LIBXML_SCHEMAS_ENABLED
31266 int mem_base;
31267 int ret_val;
31268 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
31269 int n_ctxt;
31270 xmlSchemaValidityErrorFunc * err; /* the error function result */
31271 int n_err;
31272 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
31273 int n_warn;
31274 void ** ctx; /* the functions context result */
31275 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031276
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031277 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31278 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31279 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31280 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31281 mem_base = xmlMemBlocks();
31282 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31283 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31284 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31285 ctx = gen_void_ptr_ptr(n_ctx, 3);
31286
31287 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
31288 desret_int(ret_val);
31289 call_tests++;
31290 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31291 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31292 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31293 des_void_ptr_ptr(n_ctx, ctx, 3);
31294 xmlResetLastError();
31295 if (mem_base != xmlMemBlocks()) {
31296 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
31297 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031298 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031299 printf(" %d", n_ctxt);
31300 printf(" %d", n_err);
31301 printf(" %d", n_warn);
31302 printf(" %d", n_ctx);
31303 printf("\n");
31304 }
31305 }
31306 }
31307 }
31308 }
31309#endif
31310
31311 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031313}
31314
31315
31316static int
31317test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031319
Daniel Veillard42595322004-11-08 10:52:06 +000031320#ifdef LIBXML_SCHEMAS_ENABLED
31321 int mem_base;
31322 xmlSchemaParserCtxtPtr ret_val;
31323 xmlDocPtr doc; /* a preparsed document tree */
31324 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031325
Daniel Veillard42595322004-11-08 10:52:06 +000031326 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31327 mem_base = xmlMemBlocks();
31328 doc = gen_xmlDocPtr(n_doc, 0);
31329
31330 ret_val = xmlSchemaNewDocParserCtxt(doc);
31331 desret_xmlSchemaParserCtxtPtr(ret_val);
31332 call_tests++;
31333 des_xmlDocPtr(n_doc, doc, 0);
31334 xmlResetLastError();
31335 if (mem_base != xmlMemBlocks()) {
31336 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
31337 xmlMemBlocks() - mem_base);
31338 test_ret++;
31339 printf(" %d", n_doc);
31340 printf("\n");
31341 }
31342 }
31343#endif
31344
31345 function_tests++;
31346 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031347}
31348
31349
31350static int
31351test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031352 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031353
Daniel Veillard42595322004-11-08 10:52:06 +000031354#ifdef LIBXML_SCHEMAS_ENABLED
31355 int mem_base;
31356 xmlSchemaParserCtxtPtr ret_val;
31357 char * buffer; /* a pointer to a char array containing the schemas */
31358 int n_buffer;
31359 int size; /* the size of the array */
31360 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031361
Daniel Veillard42595322004-11-08 10:52:06 +000031362 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
31363 for (n_size = 0;n_size < gen_nb_int;n_size++) {
31364 mem_base = xmlMemBlocks();
31365 buffer = gen_const_char_ptr(n_buffer, 0);
31366 size = gen_int(n_size, 1);
31367
31368 ret_val = xmlSchemaNewMemParserCtxt(buffer, size);
31369 desret_xmlSchemaParserCtxtPtr(ret_val);
31370 call_tests++;
31371 des_const_char_ptr(n_buffer, buffer, 0);
31372 des_int(n_size, size, 1);
31373 xmlResetLastError();
31374 if (mem_base != xmlMemBlocks()) {
31375 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
31376 xmlMemBlocks() - mem_base);
31377 test_ret++;
31378 printf(" %d", n_buffer);
31379 printf(" %d", n_size);
31380 printf("\n");
31381 }
31382 }
31383 }
31384#endif
31385
31386 function_tests++;
31387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031388}
31389
31390
31391static int
31392test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031394
Daniel Veillard42595322004-11-08 10:52:06 +000031395#ifdef LIBXML_SCHEMAS_ENABLED
31396 int mem_base;
31397 xmlSchemaParserCtxtPtr ret_val;
31398 char * URL; /* the location of the schema */
31399 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031400
Daniel Veillard42595322004-11-08 10:52:06 +000031401 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
31402 mem_base = xmlMemBlocks();
31403 URL = gen_const_char_ptr(n_URL, 0);
31404
31405 ret_val = xmlSchemaNewParserCtxt(URL);
31406 desret_xmlSchemaParserCtxtPtr(ret_val);
31407 call_tests++;
31408 des_const_char_ptr(n_URL, URL, 0);
31409 xmlResetLastError();
31410 if (mem_base != xmlMemBlocks()) {
31411 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
31412 xmlMemBlocks() - mem_base);
31413 test_ret++;
31414 printf(" %d", n_URL);
31415 printf("\n");
31416 }
31417 }
31418#endif
31419
31420 function_tests++;
31421 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031422}
31423
31424
31425static int
31426test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031427 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031428
31429
31430 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031431 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031432}
31433
31434
31435static int
31436test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031437 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031438
31439
31440 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031441 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031442}
31443
31444
31445static int
31446test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031447 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031448
31449
31450 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031452}
31453
31454
31455static int
31456test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031458
31459
31460 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031461 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031462}
31463
31464
31465static int
31466test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031467 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031468
Daniel Veillardce682bc2004-11-05 17:22:25 +000031469#ifdef LIBXML_SCHEMAS_ENABLED
31470 int mem_base;
31471 int ret_val;
31472 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31473 int n_ctxt;
31474 int options; /* a combination of xmlSchemaValidOption */
31475 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031476
Daniel Veillardce682bc2004-11-05 17:22:25 +000031477 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31478 for (n_options = 0;n_options < gen_nb_int;n_options++) {
31479 mem_base = xmlMemBlocks();
31480 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31481 options = gen_int(n_options, 1);
31482
31483 ret_val = xmlSchemaSetValidOptions(ctxt, options);
31484 desret_int(ret_val);
31485 call_tests++;
31486 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31487 des_int(n_options, options, 1);
31488 xmlResetLastError();
31489 if (mem_base != xmlMemBlocks()) {
31490 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
31491 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031492 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031493 printf(" %d", n_ctxt);
31494 printf(" %d", n_options);
31495 printf("\n");
31496 }
31497 }
31498 }
31499#endif
31500
31501 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031502 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031503}
31504
31505
31506static int
31507test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031508 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031509
Daniel Veillardce682bc2004-11-05 17:22:25 +000031510#ifdef LIBXML_SCHEMAS_ENABLED
31511 int mem_base;
31512 int ret_val;
31513 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31514 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031515
Daniel Veillardce682bc2004-11-05 17:22:25 +000031516 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31517 mem_base = xmlMemBlocks();
31518 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31519
31520 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
31521 desret_int(ret_val);
31522 call_tests++;
31523 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31524 xmlResetLastError();
31525 if (mem_base != xmlMemBlocks()) {
31526 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
31527 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031528 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031529 printf(" %d", n_ctxt);
31530 printf("\n");
31531 }
31532 }
31533#endif
31534
31535 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031536 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031537}
31538
31539
31540static int
31541test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031542 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031543
Daniel Veillardce682bc2004-11-05 17:22:25 +000031544#ifdef LIBXML_SCHEMAS_ENABLED
31545 int mem_base;
31546 int ret_val;
31547 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31548 int n_ctxt;
31549 xmlDocPtr doc; /* a parsed document tree */
31550 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031551
Daniel Veillardce682bc2004-11-05 17:22:25 +000031552 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31553 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31554 mem_base = xmlMemBlocks();
31555 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31556 doc = gen_xmlDocPtr(n_doc, 1);
31557
31558 ret_val = xmlSchemaValidateDoc(ctxt, doc);
31559 desret_int(ret_val);
31560 call_tests++;
31561 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31562 des_xmlDocPtr(n_doc, doc, 1);
31563 xmlResetLastError();
31564 if (mem_base != xmlMemBlocks()) {
31565 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
31566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031567 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031568 printf(" %d", n_ctxt);
31569 printf(" %d", n_doc);
31570 printf("\n");
31571 }
31572 }
31573 }
31574#endif
31575
31576 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031577 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031578}
31579
31580
31581static int
31582test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031583 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031584
Daniel Veillardce682bc2004-11-05 17:22:25 +000031585#ifdef LIBXML_SCHEMAS_ENABLED
31586 int mem_base;
31587 int ret_val;
31588 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31589 int n_ctxt;
31590 xmlNodePtr elem; /* an element node */
31591 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031592
Daniel Veillardce682bc2004-11-05 17:22:25 +000031593 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31594 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
31595 mem_base = xmlMemBlocks();
31596 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31597 elem = gen_xmlNodePtr(n_elem, 1);
31598
31599 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
31600 desret_int(ret_val);
31601 call_tests++;
31602 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31603 des_xmlNodePtr(n_elem, elem, 1);
31604 xmlResetLastError();
31605 if (mem_base != xmlMemBlocks()) {
31606 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
31607 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031608 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031609 printf(" %d", n_ctxt);
31610 printf(" %d", n_elem);
31611 printf("\n");
31612 }
31613 }
31614 }
31615#endif
31616
31617 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031619}
31620
31621
31622static int
31623test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031624 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031625
Daniel Veillardce682bc2004-11-05 17:22:25 +000031626#ifdef LIBXML_SCHEMAS_ENABLED
31627 int mem_base;
31628 int ret_val;
31629 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31630 int n_ctxt;
31631 xmlParserInputBufferPtr input; /* the input to use for reading the data */
31632 int n_input;
31633 xmlCharEncoding enc; /* an optional encoding information */
31634 int n_enc;
31635 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
31636 int n_sax;
31637 void * user_data; /* the context to provide to the SAX handler. */
31638 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031639
Daniel Veillardce682bc2004-11-05 17:22:25 +000031640 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31641 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
31642 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
31643 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
31644 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
31645 mem_base = xmlMemBlocks();
31646 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31647 input = gen_xmlParserInputBufferPtr(n_input, 1);
31648 enc = gen_xmlCharEncoding(n_enc, 2);
31649 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
31650 user_data = gen_userdata(n_user_data, 4);
31651
31652 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
31653 desret_int(ret_val);
31654 call_tests++;
31655 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31656 des_xmlParserInputBufferPtr(n_input, input, 1);
31657 des_xmlCharEncoding(n_enc, enc, 2);
31658 des_xmlSAXHandlerPtr(n_sax, sax, 3);
31659 des_userdata(n_user_data, user_data, 4);
31660 xmlResetLastError();
31661 if (mem_base != xmlMemBlocks()) {
31662 printf("Leak of %d blocks found in xmlSchemaValidateStream",
31663 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031664 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031665 printf(" %d", n_ctxt);
31666 printf(" %d", n_input);
31667 printf(" %d", n_enc);
31668 printf(" %d", n_sax);
31669 printf(" %d", n_user_data);
31670 printf("\n");
31671 }
31672 }
31673 }
31674 }
31675 }
31676 }
31677#endif
31678
31679 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031681}
31682
31683static int
31684test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031685 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031686
Daniel Veillard42595322004-11-08 10:52:06 +000031687 printf("Testing xmlschemas : 11 of 18 functions ...\n");
31688 test_ret += test_xmlSchemaDump();
31689 test_ret += test_xmlSchemaGetParserErrors();
31690 test_ret += test_xmlSchemaGetValidErrors();
31691 test_ret += test_xmlSchemaNewDocParserCtxt();
31692 test_ret += test_xmlSchemaNewMemParserCtxt();
31693 test_ret += test_xmlSchemaNewParserCtxt();
31694 test_ret += test_xmlSchemaNewValidCtxt();
31695 test_ret += test_xmlSchemaParse();
31696 test_ret += test_xmlSchemaSetParserErrors();
31697 test_ret += test_xmlSchemaSetValidErrors();
31698 test_ret += test_xmlSchemaSetValidOptions();
31699 test_ret += test_xmlSchemaValidCtxtGetOptions();
31700 test_ret += test_xmlSchemaValidateDoc();
31701 test_ret += test_xmlSchemaValidateOneElement();
31702 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031703
Daniel Veillard42595322004-11-08 10:52:06 +000031704 if (test_ret != 0)
31705 printf("Module xmlschemas: %d errors\n", test_ret);
31706 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031707}
31708
Daniel Veillardce682bc2004-11-05 17:22:25 +000031709#define gen_nb_xmlSchemaFacetPtr 1
31710static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31711 return(NULL);
31712}
31713static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31714}
31715
31716#define gen_nb_xmlSchemaTypePtr 1
31717static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31718 return(NULL);
31719}
31720static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31721}
31722
Daniel Veillardd93f6252004-11-02 15:53:51 +000031723static int
31724test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031725 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031726
Daniel Veillardce682bc2004-11-05 17:22:25 +000031727#ifdef LIBXML_SCHEMAS_ENABLED
31728 int mem_base;
31729 int ret_val;
31730 xmlSchemaFacetPtr facet; /* the facet */
31731 int n_facet;
31732 xmlSchemaTypePtr typeDecl; /* the schema type definition */
31733 int n_typeDecl;
31734 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
31735 int n_ctxt;
31736 xmlChar * name; /* name of the type */
31737 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031738
Daniel Veillardce682bc2004-11-05 17:22:25 +000031739 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
31740 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
31741 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
31742 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
31743 mem_base = xmlMemBlocks();
31744 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
31745 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
31746 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
31747 name = gen_const_xmlChar_ptr(n_name, 3);
31748
31749 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, name);
31750 desret_int(ret_val);
31751 call_tests++;
31752 des_xmlSchemaFacetPtr(n_facet, facet, 0);
31753 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
31754 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
31755 des_const_xmlChar_ptr(n_name, name, 3);
31756 xmlResetLastError();
31757 if (mem_base != xmlMemBlocks()) {
31758 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
31759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031760 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031761 printf(" %d", n_facet);
31762 printf(" %d", n_typeDecl);
31763 printf(" %d", n_ctxt);
31764 printf(" %d", n_name);
31765 printf("\n");
31766 }
31767 }
31768 }
31769 }
31770 }
31771#endif
31772
31773 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031774 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031775}
31776
31777
31778static int
31779test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031781
31782#ifdef LIBXML_SCHEMAS_ENABLED
31783 int mem_base;
31784
31785 mem_base = xmlMemBlocks();
31786
31787 xmlSchemaCleanupTypes();
31788 call_tests++;
31789 xmlResetLastError();
31790 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000031791 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000031792 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031793 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000031794 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000031795 }
31796#endif
31797
Daniel Veillard3d97e662004-11-04 10:49:00 +000031798 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031800}
31801
31802
31803static int
31804test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031806
Daniel Veillard8a32fe42004-11-02 22:10:16 +000031807#ifdef LIBXML_SCHEMAS_ENABLED
31808 int mem_base;
31809 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031810 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000031811 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031812
Daniel Veillard8a32fe42004-11-02 22:10:16 +000031813 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31814 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031815 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000031816
31817 ret_val = xmlSchemaCollapseString(value);
31818 desret_xmlChar_ptr(ret_val);
31819 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031820 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000031821 xmlResetLastError();
31822 if (mem_base != xmlMemBlocks()) {
31823 printf("Leak of %d blocks found in xmlSchemaCollapseString",
31824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031825 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000031826 printf(" %d", n_value);
31827 printf("\n");
31828 }
31829 }
31830#endif
31831
Daniel Veillard3d97e662004-11-04 10:49:00 +000031832 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031834}
31835
31836
Daniel Veillardce682bc2004-11-05 17:22:25 +000031837#define gen_nb_xmlSchemaValPtr 1
31838static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31839 return(NULL);
31840}
31841static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31842}
31843
Daniel Veillardd93f6252004-11-02 15:53:51 +000031844static int
31845test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031846 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031847
Daniel Veillardce682bc2004-11-05 17:22:25 +000031848#ifdef LIBXML_SCHEMAS_ENABLED
31849 int mem_base;
31850 int ret_val;
31851 xmlSchemaValPtr x; /* a first value */
31852 int n_x;
31853 xmlSchemaValPtr y; /* a second value */
31854 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031855
Daniel Veillardce682bc2004-11-05 17:22:25 +000031856 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
31857 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
31858 mem_base = xmlMemBlocks();
31859 x = gen_xmlSchemaValPtr(n_x, 0);
31860 y = gen_xmlSchemaValPtr(n_y, 1);
31861
31862 ret_val = xmlSchemaCompareValues(x, y);
31863 desret_int(ret_val);
31864 call_tests++;
31865 des_xmlSchemaValPtr(n_x, x, 0);
31866 des_xmlSchemaValPtr(n_y, y, 1);
31867 xmlResetLastError();
31868 if (mem_base != xmlMemBlocks()) {
31869 printf("Leak of %d blocks found in xmlSchemaCompareValues",
31870 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031871 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031872 printf(" %d", n_x);
31873 printf(" %d", n_y);
31874 printf("\n");
31875 }
31876 }
31877 }
31878#endif
31879
31880 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031881 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031882}
31883
31884
31885static int
31886test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031887 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031888
Daniel Veillard42595322004-11-08 10:52:06 +000031889#ifdef LIBXML_SCHEMAS_ENABLED
31890 int mem_base;
31891 xmlSchemaTypePtr ret_val;
31892 xmlSchemaTypePtr type; /* the built-in simple type. */
31893 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031894
Daniel Veillard42595322004-11-08 10:52:06 +000031895 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
31896 mem_base = xmlMemBlocks();
31897 type = gen_xmlSchemaTypePtr(n_type, 0);
31898
31899 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
31900 desret_xmlSchemaTypePtr(ret_val);
31901 call_tests++;
31902 des_xmlSchemaTypePtr(n_type, type, 0);
31903 xmlResetLastError();
31904 if (mem_base != xmlMemBlocks()) {
31905 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
31906 xmlMemBlocks() - mem_base);
31907 test_ret++;
31908 printf(" %d", n_type);
31909 printf("\n");
31910 }
31911 }
31912#endif
31913
31914 function_tests++;
31915 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031916}
31917
31918
31919static int
31920test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031921 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031922
Daniel Veillard42595322004-11-08 10:52:06 +000031923#ifdef LIBXML_SCHEMAS_ENABLED
31924 xmlSchemaTypePtr ret_val;
31925 xmlSchemaValType type; /* the type of the built in type */
31926 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031927
Daniel Veillard42595322004-11-08 10:52:06 +000031928 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
31929 type = gen_xmlSchemaValType(n_type, 0);
31930
31931 ret_val = xmlSchemaGetBuiltInType(type);
31932 desret_xmlSchemaTypePtr(ret_val);
31933 call_tests++;
31934 des_xmlSchemaValType(n_type, type, 0);
31935 xmlResetLastError();
31936 }
31937#endif
31938
31939 function_tests++;
31940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031941}
31942
31943
31944static int
31945test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031947
31948
31949 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031951}
31952
31953
31954static int
31955test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031957
Daniel Veillard42595322004-11-08 10:52:06 +000031958#ifdef LIBXML_SCHEMAS_ENABLED
31959 int mem_base;
31960 xmlSchemaTypePtr ret_val;
31961 xmlChar * name; /* the type name */
31962 int n_name;
31963 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
31964 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031965
Daniel Veillard42595322004-11-08 10:52:06 +000031966 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
31967 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
31968 mem_base = xmlMemBlocks();
31969 name = gen_const_xmlChar_ptr(n_name, 0);
31970 ns = gen_const_xmlChar_ptr(n_ns, 1);
31971
31972 ret_val = xmlSchemaGetPredefinedType(name, ns);
31973 desret_xmlSchemaTypePtr(ret_val);
31974 call_tests++;
31975 des_const_xmlChar_ptr(n_name, name, 0);
31976 des_const_xmlChar_ptr(n_ns, ns, 1);
31977 xmlResetLastError();
31978 if (mem_base != xmlMemBlocks()) {
31979 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
31980 xmlMemBlocks() - mem_base);
31981 test_ret++;
31982 printf(" %d", n_name);
31983 printf(" %d", n_ns);
31984 printf("\n");
31985 }
31986 }
31987 }
31988#endif
31989
31990 function_tests++;
31991 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031992}
31993
31994
31995static int
31996test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031997 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031998
31999#ifdef LIBXML_SCHEMAS_ENABLED
32000
32001
32002 xmlSchemaInitTypes();
32003 call_tests++;
32004 xmlResetLastError();
32005#endif
32006
Daniel Veillard3d97e662004-11-04 10:49:00 +000032007 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032008 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032009}
32010
32011
32012static int
32013test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032015
Daniel Veillardce682bc2004-11-05 17:22:25 +000032016#ifdef LIBXML_SCHEMAS_ENABLED
32017 int mem_base;
32018 int ret_val;
32019 xmlSchemaTypePtr type; /* the built-in type */
32020 int n_type;
32021 int facetType; /* the facet type */
32022 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032023
Daniel Veillardce682bc2004-11-05 17:22:25 +000032024 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32025 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
32026 mem_base = xmlMemBlocks();
32027 type = gen_xmlSchemaTypePtr(n_type, 0);
32028 facetType = gen_int(n_facetType, 1);
32029
32030 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
32031 desret_int(ret_val);
32032 call_tests++;
32033 des_xmlSchemaTypePtr(n_type, type, 0);
32034 des_int(n_facetType, facetType, 1);
32035 xmlResetLastError();
32036 if (mem_base != xmlMemBlocks()) {
32037 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
32038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032039 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032040 printf(" %d", n_type);
32041 printf(" %d", n_facetType);
32042 printf("\n");
32043 }
32044 }
32045 }
32046#endif
32047
32048 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032050}
32051
32052
32053static int
32054test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032056
32057
32058 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032059 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032060}
32061
32062
Daniel Veillardce682bc2004-11-05 17:22:25 +000032063#define gen_nb_xmlSchemaValPtr_ptr 1
32064static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32065 return(NULL);
32066}
32067static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32068}
32069
Daniel Veillardd93f6252004-11-02 15:53:51 +000032070static int
32071test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032073
Daniel Veillardce682bc2004-11-05 17:22:25 +000032074#ifdef LIBXML_SCHEMAS_ENABLED
32075 int mem_base;
32076 int ret_val;
32077 xmlSchemaTypePtr type; /* the predefined type */
32078 int n_type;
32079 xmlChar * value; /* the value to check */
32080 int n_value;
32081 xmlSchemaValPtr * val; /* the return computed value */
32082 int n_val;
32083 xmlNodePtr node; /* the node containing the value */
32084 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032085
Daniel Veillardce682bc2004-11-05 17:22:25 +000032086 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32087 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32088 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32089 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32090 mem_base = xmlMemBlocks();
32091 type = gen_xmlSchemaTypePtr(n_type, 0);
32092 value = gen_const_xmlChar_ptr(n_value, 1);
32093 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32094 node = gen_xmlNodePtr(n_node, 3);
32095
32096 ret_val = xmlSchemaValPredefTypeNode(type, value, val, node);
32097 desret_int(ret_val);
32098 call_tests++;
32099 des_xmlSchemaTypePtr(n_type, type, 0);
32100 des_const_xmlChar_ptr(n_value, value, 1);
32101 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32102 des_xmlNodePtr(n_node, node, 3);
32103 xmlResetLastError();
32104 if (mem_base != xmlMemBlocks()) {
32105 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
32106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032107 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032108 printf(" %d", n_type);
32109 printf(" %d", n_value);
32110 printf(" %d", n_val);
32111 printf(" %d", n_node);
32112 printf("\n");
32113 }
32114 }
32115 }
32116 }
32117 }
32118#endif
32119
32120 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032122}
32123
32124
32125static int
32126test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032128
Daniel Veillardce682bc2004-11-05 17:22:25 +000032129#ifdef LIBXML_SCHEMAS_ENABLED
32130 int mem_base;
32131 int ret_val;
32132 xmlSchemaTypePtr type; /* the predefined type */
32133 int n_type;
32134 xmlChar * value; /* the value to check */
32135 int n_value;
32136 xmlSchemaValPtr * val; /* the return computed value */
32137 int n_val;
32138 xmlNodePtr node; /* the node containing the value */
32139 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032140
Daniel Veillardce682bc2004-11-05 17:22:25 +000032141 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32142 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32143 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32144 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32145 mem_base = xmlMemBlocks();
32146 type = gen_xmlSchemaTypePtr(n_type, 0);
32147 value = gen_const_xmlChar_ptr(n_value, 1);
32148 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32149 node = gen_xmlNodePtr(n_node, 3);
32150
32151 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, value, val, node);
32152 desret_int(ret_val);
32153 call_tests++;
32154 des_xmlSchemaTypePtr(n_type, type, 0);
32155 des_const_xmlChar_ptr(n_value, value, 1);
32156 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32157 des_xmlNodePtr(n_node, node, 3);
32158 xmlResetLastError();
32159 if (mem_base != xmlMemBlocks()) {
32160 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
32161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032162 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032163 printf(" %d", n_type);
32164 printf(" %d", n_value);
32165 printf(" %d", n_val);
32166 printf(" %d", n_node);
32167 printf("\n");
32168 }
32169 }
32170 }
32171 }
32172 }
32173#endif
32174
32175 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032177}
32178
32179
32180static int
32181test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032182 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032183
Daniel Veillardce682bc2004-11-05 17:22:25 +000032184#ifdef LIBXML_SCHEMAS_ENABLED
32185 int mem_base;
32186 int ret_val;
32187 xmlSchemaTypePtr base; /* the base type */
32188 int n_base;
32189 xmlSchemaFacetPtr facet; /* the facet to check */
32190 int n_facet;
32191 xmlChar * value; /* the lexical repr of the value to validate */
32192 int n_value;
32193 xmlSchemaValPtr val; /* the precomputed value */
32194 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032195
Daniel Veillardce682bc2004-11-05 17:22:25 +000032196 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
32197 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32198 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32199 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32200 mem_base = xmlMemBlocks();
32201 base = gen_xmlSchemaTypePtr(n_base, 0);
32202 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32203 value = gen_const_xmlChar_ptr(n_value, 2);
32204 val = gen_xmlSchemaValPtr(n_val, 3);
32205
32206 ret_val = xmlSchemaValidateFacet(base, facet, value, val);
32207 desret_int(ret_val);
32208 call_tests++;
32209 des_xmlSchemaTypePtr(n_base, base, 0);
32210 des_xmlSchemaFacetPtr(n_facet, facet, 1);
32211 des_const_xmlChar_ptr(n_value, value, 2);
32212 des_xmlSchemaValPtr(n_val, val, 3);
32213 xmlResetLastError();
32214 if (mem_base != xmlMemBlocks()) {
32215 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
32216 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032217 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032218 printf(" %d", n_base);
32219 printf(" %d", n_facet);
32220 printf(" %d", n_value);
32221 printf(" %d", n_val);
32222 printf("\n");
32223 }
32224 }
32225 }
32226 }
32227 }
32228#endif
32229
32230 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032232}
32233
32234
32235static int
32236test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032238
Daniel Veillardce682bc2004-11-05 17:22:25 +000032239#ifdef LIBXML_SCHEMAS_ENABLED
32240 int mem_base;
32241 int ret_val;
32242 xmlSchemaTypePtr type; /* the built-in type */
32243 int n_type;
32244 xmlSchemaFacetPtr facet; /* the facet to check */
32245 int n_facet;
32246 xmlChar * value; /* the lexical repr. of the value to be validated */
32247 int n_value;
32248 xmlSchemaValPtr val; /* the precomputed value */
32249 int n_val;
32250 unsigned long * length; /* the actual length of the value */
32251 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032252
Daniel Veillardce682bc2004-11-05 17:22:25 +000032253 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32254 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32255 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32256 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32257 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
32258 mem_base = xmlMemBlocks();
32259 type = gen_xmlSchemaTypePtr(n_type, 0);
32260 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32261 value = gen_const_xmlChar_ptr(n_value, 2);
32262 val = gen_xmlSchemaValPtr(n_val, 3);
32263 length = gen_unsigned_long_ptr(n_length, 4);
32264
32265 ret_val = xmlSchemaValidateLengthFacet(type, facet, value, val, length);
32266 desret_int(ret_val);
32267 call_tests++;
32268 des_xmlSchemaTypePtr(n_type, type, 0);
32269 des_xmlSchemaFacetPtr(n_facet, facet, 1);
32270 des_const_xmlChar_ptr(n_value, value, 2);
32271 des_xmlSchemaValPtr(n_val, val, 3);
32272 des_unsigned_long_ptr(n_length, length, 4);
32273 xmlResetLastError();
32274 if (mem_base != xmlMemBlocks()) {
32275 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
32276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032277 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032278 printf(" %d", n_type);
32279 printf(" %d", n_facet);
32280 printf(" %d", n_value);
32281 printf(" %d", n_val);
32282 printf(" %d", n_length);
32283 printf("\n");
32284 }
32285 }
32286 }
32287 }
32288 }
32289 }
32290#endif
32291
32292 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032293 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032294}
32295
32296
32297static int
32298test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032300
Daniel Veillardce682bc2004-11-05 17:22:25 +000032301#ifdef LIBXML_SCHEMAS_ENABLED
32302 int mem_base;
32303 int ret_val;
32304 xmlSchemaFacetPtr facet; /* the facet to check */
32305 int n_facet;
32306 xmlChar * value; /* the lexical repr of the value to validate */
32307 int n_value;
32308 unsigned long actualLen; /* the number of list items */
32309 int n_actualLen;
32310 unsigned long * expectedLen; /* the resulting expected number of list items */
32311 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032312
Daniel Veillardce682bc2004-11-05 17:22:25 +000032313 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32314 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32315 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
32316 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
32317 mem_base = xmlMemBlocks();
32318 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32319 value = gen_const_xmlChar_ptr(n_value, 1);
32320 actualLen = gen_unsigned_long(n_actualLen, 2);
32321 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
32322
32323 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, value, actualLen, expectedLen);
32324 desret_int(ret_val);
32325 call_tests++;
32326 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32327 des_const_xmlChar_ptr(n_value, value, 1);
32328 des_unsigned_long(n_actualLen, actualLen, 2);
32329 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
32330 xmlResetLastError();
32331 if (mem_base != xmlMemBlocks()) {
32332 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
32333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032334 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032335 printf(" %d", n_facet);
32336 printf(" %d", n_value);
32337 printf(" %d", n_actualLen);
32338 printf(" %d", n_expectedLen);
32339 printf("\n");
32340 }
32341 }
32342 }
32343 }
32344 }
32345#endif
32346
32347 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032349}
32350
32351
32352static int
32353test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032355
Daniel Veillardce682bc2004-11-05 17:22:25 +000032356#ifdef LIBXML_SCHEMAS_ENABLED
32357 int mem_base;
32358 int ret_val;
32359 xmlSchemaTypePtr type; /* the predefined type */
32360 int n_type;
32361 xmlChar * value; /* the value to check */
32362 int n_value;
32363 xmlSchemaValPtr * val; /* the return computed value */
32364 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032365
Daniel Veillardce682bc2004-11-05 17:22:25 +000032366 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32367 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32368 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32369 mem_base = xmlMemBlocks();
32370 type = gen_xmlSchemaTypePtr(n_type, 0);
32371 value = gen_const_xmlChar_ptr(n_value, 1);
32372 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32373
32374 ret_val = xmlSchemaValidatePredefinedType(type, value, val);
32375 desret_int(ret_val);
32376 call_tests++;
32377 des_xmlSchemaTypePtr(n_type, type, 0);
32378 des_const_xmlChar_ptr(n_value, value, 1);
32379 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32380 xmlResetLastError();
32381 if (mem_base != xmlMemBlocks()) {
32382 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
32383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032384 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032385 printf(" %d", n_type);
32386 printf(" %d", n_value);
32387 printf(" %d", n_val);
32388 printf("\n");
32389 }
32390 }
32391 }
32392 }
32393#endif
32394
32395 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032397}
32398
32399static int
32400test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032401 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032402
Daniel Veillard42595322004-11-08 10:52:06 +000032403 printf("Testing xmlschemastypes : 15 of 19 functions ...\n");
32404 test_ret += test_xmlSchemaCheckFacet();
32405 test_ret += test_xmlSchemaCleanupTypes();
32406 test_ret += test_xmlSchemaCollapseString();
32407 test_ret += test_xmlSchemaCompareValues();
32408 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
32409 test_ret += test_xmlSchemaGetBuiltInType();
32410 test_ret += test_xmlSchemaGetFacetValueAsULong();
32411 test_ret += test_xmlSchemaGetPredefinedType();
32412 test_ret += test_xmlSchemaInitTypes();
32413 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
32414 test_ret += test_xmlSchemaNewFacet();
32415 test_ret += test_xmlSchemaValPredefTypeNode();
32416 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
32417 test_ret += test_xmlSchemaValidateFacet();
32418 test_ret += test_xmlSchemaValidateLengthFacet();
32419 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
32420 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032421
Daniel Veillard42595322004-11-08 10:52:06 +000032422 if (test_ret != 0)
32423 printf("Module xmlschemastypes: %d errors\n", test_ret);
32424 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032425}
32426
32427static int
32428test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032430
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032431 int mem_base;
32432 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032433 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032434 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032435
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032436 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
32437 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032438 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032439
32440 ret_val = xmlCharStrdup(cur);
32441 desret_xmlChar_ptr(ret_val);
32442 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032443 des_const_char_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032444 xmlResetLastError();
32445 if (mem_base != xmlMemBlocks()) {
32446 printf("Leak of %d blocks found in xmlCharStrdup",
32447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032448 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032449 printf(" %d", n_cur);
32450 printf("\n");
32451 }
32452 }
32453
Daniel Veillard3d97e662004-11-04 10:49:00 +000032454 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032455 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032456}
32457
32458
32459static int
32460test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032461 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032462
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032463 int mem_base;
32464 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032465 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032466 int n_cur;
32467 int len; /* the len of @cur */
32468 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032469
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032470 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
32471 for (n_len = 0;n_len < gen_nb_int;n_len++) {
32472 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032473 cur = gen_const_char_ptr(n_cur, 0);
32474 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032475
32476 ret_val = xmlCharStrndup(cur, len);
32477 desret_xmlChar_ptr(ret_val);
32478 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032479 des_const_char_ptr(n_cur, cur, 0);
32480 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032481 xmlResetLastError();
32482 if (mem_base != xmlMemBlocks()) {
32483 printf("Leak of %d blocks found in xmlCharStrndup",
32484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032485 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032486 printf(" %d", n_cur);
32487 printf(" %d", n_len);
32488 printf("\n");
32489 }
32490 }
32491 }
32492
Daniel Veillard3d97e662004-11-04 10:49:00 +000032493 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032495}
32496
32497
32498static int
32499test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032501
Daniel Veillardce682bc2004-11-05 17:22:25 +000032502 int mem_base;
32503 int ret_val;
32504 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
32505 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032506
Daniel Veillardce682bc2004-11-05 17:22:25 +000032507 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
32508 mem_base = xmlMemBlocks();
32509 utf = gen_const_unsigned_char_ptr(n_utf, 0);
32510
32511 ret_val = xmlCheckUTF8(utf);
32512 desret_int(ret_val);
32513 call_tests++;
32514 des_const_unsigned_char_ptr(n_utf, utf, 0);
32515 xmlResetLastError();
32516 if (mem_base != xmlMemBlocks()) {
32517 printf("Leak of %d blocks found in xmlCheckUTF8",
32518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032519 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032520 printf(" %d", n_utf);
32521 printf("\n");
32522 }
32523 }
32524
32525 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032527}
32528
32529
32530static int
32531test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032533
Daniel Veillardce682bc2004-11-05 17:22:25 +000032534 int mem_base;
32535 int ret_val;
32536 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
32537 int n_utf;
32538 int * len; /* a pointer to the minimum number of bytes present in the sequence. This is used to assure the next character is completely contained within the sequence. */
32539 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032540
Daniel Veillardce682bc2004-11-05 17:22:25 +000032541 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
32542 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
32543 mem_base = xmlMemBlocks();
32544 utf = gen_const_unsigned_char_ptr(n_utf, 0);
32545 len = gen_int_ptr(n_len, 1);
32546
32547 ret_val = xmlGetUTF8Char(utf, len);
32548 desret_int(ret_val);
32549 call_tests++;
32550 des_const_unsigned_char_ptr(n_utf, utf, 0);
32551 des_int_ptr(n_len, len, 1);
32552 xmlResetLastError();
32553 if (mem_base != xmlMemBlocks()) {
32554 printf("Leak of %d blocks found in xmlGetUTF8Char",
32555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032556 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032557 printf(" %d", n_utf);
32558 printf(" %d", n_len);
32559 printf("\n");
32560 }
32561 }
32562 }
32563
32564 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032565 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032566}
32567
32568
32569static int
32570test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032571 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032572
32573 int mem_base;
32574 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032575 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032576 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032577 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032578 int n_str2;
32579
32580 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
32581 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
32582 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032583 str1 = gen_const_xmlChar_ptr(n_str1, 0);
32584 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032585
32586 ret_val = xmlStrEqual(str1, str2);
32587 desret_int(ret_val);
32588 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032589 des_const_xmlChar_ptr(n_str1, str1, 0);
32590 des_const_xmlChar_ptr(n_str2, str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032591 xmlResetLastError();
32592 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032593 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032595 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032596 printf(" %d", n_str1);
32597 printf(" %d", n_str2);
32598 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032599 }
32600 }
32601 }
32602
Daniel Veillard3d97e662004-11-04 10:49:00 +000032603 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032604 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032605}
32606
32607
32608static int
32609test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032610 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032611
32612
32613 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032614 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032615}
32616
32617
32618static int
32619test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032621
32622 int mem_base;
32623 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032624 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032625 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032626 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032627 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032628 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032629 int n_str;
32630
32631 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
32632 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32633 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
32634 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032635 pref = gen_const_xmlChar_ptr(n_pref, 0);
32636 name = gen_const_xmlChar_ptr(n_name, 1);
32637 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032638
32639 ret_val = xmlStrQEqual(pref, name, str);
32640 desret_int(ret_val);
32641 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032642 des_const_xmlChar_ptr(n_pref, pref, 0);
32643 des_const_xmlChar_ptr(n_name, name, 1);
32644 des_const_xmlChar_ptr(n_str, str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032645 xmlResetLastError();
32646 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032647 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032649 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032650 printf(" %d", n_pref);
32651 printf(" %d", n_name);
32652 printf(" %d", n_str);
32653 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032654 }
32655 }
32656 }
32657 }
32658
Daniel Veillard3d97e662004-11-04 10:49:00 +000032659 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032661}
32662
32663
32664static int
32665test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032667
32668
32669 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032670 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032671}
32672
32673
32674static int
32675test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032676 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032677
32678 int mem_base;
32679 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032680 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032681 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032682 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032683 int n_str2;
32684
32685 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
32686 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
32687 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032688 str1 = gen_const_xmlChar_ptr(n_str1, 0);
32689 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032690
32691 ret_val = xmlStrcasecmp(str1, str2);
32692 desret_int(ret_val);
32693 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032694 des_const_xmlChar_ptr(n_str1, str1, 0);
32695 des_const_xmlChar_ptr(n_str2, str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032696 xmlResetLastError();
32697 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032698 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032700 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032701 printf(" %d", n_str1);
32702 printf(" %d", n_str2);
32703 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032704 }
32705 }
32706 }
32707
Daniel Veillard3d97e662004-11-04 10:49:00 +000032708 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032710}
32711
32712
32713static int
32714test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032715 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032716
Daniel Veillardd005b9e2004-11-03 17:07:05 +000032717 int mem_base;
32718 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032719 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000032720 int n_str;
32721 xmlChar * val; /* the xmlChar to search (needle) */
32722 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032723
Daniel Veillardd005b9e2004-11-03 17:07:05 +000032724 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
32725 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
32726 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032727 str = gen_const_xmlChar_ptr(n_str, 0);
32728 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000032729
32730 ret_val = xmlStrcasestr(str, val);
32731 desret_const_xmlChar_ptr(ret_val);
32732 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032733 des_const_xmlChar_ptr(n_str, str, 0);
32734 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000032735 xmlResetLastError();
32736 if (mem_base != xmlMemBlocks()) {
32737 printf("Leak of %d blocks found in xmlStrcasestr",
32738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032739 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000032740 printf(" %d", n_str);
32741 printf(" %d", n_val);
32742 printf("\n");
32743 }
32744 }
32745 }
32746
Daniel Veillard3d97e662004-11-04 10:49:00 +000032747 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032749}
32750
32751
32752static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000032753test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032755
32756
32757 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032759}
32760
32761
32762static int
32763test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032765
32766 int mem_base;
32767 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032768 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032769 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032770 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032771 int n_str2;
32772
32773 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
32774 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
32775 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032776 str1 = gen_const_xmlChar_ptr(n_str1, 0);
32777 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032778
32779 ret_val = xmlStrcmp(str1, str2);
32780 desret_int(ret_val);
32781 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032782 des_const_xmlChar_ptr(n_str1, str1, 0);
32783 des_const_xmlChar_ptr(n_str2, str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032784 xmlResetLastError();
32785 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032786 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032788 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032789 printf(" %d", n_str1);
32790 printf(" %d", n_str2);
32791 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032792 }
32793 }
32794 }
32795
Daniel Veillard3d97e662004-11-04 10:49:00 +000032796 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032797 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032798}
32799
32800
32801static int
32802test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032803 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032804
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032805 int mem_base;
32806 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032807 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032808 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032809
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032810 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
32811 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032812 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032813
32814 ret_val = xmlStrdup(cur);
32815 desret_xmlChar_ptr(ret_val);
32816 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032817 des_const_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032818 xmlResetLastError();
32819 if (mem_base != xmlMemBlocks()) {
32820 printf("Leak of %d blocks found in xmlStrdup",
32821 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032822 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032823 printf(" %d", n_cur);
32824 printf("\n");
32825 }
32826 }
32827
Daniel Veillard3d97e662004-11-04 10:49:00 +000032828 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032829 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032830}
32831
32832
32833static int
32834test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032835 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032836
32837 int mem_base;
32838 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032839 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032840 int n_str;
32841
32842 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
32843 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032844 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032845
32846 ret_val = xmlStrlen(str);
32847 desret_int(ret_val);
32848 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032849 des_const_xmlChar_ptr(n_str, str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032850 xmlResetLastError();
32851 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032852 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032854 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032855 printf(" %d", n_str);
32856 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032857 }
32858 }
32859
Daniel Veillard3d97e662004-11-04 10:49:00 +000032860 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032862}
32863
32864
32865static int
32866test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032868
32869 int mem_base;
32870 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032871 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032872 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032873 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032874 int n_str2;
32875 int len; /* the max comparison length */
32876 int n_len;
32877
32878 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
32879 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
32880 for (n_len = 0;n_len < gen_nb_int;n_len++) {
32881 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032882 str1 = gen_const_xmlChar_ptr(n_str1, 0);
32883 str2 = gen_const_xmlChar_ptr(n_str2, 1);
32884 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032885
32886 ret_val = xmlStrncasecmp(str1, str2, len);
32887 desret_int(ret_val);
32888 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032889 des_const_xmlChar_ptr(n_str1, str1, 0);
32890 des_const_xmlChar_ptr(n_str2, str2, 1);
32891 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032892 xmlResetLastError();
32893 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032894 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032895 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032896 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032897 printf(" %d", n_str1);
32898 printf(" %d", n_str2);
32899 printf(" %d", n_len);
32900 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032901 }
32902 }
32903 }
32904 }
32905
Daniel Veillard3d97e662004-11-04 10:49:00 +000032906 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032907 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032908}
32909
32910
32911static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000032912test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032913 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032914
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032915 int mem_base;
32916 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032917 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032918 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032919 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032920 int n_str2;
32921 int len; /* the len of @str2 */
32922 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032923
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032924 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
32925 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
32926 for (n_len = 0;n_len < gen_nb_int;n_len++) {
32927 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032928 str1 = gen_const_xmlChar_ptr(n_str1, 0);
32929 str2 = gen_const_xmlChar_ptr(n_str2, 1);
32930 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032931
32932 ret_val = xmlStrncatNew(str1, str2, len);
32933 desret_xmlChar_ptr(ret_val);
32934 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032935 des_const_xmlChar_ptr(n_str1, str1, 0);
32936 des_const_xmlChar_ptr(n_str2, str2, 1);
32937 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032938 xmlResetLastError();
32939 if (mem_base != xmlMemBlocks()) {
32940 printf("Leak of %d blocks found in xmlStrncatNew",
32941 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032942 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032943 printf(" %d", n_str1);
32944 printf(" %d", n_str2);
32945 printf(" %d", n_len);
32946 printf("\n");
32947 }
32948 }
32949 }
32950 }
32951
Daniel Veillard3d97e662004-11-04 10:49:00 +000032952 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032954}
32955
32956
32957static int
32958test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032960
32961 int mem_base;
32962 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032963 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032964 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032965 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032966 int n_str2;
32967 int len; /* the max comparison length */
32968 int n_len;
32969
32970 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
32971 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
32972 for (n_len = 0;n_len < gen_nb_int;n_len++) {
32973 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032974 str1 = gen_const_xmlChar_ptr(n_str1, 0);
32975 str2 = gen_const_xmlChar_ptr(n_str2, 1);
32976 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032977
32978 ret_val = xmlStrncmp(str1, str2, len);
32979 desret_int(ret_val);
32980 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032981 des_const_xmlChar_ptr(n_str1, str1, 0);
32982 des_const_xmlChar_ptr(n_str2, str2, 1);
32983 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032984 xmlResetLastError();
32985 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032986 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032988 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032989 printf(" %d", n_str1);
32990 printf(" %d", n_str2);
32991 printf(" %d", n_len);
32992 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032993 }
32994 }
32995 }
32996 }
32997
Daniel Veillard3d97e662004-11-04 10:49:00 +000032998 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033000}
33001
33002
33003static int
33004test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033006
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033007 int mem_base;
33008 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033009 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033010 int n_cur;
33011 int len; /* the len of @cur */
33012 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033013
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033014 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33015 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33016 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033017 cur = gen_const_xmlChar_ptr(n_cur, 0);
33018 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033019
33020 ret_val = xmlStrndup(cur, len);
33021 desret_xmlChar_ptr(ret_val);
33022 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033023 des_const_xmlChar_ptr(n_cur, cur, 0);
33024 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033025 xmlResetLastError();
33026 if (mem_base != xmlMemBlocks()) {
33027 printf("Leak of %d blocks found in xmlStrndup",
33028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033029 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033030 printf(" %d", n_cur);
33031 printf(" %d", n_len);
33032 printf("\n");
33033 }
33034 }
33035 }
33036
Daniel Veillard3d97e662004-11-04 10:49:00 +000033037 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033039}
33040
33041
33042static int
33043test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033045
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033046 int mem_base;
33047 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033048 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033049 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033050 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033051 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033052
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033053 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33054 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
33055 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033056 str = gen_const_xmlChar_ptr(n_str, 0);
33057 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033058
33059 ret_val = xmlStrstr(str, val);
33060 desret_const_xmlChar_ptr(ret_val);
33061 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033062 des_const_xmlChar_ptr(n_str, str, 0);
33063 des_const_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033064 xmlResetLastError();
33065 if (mem_base != xmlMemBlocks()) {
33066 printf("Leak of %d blocks found in xmlStrstr",
33067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033068 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033069 printf(" %d", n_str);
33070 printf(" %d", n_val);
33071 printf("\n");
33072 }
33073 }
33074 }
33075
Daniel Veillard3d97e662004-11-04 10:49:00 +000033076 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033078}
33079
33080
33081static int
33082test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033084
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033085 int mem_base;
33086 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033087 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033088 int n_str;
33089 int start; /* the index of the first char (zero based) */
33090 int n_start;
33091 int len; /* the length of the substring */
33092 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033093
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033094 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33095 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33096 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33097 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033098 str = gen_const_xmlChar_ptr(n_str, 0);
33099 start = gen_int(n_start, 1);
33100 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033101
33102 ret_val = xmlStrsub(str, start, len);
33103 desret_xmlChar_ptr(ret_val);
33104 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033105 des_const_xmlChar_ptr(n_str, str, 0);
33106 des_int(n_start, start, 1);
33107 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033108 xmlResetLastError();
33109 if (mem_base != xmlMemBlocks()) {
33110 printf("Leak of %d blocks found in xmlStrsub",
33111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033112 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033113 printf(" %d", n_str);
33114 printf(" %d", n_start);
33115 printf(" %d", n_len);
33116 printf("\n");
33117 }
33118 }
33119 }
33120 }
33121
Daniel Veillard3d97e662004-11-04 10:49:00 +000033122 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033124}
33125
33126
33127static int
33128test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033130
33131 int mem_base;
33132 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033133 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033134 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033135 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033136 int n_utf2;
33137
33138 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
33139 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
33140 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033141 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
33142 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033143
33144 ret_val = xmlUTF8Charcmp(utf1, utf2);
33145 desret_int(ret_val);
33146 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033147 des_const_xmlChar_ptr(n_utf1, utf1, 0);
33148 des_const_xmlChar_ptr(n_utf2, utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033149 xmlResetLastError();
33150 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033151 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033153 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033154 printf(" %d", n_utf1);
33155 printf(" %d", n_utf2);
33156 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033157 }
33158 }
33159 }
33160
Daniel Veillard3d97e662004-11-04 10:49:00 +000033161 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033163}
33164
33165
33166static int
33167test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033169
33170 int mem_base;
33171 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033172 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033173 int n_utf;
33174
33175 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33176 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033177 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033178
33179 ret_val = xmlUTF8Size(utf);
33180 desret_int(ret_val);
33181 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033182 des_const_xmlChar_ptr(n_utf, utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033183 xmlResetLastError();
33184 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033185 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033187 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033188 printf(" %d", n_utf);
33189 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033190 }
33191 }
33192
Daniel Veillard3d97e662004-11-04 10:49:00 +000033193 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033195}
33196
33197
33198static int
33199test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033200 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033201
33202 int mem_base;
33203 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033204 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033205 int n_utf;
33206
33207 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33208 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033209 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033210
33211 ret_val = xmlUTF8Strlen(utf);
33212 desret_int(ret_val);
33213 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033214 des_const_xmlChar_ptr(n_utf, utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033215 xmlResetLastError();
33216 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033217 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033219 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033220 printf(" %d", n_utf);
33221 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033222 }
33223 }
33224
Daniel Veillard3d97e662004-11-04 10:49:00 +000033225 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033226 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033227}
33228
33229
33230static int
33231test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033232 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033233
33234 int mem_base;
33235 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033236 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033237 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033238 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033239 int n_utfchar;
33240
33241 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33242 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
33243 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033244 utf = gen_const_xmlChar_ptr(n_utf, 0);
33245 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033246
33247 ret_val = xmlUTF8Strloc(utf, utfchar);
33248 desret_int(ret_val);
33249 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033250 des_const_xmlChar_ptr(n_utf, utf, 0);
33251 des_const_xmlChar_ptr(n_utfchar, utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033252 xmlResetLastError();
33253 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033254 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033255 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033256 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033257 printf(" %d", n_utf);
33258 printf(" %d", n_utfchar);
33259 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033260 }
33261 }
33262 }
33263
Daniel Veillard3d97e662004-11-04 10:49:00 +000033264 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033266}
33267
33268
33269static int
33270test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033272
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033273 int mem_base;
33274 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033275 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033276 int n_utf;
33277 int len; /* the len of @utf (in chars) */
33278 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033279
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033280 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33281 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33282 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033283 utf = gen_const_xmlChar_ptr(n_utf, 0);
33284 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033285
33286 ret_val = xmlUTF8Strndup(utf, len);
33287 desret_xmlChar_ptr(ret_val);
33288 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033289 des_const_xmlChar_ptr(n_utf, utf, 0);
33290 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033291 xmlResetLastError();
33292 if (mem_base != xmlMemBlocks()) {
33293 printf("Leak of %d blocks found in xmlUTF8Strndup",
33294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033295 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033296 printf(" %d", n_utf);
33297 printf(" %d", n_len);
33298 printf("\n");
33299 }
33300 }
33301 }
33302
Daniel Veillard3d97e662004-11-04 10:49:00 +000033303 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033304 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033305}
33306
33307
33308static int
33309test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033310 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033311
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033312 int mem_base;
33313 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033314 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033315 int n_utf;
33316 int pos; /* the position of the desired UTF8 char (in chars) */
33317 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033318
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033319 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33320 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
33321 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033322 utf = gen_const_xmlChar_ptr(n_utf, 0);
33323 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033324
33325 ret_val = xmlUTF8Strpos(utf, pos);
33326 desret_const_xmlChar_ptr(ret_val);
33327 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033328 des_const_xmlChar_ptr(n_utf, utf, 0);
33329 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033330 xmlResetLastError();
33331 if (mem_base != xmlMemBlocks()) {
33332 printf("Leak of %d blocks found in xmlUTF8Strpos",
33333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033334 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033335 printf(" %d", n_utf);
33336 printf(" %d", n_pos);
33337 printf("\n");
33338 }
33339 }
33340 }
33341
Daniel Veillard3d97e662004-11-04 10:49:00 +000033342 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033344}
33345
33346
33347static int
33348test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033350
33351 int mem_base;
33352 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033353 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033354 int n_utf;
33355 int len; /* the number of characters in the array */
33356 int n_len;
33357
33358 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33359 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33360 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033361 utf = gen_const_xmlChar_ptr(n_utf, 0);
33362 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033363
33364 ret_val = xmlUTF8Strsize(utf, len);
33365 desret_int(ret_val);
33366 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033367 des_const_xmlChar_ptr(n_utf, utf, 0);
33368 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033369 xmlResetLastError();
33370 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033371 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033373 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033374 printf(" %d", n_utf);
33375 printf(" %d", n_len);
33376 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033377 }
33378 }
33379 }
33380
Daniel Veillard3d97e662004-11-04 10:49:00 +000033381 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033382 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033383}
33384
33385
33386static int
33387test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033388 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033389
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033390 int mem_base;
33391 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033392 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033393 int n_utf;
33394 int start; /* relative pos of first char */
33395 int n_start;
33396 int len; /* total number to copy */
33397 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033398
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033399 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33400 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33401 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33402 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033403 utf = gen_const_xmlChar_ptr(n_utf, 0);
33404 start = gen_int(n_start, 1);
33405 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033406
33407 ret_val = xmlUTF8Strsub(utf, start, len);
33408 desret_xmlChar_ptr(ret_val);
33409 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033410 des_const_xmlChar_ptr(n_utf, utf, 0);
33411 des_int(n_start, start, 1);
33412 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033413 xmlResetLastError();
33414 if (mem_base != xmlMemBlocks()) {
33415 printf("Leak of %d blocks found in xmlUTF8Strsub",
33416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033417 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033418 printf(" %d", n_utf);
33419 printf(" %d", n_start);
33420 printf(" %d", n_len);
33421 printf("\n");
33422 }
33423 }
33424 }
33425 }
33426
Daniel Veillard3d97e662004-11-04 10:49:00 +000033427 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033429}
33430
33431static int
33432test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033433 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033434
Daniel Veillardce682bc2004-11-05 17:22:25 +000033435 printf("Testing xmlstring : 25 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000033436 test_ret += test_xmlCharStrdup();
33437 test_ret += test_xmlCharStrndup();
33438 test_ret += test_xmlCheckUTF8();
33439 test_ret += test_xmlGetUTF8Char();
33440 test_ret += test_xmlStrEqual();
33441 test_ret += test_xmlStrPrintf();
33442 test_ret += test_xmlStrQEqual();
33443 test_ret += test_xmlStrVPrintf();
33444 test_ret += test_xmlStrcasecmp();
33445 test_ret += test_xmlStrcasestr();
33446 test_ret += test_xmlStrchr();
33447 test_ret += test_xmlStrcmp();
33448 test_ret += test_xmlStrdup();
33449 test_ret += test_xmlStrlen();
33450 test_ret += test_xmlStrncasecmp();
33451 test_ret += test_xmlStrncatNew();
33452 test_ret += test_xmlStrncmp();
33453 test_ret += test_xmlStrndup();
33454 test_ret += test_xmlStrstr();
33455 test_ret += test_xmlStrsub();
33456 test_ret += test_xmlUTF8Charcmp();
33457 test_ret += test_xmlUTF8Size();
33458 test_ret += test_xmlUTF8Strlen();
33459 test_ret += test_xmlUTF8Strloc();
33460 test_ret += test_xmlUTF8Strndup();
33461 test_ret += test_xmlUTF8Strpos();
33462 test_ret += test_xmlUTF8Strsize();
33463 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000033464
Daniel Veillard42595322004-11-08 10:52:06 +000033465 if (test_ret != 0)
33466 printf("Module xmlstring: %d errors\n", test_ret);
33467 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033468}
33469
33470static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033471test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033472 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033473
33474#ifdef LIBXML_UNICODE_ENABLED
33475 int mem_base;
33476 int ret_val;
33477 int code; /* UCS code point */
33478 int n_code;
33479
33480 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33481 mem_base = xmlMemBlocks();
33482 code = gen_int(n_code, 0);
33483
33484 ret_val = xmlUCSIsAegeanNumbers(code);
33485 desret_int(ret_val);
33486 call_tests++;
33487 des_int(n_code, code, 0);
33488 xmlResetLastError();
33489 if (mem_base != xmlMemBlocks()) {
33490 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
33491 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033492 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033493 printf(" %d", n_code);
33494 printf("\n");
33495 }
33496 }
33497#endif
33498
33499 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033500 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033501}
33502
33503
33504static int
33505test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033506 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033507
33508#ifdef LIBXML_UNICODE_ENABLED
33509 int mem_base;
33510 int ret_val;
33511 int code; /* UCS code point */
33512 int n_code;
33513
33514 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33515 mem_base = xmlMemBlocks();
33516 code = gen_int(n_code, 0);
33517
33518 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
33519 desret_int(ret_val);
33520 call_tests++;
33521 des_int(n_code, code, 0);
33522 xmlResetLastError();
33523 if (mem_base != xmlMemBlocks()) {
33524 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
33525 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033526 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033527 printf(" %d", n_code);
33528 printf("\n");
33529 }
33530 }
33531#endif
33532
33533 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033534 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033535}
33536
33537
33538static int
33539test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033540 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033541
33542#ifdef LIBXML_UNICODE_ENABLED
33543 int mem_base;
33544 int ret_val;
33545 int code; /* UCS code point */
33546 int n_code;
33547
33548 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33549 mem_base = xmlMemBlocks();
33550 code = gen_int(n_code, 0);
33551
33552 ret_val = xmlUCSIsArabic(code);
33553 desret_int(ret_val);
33554 call_tests++;
33555 des_int(n_code, code, 0);
33556 xmlResetLastError();
33557 if (mem_base != xmlMemBlocks()) {
33558 printf("Leak of %d blocks found in xmlUCSIsArabic",
33559 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033560 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033561 printf(" %d", n_code);
33562 printf("\n");
33563 }
33564 }
33565#endif
33566
33567 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033568 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033569}
33570
33571
33572static int
33573test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033574 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033575
33576#ifdef LIBXML_UNICODE_ENABLED
33577 int mem_base;
33578 int ret_val;
33579 int code; /* UCS code point */
33580 int n_code;
33581
33582 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33583 mem_base = xmlMemBlocks();
33584 code = gen_int(n_code, 0);
33585
33586 ret_val = xmlUCSIsArabicPresentationFormsA(code);
33587 desret_int(ret_val);
33588 call_tests++;
33589 des_int(n_code, code, 0);
33590 xmlResetLastError();
33591 if (mem_base != xmlMemBlocks()) {
33592 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
33593 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033594 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033595 printf(" %d", n_code);
33596 printf("\n");
33597 }
33598 }
33599#endif
33600
33601 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033602 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033603}
33604
33605
33606static int
33607test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033608 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033609
33610#ifdef LIBXML_UNICODE_ENABLED
33611 int mem_base;
33612 int ret_val;
33613 int code; /* UCS code point */
33614 int n_code;
33615
33616 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33617 mem_base = xmlMemBlocks();
33618 code = gen_int(n_code, 0);
33619
33620 ret_val = xmlUCSIsArabicPresentationFormsB(code);
33621 desret_int(ret_val);
33622 call_tests++;
33623 des_int(n_code, code, 0);
33624 xmlResetLastError();
33625 if (mem_base != xmlMemBlocks()) {
33626 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
33627 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033628 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033629 printf(" %d", n_code);
33630 printf("\n");
33631 }
33632 }
33633#endif
33634
33635 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033636 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033637}
33638
33639
33640static int
33641test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033642 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033643
33644#ifdef LIBXML_UNICODE_ENABLED
33645 int mem_base;
33646 int ret_val;
33647 int code; /* UCS code point */
33648 int n_code;
33649
33650 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33651 mem_base = xmlMemBlocks();
33652 code = gen_int(n_code, 0);
33653
33654 ret_val = xmlUCSIsArmenian(code);
33655 desret_int(ret_val);
33656 call_tests++;
33657 des_int(n_code, code, 0);
33658 xmlResetLastError();
33659 if (mem_base != xmlMemBlocks()) {
33660 printf("Leak of %d blocks found in xmlUCSIsArmenian",
33661 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033662 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033663 printf(" %d", n_code);
33664 printf("\n");
33665 }
33666 }
33667#endif
33668
33669 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033670 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033671}
33672
33673
33674static int
33675test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033676 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033677
33678#ifdef LIBXML_UNICODE_ENABLED
33679 int mem_base;
33680 int ret_val;
33681 int code; /* UCS code point */
33682 int n_code;
33683
33684 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33685 mem_base = xmlMemBlocks();
33686 code = gen_int(n_code, 0);
33687
33688 ret_val = xmlUCSIsArrows(code);
33689 desret_int(ret_val);
33690 call_tests++;
33691 des_int(n_code, code, 0);
33692 xmlResetLastError();
33693 if (mem_base != xmlMemBlocks()) {
33694 printf("Leak of %d blocks found in xmlUCSIsArrows",
33695 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033696 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033697 printf(" %d", n_code);
33698 printf("\n");
33699 }
33700 }
33701#endif
33702
33703 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033704 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033705}
33706
33707
33708static int
33709test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033710 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033711
33712#ifdef LIBXML_UNICODE_ENABLED
33713 int mem_base;
33714 int ret_val;
33715 int code; /* UCS code point */
33716 int n_code;
33717
33718 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33719 mem_base = xmlMemBlocks();
33720 code = gen_int(n_code, 0);
33721
33722 ret_val = xmlUCSIsBasicLatin(code);
33723 desret_int(ret_val);
33724 call_tests++;
33725 des_int(n_code, code, 0);
33726 xmlResetLastError();
33727 if (mem_base != xmlMemBlocks()) {
33728 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
33729 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033730 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033731 printf(" %d", n_code);
33732 printf("\n");
33733 }
33734 }
33735#endif
33736
33737 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033738 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033739}
33740
33741
33742static int
33743test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033744 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033745
33746#ifdef LIBXML_UNICODE_ENABLED
33747 int mem_base;
33748 int ret_val;
33749 int code; /* UCS code point */
33750 int n_code;
33751
33752 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33753 mem_base = xmlMemBlocks();
33754 code = gen_int(n_code, 0);
33755
33756 ret_val = xmlUCSIsBengali(code);
33757 desret_int(ret_val);
33758 call_tests++;
33759 des_int(n_code, code, 0);
33760 xmlResetLastError();
33761 if (mem_base != xmlMemBlocks()) {
33762 printf("Leak of %d blocks found in xmlUCSIsBengali",
33763 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033764 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033765 printf(" %d", n_code);
33766 printf("\n");
33767 }
33768 }
33769#endif
33770
33771 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033772 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033773}
33774
33775
33776static int
33777test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033778 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033779
33780#ifdef LIBXML_UNICODE_ENABLED
33781 int mem_base;
33782 int ret_val;
33783 int code; /* UCS code point */
33784 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033785 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033786 int n_block;
33787
33788 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33789 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
33790 mem_base = xmlMemBlocks();
33791 code = gen_int(n_code, 0);
33792 block = gen_const_char_ptr(n_block, 1);
33793
33794 ret_val = xmlUCSIsBlock(code, block);
33795 desret_int(ret_val);
33796 call_tests++;
33797 des_int(n_code, code, 0);
33798 des_const_char_ptr(n_block, block, 1);
33799 xmlResetLastError();
33800 if (mem_base != xmlMemBlocks()) {
33801 printf("Leak of %d blocks found in xmlUCSIsBlock",
33802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033803 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033804 printf(" %d", n_code);
33805 printf(" %d", n_block);
33806 printf("\n");
33807 }
33808 }
33809 }
33810#endif
33811
33812 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033813 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033814}
33815
33816
33817static int
33818test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033819 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033820
33821#ifdef LIBXML_UNICODE_ENABLED
33822 int mem_base;
33823 int ret_val;
33824 int code; /* UCS code point */
33825 int n_code;
33826
33827 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33828 mem_base = xmlMemBlocks();
33829 code = gen_int(n_code, 0);
33830
33831 ret_val = xmlUCSIsBlockElements(code);
33832 desret_int(ret_val);
33833 call_tests++;
33834 des_int(n_code, code, 0);
33835 xmlResetLastError();
33836 if (mem_base != xmlMemBlocks()) {
33837 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
33838 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033839 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033840 printf(" %d", n_code);
33841 printf("\n");
33842 }
33843 }
33844#endif
33845
33846 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033847 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033848}
33849
33850
33851static int
33852test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033853 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033854
33855#ifdef LIBXML_UNICODE_ENABLED
33856 int mem_base;
33857 int ret_val;
33858 int code; /* UCS code point */
33859 int n_code;
33860
33861 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33862 mem_base = xmlMemBlocks();
33863 code = gen_int(n_code, 0);
33864
33865 ret_val = xmlUCSIsBopomofo(code);
33866 desret_int(ret_val);
33867 call_tests++;
33868 des_int(n_code, code, 0);
33869 xmlResetLastError();
33870 if (mem_base != xmlMemBlocks()) {
33871 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
33872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033873 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033874 printf(" %d", n_code);
33875 printf("\n");
33876 }
33877 }
33878#endif
33879
33880 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033881 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033882}
33883
33884
33885static int
33886test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033887 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033888
33889#ifdef LIBXML_UNICODE_ENABLED
33890 int mem_base;
33891 int ret_val;
33892 int code; /* UCS code point */
33893 int n_code;
33894
33895 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33896 mem_base = xmlMemBlocks();
33897 code = gen_int(n_code, 0);
33898
33899 ret_val = xmlUCSIsBopomofoExtended(code);
33900 desret_int(ret_val);
33901 call_tests++;
33902 des_int(n_code, code, 0);
33903 xmlResetLastError();
33904 if (mem_base != xmlMemBlocks()) {
33905 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
33906 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033907 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033908 printf(" %d", n_code);
33909 printf("\n");
33910 }
33911 }
33912#endif
33913
33914 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033915 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033916}
33917
33918
33919static int
33920test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033921 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033922
33923#ifdef LIBXML_UNICODE_ENABLED
33924 int mem_base;
33925 int ret_val;
33926 int code; /* UCS code point */
33927 int n_code;
33928
33929 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33930 mem_base = xmlMemBlocks();
33931 code = gen_int(n_code, 0);
33932
33933 ret_val = xmlUCSIsBoxDrawing(code);
33934 desret_int(ret_val);
33935 call_tests++;
33936 des_int(n_code, code, 0);
33937 xmlResetLastError();
33938 if (mem_base != xmlMemBlocks()) {
33939 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
33940 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033941 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033942 printf(" %d", n_code);
33943 printf("\n");
33944 }
33945 }
33946#endif
33947
33948 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033949 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033950}
33951
33952
33953static int
33954test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033955 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033956
33957#ifdef LIBXML_UNICODE_ENABLED
33958 int mem_base;
33959 int ret_val;
33960 int code; /* UCS code point */
33961 int n_code;
33962
33963 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33964 mem_base = xmlMemBlocks();
33965 code = gen_int(n_code, 0);
33966
33967 ret_val = xmlUCSIsBraillePatterns(code);
33968 desret_int(ret_val);
33969 call_tests++;
33970 des_int(n_code, code, 0);
33971 xmlResetLastError();
33972 if (mem_base != xmlMemBlocks()) {
33973 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
33974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033975 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033976 printf(" %d", n_code);
33977 printf("\n");
33978 }
33979 }
33980#endif
33981
33982 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033983 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033984}
33985
33986
33987static int
33988test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033989 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033990
33991#ifdef LIBXML_UNICODE_ENABLED
33992 int mem_base;
33993 int ret_val;
33994 int code; /* UCS code point */
33995 int n_code;
33996
33997 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33998 mem_base = xmlMemBlocks();
33999 code = gen_int(n_code, 0);
34000
34001 ret_val = xmlUCSIsBuhid(code);
34002 desret_int(ret_val);
34003 call_tests++;
34004 des_int(n_code, code, 0);
34005 xmlResetLastError();
34006 if (mem_base != xmlMemBlocks()) {
34007 printf("Leak of %d blocks found in xmlUCSIsBuhid",
34008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034009 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034010 printf(" %d", n_code);
34011 printf("\n");
34012 }
34013 }
34014#endif
34015
34016 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034017 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034018}
34019
34020
34021static int
34022test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034023 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034024
34025#ifdef LIBXML_UNICODE_ENABLED
34026 int mem_base;
34027 int ret_val;
34028 int code; /* UCS code point */
34029 int n_code;
34030
34031 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34032 mem_base = xmlMemBlocks();
34033 code = gen_int(n_code, 0);
34034
34035 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
34036 desret_int(ret_val);
34037 call_tests++;
34038 des_int(n_code, code, 0);
34039 xmlResetLastError();
34040 if (mem_base != xmlMemBlocks()) {
34041 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
34042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034043 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034044 printf(" %d", n_code);
34045 printf("\n");
34046 }
34047 }
34048#endif
34049
34050 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034051 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034052}
34053
34054
34055static int
34056test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034057 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034058
34059#ifdef LIBXML_UNICODE_ENABLED
34060 int mem_base;
34061 int ret_val;
34062 int code; /* UCS code point */
34063 int n_code;
34064
34065 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34066 mem_base = xmlMemBlocks();
34067 code = gen_int(n_code, 0);
34068
34069 ret_val = xmlUCSIsCJKCompatibility(code);
34070 desret_int(ret_val);
34071 call_tests++;
34072 des_int(n_code, code, 0);
34073 xmlResetLastError();
34074 if (mem_base != xmlMemBlocks()) {
34075 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
34076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034077 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034078 printf(" %d", n_code);
34079 printf("\n");
34080 }
34081 }
34082#endif
34083
34084 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034085 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034086}
34087
34088
34089static int
34090test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034091 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034092
34093#ifdef LIBXML_UNICODE_ENABLED
34094 int mem_base;
34095 int ret_val;
34096 int code; /* UCS code point */
34097 int n_code;
34098
34099 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34100 mem_base = xmlMemBlocks();
34101 code = gen_int(n_code, 0);
34102
34103 ret_val = xmlUCSIsCJKCompatibilityForms(code);
34104 desret_int(ret_val);
34105 call_tests++;
34106 des_int(n_code, code, 0);
34107 xmlResetLastError();
34108 if (mem_base != xmlMemBlocks()) {
34109 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
34110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034111 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034112 printf(" %d", n_code);
34113 printf("\n");
34114 }
34115 }
34116#endif
34117
34118 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034119 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034120}
34121
34122
34123static int
34124test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034125 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034126
34127#ifdef LIBXML_UNICODE_ENABLED
34128 int mem_base;
34129 int ret_val;
34130 int code; /* UCS code point */
34131 int n_code;
34132
34133 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34134 mem_base = xmlMemBlocks();
34135 code = gen_int(n_code, 0);
34136
34137 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
34138 desret_int(ret_val);
34139 call_tests++;
34140 des_int(n_code, code, 0);
34141 xmlResetLastError();
34142 if (mem_base != xmlMemBlocks()) {
34143 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
34144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034145 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034146 printf(" %d", n_code);
34147 printf("\n");
34148 }
34149 }
34150#endif
34151
34152 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034153 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034154}
34155
34156
34157static int
34158test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034159 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034160
34161#ifdef LIBXML_UNICODE_ENABLED
34162 int mem_base;
34163 int ret_val;
34164 int code; /* UCS code point */
34165 int n_code;
34166
34167 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34168 mem_base = xmlMemBlocks();
34169 code = gen_int(n_code, 0);
34170
34171 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
34172 desret_int(ret_val);
34173 call_tests++;
34174 des_int(n_code, code, 0);
34175 xmlResetLastError();
34176 if (mem_base != xmlMemBlocks()) {
34177 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
34178 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034179 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034180 printf(" %d", n_code);
34181 printf("\n");
34182 }
34183 }
34184#endif
34185
34186 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034187 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034188}
34189
34190
34191static int
34192test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034193 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034194
34195#ifdef LIBXML_UNICODE_ENABLED
34196 int mem_base;
34197 int ret_val;
34198 int code; /* UCS code point */
34199 int n_code;
34200
34201 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34202 mem_base = xmlMemBlocks();
34203 code = gen_int(n_code, 0);
34204
34205 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
34206 desret_int(ret_val);
34207 call_tests++;
34208 des_int(n_code, code, 0);
34209 xmlResetLastError();
34210 if (mem_base != xmlMemBlocks()) {
34211 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
34212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034213 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034214 printf(" %d", n_code);
34215 printf("\n");
34216 }
34217 }
34218#endif
34219
34220 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034221 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034222}
34223
34224
34225static int
34226test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034227 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034228
34229#ifdef LIBXML_UNICODE_ENABLED
34230 int mem_base;
34231 int ret_val;
34232 int code; /* UCS code point */
34233 int n_code;
34234
34235 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34236 mem_base = xmlMemBlocks();
34237 code = gen_int(n_code, 0);
34238
34239 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
34240 desret_int(ret_val);
34241 call_tests++;
34242 des_int(n_code, code, 0);
34243 xmlResetLastError();
34244 if (mem_base != xmlMemBlocks()) {
34245 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
34246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034247 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034248 printf(" %d", n_code);
34249 printf("\n");
34250 }
34251 }
34252#endif
34253
34254 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034255 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034256}
34257
34258
34259static int
34260test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034261 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034262
34263#ifdef LIBXML_UNICODE_ENABLED
34264 int mem_base;
34265 int ret_val;
34266 int code; /* UCS code point */
34267 int n_code;
34268
34269 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34270 mem_base = xmlMemBlocks();
34271 code = gen_int(n_code, 0);
34272
34273 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
34274 desret_int(ret_val);
34275 call_tests++;
34276 des_int(n_code, code, 0);
34277 xmlResetLastError();
34278 if (mem_base != xmlMemBlocks()) {
34279 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
34280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034281 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034282 printf(" %d", n_code);
34283 printf("\n");
34284 }
34285 }
34286#endif
34287
34288 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034289 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034290}
34291
34292
34293static int
34294test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034295 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034296
34297#ifdef LIBXML_UNICODE_ENABLED
34298 int mem_base;
34299 int ret_val;
34300 int code; /* UCS code point */
34301 int n_code;
34302
34303 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34304 mem_base = xmlMemBlocks();
34305 code = gen_int(n_code, 0);
34306
34307 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
34308 desret_int(ret_val);
34309 call_tests++;
34310 des_int(n_code, code, 0);
34311 xmlResetLastError();
34312 if (mem_base != xmlMemBlocks()) {
34313 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
34314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034315 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034316 printf(" %d", n_code);
34317 printf("\n");
34318 }
34319 }
34320#endif
34321
34322 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034323 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034324}
34325
34326
34327static int
34328test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034329 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034330
34331#ifdef LIBXML_UNICODE_ENABLED
34332 int mem_base;
34333 int ret_val;
34334 int code; /* UCS code point */
34335 int n_code;
34336
34337 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34338 mem_base = xmlMemBlocks();
34339 code = gen_int(n_code, 0);
34340
34341 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
34342 desret_int(ret_val);
34343 call_tests++;
34344 des_int(n_code, code, 0);
34345 xmlResetLastError();
34346 if (mem_base != xmlMemBlocks()) {
34347 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
34348 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034349 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034350 printf(" %d", n_code);
34351 printf("\n");
34352 }
34353 }
34354#endif
34355
34356 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034357 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034358}
34359
34360
34361static int
34362test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034363 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034364
34365#ifdef LIBXML_UNICODE_ENABLED
34366 int mem_base;
34367 int ret_val;
34368 int code; /* UCS code point */
34369 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034370 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034371 int n_cat;
34372
34373 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34374 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
34375 mem_base = xmlMemBlocks();
34376 code = gen_int(n_code, 0);
34377 cat = gen_const_char_ptr(n_cat, 1);
34378
34379 ret_val = xmlUCSIsCat(code, cat);
34380 desret_int(ret_val);
34381 call_tests++;
34382 des_int(n_code, code, 0);
34383 des_const_char_ptr(n_cat, cat, 1);
34384 xmlResetLastError();
34385 if (mem_base != xmlMemBlocks()) {
34386 printf("Leak of %d blocks found in xmlUCSIsCat",
34387 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034388 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034389 printf(" %d", n_code);
34390 printf(" %d", n_cat);
34391 printf("\n");
34392 }
34393 }
34394 }
34395#endif
34396
34397 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034398 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034399}
34400
34401
34402static int
34403test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034404 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034405
34406#ifdef LIBXML_UNICODE_ENABLED
34407 int mem_base;
34408 int ret_val;
34409 int code; /* UCS code point */
34410 int n_code;
34411
34412 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34413 mem_base = xmlMemBlocks();
34414 code = gen_int(n_code, 0);
34415
34416 ret_val = xmlUCSIsCatC(code);
34417 desret_int(ret_val);
34418 call_tests++;
34419 des_int(n_code, code, 0);
34420 xmlResetLastError();
34421 if (mem_base != xmlMemBlocks()) {
34422 printf("Leak of %d blocks found in xmlUCSIsCatC",
34423 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034424 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034425 printf(" %d", n_code);
34426 printf("\n");
34427 }
34428 }
34429#endif
34430
34431 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034432 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034433}
34434
34435
34436static int
34437test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034438 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034439
34440#ifdef LIBXML_UNICODE_ENABLED
34441 int mem_base;
34442 int ret_val;
34443 int code; /* UCS code point */
34444 int n_code;
34445
34446 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34447 mem_base = xmlMemBlocks();
34448 code = gen_int(n_code, 0);
34449
34450 ret_val = xmlUCSIsCatCc(code);
34451 desret_int(ret_val);
34452 call_tests++;
34453 des_int(n_code, code, 0);
34454 xmlResetLastError();
34455 if (mem_base != xmlMemBlocks()) {
34456 printf("Leak of %d blocks found in xmlUCSIsCatCc",
34457 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034458 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034459 printf(" %d", n_code);
34460 printf("\n");
34461 }
34462 }
34463#endif
34464
34465 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034466 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034467}
34468
34469
34470static int
34471test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034472 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034473
34474#ifdef LIBXML_UNICODE_ENABLED
34475 int mem_base;
34476 int ret_val;
34477 int code; /* UCS code point */
34478 int n_code;
34479
34480 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34481 mem_base = xmlMemBlocks();
34482 code = gen_int(n_code, 0);
34483
34484 ret_val = xmlUCSIsCatCf(code);
34485 desret_int(ret_val);
34486 call_tests++;
34487 des_int(n_code, code, 0);
34488 xmlResetLastError();
34489 if (mem_base != xmlMemBlocks()) {
34490 printf("Leak of %d blocks found in xmlUCSIsCatCf",
34491 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034492 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034493 printf(" %d", n_code);
34494 printf("\n");
34495 }
34496 }
34497#endif
34498
34499 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034500 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034501}
34502
34503
34504static int
34505test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034506 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034507
34508#ifdef LIBXML_UNICODE_ENABLED
34509 int mem_base;
34510 int ret_val;
34511 int code; /* UCS code point */
34512 int n_code;
34513
34514 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34515 mem_base = xmlMemBlocks();
34516 code = gen_int(n_code, 0);
34517
34518 ret_val = xmlUCSIsCatCo(code);
34519 desret_int(ret_val);
34520 call_tests++;
34521 des_int(n_code, code, 0);
34522 xmlResetLastError();
34523 if (mem_base != xmlMemBlocks()) {
34524 printf("Leak of %d blocks found in xmlUCSIsCatCo",
34525 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034526 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034527 printf(" %d", n_code);
34528 printf("\n");
34529 }
34530 }
34531#endif
34532
34533 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034534 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034535}
34536
34537
34538static int
34539test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034540 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034541
34542#ifdef LIBXML_UNICODE_ENABLED
34543 int mem_base;
34544 int ret_val;
34545 int code; /* UCS code point */
34546 int n_code;
34547
34548 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34549 mem_base = xmlMemBlocks();
34550 code = gen_int(n_code, 0);
34551
34552 ret_val = xmlUCSIsCatCs(code);
34553 desret_int(ret_val);
34554 call_tests++;
34555 des_int(n_code, code, 0);
34556 xmlResetLastError();
34557 if (mem_base != xmlMemBlocks()) {
34558 printf("Leak of %d blocks found in xmlUCSIsCatCs",
34559 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034560 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034561 printf(" %d", n_code);
34562 printf("\n");
34563 }
34564 }
34565#endif
34566
34567 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034568 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034569}
34570
34571
34572static int
34573test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034574 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034575
34576#ifdef LIBXML_UNICODE_ENABLED
34577 int mem_base;
34578 int ret_val;
34579 int code; /* UCS code point */
34580 int n_code;
34581
34582 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34583 mem_base = xmlMemBlocks();
34584 code = gen_int(n_code, 0);
34585
34586 ret_val = xmlUCSIsCatL(code);
34587 desret_int(ret_val);
34588 call_tests++;
34589 des_int(n_code, code, 0);
34590 xmlResetLastError();
34591 if (mem_base != xmlMemBlocks()) {
34592 printf("Leak of %d blocks found in xmlUCSIsCatL",
34593 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034594 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034595 printf(" %d", n_code);
34596 printf("\n");
34597 }
34598 }
34599#endif
34600
34601 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034602 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034603}
34604
34605
34606static int
34607test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034608 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034609
34610#ifdef LIBXML_UNICODE_ENABLED
34611 int mem_base;
34612 int ret_val;
34613 int code; /* UCS code point */
34614 int n_code;
34615
34616 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34617 mem_base = xmlMemBlocks();
34618 code = gen_int(n_code, 0);
34619
34620 ret_val = xmlUCSIsCatLl(code);
34621 desret_int(ret_val);
34622 call_tests++;
34623 des_int(n_code, code, 0);
34624 xmlResetLastError();
34625 if (mem_base != xmlMemBlocks()) {
34626 printf("Leak of %d blocks found in xmlUCSIsCatLl",
34627 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034628 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034629 printf(" %d", n_code);
34630 printf("\n");
34631 }
34632 }
34633#endif
34634
34635 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034636 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034637}
34638
34639
34640static int
34641test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034642 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034643
34644#ifdef LIBXML_UNICODE_ENABLED
34645 int mem_base;
34646 int ret_val;
34647 int code; /* UCS code point */
34648 int n_code;
34649
34650 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34651 mem_base = xmlMemBlocks();
34652 code = gen_int(n_code, 0);
34653
34654 ret_val = xmlUCSIsCatLm(code);
34655 desret_int(ret_val);
34656 call_tests++;
34657 des_int(n_code, code, 0);
34658 xmlResetLastError();
34659 if (mem_base != xmlMemBlocks()) {
34660 printf("Leak of %d blocks found in xmlUCSIsCatLm",
34661 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034662 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034663 printf(" %d", n_code);
34664 printf("\n");
34665 }
34666 }
34667#endif
34668
34669 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034670 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034671}
34672
34673
34674static int
34675test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034676 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034677
34678#ifdef LIBXML_UNICODE_ENABLED
34679 int mem_base;
34680 int ret_val;
34681 int code; /* UCS code point */
34682 int n_code;
34683
34684 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34685 mem_base = xmlMemBlocks();
34686 code = gen_int(n_code, 0);
34687
34688 ret_val = xmlUCSIsCatLo(code);
34689 desret_int(ret_val);
34690 call_tests++;
34691 des_int(n_code, code, 0);
34692 xmlResetLastError();
34693 if (mem_base != xmlMemBlocks()) {
34694 printf("Leak of %d blocks found in xmlUCSIsCatLo",
34695 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034696 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034697 printf(" %d", n_code);
34698 printf("\n");
34699 }
34700 }
34701#endif
34702
34703 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034704 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034705}
34706
34707
34708static int
34709test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034710 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034711
34712#ifdef LIBXML_UNICODE_ENABLED
34713 int mem_base;
34714 int ret_val;
34715 int code; /* UCS code point */
34716 int n_code;
34717
34718 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34719 mem_base = xmlMemBlocks();
34720 code = gen_int(n_code, 0);
34721
34722 ret_val = xmlUCSIsCatLt(code);
34723 desret_int(ret_val);
34724 call_tests++;
34725 des_int(n_code, code, 0);
34726 xmlResetLastError();
34727 if (mem_base != xmlMemBlocks()) {
34728 printf("Leak of %d blocks found in xmlUCSIsCatLt",
34729 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034730 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034731 printf(" %d", n_code);
34732 printf("\n");
34733 }
34734 }
34735#endif
34736
34737 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034738 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034739}
34740
34741
34742static int
34743test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034744 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034745
34746#ifdef LIBXML_UNICODE_ENABLED
34747 int mem_base;
34748 int ret_val;
34749 int code; /* UCS code point */
34750 int n_code;
34751
34752 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34753 mem_base = xmlMemBlocks();
34754 code = gen_int(n_code, 0);
34755
34756 ret_val = xmlUCSIsCatLu(code);
34757 desret_int(ret_val);
34758 call_tests++;
34759 des_int(n_code, code, 0);
34760 xmlResetLastError();
34761 if (mem_base != xmlMemBlocks()) {
34762 printf("Leak of %d blocks found in xmlUCSIsCatLu",
34763 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034764 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034765 printf(" %d", n_code);
34766 printf("\n");
34767 }
34768 }
34769#endif
34770
34771 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034772 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034773}
34774
34775
34776static int
34777test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034778 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034779
34780#ifdef LIBXML_UNICODE_ENABLED
34781 int mem_base;
34782 int ret_val;
34783 int code; /* UCS code point */
34784 int n_code;
34785
34786 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34787 mem_base = xmlMemBlocks();
34788 code = gen_int(n_code, 0);
34789
34790 ret_val = xmlUCSIsCatM(code);
34791 desret_int(ret_val);
34792 call_tests++;
34793 des_int(n_code, code, 0);
34794 xmlResetLastError();
34795 if (mem_base != xmlMemBlocks()) {
34796 printf("Leak of %d blocks found in xmlUCSIsCatM",
34797 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034798 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034799 printf(" %d", n_code);
34800 printf("\n");
34801 }
34802 }
34803#endif
34804
34805 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034806 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034807}
34808
34809
34810static int
34811test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034812 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034813
34814#ifdef LIBXML_UNICODE_ENABLED
34815 int mem_base;
34816 int ret_val;
34817 int code; /* UCS code point */
34818 int n_code;
34819
34820 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34821 mem_base = xmlMemBlocks();
34822 code = gen_int(n_code, 0);
34823
34824 ret_val = xmlUCSIsCatMc(code);
34825 desret_int(ret_val);
34826 call_tests++;
34827 des_int(n_code, code, 0);
34828 xmlResetLastError();
34829 if (mem_base != xmlMemBlocks()) {
34830 printf("Leak of %d blocks found in xmlUCSIsCatMc",
34831 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034832 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034833 printf(" %d", n_code);
34834 printf("\n");
34835 }
34836 }
34837#endif
34838
34839 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034840 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034841}
34842
34843
34844static int
34845test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034846 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034847
34848#ifdef LIBXML_UNICODE_ENABLED
34849 int mem_base;
34850 int ret_val;
34851 int code; /* UCS code point */
34852 int n_code;
34853
34854 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34855 mem_base = xmlMemBlocks();
34856 code = gen_int(n_code, 0);
34857
34858 ret_val = xmlUCSIsCatMe(code);
34859 desret_int(ret_val);
34860 call_tests++;
34861 des_int(n_code, code, 0);
34862 xmlResetLastError();
34863 if (mem_base != xmlMemBlocks()) {
34864 printf("Leak of %d blocks found in xmlUCSIsCatMe",
34865 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034866 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034867 printf(" %d", n_code);
34868 printf("\n");
34869 }
34870 }
34871#endif
34872
34873 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034874 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034875}
34876
34877
34878static int
34879test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034880 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034881
34882#ifdef LIBXML_UNICODE_ENABLED
34883 int mem_base;
34884 int ret_val;
34885 int code; /* UCS code point */
34886 int n_code;
34887
34888 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34889 mem_base = xmlMemBlocks();
34890 code = gen_int(n_code, 0);
34891
34892 ret_val = xmlUCSIsCatMn(code);
34893 desret_int(ret_val);
34894 call_tests++;
34895 des_int(n_code, code, 0);
34896 xmlResetLastError();
34897 if (mem_base != xmlMemBlocks()) {
34898 printf("Leak of %d blocks found in xmlUCSIsCatMn",
34899 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034900 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034901 printf(" %d", n_code);
34902 printf("\n");
34903 }
34904 }
34905#endif
34906
34907 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034908 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034909}
34910
34911
34912static int
34913test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034914 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034915
34916#ifdef LIBXML_UNICODE_ENABLED
34917 int mem_base;
34918 int ret_val;
34919 int code; /* UCS code point */
34920 int n_code;
34921
34922 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34923 mem_base = xmlMemBlocks();
34924 code = gen_int(n_code, 0);
34925
34926 ret_val = xmlUCSIsCatN(code);
34927 desret_int(ret_val);
34928 call_tests++;
34929 des_int(n_code, code, 0);
34930 xmlResetLastError();
34931 if (mem_base != xmlMemBlocks()) {
34932 printf("Leak of %d blocks found in xmlUCSIsCatN",
34933 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034934 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034935 printf(" %d", n_code);
34936 printf("\n");
34937 }
34938 }
34939#endif
34940
34941 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034942 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034943}
34944
34945
34946static int
34947test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034948 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034949
34950#ifdef LIBXML_UNICODE_ENABLED
34951 int mem_base;
34952 int ret_val;
34953 int code; /* UCS code point */
34954 int n_code;
34955
34956 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34957 mem_base = xmlMemBlocks();
34958 code = gen_int(n_code, 0);
34959
34960 ret_val = xmlUCSIsCatNd(code);
34961 desret_int(ret_val);
34962 call_tests++;
34963 des_int(n_code, code, 0);
34964 xmlResetLastError();
34965 if (mem_base != xmlMemBlocks()) {
34966 printf("Leak of %d blocks found in xmlUCSIsCatNd",
34967 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034968 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034969 printf(" %d", n_code);
34970 printf("\n");
34971 }
34972 }
34973#endif
34974
34975 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034976 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034977}
34978
34979
34980static int
34981test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034982 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034983
34984#ifdef LIBXML_UNICODE_ENABLED
34985 int mem_base;
34986 int ret_val;
34987 int code; /* UCS code point */
34988 int n_code;
34989
34990 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34991 mem_base = xmlMemBlocks();
34992 code = gen_int(n_code, 0);
34993
34994 ret_val = xmlUCSIsCatNl(code);
34995 desret_int(ret_val);
34996 call_tests++;
34997 des_int(n_code, code, 0);
34998 xmlResetLastError();
34999 if (mem_base != xmlMemBlocks()) {
35000 printf("Leak of %d blocks found in xmlUCSIsCatNl",
35001 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035002 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035003 printf(" %d", n_code);
35004 printf("\n");
35005 }
35006 }
35007#endif
35008
35009 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035010 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035011}
35012
35013
35014static int
35015test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035016 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035017
35018#ifdef LIBXML_UNICODE_ENABLED
35019 int mem_base;
35020 int ret_val;
35021 int code; /* UCS code point */
35022 int n_code;
35023
35024 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35025 mem_base = xmlMemBlocks();
35026 code = gen_int(n_code, 0);
35027
35028 ret_val = xmlUCSIsCatNo(code);
35029 desret_int(ret_val);
35030 call_tests++;
35031 des_int(n_code, code, 0);
35032 xmlResetLastError();
35033 if (mem_base != xmlMemBlocks()) {
35034 printf("Leak of %d blocks found in xmlUCSIsCatNo",
35035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035036 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035037 printf(" %d", n_code);
35038 printf("\n");
35039 }
35040 }
35041#endif
35042
35043 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035044 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035045}
35046
35047
35048static int
35049test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035050 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035051
35052#ifdef LIBXML_UNICODE_ENABLED
35053 int mem_base;
35054 int ret_val;
35055 int code; /* UCS code point */
35056 int n_code;
35057
35058 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35059 mem_base = xmlMemBlocks();
35060 code = gen_int(n_code, 0);
35061
35062 ret_val = xmlUCSIsCatP(code);
35063 desret_int(ret_val);
35064 call_tests++;
35065 des_int(n_code, code, 0);
35066 xmlResetLastError();
35067 if (mem_base != xmlMemBlocks()) {
35068 printf("Leak of %d blocks found in xmlUCSIsCatP",
35069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035070 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035071 printf(" %d", n_code);
35072 printf("\n");
35073 }
35074 }
35075#endif
35076
35077 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035078 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035079}
35080
35081
35082static int
35083test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035084 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035085
35086#ifdef LIBXML_UNICODE_ENABLED
35087 int mem_base;
35088 int ret_val;
35089 int code; /* UCS code point */
35090 int n_code;
35091
35092 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35093 mem_base = xmlMemBlocks();
35094 code = gen_int(n_code, 0);
35095
35096 ret_val = xmlUCSIsCatPc(code);
35097 desret_int(ret_val);
35098 call_tests++;
35099 des_int(n_code, code, 0);
35100 xmlResetLastError();
35101 if (mem_base != xmlMemBlocks()) {
35102 printf("Leak of %d blocks found in xmlUCSIsCatPc",
35103 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035104 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035105 printf(" %d", n_code);
35106 printf("\n");
35107 }
35108 }
35109#endif
35110
35111 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035112 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035113}
35114
35115
35116static int
35117test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035118 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035119
35120#ifdef LIBXML_UNICODE_ENABLED
35121 int mem_base;
35122 int ret_val;
35123 int code; /* UCS code point */
35124 int n_code;
35125
35126 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35127 mem_base = xmlMemBlocks();
35128 code = gen_int(n_code, 0);
35129
35130 ret_val = xmlUCSIsCatPd(code);
35131 desret_int(ret_val);
35132 call_tests++;
35133 des_int(n_code, code, 0);
35134 xmlResetLastError();
35135 if (mem_base != xmlMemBlocks()) {
35136 printf("Leak of %d blocks found in xmlUCSIsCatPd",
35137 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035138 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035139 printf(" %d", n_code);
35140 printf("\n");
35141 }
35142 }
35143#endif
35144
35145 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035146 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035147}
35148
35149
35150static int
35151test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035152 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035153
35154#ifdef LIBXML_UNICODE_ENABLED
35155 int mem_base;
35156 int ret_val;
35157 int code; /* UCS code point */
35158 int n_code;
35159
35160 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35161 mem_base = xmlMemBlocks();
35162 code = gen_int(n_code, 0);
35163
35164 ret_val = xmlUCSIsCatPe(code);
35165 desret_int(ret_val);
35166 call_tests++;
35167 des_int(n_code, code, 0);
35168 xmlResetLastError();
35169 if (mem_base != xmlMemBlocks()) {
35170 printf("Leak of %d blocks found in xmlUCSIsCatPe",
35171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035172 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035173 printf(" %d", n_code);
35174 printf("\n");
35175 }
35176 }
35177#endif
35178
35179 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035180 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035181}
35182
35183
35184static int
35185test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035186 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035187
35188#ifdef LIBXML_UNICODE_ENABLED
35189 int mem_base;
35190 int ret_val;
35191 int code; /* UCS code point */
35192 int n_code;
35193
35194 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35195 mem_base = xmlMemBlocks();
35196 code = gen_int(n_code, 0);
35197
35198 ret_val = xmlUCSIsCatPf(code);
35199 desret_int(ret_val);
35200 call_tests++;
35201 des_int(n_code, code, 0);
35202 xmlResetLastError();
35203 if (mem_base != xmlMemBlocks()) {
35204 printf("Leak of %d blocks found in xmlUCSIsCatPf",
35205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035206 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035207 printf(" %d", n_code);
35208 printf("\n");
35209 }
35210 }
35211#endif
35212
35213 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035214 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035215}
35216
35217
35218static int
35219test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035220 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035221
35222#ifdef LIBXML_UNICODE_ENABLED
35223 int mem_base;
35224 int ret_val;
35225 int code; /* UCS code point */
35226 int n_code;
35227
35228 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35229 mem_base = xmlMemBlocks();
35230 code = gen_int(n_code, 0);
35231
35232 ret_val = xmlUCSIsCatPi(code);
35233 desret_int(ret_val);
35234 call_tests++;
35235 des_int(n_code, code, 0);
35236 xmlResetLastError();
35237 if (mem_base != xmlMemBlocks()) {
35238 printf("Leak of %d blocks found in xmlUCSIsCatPi",
35239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035240 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035241 printf(" %d", n_code);
35242 printf("\n");
35243 }
35244 }
35245#endif
35246
35247 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035248 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035249}
35250
35251
35252static int
35253test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035254 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035255
35256#ifdef LIBXML_UNICODE_ENABLED
35257 int mem_base;
35258 int ret_val;
35259 int code; /* UCS code point */
35260 int n_code;
35261
35262 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35263 mem_base = xmlMemBlocks();
35264 code = gen_int(n_code, 0);
35265
35266 ret_val = xmlUCSIsCatPo(code);
35267 desret_int(ret_val);
35268 call_tests++;
35269 des_int(n_code, code, 0);
35270 xmlResetLastError();
35271 if (mem_base != xmlMemBlocks()) {
35272 printf("Leak of %d blocks found in xmlUCSIsCatPo",
35273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035274 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035275 printf(" %d", n_code);
35276 printf("\n");
35277 }
35278 }
35279#endif
35280
35281 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035282 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035283}
35284
35285
35286static int
35287test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035288 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035289
35290#ifdef LIBXML_UNICODE_ENABLED
35291 int mem_base;
35292 int ret_val;
35293 int code; /* UCS code point */
35294 int n_code;
35295
35296 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35297 mem_base = xmlMemBlocks();
35298 code = gen_int(n_code, 0);
35299
35300 ret_val = xmlUCSIsCatPs(code);
35301 desret_int(ret_val);
35302 call_tests++;
35303 des_int(n_code, code, 0);
35304 xmlResetLastError();
35305 if (mem_base != xmlMemBlocks()) {
35306 printf("Leak of %d blocks found in xmlUCSIsCatPs",
35307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035308 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035309 printf(" %d", n_code);
35310 printf("\n");
35311 }
35312 }
35313#endif
35314
35315 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035316 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035317}
35318
35319
35320static int
35321test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035322 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035323
35324#ifdef LIBXML_UNICODE_ENABLED
35325 int mem_base;
35326 int ret_val;
35327 int code; /* UCS code point */
35328 int n_code;
35329
35330 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35331 mem_base = xmlMemBlocks();
35332 code = gen_int(n_code, 0);
35333
35334 ret_val = xmlUCSIsCatS(code);
35335 desret_int(ret_val);
35336 call_tests++;
35337 des_int(n_code, code, 0);
35338 xmlResetLastError();
35339 if (mem_base != xmlMemBlocks()) {
35340 printf("Leak of %d blocks found in xmlUCSIsCatS",
35341 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035342 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035343 printf(" %d", n_code);
35344 printf("\n");
35345 }
35346 }
35347#endif
35348
35349 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035350 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035351}
35352
35353
35354static int
35355test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035356 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035357
35358#ifdef LIBXML_UNICODE_ENABLED
35359 int mem_base;
35360 int ret_val;
35361 int code; /* UCS code point */
35362 int n_code;
35363
35364 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35365 mem_base = xmlMemBlocks();
35366 code = gen_int(n_code, 0);
35367
35368 ret_val = xmlUCSIsCatSc(code);
35369 desret_int(ret_val);
35370 call_tests++;
35371 des_int(n_code, code, 0);
35372 xmlResetLastError();
35373 if (mem_base != xmlMemBlocks()) {
35374 printf("Leak of %d blocks found in xmlUCSIsCatSc",
35375 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035376 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035377 printf(" %d", n_code);
35378 printf("\n");
35379 }
35380 }
35381#endif
35382
35383 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035384 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035385}
35386
35387
35388static int
35389test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035390 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035391
35392#ifdef LIBXML_UNICODE_ENABLED
35393 int mem_base;
35394 int ret_val;
35395 int code; /* UCS code point */
35396 int n_code;
35397
35398 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35399 mem_base = xmlMemBlocks();
35400 code = gen_int(n_code, 0);
35401
35402 ret_val = xmlUCSIsCatSk(code);
35403 desret_int(ret_val);
35404 call_tests++;
35405 des_int(n_code, code, 0);
35406 xmlResetLastError();
35407 if (mem_base != xmlMemBlocks()) {
35408 printf("Leak of %d blocks found in xmlUCSIsCatSk",
35409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035410 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035411 printf(" %d", n_code);
35412 printf("\n");
35413 }
35414 }
35415#endif
35416
35417 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035418 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035419}
35420
35421
35422static int
35423test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035424 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035425
35426#ifdef LIBXML_UNICODE_ENABLED
35427 int mem_base;
35428 int ret_val;
35429 int code; /* UCS code point */
35430 int n_code;
35431
35432 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35433 mem_base = xmlMemBlocks();
35434 code = gen_int(n_code, 0);
35435
35436 ret_val = xmlUCSIsCatSm(code);
35437 desret_int(ret_val);
35438 call_tests++;
35439 des_int(n_code, code, 0);
35440 xmlResetLastError();
35441 if (mem_base != xmlMemBlocks()) {
35442 printf("Leak of %d blocks found in xmlUCSIsCatSm",
35443 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035444 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035445 printf(" %d", n_code);
35446 printf("\n");
35447 }
35448 }
35449#endif
35450
35451 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035452 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035453}
35454
35455
35456static int
35457test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035458 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035459
35460#ifdef LIBXML_UNICODE_ENABLED
35461 int mem_base;
35462 int ret_val;
35463 int code; /* UCS code point */
35464 int n_code;
35465
35466 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35467 mem_base = xmlMemBlocks();
35468 code = gen_int(n_code, 0);
35469
35470 ret_val = xmlUCSIsCatSo(code);
35471 desret_int(ret_val);
35472 call_tests++;
35473 des_int(n_code, code, 0);
35474 xmlResetLastError();
35475 if (mem_base != xmlMemBlocks()) {
35476 printf("Leak of %d blocks found in xmlUCSIsCatSo",
35477 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035478 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035479 printf(" %d", n_code);
35480 printf("\n");
35481 }
35482 }
35483#endif
35484
35485 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035486 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035487}
35488
35489
35490static int
35491test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035492 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035493
35494#ifdef LIBXML_UNICODE_ENABLED
35495 int mem_base;
35496 int ret_val;
35497 int code; /* UCS code point */
35498 int n_code;
35499
35500 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35501 mem_base = xmlMemBlocks();
35502 code = gen_int(n_code, 0);
35503
35504 ret_val = xmlUCSIsCatZ(code);
35505 desret_int(ret_val);
35506 call_tests++;
35507 des_int(n_code, code, 0);
35508 xmlResetLastError();
35509 if (mem_base != xmlMemBlocks()) {
35510 printf("Leak of %d blocks found in xmlUCSIsCatZ",
35511 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035512 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035513 printf(" %d", n_code);
35514 printf("\n");
35515 }
35516 }
35517#endif
35518
35519 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035520 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035521}
35522
35523
35524static int
35525test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035526 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035527
35528#ifdef LIBXML_UNICODE_ENABLED
35529 int mem_base;
35530 int ret_val;
35531 int code; /* UCS code point */
35532 int n_code;
35533
35534 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35535 mem_base = xmlMemBlocks();
35536 code = gen_int(n_code, 0);
35537
35538 ret_val = xmlUCSIsCatZl(code);
35539 desret_int(ret_val);
35540 call_tests++;
35541 des_int(n_code, code, 0);
35542 xmlResetLastError();
35543 if (mem_base != xmlMemBlocks()) {
35544 printf("Leak of %d blocks found in xmlUCSIsCatZl",
35545 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035546 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035547 printf(" %d", n_code);
35548 printf("\n");
35549 }
35550 }
35551#endif
35552
35553 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035554 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035555}
35556
35557
35558static int
35559test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035560 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035561
35562#ifdef LIBXML_UNICODE_ENABLED
35563 int mem_base;
35564 int ret_val;
35565 int code; /* UCS code point */
35566 int n_code;
35567
35568 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35569 mem_base = xmlMemBlocks();
35570 code = gen_int(n_code, 0);
35571
35572 ret_val = xmlUCSIsCatZp(code);
35573 desret_int(ret_val);
35574 call_tests++;
35575 des_int(n_code, code, 0);
35576 xmlResetLastError();
35577 if (mem_base != xmlMemBlocks()) {
35578 printf("Leak of %d blocks found in xmlUCSIsCatZp",
35579 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035580 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035581 printf(" %d", n_code);
35582 printf("\n");
35583 }
35584 }
35585#endif
35586
35587 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035588 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035589}
35590
35591
35592static int
35593test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035594 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035595
35596#ifdef LIBXML_UNICODE_ENABLED
35597 int mem_base;
35598 int ret_val;
35599 int code; /* UCS code point */
35600 int n_code;
35601
35602 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35603 mem_base = xmlMemBlocks();
35604 code = gen_int(n_code, 0);
35605
35606 ret_val = xmlUCSIsCatZs(code);
35607 desret_int(ret_val);
35608 call_tests++;
35609 des_int(n_code, code, 0);
35610 xmlResetLastError();
35611 if (mem_base != xmlMemBlocks()) {
35612 printf("Leak of %d blocks found in xmlUCSIsCatZs",
35613 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035614 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035615 printf(" %d", n_code);
35616 printf("\n");
35617 }
35618 }
35619#endif
35620
35621 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035622 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035623}
35624
35625
35626static int
35627test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035628 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035629
35630#ifdef LIBXML_UNICODE_ENABLED
35631 int mem_base;
35632 int ret_val;
35633 int code; /* UCS code point */
35634 int n_code;
35635
35636 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35637 mem_base = xmlMemBlocks();
35638 code = gen_int(n_code, 0);
35639
35640 ret_val = xmlUCSIsCherokee(code);
35641 desret_int(ret_val);
35642 call_tests++;
35643 des_int(n_code, code, 0);
35644 xmlResetLastError();
35645 if (mem_base != xmlMemBlocks()) {
35646 printf("Leak of %d blocks found in xmlUCSIsCherokee",
35647 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035648 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035649 printf(" %d", n_code);
35650 printf("\n");
35651 }
35652 }
35653#endif
35654
35655 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035656 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035657}
35658
35659
35660static int
35661test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035662 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035663
35664#ifdef LIBXML_UNICODE_ENABLED
35665 int mem_base;
35666 int ret_val;
35667 int code; /* UCS code point */
35668 int n_code;
35669
35670 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35671 mem_base = xmlMemBlocks();
35672 code = gen_int(n_code, 0);
35673
35674 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
35675 desret_int(ret_val);
35676 call_tests++;
35677 des_int(n_code, code, 0);
35678 xmlResetLastError();
35679 if (mem_base != xmlMemBlocks()) {
35680 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
35681 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035682 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035683 printf(" %d", n_code);
35684 printf("\n");
35685 }
35686 }
35687#endif
35688
35689 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035690 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035691}
35692
35693
35694static int
35695test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035696 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035697
35698#ifdef LIBXML_UNICODE_ENABLED
35699 int mem_base;
35700 int ret_val;
35701 int code; /* UCS code point */
35702 int n_code;
35703
35704 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35705 mem_base = xmlMemBlocks();
35706 code = gen_int(n_code, 0);
35707
35708 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
35709 desret_int(ret_val);
35710 call_tests++;
35711 des_int(n_code, code, 0);
35712 xmlResetLastError();
35713 if (mem_base != xmlMemBlocks()) {
35714 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
35715 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035716 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035717 printf(" %d", n_code);
35718 printf("\n");
35719 }
35720 }
35721#endif
35722
35723 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035724 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035725}
35726
35727
35728static int
35729test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035730 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035731
35732#ifdef LIBXML_UNICODE_ENABLED
35733 int mem_base;
35734 int ret_val;
35735 int code; /* UCS code point */
35736 int n_code;
35737
35738 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35739 mem_base = xmlMemBlocks();
35740 code = gen_int(n_code, 0);
35741
35742 ret_val = xmlUCSIsCombiningHalfMarks(code);
35743 desret_int(ret_val);
35744 call_tests++;
35745 des_int(n_code, code, 0);
35746 xmlResetLastError();
35747 if (mem_base != xmlMemBlocks()) {
35748 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
35749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035750 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035751 printf(" %d", n_code);
35752 printf("\n");
35753 }
35754 }
35755#endif
35756
35757 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035758 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035759}
35760
35761
35762static int
35763test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035764 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035765
35766#ifdef LIBXML_UNICODE_ENABLED
35767 int mem_base;
35768 int ret_val;
35769 int code; /* UCS code point */
35770 int n_code;
35771
35772 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35773 mem_base = xmlMemBlocks();
35774 code = gen_int(n_code, 0);
35775
35776 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
35777 desret_int(ret_val);
35778 call_tests++;
35779 des_int(n_code, code, 0);
35780 xmlResetLastError();
35781 if (mem_base != xmlMemBlocks()) {
35782 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
35783 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035784 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035785 printf(" %d", n_code);
35786 printf("\n");
35787 }
35788 }
35789#endif
35790
35791 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035792 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035793}
35794
35795
35796static int
35797test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035798 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035799
35800#ifdef LIBXML_UNICODE_ENABLED
35801 int mem_base;
35802 int ret_val;
35803 int code; /* UCS code point */
35804 int n_code;
35805
35806 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35807 mem_base = xmlMemBlocks();
35808 code = gen_int(n_code, 0);
35809
35810 ret_val = xmlUCSIsControlPictures(code);
35811 desret_int(ret_val);
35812 call_tests++;
35813 des_int(n_code, code, 0);
35814 xmlResetLastError();
35815 if (mem_base != xmlMemBlocks()) {
35816 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
35817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035818 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035819 printf(" %d", n_code);
35820 printf("\n");
35821 }
35822 }
35823#endif
35824
35825 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035826 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035827}
35828
35829
35830static int
35831test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035832 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035833
35834#ifdef LIBXML_UNICODE_ENABLED
35835 int mem_base;
35836 int ret_val;
35837 int code; /* UCS code point */
35838 int n_code;
35839
35840 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35841 mem_base = xmlMemBlocks();
35842 code = gen_int(n_code, 0);
35843
35844 ret_val = xmlUCSIsCurrencySymbols(code);
35845 desret_int(ret_val);
35846 call_tests++;
35847 des_int(n_code, code, 0);
35848 xmlResetLastError();
35849 if (mem_base != xmlMemBlocks()) {
35850 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
35851 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035852 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035853 printf(" %d", n_code);
35854 printf("\n");
35855 }
35856 }
35857#endif
35858
35859 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035860 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035861}
35862
35863
35864static int
35865test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035866 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035867
35868#ifdef LIBXML_UNICODE_ENABLED
35869 int mem_base;
35870 int ret_val;
35871 int code; /* UCS code point */
35872 int n_code;
35873
35874 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35875 mem_base = xmlMemBlocks();
35876 code = gen_int(n_code, 0);
35877
35878 ret_val = xmlUCSIsCypriotSyllabary(code);
35879 desret_int(ret_val);
35880 call_tests++;
35881 des_int(n_code, code, 0);
35882 xmlResetLastError();
35883 if (mem_base != xmlMemBlocks()) {
35884 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
35885 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035886 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035887 printf(" %d", n_code);
35888 printf("\n");
35889 }
35890 }
35891#endif
35892
35893 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035894 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035895}
35896
35897
35898static int
35899test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035900 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035901
35902#ifdef LIBXML_UNICODE_ENABLED
35903 int mem_base;
35904 int ret_val;
35905 int code; /* UCS code point */
35906 int n_code;
35907
35908 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35909 mem_base = xmlMemBlocks();
35910 code = gen_int(n_code, 0);
35911
35912 ret_val = xmlUCSIsCyrillic(code);
35913 desret_int(ret_val);
35914 call_tests++;
35915 des_int(n_code, code, 0);
35916 xmlResetLastError();
35917 if (mem_base != xmlMemBlocks()) {
35918 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
35919 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035920 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035921 printf(" %d", n_code);
35922 printf("\n");
35923 }
35924 }
35925#endif
35926
35927 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035928 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035929}
35930
35931
35932static int
35933test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035934 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035935
35936#ifdef LIBXML_UNICODE_ENABLED
35937 int mem_base;
35938 int ret_val;
35939 int code; /* UCS code point */
35940 int n_code;
35941
35942 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35943 mem_base = xmlMemBlocks();
35944 code = gen_int(n_code, 0);
35945
35946 ret_val = xmlUCSIsCyrillicSupplement(code);
35947 desret_int(ret_val);
35948 call_tests++;
35949 des_int(n_code, code, 0);
35950 xmlResetLastError();
35951 if (mem_base != xmlMemBlocks()) {
35952 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
35953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035954 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035955 printf(" %d", n_code);
35956 printf("\n");
35957 }
35958 }
35959#endif
35960
35961 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035962 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035963}
35964
35965
35966static int
35967test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035968 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035969
35970#ifdef LIBXML_UNICODE_ENABLED
35971 int mem_base;
35972 int ret_val;
35973 int code; /* UCS code point */
35974 int n_code;
35975
35976 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35977 mem_base = xmlMemBlocks();
35978 code = gen_int(n_code, 0);
35979
35980 ret_val = xmlUCSIsDeseret(code);
35981 desret_int(ret_val);
35982 call_tests++;
35983 des_int(n_code, code, 0);
35984 xmlResetLastError();
35985 if (mem_base != xmlMemBlocks()) {
35986 printf("Leak of %d blocks found in xmlUCSIsDeseret",
35987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035988 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035989 printf(" %d", n_code);
35990 printf("\n");
35991 }
35992 }
35993#endif
35994
35995 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035996 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035997}
35998
35999
36000static int
36001test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036002 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036003
36004#ifdef LIBXML_UNICODE_ENABLED
36005 int mem_base;
36006 int ret_val;
36007 int code; /* UCS code point */
36008 int n_code;
36009
36010 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36011 mem_base = xmlMemBlocks();
36012 code = gen_int(n_code, 0);
36013
36014 ret_val = xmlUCSIsDevanagari(code);
36015 desret_int(ret_val);
36016 call_tests++;
36017 des_int(n_code, code, 0);
36018 xmlResetLastError();
36019 if (mem_base != xmlMemBlocks()) {
36020 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
36021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036022 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036023 printf(" %d", n_code);
36024 printf("\n");
36025 }
36026 }
36027#endif
36028
36029 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036030 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036031}
36032
36033
36034static int
36035test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036036 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036037
36038#ifdef LIBXML_UNICODE_ENABLED
36039 int mem_base;
36040 int ret_val;
36041 int code; /* UCS code point */
36042 int n_code;
36043
36044 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36045 mem_base = xmlMemBlocks();
36046 code = gen_int(n_code, 0);
36047
36048 ret_val = xmlUCSIsDingbats(code);
36049 desret_int(ret_val);
36050 call_tests++;
36051 des_int(n_code, code, 0);
36052 xmlResetLastError();
36053 if (mem_base != xmlMemBlocks()) {
36054 printf("Leak of %d blocks found in xmlUCSIsDingbats",
36055 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036056 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036057 printf(" %d", n_code);
36058 printf("\n");
36059 }
36060 }
36061#endif
36062
36063 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036064 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036065}
36066
36067
36068static int
36069test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036070 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036071
36072#ifdef LIBXML_UNICODE_ENABLED
36073 int mem_base;
36074 int ret_val;
36075 int code; /* UCS code point */
36076 int n_code;
36077
36078 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36079 mem_base = xmlMemBlocks();
36080 code = gen_int(n_code, 0);
36081
36082 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
36083 desret_int(ret_val);
36084 call_tests++;
36085 des_int(n_code, code, 0);
36086 xmlResetLastError();
36087 if (mem_base != xmlMemBlocks()) {
36088 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
36089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036090 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036091 printf(" %d", n_code);
36092 printf("\n");
36093 }
36094 }
36095#endif
36096
36097 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036098 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036099}
36100
36101
36102static int
36103test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036104 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036105
36106#ifdef LIBXML_UNICODE_ENABLED
36107 int mem_base;
36108 int ret_val;
36109 int code; /* UCS code point */
36110 int n_code;
36111
36112 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36113 mem_base = xmlMemBlocks();
36114 code = gen_int(n_code, 0);
36115
36116 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
36117 desret_int(ret_val);
36118 call_tests++;
36119 des_int(n_code, code, 0);
36120 xmlResetLastError();
36121 if (mem_base != xmlMemBlocks()) {
36122 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
36123 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036124 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036125 printf(" %d", n_code);
36126 printf("\n");
36127 }
36128 }
36129#endif
36130
36131 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036132 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036133}
36134
36135
36136static int
36137test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036138 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036139
36140#ifdef LIBXML_UNICODE_ENABLED
36141 int mem_base;
36142 int ret_val;
36143 int code; /* UCS code point */
36144 int n_code;
36145
36146 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36147 mem_base = xmlMemBlocks();
36148 code = gen_int(n_code, 0);
36149
36150 ret_val = xmlUCSIsEthiopic(code);
36151 desret_int(ret_val);
36152 call_tests++;
36153 des_int(n_code, code, 0);
36154 xmlResetLastError();
36155 if (mem_base != xmlMemBlocks()) {
36156 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
36157 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036158 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036159 printf(" %d", n_code);
36160 printf("\n");
36161 }
36162 }
36163#endif
36164
36165 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036166 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036167}
36168
36169
36170static int
36171test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036172 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036173
36174#ifdef LIBXML_UNICODE_ENABLED
36175 int mem_base;
36176 int ret_val;
36177 int code; /* UCS code point */
36178 int n_code;
36179
36180 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36181 mem_base = xmlMemBlocks();
36182 code = gen_int(n_code, 0);
36183
36184 ret_val = xmlUCSIsGeneralPunctuation(code);
36185 desret_int(ret_val);
36186 call_tests++;
36187 des_int(n_code, code, 0);
36188 xmlResetLastError();
36189 if (mem_base != xmlMemBlocks()) {
36190 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
36191 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036192 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036193 printf(" %d", n_code);
36194 printf("\n");
36195 }
36196 }
36197#endif
36198
36199 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036200 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036201}
36202
36203
36204static int
36205test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036206 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036207
36208#ifdef LIBXML_UNICODE_ENABLED
36209 int mem_base;
36210 int ret_val;
36211 int code; /* UCS code point */
36212 int n_code;
36213
36214 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36215 mem_base = xmlMemBlocks();
36216 code = gen_int(n_code, 0);
36217
36218 ret_val = xmlUCSIsGeometricShapes(code);
36219 desret_int(ret_val);
36220 call_tests++;
36221 des_int(n_code, code, 0);
36222 xmlResetLastError();
36223 if (mem_base != xmlMemBlocks()) {
36224 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
36225 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036226 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036227 printf(" %d", n_code);
36228 printf("\n");
36229 }
36230 }
36231#endif
36232
36233 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036234 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036235}
36236
36237
36238static int
36239test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036240 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036241
36242#ifdef LIBXML_UNICODE_ENABLED
36243 int mem_base;
36244 int ret_val;
36245 int code; /* UCS code point */
36246 int n_code;
36247
36248 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36249 mem_base = xmlMemBlocks();
36250 code = gen_int(n_code, 0);
36251
36252 ret_val = xmlUCSIsGeorgian(code);
36253 desret_int(ret_val);
36254 call_tests++;
36255 des_int(n_code, code, 0);
36256 xmlResetLastError();
36257 if (mem_base != xmlMemBlocks()) {
36258 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
36259 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036260 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036261 printf(" %d", n_code);
36262 printf("\n");
36263 }
36264 }
36265#endif
36266
36267 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036268 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036269}
36270
36271
36272static int
36273test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036274 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036275
36276#ifdef LIBXML_UNICODE_ENABLED
36277 int mem_base;
36278 int ret_val;
36279 int code; /* UCS code point */
36280 int n_code;
36281
36282 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36283 mem_base = xmlMemBlocks();
36284 code = gen_int(n_code, 0);
36285
36286 ret_val = xmlUCSIsGothic(code);
36287 desret_int(ret_val);
36288 call_tests++;
36289 des_int(n_code, code, 0);
36290 xmlResetLastError();
36291 if (mem_base != xmlMemBlocks()) {
36292 printf("Leak of %d blocks found in xmlUCSIsGothic",
36293 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036294 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036295 printf(" %d", n_code);
36296 printf("\n");
36297 }
36298 }
36299#endif
36300
36301 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036302 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036303}
36304
36305
36306static int
36307test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036308 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036309
36310#ifdef LIBXML_UNICODE_ENABLED
36311 int mem_base;
36312 int ret_val;
36313 int code; /* UCS code point */
36314 int n_code;
36315
36316 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36317 mem_base = xmlMemBlocks();
36318 code = gen_int(n_code, 0);
36319
36320 ret_val = xmlUCSIsGreek(code);
36321 desret_int(ret_val);
36322 call_tests++;
36323 des_int(n_code, code, 0);
36324 xmlResetLastError();
36325 if (mem_base != xmlMemBlocks()) {
36326 printf("Leak of %d blocks found in xmlUCSIsGreek",
36327 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036328 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036329 printf(" %d", n_code);
36330 printf("\n");
36331 }
36332 }
36333#endif
36334
36335 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036336 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036337}
36338
36339
36340static int
36341test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036342 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036343
36344#ifdef LIBXML_UNICODE_ENABLED
36345 int mem_base;
36346 int ret_val;
36347 int code; /* UCS code point */
36348 int n_code;
36349
36350 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36351 mem_base = xmlMemBlocks();
36352 code = gen_int(n_code, 0);
36353
36354 ret_val = xmlUCSIsGreekExtended(code);
36355 desret_int(ret_val);
36356 call_tests++;
36357 des_int(n_code, code, 0);
36358 xmlResetLastError();
36359 if (mem_base != xmlMemBlocks()) {
36360 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
36361 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036362 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036363 printf(" %d", n_code);
36364 printf("\n");
36365 }
36366 }
36367#endif
36368
36369 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036370 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036371}
36372
36373
36374static int
36375test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036376 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036377
36378#ifdef LIBXML_UNICODE_ENABLED
36379 int mem_base;
36380 int ret_val;
36381 int code; /* UCS code point */
36382 int n_code;
36383
36384 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36385 mem_base = xmlMemBlocks();
36386 code = gen_int(n_code, 0);
36387
36388 ret_val = xmlUCSIsGreekandCoptic(code);
36389 desret_int(ret_val);
36390 call_tests++;
36391 des_int(n_code, code, 0);
36392 xmlResetLastError();
36393 if (mem_base != xmlMemBlocks()) {
36394 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
36395 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036396 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036397 printf(" %d", n_code);
36398 printf("\n");
36399 }
36400 }
36401#endif
36402
36403 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036404 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036405}
36406
36407
36408static int
36409test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036410 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036411
36412#ifdef LIBXML_UNICODE_ENABLED
36413 int mem_base;
36414 int ret_val;
36415 int code; /* UCS code point */
36416 int n_code;
36417
36418 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36419 mem_base = xmlMemBlocks();
36420 code = gen_int(n_code, 0);
36421
36422 ret_val = xmlUCSIsGujarati(code);
36423 desret_int(ret_val);
36424 call_tests++;
36425 des_int(n_code, code, 0);
36426 xmlResetLastError();
36427 if (mem_base != xmlMemBlocks()) {
36428 printf("Leak of %d blocks found in xmlUCSIsGujarati",
36429 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036430 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036431 printf(" %d", n_code);
36432 printf("\n");
36433 }
36434 }
36435#endif
36436
36437 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036438 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036439}
36440
36441
36442static int
36443test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036444 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036445
36446#ifdef LIBXML_UNICODE_ENABLED
36447 int mem_base;
36448 int ret_val;
36449 int code; /* UCS code point */
36450 int n_code;
36451
36452 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36453 mem_base = xmlMemBlocks();
36454 code = gen_int(n_code, 0);
36455
36456 ret_val = xmlUCSIsGurmukhi(code);
36457 desret_int(ret_val);
36458 call_tests++;
36459 des_int(n_code, code, 0);
36460 xmlResetLastError();
36461 if (mem_base != xmlMemBlocks()) {
36462 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
36463 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036464 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036465 printf(" %d", n_code);
36466 printf("\n");
36467 }
36468 }
36469#endif
36470
36471 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036472 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036473}
36474
36475
36476static int
36477test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036478 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036479
36480#ifdef LIBXML_UNICODE_ENABLED
36481 int mem_base;
36482 int ret_val;
36483 int code; /* UCS code point */
36484 int n_code;
36485
36486 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36487 mem_base = xmlMemBlocks();
36488 code = gen_int(n_code, 0);
36489
36490 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
36491 desret_int(ret_val);
36492 call_tests++;
36493 des_int(n_code, code, 0);
36494 xmlResetLastError();
36495 if (mem_base != xmlMemBlocks()) {
36496 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
36497 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036498 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036499 printf(" %d", n_code);
36500 printf("\n");
36501 }
36502 }
36503#endif
36504
36505 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036506 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036507}
36508
36509
36510static int
36511test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036512 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036513
36514#ifdef LIBXML_UNICODE_ENABLED
36515 int mem_base;
36516 int ret_val;
36517 int code; /* UCS code point */
36518 int n_code;
36519
36520 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36521 mem_base = xmlMemBlocks();
36522 code = gen_int(n_code, 0);
36523
36524 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
36525 desret_int(ret_val);
36526 call_tests++;
36527 des_int(n_code, code, 0);
36528 xmlResetLastError();
36529 if (mem_base != xmlMemBlocks()) {
36530 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
36531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036532 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036533 printf(" %d", n_code);
36534 printf("\n");
36535 }
36536 }
36537#endif
36538
36539 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036540 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036541}
36542
36543
36544static int
36545test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036546 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036547
36548#ifdef LIBXML_UNICODE_ENABLED
36549 int mem_base;
36550 int ret_val;
36551 int code; /* UCS code point */
36552 int n_code;
36553
36554 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36555 mem_base = xmlMemBlocks();
36556 code = gen_int(n_code, 0);
36557
36558 ret_val = xmlUCSIsHangulJamo(code);
36559 desret_int(ret_val);
36560 call_tests++;
36561 des_int(n_code, code, 0);
36562 xmlResetLastError();
36563 if (mem_base != xmlMemBlocks()) {
36564 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
36565 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036566 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036567 printf(" %d", n_code);
36568 printf("\n");
36569 }
36570 }
36571#endif
36572
36573 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036574 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036575}
36576
36577
36578static int
36579test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036580 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036581
36582#ifdef LIBXML_UNICODE_ENABLED
36583 int mem_base;
36584 int ret_val;
36585 int code; /* UCS code point */
36586 int n_code;
36587
36588 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36589 mem_base = xmlMemBlocks();
36590 code = gen_int(n_code, 0);
36591
36592 ret_val = xmlUCSIsHangulSyllables(code);
36593 desret_int(ret_val);
36594 call_tests++;
36595 des_int(n_code, code, 0);
36596 xmlResetLastError();
36597 if (mem_base != xmlMemBlocks()) {
36598 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
36599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036600 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036601 printf(" %d", n_code);
36602 printf("\n");
36603 }
36604 }
36605#endif
36606
36607 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036608 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036609}
36610
36611
36612static int
36613test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036614 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036615
36616#ifdef LIBXML_UNICODE_ENABLED
36617 int mem_base;
36618 int ret_val;
36619 int code; /* UCS code point */
36620 int n_code;
36621
36622 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36623 mem_base = xmlMemBlocks();
36624 code = gen_int(n_code, 0);
36625
36626 ret_val = xmlUCSIsHanunoo(code);
36627 desret_int(ret_val);
36628 call_tests++;
36629 des_int(n_code, code, 0);
36630 xmlResetLastError();
36631 if (mem_base != xmlMemBlocks()) {
36632 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
36633 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036634 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036635 printf(" %d", n_code);
36636 printf("\n");
36637 }
36638 }
36639#endif
36640
36641 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036642 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036643}
36644
36645
36646static int
36647test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036648 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036649
36650#ifdef LIBXML_UNICODE_ENABLED
36651 int mem_base;
36652 int ret_val;
36653 int code; /* UCS code point */
36654 int n_code;
36655
36656 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36657 mem_base = xmlMemBlocks();
36658 code = gen_int(n_code, 0);
36659
36660 ret_val = xmlUCSIsHebrew(code);
36661 desret_int(ret_val);
36662 call_tests++;
36663 des_int(n_code, code, 0);
36664 xmlResetLastError();
36665 if (mem_base != xmlMemBlocks()) {
36666 printf("Leak of %d blocks found in xmlUCSIsHebrew",
36667 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036668 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036669 printf(" %d", n_code);
36670 printf("\n");
36671 }
36672 }
36673#endif
36674
36675 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036676 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036677}
36678
36679
36680static int
36681test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036682 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036683
36684#ifdef LIBXML_UNICODE_ENABLED
36685 int mem_base;
36686 int ret_val;
36687 int code; /* UCS code point */
36688 int n_code;
36689
36690 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36691 mem_base = xmlMemBlocks();
36692 code = gen_int(n_code, 0);
36693
36694 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
36695 desret_int(ret_val);
36696 call_tests++;
36697 des_int(n_code, code, 0);
36698 xmlResetLastError();
36699 if (mem_base != xmlMemBlocks()) {
36700 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
36701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036702 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036703 printf(" %d", n_code);
36704 printf("\n");
36705 }
36706 }
36707#endif
36708
36709 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036710 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036711}
36712
36713
36714static int
36715test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036716 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036717
36718#ifdef LIBXML_UNICODE_ENABLED
36719 int mem_base;
36720 int ret_val;
36721 int code; /* UCS code point */
36722 int n_code;
36723
36724 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36725 mem_base = xmlMemBlocks();
36726 code = gen_int(n_code, 0);
36727
36728 ret_val = xmlUCSIsHighSurrogates(code);
36729 desret_int(ret_val);
36730 call_tests++;
36731 des_int(n_code, code, 0);
36732 xmlResetLastError();
36733 if (mem_base != xmlMemBlocks()) {
36734 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
36735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036736 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036737 printf(" %d", n_code);
36738 printf("\n");
36739 }
36740 }
36741#endif
36742
36743 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036744 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036745}
36746
36747
36748static int
36749test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036750 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036751
36752#ifdef LIBXML_UNICODE_ENABLED
36753 int mem_base;
36754 int ret_val;
36755 int code; /* UCS code point */
36756 int n_code;
36757
36758 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36759 mem_base = xmlMemBlocks();
36760 code = gen_int(n_code, 0);
36761
36762 ret_val = xmlUCSIsHiragana(code);
36763 desret_int(ret_val);
36764 call_tests++;
36765 des_int(n_code, code, 0);
36766 xmlResetLastError();
36767 if (mem_base != xmlMemBlocks()) {
36768 printf("Leak of %d blocks found in xmlUCSIsHiragana",
36769 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036770 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036771 printf(" %d", n_code);
36772 printf("\n");
36773 }
36774 }
36775#endif
36776
36777 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036778 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036779}
36780
36781
36782static int
36783test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036784 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036785
36786#ifdef LIBXML_UNICODE_ENABLED
36787 int mem_base;
36788 int ret_val;
36789 int code; /* UCS code point */
36790 int n_code;
36791
36792 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36793 mem_base = xmlMemBlocks();
36794 code = gen_int(n_code, 0);
36795
36796 ret_val = xmlUCSIsIPAExtensions(code);
36797 desret_int(ret_val);
36798 call_tests++;
36799 des_int(n_code, code, 0);
36800 xmlResetLastError();
36801 if (mem_base != xmlMemBlocks()) {
36802 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
36803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036804 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036805 printf(" %d", n_code);
36806 printf("\n");
36807 }
36808 }
36809#endif
36810
36811 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036812 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036813}
36814
36815
36816static int
36817test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036818 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036819
36820#ifdef LIBXML_UNICODE_ENABLED
36821 int mem_base;
36822 int ret_val;
36823 int code; /* UCS code point */
36824 int n_code;
36825
36826 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36827 mem_base = xmlMemBlocks();
36828 code = gen_int(n_code, 0);
36829
36830 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
36831 desret_int(ret_val);
36832 call_tests++;
36833 des_int(n_code, code, 0);
36834 xmlResetLastError();
36835 if (mem_base != xmlMemBlocks()) {
36836 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
36837 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036838 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036839 printf(" %d", n_code);
36840 printf("\n");
36841 }
36842 }
36843#endif
36844
36845 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036846 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036847}
36848
36849
36850static int
36851test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036852 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036853
36854#ifdef LIBXML_UNICODE_ENABLED
36855 int mem_base;
36856 int ret_val;
36857 int code; /* UCS code point */
36858 int n_code;
36859
36860 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36861 mem_base = xmlMemBlocks();
36862 code = gen_int(n_code, 0);
36863
36864 ret_val = xmlUCSIsKanbun(code);
36865 desret_int(ret_val);
36866 call_tests++;
36867 des_int(n_code, code, 0);
36868 xmlResetLastError();
36869 if (mem_base != xmlMemBlocks()) {
36870 printf("Leak of %d blocks found in xmlUCSIsKanbun",
36871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036872 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036873 printf(" %d", n_code);
36874 printf("\n");
36875 }
36876 }
36877#endif
36878
36879 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036880 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036881}
36882
36883
36884static int
36885test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036886 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036887
36888#ifdef LIBXML_UNICODE_ENABLED
36889 int mem_base;
36890 int ret_val;
36891 int code; /* UCS code point */
36892 int n_code;
36893
36894 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36895 mem_base = xmlMemBlocks();
36896 code = gen_int(n_code, 0);
36897
36898 ret_val = xmlUCSIsKangxiRadicals(code);
36899 desret_int(ret_val);
36900 call_tests++;
36901 des_int(n_code, code, 0);
36902 xmlResetLastError();
36903 if (mem_base != xmlMemBlocks()) {
36904 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
36905 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036906 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036907 printf(" %d", n_code);
36908 printf("\n");
36909 }
36910 }
36911#endif
36912
36913 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036914 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036915}
36916
36917
36918static int
36919test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036920 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036921
36922#ifdef LIBXML_UNICODE_ENABLED
36923 int mem_base;
36924 int ret_val;
36925 int code; /* UCS code point */
36926 int n_code;
36927
36928 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36929 mem_base = xmlMemBlocks();
36930 code = gen_int(n_code, 0);
36931
36932 ret_val = xmlUCSIsKannada(code);
36933 desret_int(ret_val);
36934 call_tests++;
36935 des_int(n_code, code, 0);
36936 xmlResetLastError();
36937 if (mem_base != xmlMemBlocks()) {
36938 printf("Leak of %d blocks found in xmlUCSIsKannada",
36939 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036940 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036941 printf(" %d", n_code);
36942 printf("\n");
36943 }
36944 }
36945#endif
36946
36947 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036948 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036949}
36950
36951
36952static int
36953test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036954 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036955
36956#ifdef LIBXML_UNICODE_ENABLED
36957 int mem_base;
36958 int ret_val;
36959 int code; /* UCS code point */
36960 int n_code;
36961
36962 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36963 mem_base = xmlMemBlocks();
36964 code = gen_int(n_code, 0);
36965
36966 ret_val = xmlUCSIsKatakana(code);
36967 desret_int(ret_val);
36968 call_tests++;
36969 des_int(n_code, code, 0);
36970 xmlResetLastError();
36971 if (mem_base != xmlMemBlocks()) {
36972 printf("Leak of %d blocks found in xmlUCSIsKatakana",
36973 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036974 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036975 printf(" %d", n_code);
36976 printf("\n");
36977 }
36978 }
36979#endif
36980
36981 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036982 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036983}
36984
36985
36986static int
36987test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036988 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036989
36990#ifdef LIBXML_UNICODE_ENABLED
36991 int mem_base;
36992 int ret_val;
36993 int code; /* UCS code point */
36994 int n_code;
36995
36996 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36997 mem_base = xmlMemBlocks();
36998 code = gen_int(n_code, 0);
36999
37000 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
37001 desret_int(ret_val);
37002 call_tests++;
37003 des_int(n_code, code, 0);
37004 xmlResetLastError();
37005 if (mem_base != xmlMemBlocks()) {
37006 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
37007 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037008 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037009 printf(" %d", n_code);
37010 printf("\n");
37011 }
37012 }
37013#endif
37014
37015 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037016 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037017}
37018
37019
37020static int
37021test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037022 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037023
37024#ifdef LIBXML_UNICODE_ENABLED
37025 int mem_base;
37026 int ret_val;
37027 int code; /* UCS code point */
37028 int n_code;
37029
37030 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37031 mem_base = xmlMemBlocks();
37032 code = gen_int(n_code, 0);
37033
37034 ret_val = xmlUCSIsKhmer(code);
37035 desret_int(ret_val);
37036 call_tests++;
37037 des_int(n_code, code, 0);
37038 xmlResetLastError();
37039 if (mem_base != xmlMemBlocks()) {
37040 printf("Leak of %d blocks found in xmlUCSIsKhmer",
37041 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037042 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037043 printf(" %d", n_code);
37044 printf("\n");
37045 }
37046 }
37047#endif
37048
37049 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037050 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037051}
37052
37053
37054static int
37055test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037056 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037057
37058#ifdef LIBXML_UNICODE_ENABLED
37059 int mem_base;
37060 int ret_val;
37061 int code; /* UCS code point */
37062 int n_code;
37063
37064 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37065 mem_base = xmlMemBlocks();
37066 code = gen_int(n_code, 0);
37067
37068 ret_val = xmlUCSIsKhmerSymbols(code);
37069 desret_int(ret_val);
37070 call_tests++;
37071 des_int(n_code, code, 0);
37072 xmlResetLastError();
37073 if (mem_base != xmlMemBlocks()) {
37074 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
37075 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037076 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037077 printf(" %d", n_code);
37078 printf("\n");
37079 }
37080 }
37081#endif
37082
37083 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037084 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037085}
37086
37087
37088static int
37089test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037090 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037091
37092#ifdef LIBXML_UNICODE_ENABLED
37093 int mem_base;
37094 int ret_val;
37095 int code; /* UCS code point */
37096 int n_code;
37097
37098 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37099 mem_base = xmlMemBlocks();
37100 code = gen_int(n_code, 0);
37101
37102 ret_val = xmlUCSIsLao(code);
37103 desret_int(ret_val);
37104 call_tests++;
37105 des_int(n_code, code, 0);
37106 xmlResetLastError();
37107 if (mem_base != xmlMemBlocks()) {
37108 printf("Leak of %d blocks found in xmlUCSIsLao",
37109 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037110 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037111 printf(" %d", n_code);
37112 printf("\n");
37113 }
37114 }
37115#endif
37116
37117 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037118 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037119}
37120
37121
37122static int
37123test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037124 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037125
37126#ifdef LIBXML_UNICODE_ENABLED
37127 int mem_base;
37128 int ret_val;
37129 int code; /* UCS code point */
37130 int n_code;
37131
37132 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37133 mem_base = xmlMemBlocks();
37134 code = gen_int(n_code, 0);
37135
37136 ret_val = xmlUCSIsLatin1Supplement(code);
37137 desret_int(ret_val);
37138 call_tests++;
37139 des_int(n_code, code, 0);
37140 xmlResetLastError();
37141 if (mem_base != xmlMemBlocks()) {
37142 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
37143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037144 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037145 printf(" %d", n_code);
37146 printf("\n");
37147 }
37148 }
37149#endif
37150
37151 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037152 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037153}
37154
37155
37156static int
37157test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037158 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037159
37160#ifdef LIBXML_UNICODE_ENABLED
37161 int mem_base;
37162 int ret_val;
37163 int code; /* UCS code point */
37164 int n_code;
37165
37166 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37167 mem_base = xmlMemBlocks();
37168 code = gen_int(n_code, 0);
37169
37170 ret_val = xmlUCSIsLatinExtendedA(code);
37171 desret_int(ret_val);
37172 call_tests++;
37173 des_int(n_code, code, 0);
37174 xmlResetLastError();
37175 if (mem_base != xmlMemBlocks()) {
37176 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
37177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037178 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037179 printf(" %d", n_code);
37180 printf("\n");
37181 }
37182 }
37183#endif
37184
37185 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037186 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037187}
37188
37189
37190static int
37191test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037192 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037193
37194#ifdef LIBXML_UNICODE_ENABLED
37195 int mem_base;
37196 int ret_val;
37197 int code; /* UCS code point */
37198 int n_code;
37199
37200 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37201 mem_base = xmlMemBlocks();
37202 code = gen_int(n_code, 0);
37203
37204 ret_val = xmlUCSIsLatinExtendedAdditional(code);
37205 desret_int(ret_val);
37206 call_tests++;
37207 des_int(n_code, code, 0);
37208 xmlResetLastError();
37209 if (mem_base != xmlMemBlocks()) {
37210 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
37211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037212 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037213 printf(" %d", n_code);
37214 printf("\n");
37215 }
37216 }
37217#endif
37218
37219 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037220 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037221}
37222
37223
37224static int
37225test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037226 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037227
37228#ifdef LIBXML_UNICODE_ENABLED
37229 int mem_base;
37230 int ret_val;
37231 int code; /* UCS code point */
37232 int n_code;
37233
37234 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37235 mem_base = xmlMemBlocks();
37236 code = gen_int(n_code, 0);
37237
37238 ret_val = xmlUCSIsLatinExtendedB(code);
37239 desret_int(ret_val);
37240 call_tests++;
37241 des_int(n_code, code, 0);
37242 xmlResetLastError();
37243 if (mem_base != xmlMemBlocks()) {
37244 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
37245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037246 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037247 printf(" %d", n_code);
37248 printf("\n");
37249 }
37250 }
37251#endif
37252
37253 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037254 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037255}
37256
37257
37258static int
37259test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037260 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037261
37262#ifdef LIBXML_UNICODE_ENABLED
37263 int mem_base;
37264 int ret_val;
37265 int code; /* UCS code point */
37266 int n_code;
37267
37268 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37269 mem_base = xmlMemBlocks();
37270 code = gen_int(n_code, 0);
37271
37272 ret_val = xmlUCSIsLetterlikeSymbols(code);
37273 desret_int(ret_val);
37274 call_tests++;
37275 des_int(n_code, code, 0);
37276 xmlResetLastError();
37277 if (mem_base != xmlMemBlocks()) {
37278 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
37279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037280 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037281 printf(" %d", n_code);
37282 printf("\n");
37283 }
37284 }
37285#endif
37286
37287 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037288 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037289}
37290
37291
37292static int
37293test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037294 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037295
37296#ifdef LIBXML_UNICODE_ENABLED
37297 int mem_base;
37298 int ret_val;
37299 int code; /* UCS code point */
37300 int n_code;
37301
37302 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37303 mem_base = xmlMemBlocks();
37304 code = gen_int(n_code, 0);
37305
37306 ret_val = xmlUCSIsLimbu(code);
37307 desret_int(ret_val);
37308 call_tests++;
37309 des_int(n_code, code, 0);
37310 xmlResetLastError();
37311 if (mem_base != xmlMemBlocks()) {
37312 printf("Leak of %d blocks found in xmlUCSIsLimbu",
37313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037314 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037315 printf(" %d", n_code);
37316 printf("\n");
37317 }
37318 }
37319#endif
37320
37321 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037322 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037323}
37324
37325
37326static int
37327test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037328 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037329
37330#ifdef LIBXML_UNICODE_ENABLED
37331 int mem_base;
37332 int ret_val;
37333 int code; /* UCS code point */
37334 int n_code;
37335
37336 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37337 mem_base = xmlMemBlocks();
37338 code = gen_int(n_code, 0);
37339
37340 ret_val = xmlUCSIsLinearBIdeograms(code);
37341 desret_int(ret_val);
37342 call_tests++;
37343 des_int(n_code, code, 0);
37344 xmlResetLastError();
37345 if (mem_base != xmlMemBlocks()) {
37346 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
37347 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037348 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037349 printf(" %d", n_code);
37350 printf("\n");
37351 }
37352 }
37353#endif
37354
37355 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037356 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037357}
37358
37359
37360static int
37361test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037362 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037363
37364#ifdef LIBXML_UNICODE_ENABLED
37365 int mem_base;
37366 int ret_val;
37367 int code; /* UCS code point */
37368 int n_code;
37369
37370 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37371 mem_base = xmlMemBlocks();
37372 code = gen_int(n_code, 0);
37373
37374 ret_val = xmlUCSIsLinearBSyllabary(code);
37375 desret_int(ret_val);
37376 call_tests++;
37377 des_int(n_code, code, 0);
37378 xmlResetLastError();
37379 if (mem_base != xmlMemBlocks()) {
37380 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
37381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037382 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037383 printf(" %d", n_code);
37384 printf("\n");
37385 }
37386 }
37387#endif
37388
37389 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037390 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037391}
37392
37393
37394static int
37395test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037396 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037397
37398#ifdef LIBXML_UNICODE_ENABLED
37399 int mem_base;
37400 int ret_val;
37401 int code; /* UCS code point */
37402 int n_code;
37403
37404 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37405 mem_base = xmlMemBlocks();
37406 code = gen_int(n_code, 0);
37407
37408 ret_val = xmlUCSIsLowSurrogates(code);
37409 desret_int(ret_val);
37410 call_tests++;
37411 des_int(n_code, code, 0);
37412 xmlResetLastError();
37413 if (mem_base != xmlMemBlocks()) {
37414 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
37415 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037416 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037417 printf(" %d", n_code);
37418 printf("\n");
37419 }
37420 }
37421#endif
37422
37423 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037424 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037425}
37426
37427
37428static int
37429test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037430 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037431
37432#ifdef LIBXML_UNICODE_ENABLED
37433 int mem_base;
37434 int ret_val;
37435 int code; /* UCS code point */
37436 int n_code;
37437
37438 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37439 mem_base = xmlMemBlocks();
37440 code = gen_int(n_code, 0);
37441
37442 ret_val = xmlUCSIsMalayalam(code);
37443 desret_int(ret_val);
37444 call_tests++;
37445 des_int(n_code, code, 0);
37446 xmlResetLastError();
37447 if (mem_base != xmlMemBlocks()) {
37448 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
37449 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037450 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037451 printf(" %d", n_code);
37452 printf("\n");
37453 }
37454 }
37455#endif
37456
37457 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037458 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037459}
37460
37461
37462static int
37463test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037464 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037465
37466#ifdef LIBXML_UNICODE_ENABLED
37467 int mem_base;
37468 int ret_val;
37469 int code; /* UCS code point */
37470 int n_code;
37471
37472 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37473 mem_base = xmlMemBlocks();
37474 code = gen_int(n_code, 0);
37475
37476 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
37477 desret_int(ret_val);
37478 call_tests++;
37479 des_int(n_code, code, 0);
37480 xmlResetLastError();
37481 if (mem_base != xmlMemBlocks()) {
37482 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
37483 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037484 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037485 printf(" %d", n_code);
37486 printf("\n");
37487 }
37488 }
37489#endif
37490
37491 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037492 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037493}
37494
37495
37496static int
37497test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037498 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037499
37500#ifdef LIBXML_UNICODE_ENABLED
37501 int mem_base;
37502 int ret_val;
37503 int code; /* UCS code point */
37504 int n_code;
37505
37506 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37507 mem_base = xmlMemBlocks();
37508 code = gen_int(n_code, 0);
37509
37510 ret_val = xmlUCSIsMathematicalOperators(code);
37511 desret_int(ret_val);
37512 call_tests++;
37513 des_int(n_code, code, 0);
37514 xmlResetLastError();
37515 if (mem_base != xmlMemBlocks()) {
37516 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
37517 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037518 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037519 printf(" %d", n_code);
37520 printf("\n");
37521 }
37522 }
37523#endif
37524
37525 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037526 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037527}
37528
37529
37530static int
37531test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037532 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037533
37534#ifdef LIBXML_UNICODE_ENABLED
37535 int mem_base;
37536 int ret_val;
37537 int code; /* UCS code point */
37538 int n_code;
37539
37540 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37541 mem_base = xmlMemBlocks();
37542 code = gen_int(n_code, 0);
37543
37544 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
37545 desret_int(ret_val);
37546 call_tests++;
37547 des_int(n_code, code, 0);
37548 xmlResetLastError();
37549 if (mem_base != xmlMemBlocks()) {
37550 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
37551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037552 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037553 printf(" %d", n_code);
37554 printf("\n");
37555 }
37556 }
37557#endif
37558
37559 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037560 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037561}
37562
37563
37564static int
37565test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037566 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037567
37568#ifdef LIBXML_UNICODE_ENABLED
37569 int mem_base;
37570 int ret_val;
37571 int code; /* UCS code point */
37572 int n_code;
37573
37574 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37575 mem_base = xmlMemBlocks();
37576 code = gen_int(n_code, 0);
37577
37578 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
37579 desret_int(ret_val);
37580 call_tests++;
37581 des_int(n_code, code, 0);
37582 xmlResetLastError();
37583 if (mem_base != xmlMemBlocks()) {
37584 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
37585 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037586 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037587 printf(" %d", n_code);
37588 printf("\n");
37589 }
37590 }
37591#endif
37592
37593 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037594 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037595}
37596
37597
37598static int
37599test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037600 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037601
37602#ifdef LIBXML_UNICODE_ENABLED
37603 int mem_base;
37604 int ret_val;
37605 int code; /* UCS code point */
37606 int n_code;
37607
37608 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37609 mem_base = xmlMemBlocks();
37610 code = gen_int(n_code, 0);
37611
37612 ret_val = xmlUCSIsMiscellaneousSymbols(code);
37613 desret_int(ret_val);
37614 call_tests++;
37615 des_int(n_code, code, 0);
37616 xmlResetLastError();
37617 if (mem_base != xmlMemBlocks()) {
37618 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
37619 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037620 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037621 printf(" %d", n_code);
37622 printf("\n");
37623 }
37624 }
37625#endif
37626
37627 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037628 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037629}
37630
37631
37632static int
37633test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037634 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037635
37636#ifdef LIBXML_UNICODE_ENABLED
37637 int mem_base;
37638 int ret_val;
37639 int code; /* UCS code point */
37640 int n_code;
37641
37642 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37643 mem_base = xmlMemBlocks();
37644 code = gen_int(n_code, 0);
37645
37646 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
37647 desret_int(ret_val);
37648 call_tests++;
37649 des_int(n_code, code, 0);
37650 xmlResetLastError();
37651 if (mem_base != xmlMemBlocks()) {
37652 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
37653 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037654 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037655 printf(" %d", n_code);
37656 printf("\n");
37657 }
37658 }
37659#endif
37660
37661 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037662 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037663}
37664
37665
37666static int
37667test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037668 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037669
37670#ifdef LIBXML_UNICODE_ENABLED
37671 int mem_base;
37672 int ret_val;
37673 int code; /* UCS code point */
37674 int n_code;
37675
37676 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37677 mem_base = xmlMemBlocks();
37678 code = gen_int(n_code, 0);
37679
37680 ret_val = xmlUCSIsMiscellaneousTechnical(code);
37681 desret_int(ret_val);
37682 call_tests++;
37683 des_int(n_code, code, 0);
37684 xmlResetLastError();
37685 if (mem_base != xmlMemBlocks()) {
37686 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
37687 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037688 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037689 printf(" %d", n_code);
37690 printf("\n");
37691 }
37692 }
37693#endif
37694
37695 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037696 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037697}
37698
37699
37700static int
37701test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037702 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037703
37704#ifdef LIBXML_UNICODE_ENABLED
37705 int mem_base;
37706 int ret_val;
37707 int code; /* UCS code point */
37708 int n_code;
37709
37710 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37711 mem_base = xmlMemBlocks();
37712 code = gen_int(n_code, 0);
37713
37714 ret_val = xmlUCSIsMongolian(code);
37715 desret_int(ret_val);
37716 call_tests++;
37717 des_int(n_code, code, 0);
37718 xmlResetLastError();
37719 if (mem_base != xmlMemBlocks()) {
37720 printf("Leak of %d blocks found in xmlUCSIsMongolian",
37721 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037722 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037723 printf(" %d", n_code);
37724 printf("\n");
37725 }
37726 }
37727#endif
37728
37729 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037730 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037731}
37732
37733
37734static int
37735test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037736 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037737
37738#ifdef LIBXML_UNICODE_ENABLED
37739 int mem_base;
37740 int ret_val;
37741 int code; /* UCS code point */
37742 int n_code;
37743
37744 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37745 mem_base = xmlMemBlocks();
37746 code = gen_int(n_code, 0);
37747
37748 ret_val = xmlUCSIsMusicalSymbols(code);
37749 desret_int(ret_val);
37750 call_tests++;
37751 des_int(n_code, code, 0);
37752 xmlResetLastError();
37753 if (mem_base != xmlMemBlocks()) {
37754 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
37755 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037756 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037757 printf(" %d", n_code);
37758 printf("\n");
37759 }
37760 }
37761#endif
37762
37763 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037764 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037765}
37766
37767
37768static int
37769test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037770 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037771
37772#ifdef LIBXML_UNICODE_ENABLED
37773 int mem_base;
37774 int ret_val;
37775 int code; /* UCS code point */
37776 int n_code;
37777
37778 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37779 mem_base = xmlMemBlocks();
37780 code = gen_int(n_code, 0);
37781
37782 ret_val = xmlUCSIsMyanmar(code);
37783 desret_int(ret_val);
37784 call_tests++;
37785 des_int(n_code, code, 0);
37786 xmlResetLastError();
37787 if (mem_base != xmlMemBlocks()) {
37788 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
37789 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037790 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037791 printf(" %d", n_code);
37792 printf("\n");
37793 }
37794 }
37795#endif
37796
37797 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037798 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037799}
37800
37801
37802static int
37803test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037804 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037805
37806#ifdef LIBXML_UNICODE_ENABLED
37807 int mem_base;
37808 int ret_val;
37809 int code; /* UCS code point */
37810 int n_code;
37811
37812 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37813 mem_base = xmlMemBlocks();
37814 code = gen_int(n_code, 0);
37815
37816 ret_val = xmlUCSIsNumberForms(code);
37817 desret_int(ret_val);
37818 call_tests++;
37819 des_int(n_code, code, 0);
37820 xmlResetLastError();
37821 if (mem_base != xmlMemBlocks()) {
37822 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
37823 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037824 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037825 printf(" %d", n_code);
37826 printf("\n");
37827 }
37828 }
37829#endif
37830
37831 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037832 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037833}
37834
37835
37836static int
37837test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037838 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037839
37840#ifdef LIBXML_UNICODE_ENABLED
37841 int mem_base;
37842 int ret_val;
37843 int code; /* UCS code point */
37844 int n_code;
37845
37846 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37847 mem_base = xmlMemBlocks();
37848 code = gen_int(n_code, 0);
37849
37850 ret_val = xmlUCSIsOgham(code);
37851 desret_int(ret_val);
37852 call_tests++;
37853 des_int(n_code, code, 0);
37854 xmlResetLastError();
37855 if (mem_base != xmlMemBlocks()) {
37856 printf("Leak of %d blocks found in xmlUCSIsOgham",
37857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037858 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037859 printf(" %d", n_code);
37860 printf("\n");
37861 }
37862 }
37863#endif
37864
37865 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037866 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037867}
37868
37869
37870static int
37871test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037872 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037873
37874#ifdef LIBXML_UNICODE_ENABLED
37875 int mem_base;
37876 int ret_val;
37877 int code; /* UCS code point */
37878 int n_code;
37879
37880 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37881 mem_base = xmlMemBlocks();
37882 code = gen_int(n_code, 0);
37883
37884 ret_val = xmlUCSIsOldItalic(code);
37885 desret_int(ret_val);
37886 call_tests++;
37887 des_int(n_code, code, 0);
37888 xmlResetLastError();
37889 if (mem_base != xmlMemBlocks()) {
37890 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
37891 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037892 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037893 printf(" %d", n_code);
37894 printf("\n");
37895 }
37896 }
37897#endif
37898
37899 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037900 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037901}
37902
37903
37904static int
37905test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037906 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037907
37908#ifdef LIBXML_UNICODE_ENABLED
37909 int mem_base;
37910 int ret_val;
37911 int code; /* UCS code point */
37912 int n_code;
37913
37914 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37915 mem_base = xmlMemBlocks();
37916 code = gen_int(n_code, 0);
37917
37918 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
37919 desret_int(ret_val);
37920 call_tests++;
37921 des_int(n_code, code, 0);
37922 xmlResetLastError();
37923 if (mem_base != xmlMemBlocks()) {
37924 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
37925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037926 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037927 printf(" %d", n_code);
37928 printf("\n");
37929 }
37930 }
37931#endif
37932
37933 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037934 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037935}
37936
37937
37938static int
37939test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037940 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037941
37942#ifdef LIBXML_UNICODE_ENABLED
37943 int mem_base;
37944 int ret_val;
37945 int code; /* UCS code point */
37946 int n_code;
37947
37948 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37949 mem_base = xmlMemBlocks();
37950 code = gen_int(n_code, 0);
37951
37952 ret_val = xmlUCSIsOriya(code);
37953 desret_int(ret_val);
37954 call_tests++;
37955 des_int(n_code, code, 0);
37956 xmlResetLastError();
37957 if (mem_base != xmlMemBlocks()) {
37958 printf("Leak of %d blocks found in xmlUCSIsOriya",
37959 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037960 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037961 printf(" %d", n_code);
37962 printf("\n");
37963 }
37964 }
37965#endif
37966
37967 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037968 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037969}
37970
37971
37972static int
37973test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037974 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037975
37976#ifdef LIBXML_UNICODE_ENABLED
37977 int mem_base;
37978 int ret_val;
37979 int code; /* UCS code point */
37980 int n_code;
37981
37982 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37983 mem_base = xmlMemBlocks();
37984 code = gen_int(n_code, 0);
37985
37986 ret_val = xmlUCSIsOsmanya(code);
37987 desret_int(ret_val);
37988 call_tests++;
37989 des_int(n_code, code, 0);
37990 xmlResetLastError();
37991 if (mem_base != xmlMemBlocks()) {
37992 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
37993 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037994 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037995 printf(" %d", n_code);
37996 printf("\n");
37997 }
37998 }
37999#endif
38000
38001 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038002 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038003}
38004
38005
38006static int
38007test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038008 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038009
38010#ifdef LIBXML_UNICODE_ENABLED
38011 int mem_base;
38012 int ret_val;
38013 int code; /* UCS code point */
38014 int n_code;
38015
38016 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38017 mem_base = xmlMemBlocks();
38018 code = gen_int(n_code, 0);
38019
38020 ret_val = xmlUCSIsPhoneticExtensions(code);
38021 desret_int(ret_val);
38022 call_tests++;
38023 des_int(n_code, code, 0);
38024 xmlResetLastError();
38025 if (mem_base != xmlMemBlocks()) {
38026 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
38027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038028 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038029 printf(" %d", n_code);
38030 printf("\n");
38031 }
38032 }
38033#endif
38034
38035 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038036 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038037}
38038
38039
38040static int
38041test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038042 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038043
38044#ifdef LIBXML_UNICODE_ENABLED
38045 int mem_base;
38046 int ret_val;
38047 int code; /* UCS code point */
38048 int n_code;
38049
38050 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38051 mem_base = xmlMemBlocks();
38052 code = gen_int(n_code, 0);
38053
38054 ret_val = xmlUCSIsPrivateUse(code);
38055 desret_int(ret_val);
38056 call_tests++;
38057 des_int(n_code, code, 0);
38058 xmlResetLastError();
38059 if (mem_base != xmlMemBlocks()) {
38060 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
38061 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038062 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038063 printf(" %d", n_code);
38064 printf("\n");
38065 }
38066 }
38067#endif
38068
38069 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038070 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038071}
38072
38073
38074static int
38075test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038076 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038077
38078#ifdef LIBXML_UNICODE_ENABLED
38079 int mem_base;
38080 int ret_val;
38081 int code; /* UCS code point */
38082 int n_code;
38083
38084 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38085 mem_base = xmlMemBlocks();
38086 code = gen_int(n_code, 0);
38087
38088 ret_val = xmlUCSIsPrivateUseArea(code);
38089 desret_int(ret_val);
38090 call_tests++;
38091 des_int(n_code, code, 0);
38092 xmlResetLastError();
38093 if (mem_base != xmlMemBlocks()) {
38094 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
38095 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038096 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038097 printf(" %d", n_code);
38098 printf("\n");
38099 }
38100 }
38101#endif
38102
38103 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038104 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038105}
38106
38107
38108static int
38109test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038110 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038111
38112#ifdef LIBXML_UNICODE_ENABLED
38113 int mem_base;
38114 int ret_val;
38115 int code; /* UCS code point */
38116 int n_code;
38117
38118 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38119 mem_base = xmlMemBlocks();
38120 code = gen_int(n_code, 0);
38121
38122 ret_val = xmlUCSIsRunic(code);
38123 desret_int(ret_val);
38124 call_tests++;
38125 des_int(n_code, code, 0);
38126 xmlResetLastError();
38127 if (mem_base != xmlMemBlocks()) {
38128 printf("Leak of %d blocks found in xmlUCSIsRunic",
38129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038130 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038131 printf(" %d", n_code);
38132 printf("\n");
38133 }
38134 }
38135#endif
38136
38137 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038138 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038139}
38140
38141
38142static int
38143test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038144 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038145
38146#ifdef LIBXML_UNICODE_ENABLED
38147 int mem_base;
38148 int ret_val;
38149 int code; /* UCS code point */
38150 int n_code;
38151
38152 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38153 mem_base = xmlMemBlocks();
38154 code = gen_int(n_code, 0);
38155
38156 ret_val = xmlUCSIsShavian(code);
38157 desret_int(ret_val);
38158 call_tests++;
38159 des_int(n_code, code, 0);
38160 xmlResetLastError();
38161 if (mem_base != xmlMemBlocks()) {
38162 printf("Leak of %d blocks found in xmlUCSIsShavian",
38163 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038164 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038165 printf(" %d", n_code);
38166 printf("\n");
38167 }
38168 }
38169#endif
38170
38171 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038172 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038173}
38174
38175
38176static int
38177test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038178 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038179
38180#ifdef LIBXML_UNICODE_ENABLED
38181 int mem_base;
38182 int ret_val;
38183 int code; /* UCS code point */
38184 int n_code;
38185
38186 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38187 mem_base = xmlMemBlocks();
38188 code = gen_int(n_code, 0);
38189
38190 ret_val = xmlUCSIsSinhala(code);
38191 desret_int(ret_val);
38192 call_tests++;
38193 des_int(n_code, code, 0);
38194 xmlResetLastError();
38195 if (mem_base != xmlMemBlocks()) {
38196 printf("Leak of %d blocks found in xmlUCSIsSinhala",
38197 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038198 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038199 printf(" %d", n_code);
38200 printf("\n");
38201 }
38202 }
38203#endif
38204
38205 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038206 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038207}
38208
38209
38210static int
38211test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038212 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038213
38214#ifdef LIBXML_UNICODE_ENABLED
38215 int mem_base;
38216 int ret_val;
38217 int code; /* UCS code point */
38218 int n_code;
38219
38220 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38221 mem_base = xmlMemBlocks();
38222 code = gen_int(n_code, 0);
38223
38224 ret_val = xmlUCSIsSmallFormVariants(code);
38225 desret_int(ret_val);
38226 call_tests++;
38227 des_int(n_code, code, 0);
38228 xmlResetLastError();
38229 if (mem_base != xmlMemBlocks()) {
38230 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
38231 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038232 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038233 printf(" %d", n_code);
38234 printf("\n");
38235 }
38236 }
38237#endif
38238
38239 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038240 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038241}
38242
38243
38244static int
38245test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038246 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038247
38248#ifdef LIBXML_UNICODE_ENABLED
38249 int mem_base;
38250 int ret_val;
38251 int code; /* UCS code point */
38252 int n_code;
38253
38254 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38255 mem_base = xmlMemBlocks();
38256 code = gen_int(n_code, 0);
38257
38258 ret_val = xmlUCSIsSpacingModifierLetters(code);
38259 desret_int(ret_val);
38260 call_tests++;
38261 des_int(n_code, code, 0);
38262 xmlResetLastError();
38263 if (mem_base != xmlMemBlocks()) {
38264 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
38265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038266 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038267 printf(" %d", n_code);
38268 printf("\n");
38269 }
38270 }
38271#endif
38272
38273 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038274 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038275}
38276
38277
38278static int
38279test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038280 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038281
38282#ifdef LIBXML_UNICODE_ENABLED
38283 int mem_base;
38284 int ret_val;
38285 int code; /* UCS code point */
38286 int n_code;
38287
38288 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38289 mem_base = xmlMemBlocks();
38290 code = gen_int(n_code, 0);
38291
38292 ret_val = xmlUCSIsSpecials(code);
38293 desret_int(ret_val);
38294 call_tests++;
38295 des_int(n_code, code, 0);
38296 xmlResetLastError();
38297 if (mem_base != xmlMemBlocks()) {
38298 printf("Leak of %d blocks found in xmlUCSIsSpecials",
38299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038300 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038301 printf(" %d", n_code);
38302 printf("\n");
38303 }
38304 }
38305#endif
38306
38307 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038308 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038309}
38310
38311
38312static int
38313test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038314 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038315
38316#ifdef LIBXML_UNICODE_ENABLED
38317 int mem_base;
38318 int ret_val;
38319 int code; /* UCS code point */
38320 int n_code;
38321
38322 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38323 mem_base = xmlMemBlocks();
38324 code = gen_int(n_code, 0);
38325
38326 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
38327 desret_int(ret_val);
38328 call_tests++;
38329 des_int(n_code, code, 0);
38330 xmlResetLastError();
38331 if (mem_base != xmlMemBlocks()) {
38332 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
38333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038334 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038335 printf(" %d", n_code);
38336 printf("\n");
38337 }
38338 }
38339#endif
38340
38341 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038342 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038343}
38344
38345
38346static int
38347test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038348 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038349
38350#ifdef LIBXML_UNICODE_ENABLED
38351 int mem_base;
38352 int ret_val;
38353 int code; /* UCS code point */
38354 int n_code;
38355
38356 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38357 mem_base = xmlMemBlocks();
38358 code = gen_int(n_code, 0);
38359
38360 ret_val = xmlUCSIsSupplementalArrowsA(code);
38361 desret_int(ret_val);
38362 call_tests++;
38363 des_int(n_code, code, 0);
38364 xmlResetLastError();
38365 if (mem_base != xmlMemBlocks()) {
38366 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
38367 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038368 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038369 printf(" %d", n_code);
38370 printf("\n");
38371 }
38372 }
38373#endif
38374
38375 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038376 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038377}
38378
38379
38380static int
38381test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038382 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038383
38384#ifdef LIBXML_UNICODE_ENABLED
38385 int mem_base;
38386 int ret_val;
38387 int code; /* UCS code point */
38388 int n_code;
38389
38390 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38391 mem_base = xmlMemBlocks();
38392 code = gen_int(n_code, 0);
38393
38394 ret_val = xmlUCSIsSupplementalArrowsB(code);
38395 desret_int(ret_val);
38396 call_tests++;
38397 des_int(n_code, code, 0);
38398 xmlResetLastError();
38399 if (mem_base != xmlMemBlocks()) {
38400 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
38401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038402 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038403 printf(" %d", n_code);
38404 printf("\n");
38405 }
38406 }
38407#endif
38408
38409 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038410 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038411}
38412
38413
38414static int
38415test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038416 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038417
38418#ifdef LIBXML_UNICODE_ENABLED
38419 int mem_base;
38420 int ret_val;
38421 int code; /* UCS code point */
38422 int n_code;
38423
38424 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38425 mem_base = xmlMemBlocks();
38426 code = gen_int(n_code, 0);
38427
38428 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
38429 desret_int(ret_val);
38430 call_tests++;
38431 des_int(n_code, code, 0);
38432 xmlResetLastError();
38433 if (mem_base != xmlMemBlocks()) {
38434 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
38435 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038436 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038437 printf(" %d", n_code);
38438 printf("\n");
38439 }
38440 }
38441#endif
38442
38443 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038444 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038445}
38446
38447
38448static int
38449test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038450 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038451
38452#ifdef LIBXML_UNICODE_ENABLED
38453 int mem_base;
38454 int ret_val;
38455 int code; /* UCS code point */
38456 int n_code;
38457
38458 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38459 mem_base = xmlMemBlocks();
38460 code = gen_int(n_code, 0);
38461
38462 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
38463 desret_int(ret_val);
38464 call_tests++;
38465 des_int(n_code, code, 0);
38466 xmlResetLastError();
38467 if (mem_base != xmlMemBlocks()) {
38468 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
38469 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038470 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038471 printf(" %d", n_code);
38472 printf("\n");
38473 }
38474 }
38475#endif
38476
38477 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038478 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038479}
38480
38481
38482static int
38483test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038484 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038485
38486#ifdef LIBXML_UNICODE_ENABLED
38487 int mem_base;
38488 int ret_val;
38489 int code; /* UCS code point */
38490 int n_code;
38491
38492 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38493 mem_base = xmlMemBlocks();
38494 code = gen_int(n_code, 0);
38495
38496 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
38497 desret_int(ret_val);
38498 call_tests++;
38499 des_int(n_code, code, 0);
38500 xmlResetLastError();
38501 if (mem_base != xmlMemBlocks()) {
38502 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
38503 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038504 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038505 printf(" %d", n_code);
38506 printf("\n");
38507 }
38508 }
38509#endif
38510
38511 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038512 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038513}
38514
38515
38516static int
38517test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038518 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038519
38520#ifdef LIBXML_UNICODE_ENABLED
38521 int mem_base;
38522 int ret_val;
38523 int code; /* UCS code point */
38524 int n_code;
38525
38526 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38527 mem_base = xmlMemBlocks();
38528 code = gen_int(n_code, 0);
38529
38530 ret_val = xmlUCSIsSyriac(code);
38531 desret_int(ret_val);
38532 call_tests++;
38533 des_int(n_code, code, 0);
38534 xmlResetLastError();
38535 if (mem_base != xmlMemBlocks()) {
38536 printf("Leak of %d blocks found in xmlUCSIsSyriac",
38537 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038538 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038539 printf(" %d", n_code);
38540 printf("\n");
38541 }
38542 }
38543#endif
38544
38545 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038546 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038547}
38548
38549
38550static int
38551test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038552 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038553
38554#ifdef LIBXML_UNICODE_ENABLED
38555 int mem_base;
38556 int ret_val;
38557 int code; /* UCS code point */
38558 int n_code;
38559
38560 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38561 mem_base = xmlMemBlocks();
38562 code = gen_int(n_code, 0);
38563
38564 ret_val = xmlUCSIsTagalog(code);
38565 desret_int(ret_val);
38566 call_tests++;
38567 des_int(n_code, code, 0);
38568 xmlResetLastError();
38569 if (mem_base != xmlMemBlocks()) {
38570 printf("Leak of %d blocks found in xmlUCSIsTagalog",
38571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038572 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038573 printf(" %d", n_code);
38574 printf("\n");
38575 }
38576 }
38577#endif
38578
38579 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038580 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038581}
38582
38583
38584static int
38585test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038586 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038587
38588#ifdef LIBXML_UNICODE_ENABLED
38589 int mem_base;
38590 int ret_val;
38591 int code; /* UCS code point */
38592 int n_code;
38593
38594 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38595 mem_base = xmlMemBlocks();
38596 code = gen_int(n_code, 0);
38597
38598 ret_val = xmlUCSIsTagbanwa(code);
38599 desret_int(ret_val);
38600 call_tests++;
38601 des_int(n_code, code, 0);
38602 xmlResetLastError();
38603 if (mem_base != xmlMemBlocks()) {
38604 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
38605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038606 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038607 printf(" %d", n_code);
38608 printf("\n");
38609 }
38610 }
38611#endif
38612
38613 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038614 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038615}
38616
38617
38618static int
38619test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038620 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038621
38622#ifdef LIBXML_UNICODE_ENABLED
38623 int mem_base;
38624 int ret_val;
38625 int code; /* UCS code point */
38626 int n_code;
38627
38628 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38629 mem_base = xmlMemBlocks();
38630 code = gen_int(n_code, 0);
38631
38632 ret_val = xmlUCSIsTags(code);
38633 desret_int(ret_val);
38634 call_tests++;
38635 des_int(n_code, code, 0);
38636 xmlResetLastError();
38637 if (mem_base != xmlMemBlocks()) {
38638 printf("Leak of %d blocks found in xmlUCSIsTags",
38639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038640 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038641 printf(" %d", n_code);
38642 printf("\n");
38643 }
38644 }
38645#endif
38646
38647 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038648 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038649}
38650
38651
38652static int
38653test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038654 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038655
38656#ifdef LIBXML_UNICODE_ENABLED
38657 int mem_base;
38658 int ret_val;
38659 int code; /* UCS code point */
38660 int n_code;
38661
38662 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38663 mem_base = xmlMemBlocks();
38664 code = gen_int(n_code, 0);
38665
38666 ret_val = xmlUCSIsTaiLe(code);
38667 desret_int(ret_val);
38668 call_tests++;
38669 des_int(n_code, code, 0);
38670 xmlResetLastError();
38671 if (mem_base != xmlMemBlocks()) {
38672 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
38673 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038674 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038675 printf(" %d", n_code);
38676 printf("\n");
38677 }
38678 }
38679#endif
38680
38681 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038682 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038683}
38684
38685
38686static int
38687test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038688 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038689
38690#ifdef LIBXML_UNICODE_ENABLED
38691 int mem_base;
38692 int ret_val;
38693 int code; /* UCS code point */
38694 int n_code;
38695
38696 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38697 mem_base = xmlMemBlocks();
38698 code = gen_int(n_code, 0);
38699
38700 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
38701 desret_int(ret_val);
38702 call_tests++;
38703 des_int(n_code, code, 0);
38704 xmlResetLastError();
38705 if (mem_base != xmlMemBlocks()) {
38706 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
38707 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038708 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038709 printf(" %d", n_code);
38710 printf("\n");
38711 }
38712 }
38713#endif
38714
38715 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038716 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038717}
38718
38719
38720static int
38721test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038722 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038723
38724#ifdef LIBXML_UNICODE_ENABLED
38725 int mem_base;
38726 int ret_val;
38727 int code; /* UCS code point */
38728 int n_code;
38729
38730 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38731 mem_base = xmlMemBlocks();
38732 code = gen_int(n_code, 0);
38733
38734 ret_val = xmlUCSIsTamil(code);
38735 desret_int(ret_val);
38736 call_tests++;
38737 des_int(n_code, code, 0);
38738 xmlResetLastError();
38739 if (mem_base != xmlMemBlocks()) {
38740 printf("Leak of %d blocks found in xmlUCSIsTamil",
38741 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038742 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038743 printf(" %d", n_code);
38744 printf("\n");
38745 }
38746 }
38747#endif
38748
38749 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038750 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038751}
38752
38753
38754static int
38755test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038756 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038757
38758#ifdef LIBXML_UNICODE_ENABLED
38759 int mem_base;
38760 int ret_val;
38761 int code; /* UCS code point */
38762 int n_code;
38763
38764 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38765 mem_base = xmlMemBlocks();
38766 code = gen_int(n_code, 0);
38767
38768 ret_val = xmlUCSIsTelugu(code);
38769 desret_int(ret_val);
38770 call_tests++;
38771 des_int(n_code, code, 0);
38772 xmlResetLastError();
38773 if (mem_base != xmlMemBlocks()) {
38774 printf("Leak of %d blocks found in xmlUCSIsTelugu",
38775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038776 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038777 printf(" %d", n_code);
38778 printf("\n");
38779 }
38780 }
38781#endif
38782
38783 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038784 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038785}
38786
38787
38788static int
38789test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038790 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038791
38792#ifdef LIBXML_UNICODE_ENABLED
38793 int mem_base;
38794 int ret_val;
38795 int code; /* UCS code point */
38796 int n_code;
38797
38798 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38799 mem_base = xmlMemBlocks();
38800 code = gen_int(n_code, 0);
38801
38802 ret_val = xmlUCSIsThaana(code);
38803 desret_int(ret_val);
38804 call_tests++;
38805 des_int(n_code, code, 0);
38806 xmlResetLastError();
38807 if (mem_base != xmlMemBlocks()) {
38808 printf("Leak of %d blocks found in xmlUCSIsThaana",
38809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038810 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038811 printf(" %d", n_code);
38812 printf("\n");
38813 }
38814 }
38815#endif
38816
38817 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038818 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038819}
38820
38821
38822static int
38823test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038824 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038825
38826#ifdef LIBXML_UNICODE_ENABLED
38827 int mem_base;
38828 int ret_val;
38829 int code; /* UCS code point */
38830 int n_code;
38831
38832 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38833 mem_base = xmlMemBlocks();
38834 code = gen_int(n_code, 0);
38835
38836 ret_val = xmlUCSIsThai(code);
38837 desret_int(ret_val);
38838 call_tests++;
38839 des_int(n_code, code, 0);
38840 xmlResetLastError();
38841 if (mem_base != xmlMemBlocks()) {
38842 printf("Leak of %d blocks found in xmlUCSIsThai",
38843 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038844 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038845 printf(" %d", n_code);
38846 printf("\n");
38847 }
38848 }
38849#endif
38850
38851 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038852 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038853}
38854
38855
38856static int
38857test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038858 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038859
38860#ifdef LIBXML_UNICODE_ENABLED
38861 int mem_base;
38862 int ret_val;
38863 int code; /* UCS code point */
38864 int n_code;
38865
38866 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38867 mem_base = xmlMemBlocks();
38868 code = gen_int(n_code, 0);
38869
38870 ret_val = xmlUCSIsTibetan(code);
38871 desret_int(ret_val);
38872 call_tests++;
38873 des_int(n_code, code, 0);
38874 xmlResetLastError();
38875 if (mem_base != xmlMemBlocks()) {
38876 printf("Leak of %d blocks found in xmlUCSIsTibetan",
38877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038878 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038879 printf(" %d", n_code);
38880 printf("\n");
38881 }
38882 }
38883#endif
38884
38885 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038886 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038887}
38888
38889
38890static int
38891test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038892 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038893
38894#ifdef LIBXML_UNICODE_ENABLED
38895 int mem_base;
38896 int ret_val;
38897 int code; /* UCS code point */
38898 int n_code;
38899
38900 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38901 mem_base = xmlMemBlocks();
38902 code = gen_int(n_code, 0);
38903
38904 ret_val = xmlUCSIsUgaritic(code);
38905 desret_int(ret_val);
38906 call_tests++;
38907 des_int(n_code, code, 0);
38908 xmlResetLastError();
38909 if (mem_base != xmlMemBlocks()) {
38910 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
38911 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038912 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038913 printf(" %d", n_code);
38914 printf("\n");
38915 }
38916 }
38917#endif
38918
38919 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038920 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038921}
38922
38923
38924static int
38925test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038926 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038927
38928#ifdef LIBXML_UNICODE_ENABLED
38929 int mem_base;
38930 int ret_val;
38931 int code; /* UCS code point */
38932 int n_code;
38933
38934 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38935 mem_base = xmlMemBlocks();
38936 code = gen_int(n_code, 0);
38937
38938 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
38939 desret_int(ret_val);
38940 call_tests++;
38941 des_int(n_code, code, 0);
38942 xmlResetLastError();
38943 if (mem_base != xmlMemBlocks()) {
38944 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
38945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038946 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038947 printf(" %d", n_code);
38948 printf("\n");
38949 }
38950 }
38951#endif
38952
38953 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038954 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038955}
38956
38957
38958static int
38959test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038960 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038961
38962#ifdef LIBXML_UNICODE_ENABLED
38963 int mem_base;
38964 int ret_val;
38965 int code; /* UCS code point */
38966 int n_code;
38967
38968 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38969 mem_base = xmlMemBlocks();
38970 code = gen_int(n_code, 0);
38971
38972 ret_val = xmlUCSIsVariationSelectors(code);
38973 desret_int(ret_val);
38974 call_tests++;
38975 des_int(n_code, code, 0);
38976 xmlResetLastError();
38977 if (mem_base != xmlMemBlocks()) {
38978 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
38979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038980 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038981 printf(" %d", n_code);
38982 printf("\n");
38983 }
38984 }
38985#endif
38986
38987 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038988 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038989}
38990
38991
38992static int
38993test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038994 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038995
38996#ifdef LIBXML_UNICODE_ENABLED
38997 int mem_base;
38998 int ret_val;
38999 int code; /* UCS code point */
39000 int n_code;
39001
39002 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39003 mem_base = xmlMemBlocks();
39004 code = gen_int(n_code, 0);
39005
39006 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
39007 desret_int(ret_val);
39008 call_tests++;
39009 des_int(n_code, code, 0);
39010 xmlResetLastError();
39011 if (mem_base != xmlMemBlocks()) {
39012 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
39013 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039014 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039015 printf(" %d", n_code);
39016 printf("\n");
39017 }
39018 }
39019#endif
39020
39021 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039022 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039023}
39024
39025
39026static int
39027test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039028 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039029
39030#ifdef LIBXML_UNICODE_ENABLED
39031 int mem_base;
39032 int ret_val;
39033 int code; /* UCS code point */
39034 int n_code;
39035
39036 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39037 mem_base = xmlMemBlocks();
39038 code = gen_int(n_code, 0);
39039
39040 ret_val = xmlUCSIsYiRadicals(code);
39041 desret_int(ret_val);
39042 call_tests++;
39043 des_int(n_code, code, 0);
39044 xmlResetLastError();
39045 if (mem_base != xmlMemBlocks()) {
39046 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
39047 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039048 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039049 printf(" %d", n_code);
39050 printf("\n");
39051 }
39052 }
39053#endif
39054
39055 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039056 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039057}
39058
39059
39060static int
39061test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039062 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039063
39064#ifdef LIBXML_UNICODE_ENABLED
39065 int mem_base;
39066 int ret_val;
39067 int code; /* UCS code point */
39068 int n_code;
39069
39070 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39071 mem_base = xmlMemBlocks();
39072 code = gen_int(n_code, 0);
39073
39074 ret_val = xmlUCSIsYiSyllables(code);
39075 desret_int(ret_val);
39076 call_tests++;
39077 des_int(n_code, code, 0);
39078 xmlResetLastError();
39079 if (mem_base != xmlMemBlocks()) {
39080 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
39081 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039082 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039083 printf(" %d", n_code);
39084 printf("\n");
39085 }
39086 }
39087#endif
39088
39089 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039090 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039091}
39092
39093
39094static int
39095test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039096 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039097
39098#ifdef LIBXML_UNICODE_ENABLED
39099 int mem_base;
39100 int ret_val;
39101 int code; /* UCS code point */
39102 int n_code;
39103
39104 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39105 mem_base = xmlMemBlocks();
39106 code = gen_int(n_code, 0);
39107
39108 ret_val = xmlUCSIsYijingHexagramSymbols(code);
39109 desret_int(ret_val);
39110 call_tests++;
39111 des_int(n_code, code, 0);
39112 xmlResetLastError();
39113 if (mem_base != xmlMemBlocks()) {
39114 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
39115 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039116 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039117 printf(" %d", n_code);
39118 printf("\n");
39119 }
39120 }
39121#endif
39122
39123 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039124 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039125}
39126
39127static int
39128test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039129 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039130
39131 printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000039132 test_ret += test_xmlUCSIsAegeanNumbers();
39133 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
39134 test_ret += test_xmlUCSIsArabic();
39135 test_ret += test_xmlUCSIsArabicPresentationFormsA();
39136 test_ret += test_xmlUCSIsArabicPresentationFormsB();
39137 test_ret += test_xmlUCSIsArmenian();
39138 test_ret += test_xmlUCSIsArrows();
39139 test_ret += test_xmlUCSIsBasicLatin();
39140 test_ret += test_xmlUCSIsBengali();
39141 test_ret += test_xmlUCSIsBlock();
39142 test_ret += test_xmlUCSIsBlockElements();
39143 test_ret += test_xmlUCSIsBopomofo();
39144 test_ret += test_xmlUCSIsBopomofoExtended();
39145 test_ret += test_xmlUCSIsBoxDrawing();
39146 test_ret += test_xmlUCSIsBraillePatterns();
39147 test_ret += test_xmlUCSIsBuhid();
39148 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
39149 test_ret += test_xmlUCSIsCJKCompatibility();
39150 test_ret += test_xmlUCSIsCJKCompatibilityForms();
39151 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
39152 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
39153 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
39154 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
39155 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
39156 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
39157 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
39158 test_ret += test_xmlUCSIsCat();
39159 test_ret += test_xmlUCSIsCatC();
39160 test_ret += test_xmlUCSIsCatCc();
39161 test_ret += test_xmlUCSIsCatCf();
39162 test_ret += test_xmlUCSIsCatCo();
39163 test_ret += test_xmlUCSIsCatCs();
39164 test_ret += test_xmlUCSIsCatL();
39165 test_ret += test_xmlUCSIsCatLl();
39166 test_ret += test_xmlUCSIsCatLm();
39167 test_ret += test_xmlUCSIsCatLo();
39168 test_ret += test_xmlUCSIsCatLt();
39169 test_ret += test_xmlUCSIsCatLu();
39170 test_ret += test_xmlUCSIsCatM();
39171 test_ret += test_xmlUCSIsCatMc();
39172 test_ret += test_xmlUCSIsCatMe();
39173 test_ret += test_xmlUCSIsCatMn();
39174 test_ret += test_xmlUCSIsCatN();
39175 test_ret += test_xmlUCSIsCatNd();
39176 test_ret += test_xmlUCSIsCatNl();
39177 test_ret += test_xmlUCSIsCatNo();
39178 test_ret += test_xmlUCSIsCatP();
39179 test_ret += test_xmlUCSIsCatPc();
39180 test_ret += test_xmlUCSIsCatPd();
39181 test_ret += test_xmlUCSIsCatPe();
39182 test_ret += test_xmlUCSIsCatPf();
39183 test_ret += test_xmlUCSIsCatPi();
39184 test_ret += test_xmlUCSIsCatPo();
39185 test_ret += test_xmlUCSIsCatPs();
39186 test_ret += test_xmlUCSIsCatS();
39187 test_ret += test_xmlUCSIsCatSc();
39188 test_ret += test_xmlUCSIsCatSk();
39189 test_ret += test_xmlUCSIsCatSm();
39190 test_ret += test_xmlUCSIsCatSo();
39191 test_ret += test_xmlUCSIsCatZ();
39192 test_ret += test_xmlUCSIsCatZl();
39193 test_ret += test_xmlUCSIsCatZp();
39194 test_ret += test_xmlUCSIsCatZs();
39195 test_ret += test_xmlUCSIsCherokee();
39196 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
39197 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
39198 test_ret += test_xmlUCSIsCombiningHalfMarks();
39199 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
39200 test_ret += test_xmlUCSIsControlPictures();
39201 test_ret += test_xmlUCSIsCurrencySymbols();
39202 test_ret += test_xmlUCSIsCypriotSyllabary();
39203 test_ret += test_xmlUCSIsCyrillic();
39204 test_ret += test_xmlUCSIsCyrillicSupplement();
39205 test_ret += test_xmlUCSIsDeseret();
39206 test_ret += test_xmlUCSIsDevanagari();
39207 test_ret += test_xmlUCSIsDingbats();
39208 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
39209 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
39210 test_ret += test_xmlUCSIsEthiopic();
39211 test_ret += test_xmlUCSIsGeneralPunctuation();
39212 test_ret += test_xmlUCSIsGeometricShapes();
39213 test_ret += test_xmlUCSIsGeorgian();
39214 test_ret += test_xmlUCSIsGothic();
39215 test_ret += test_xmlUCSIsGreek();
39216 test_ret += test_xmlUCSIsGreekExtended();
39217 test_ret += test_xmlUCSIsGreekandCoptic();
39218 test_ret += test_xmlUCSIsGujarati();
39219 test_ret += test_xmlUCSIsGurmukhi();
39220 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
39221 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
39222 test_ret += test_xmlUCSIsHangulJamo();
39223 test_ret += test_xmlUCSIsHangulSyllables();
39224 test_ret += test_xmlUCSIsHanunoo();
39225 test_ret += test_xmlUCSIsHebrew();
39226 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
39227 test_ret += test_xmlUCSIsHighSurrogates();
39228 test_ret += test_xmlUCSIsHiragana();
39229 test_ret += test_xmlUCSIsIPAExtensions();
39230 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
39231 test_ret += test_xmlUCSIsKanbun();
39232 test_ret += test_xmlUCSIsKangxiRadicals();
39233 test_ret += test_xmlUCSIsKannada();
39234 test_ret += test_xmlUCSIsKatakana();
39235 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
39236 test_ret += test_xmlUCSIsKhmer();
39237 test_ret += test_xmlUCSIsKhmerSymbols();
39238 test_ret += test_xmlUCSIsLao();
39239 test_ret += test_xmlUCSIsLatin1Supplement();
39240 test_ret += test_xmlUCSIsLatinExtendedA();
39241 test_ret += test_xmlUCSIsLatinExtendedAdditional();
39242 test_ret += test_xmlUCSIsLatinExtendedB();
39243 test_ret += test_xmlUCSIsLetterlikeSymbols();
39244 test_ret += test_xmlUCSIsLimbu();
39245 test_ret += test_xmlUCSIsLinearBIdeograms();
39246 test_ret += test_xmlUCSIsLinearBSyllabary();
39247 test_ret += test_xmlUCSIsLowSurrogates();
39248 test_ret += test_xmlUCSIsMalayalam();
39249 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
39250 test_ret += test_xmlUCSIsMathematicalOperators();
39251 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
39252 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
39253 test_ret += test_xmlUCSIsMiscellaneousSymbols();
39254 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
39255 test_ret += test_xmlUCSIsMiscellaneousTechnical();
39256 test_ret += test_xmlUCSIsMongolian();
39257 test_ret += test_xmlUCSIsMusicalSymbols();
39258 test_ret += test_xmlUCSIsMyanmar();
39259 test_ret += test_xmlUCSIsNumberForms();
39260 test_ret += test_xmlUCSIsOgham();
39261 test_ret += test_xmlUCSIsOldItalic();
39262 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
39263 test_ret += test_xmlUCSIsOriya();
39264 test_ret += test_xmlUCSIsOsmanya();
39265 test_ret += test_xmlUCSIsPhoneticExtensions();
39266 test_ret += test_xmlUCSIsPrivateUse();
39267 test_ret += test_xmlUCSIsPrivateUseArea();
39268 test_ret += test_xmlUCSIsRunic();
39269 test_ret += test_xmlUCSIsShavian();
39270 test_ret += test_xmlUCSIsSinhala();
39271 test_ret += test_xmlUCSIsSmallFormVariants();
39272 test_ret += test_xmlUCSIsSpacingModifierLetters();
39273 test_ret += test_xmlUCSIsSpecials();
39274 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
39275 test_ret += test_xmlUCSIsSupplementalArrowsA();
39276 test_ret += test_xmlUCSIsSupplementalArrowsB();
39277 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
39278 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
39279 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
39280 test_ret += test_xmlUCSIsSyriac();
39281 test_ret += test_xmlUCSIsTagalog();
39282 test_ret += test_xmlUCSIsTagbanwa();
39283 test_ret += test_xmlUCSIsTags();
39284 test_ret += test_xmlUCSIsTaiLe();
39285 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
39286 test_ret += test_xmlUCSIsTamil();
39287 test_ret += test_xmlUCSIsTelugu();
39288 test_ret += test_xmlUCSIsThaana();
39289 test_ret += test_xmlUCSIsThai();
39290 test_ret += test_xmlUCSIsTibetan();
39291 test_ret += test_xmlUCSIsUgaritic();
39292 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
39293 test_ret += test_xmlUCSIsVariationSelectors();
39294 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
39295 test_ret += test_xmlUCSIsYiRadicals();
39296 test_ret += test_xmlUCSIsYiSyllables();
39297 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039298
Daniel Veillard42595322004-11-08 10:52:06 +000039299 if (test_ret != 0)
39300 printf("Module xmlunicode: %d errors\n", test_ret);
39301 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039302}
39303
39304static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000039305test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039307
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039308#ifdef LIBXML_WRITER_ENABLED
39309 int mem_base;
39310 xmlTextWriterPtr ret_val;
39311 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
39312 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039313
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039314 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
39315 mem_base = xmlMemBlocks();
39316 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039317
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039318 ret_val = xmlNewTextWriter(out);
39319 if (ret_val != NULL) out = NULL;
39320 desret_xmlTextWriterPtr(ret_val);
39321 call_tests++;
39322 des_xmlOutputBufferPtr(n_out, out, 0);
39323 xmlResetLastError();
39324 if (mem_base != xmlMemBlocks()) {
39325 printf("Leak of %d blocks found in xmlNewTextWriter",
39326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039327 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039328 printf(" %d", n_out);
39329 printf("\n");
39330 }
39331 }
39332#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000039333
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039334 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039335 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039336}
39337
39338
39339static int
39340test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039341 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039342
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039343#ifdef LIBXML_WRITER_ENABLED
39344 int mem_base;
39345 xmlTextWriterPtr ret_val;
39346 const char * uri; /* the URI of the resource for the output */
39347 int n_uri;
39348 int compression; /* compress the output? */
39349 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039350
Daniel Veillard42595322004-11-08 10:52:06 +000039351 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039352 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39353 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000039354 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039355 compression = gen_int(n_compression, 1);
39356
39357 ret_val = xmlNewTextWriterFilename(uri, compression);
39358 desret_xmlTextWriterPtr(ret_val);
39359 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039360 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039361 des_int(n_compression, compression, 1);
39362 xmlResetLastError();
39363 if (mem_base != xmlMemBlocks()) {
39364 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
39365 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039366 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039367 printf(" %d", n_uri);
39368 printf(" %d", n_compression);
39369 printf("\n");
39370 }
39371 }
39372 }
39373#endif
39374
39375 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039376 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039377}
39378
39379
39380static int
39381test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039382 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039383
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039384#ifdef LIBXML_WRITER_ENABLED
39385 int mem_base;
39386 xmlTextWriterPtr ret_val;
39387 xmlBufferPtr buf; /* xmlBufferPtr */
39388 int n_buf;
39389 int compression; /* compress the output? */
39390 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039391
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039392 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
39393 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39394 mem_base = xmlMemBlocks();
39395 buf = gen_xmlBufferPtr(n_buf, 0);
39396 compression = gen_int(n_compression, 1);
39397
39398 ret_val = xmlNewTextWriterMemory(buf, compression);
39399 desret_xmlTextWriterPtr(ret_val);
39400 call_tests++;
39401 des_xmlBufferPtr(n_buf, buf, 0);
39402 des_int(n_compression, compression, 1);
39403 xmlResetLastError();
39404 if (mem_base != xmlMemBlocks()) {
39405 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
39406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039407 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039408 printf(" %d", n_buf);
39409 printf(" %d", n_compression);
39410 printf("\n");
39411 }
39412 }
39413 }
39414#endif
39415
39416 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039418}
39419
39420
39421static int
39422test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039423 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039424
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039425#ifdef LIBXML_WRITER_ENABLED
39426 int mem_base;
39427 xmlTextWriterPtr ret_val;
39428 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
39429 int n_ctxt;
39430 int compression; /* compress the output? */
39431 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039432
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039433 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
39434 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39435 mem_base = xmlMemBlocks();
39436 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
39437 compression = gen_int(n_compression, 1);
39438
39439 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
39440 if (ret_val != NULL) ctxt = NULL;
39441 desret_xmlTextWriterPtr(ret_val);
39442 call_tests++;
39443 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
39444 des_int(n_compression, compression, 1);
39445 xmlResetLastError();
39446 if (mem_base != xmlMemBlocks()) {
39447 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
39448 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039449 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039450 printf(" %d", n_ctxt);
39451 printf(" %d", n_compression);
39452 printf("\n");
39453 }
39454 }
39455 }
39456#endif
39457
39458 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039460}
39461
39462
39463static int
39464test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039466
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039467#ifdef LIBXML_WRITER_ENABLED
39468 int mem_base;
39469 xmlTextWriterPtr ret_val;
39470 xmlDocPtr doc; /* xmlDocPtr */
39471 int n_doc;
39472 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
39473 int n_node;
39474 int compression; /* compress the output? */
39475 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039476
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039477 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
39478 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
39479 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39480 mem_base = xmlMemBlocks();
39481 doc = gen_xmlDocPtr(n_doc, 0);
39482 node = gen_xmlNodePtr(n_node, 1);
39483 compression = gen_int(n_compression, 2);
39484
39485 ret_val = xmlNewTextWriterTree(doc, node, compression);
39486 desret_xmlTextWriterPtr(ret_val);
39487 call_tests++;
39488 des_xmlDocPtr(n_doc, doc, 0);
39489 des_xmlNodePtr(n_node, node, 1);
39490 des_int(n_compression, compression, 2);
39491 xmlResetLastError();
39492 if (mem_base != xmlMemBlocks()) {
39493 printf("Leak of %d blocks found in xmlNewTextWriterTree",
39494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039495 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039496 printf(" %d", n_doc);
39497 printf(" %d", n_node);
39498 printf(" %d", n_compression);
39499 printf("\n");
39500 }
39501 }
39502 }
39503 }
39504#endif
39505
39506 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039508}
39509
39510
39511static int
39512test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039514
Daniel Veillarde43cc572004-11-03 11:50:29 +000039515#ifdef LIBXML_WRITER_ENABLED
39516 int mem_base;
39517 int ret_val;
39518 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39519 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039520
Daniel Veillarde43cc572004-11-03 11:50:29 +000039521 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39522 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039523 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039524
39525 ret_val = xmlTextWriterEndAttribute(writer);
39526 desret_int(ret_val);
39527 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039528 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039529 xmlResetLastError();
39530 if (mem_base != xmlMemBlocks()) {
39531 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
39532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039533 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039534 printf(" %d", n_writer);
39535 printf("\n");
39536 }
39537 }
39538#endif
39539
Daniel Veillard3d97e662004-11-04 10:49:00 +000039540 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039542}
39543
39544
39545static int
39546test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039548
Daniel Veillarde43cc572004-11-03 11:50:29 +000039549#ifdef LIBXML_WRITER_ENABLED
39550 int mem_base;
39551 int ret_val;
39552 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39553 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039554
Daniel Veillarde43cc572004-11-03 11:50:29 +000039555 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39556 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039557 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039558
39559 ret_val = xmlTextWriterEndCDATA(writer);
39560 desret_int(ret_val);
39561 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039562 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039563 xmlResetLastError();
39564 if (mem_base != xmlMemBlocks()) {
39565 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
39566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039567 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039568 printf(" %d", n_writer);
39569 printf("\n");
39570 }
39571 }
39572#endif
39573
Daniel Veillard3d97e662004-11-04 10:49:00 +000039574 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039576}
39577
39578
39579static int
39580test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039582
Daniel Veillarde43cc572004-11-03 11:50:29 +000039583#ifdef LIBXML_WRITER_ENABLED
39584 int mem_base;
39585 int ret_val;
39586 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39587 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039588
Daniel Veillarde43cc572004-11-03 11:50:29 +000039589 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39590 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039591 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039592
39593 ret_val = xmlTextWriterEndComment(writer);
39594 desret_int(ret_val);
39595 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039596 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039597 xmlResetLastError();
39598 if (mem_base != xmlMemBlocks()) {
39599 printf("Leak of %d blocks found in xmlTextWriterEndComment",
39600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039601 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039602 printf(" %d", n_writer);
39603 printf("\n");
39604 }
39605 }
39606#endif
39607
Daniel Veillard3d97e662004-11-04 10:49:00 +000039608 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039610}
39611
39612
39613static int
39614test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039616
Daniel Veillarde43cc572004-11-03 11:50:29 +000039617#ifdef LIBXML_WRITER_ENABLED
39618 int mem_base;
39619 int ret_val;
39620 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39621 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039622
Daniel Veillarde43cc572004-11-03 11:50:29 +000039623 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39624 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039625 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039626
39627 ret_val = xmlTextWriterEndDTD(writer);
39628 desret_int(ret_val);
39629 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039630 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039631 xmlResetLastError();
39632 if (mem_base != xmlMemBlocks()) {
39633 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
39634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039635 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039636 printf(" %d", n_writer);
39637 printf("\n");
39638 }
39639 }
39640#endif
39641
Daniel Veillard3d97e662004-11-04 10:49:00 +000039642 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039643 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039644}
39645
39646
39647static int
39648test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039649 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039650
Daniel Veillarde43cc572004-11-03 11:50:29 +000039651#ifdef LIBXML_WRITER_ENABLED
39652 int mem_base;
39653 int ret_val;
39654 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39655 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039656
Daniel Veillarde43cc572004-11-03 11:50:29 +000039657 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39658 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039659 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039660
39661 ret_val = xmlTextWriterEndDTDAttlist(writer);
39662 desret_int(ret_val);
39663 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039664 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039665 xmlResetLastError();
39666 if (mem_base != xmlMemBlocks()) {
39667 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
39668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039669 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039670 printf(" %d", n_writer);
39671 printf("\n");
39672 }
39673 }
39674#endif
39675
Daniel Veillard3d97e662004-11-04 10:49:00 +000039676 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039678}
39679
39680
39681static int
39682test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039683 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039684
Daniel Veillarde43cc572004-11-03 11:50:29 +000039685#ifdef LIBXML_WRITER_ENABLED
39686 int mem_base;
39687 int ret_val;
39688 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39689 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039690
Daniel Veillarde43cc572004-11-03 11:50:29 +000039691 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39692 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039693 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039694
39695 ret_val = xmlTextWriterEndDTDElement(writer);
39696 desret_int(ret_val);
39697 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039698 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039699 xmlResetLastError();
39700 if (mem_base != xmlMemBlocks()) {
39701 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
39702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039703 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039704 printf(" %d", n_writer);
39705 printf("\n");
39706 }
39707 }
39708#endif
39709
Daniel Veillard3d97e662004-11-04 10:49:00 +000039710 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039711 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039712}
39713
39714
39715static int
39716test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039717 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039718
Daniel Veillarde43cc572004-11-03 11:50:29 +000039719#ifdef LIBXML_WRITER_ENABLED
39720 int mem_base;
39721 int ret_val;
39722 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39723 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039724
Daniel Veillarde43cc572004-11-03 11:50:29 +000039725 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39726 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039727 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039728
39729 ret_val = xmlTextWriterEndDTDEntity(writer);
39730 desret_int(ret_val);
39731 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039732 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039733 xmlResetLastError();
39734 if (mem_base != xmlMemBlocks()) {
39735 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
39736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039737 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039738 printf(" %d", n_writer);
39739 printf("\n");
39740 }
39741 }
39742#endif
39743
Daniel Veillard3d97e662004-11-04 10:49:00 +000039744 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039745 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039746}
39747
39748
39749static int
39750test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039751 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039752
Daniel Veillarde43cc572004-11-03 11:50:29 +000039753#ifdef LIBXML_WRITER_ENABLED
39754 int mem_base;
39755 int ret_val;
39756 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39757 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039758
Daniel Veillarde43cc572004-11-03 11:50:29 +000039759 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39760 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039761 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039762
39763 ret_val = xmlTextWriterEndDocument(writer);
39764 desret_int(ret_val);
39765 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039766 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039767 xmlResetLastError();
39768 if (mem_base != xmlMemBlocks()) {
39769 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
39770 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039771 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039772 printf(" %d", n_writer);
39773 printf("\n");
39774 }
39775 }
39776#endif
39777
Daniel Veillard3d97e662004-11-04 10:49:00 +000039778 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039780}
39781
39782
39783static int
39784test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039786
Daniel Veillarde43cc572004-11-03 11:50:29 +000039787#ifdef LIBXML_WRITER_ENABLED
39788 int mem_base;
39789 int ret_val;
39790 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39791 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039792
Daniel Veillarde43cc572004-11-03 11:50:29 +000039793 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39794 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039795 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039796
39797 ret_val = xmlTextWriterEndElement(writer);
39798 desret_int(ret_val);
39799 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039800 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039801 xmlResetLastError();
39802 if (mem_base != xmlMemBlocks()) {
39803 printf("Leak of %d blocks found in xmlTextWriterEndElement",
39804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039805 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039806 printf(" %d", n_writer);
39807 printf("\n");
39808 }
39809 }
39810#endif
39811
Daniel Veillard3d97e662004-11-04 10:49:00 +000039812 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039813 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039814}
39815
39816
39817static int
39818test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039819 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039820
Daniel Veillarde43cc572004-11-03 11:50:29 +000039821#ifdef LIBXML_WRITER_ENABLED
39822 int mem_base;
39823 int ret_val;
39824 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39825 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039826
Daniel Veillarde43cc572004-11-03 11:50:29 +000039827 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39828 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039829 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039830
39831 ret_val = xmlTextWriterEndPI(writer);
39832 desret_int(ret_val);
39833 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039834 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039835 xmlResetLastError();
39836 if (mem_base != xmlMemBlocks()) {
39837 printf("Leak of %d blocks found in xmlTextWriterEndPI",
39838 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039839 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039840 printf(" %d", n_writer);
39841 printf("\n");
39842 }
39843 }
39844#endif
39845
Daniel Veillard3d97e662004-11-04 10:49:00 +000039846 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039847 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039848}
39849
39850
39851static int
39852test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039853 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039854
Daniel Veillarde43cc572004-11-03 11:50:29 +000039855#ifdef LIBXML_WRITER_ENABLED
39856 int mem_base;
39857 int ret_val;
39858 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39859 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039860
Daniel Veillarde43cc572004-11-03 11:50:29 +000039861 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39862 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039863 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039864
39865 ret_val = xmlTextWriterFlush(writer);
39866 desret_int(ret_val);
39867 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039868 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039869 xmlResetLastError();
39870 if (mem_base != xmlMemBlocks()) {
39871 printf("Leak of %d blocks found in xmlTextWriterFlush",
39872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039873 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039874 printf(" %d", n_writer);
39875 printf("\n");
39876 }
39877 }
39878#endif
39879
Daniel Veillard3d97e662004-11-04 10:49:00 +000039880 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039881 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039882}
39883
39884
39885static int
39886test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039887 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039888
Daniel Veillarde43cc572004-11-03 11:50:29 +000039889#ifdef LIBXML_WRITER_ENABLED
39890 int mem_base;
39891 int ret_val;
39892 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39893 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039894
Daniel Veillarde43cc572004-11-03 11:50:29 +000039895 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39896 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039897 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039898
39899 ret_val = xmlTextWriterFullEndElement(writer);
39900 desret_int(ret_val);
39901 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039902 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039903 xmlResetLastError();
39904 if (mem_base != xmlMemBlocks()) {
39905 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
39906 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039907 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039908 printf(" %d", n_writer);
39909 printf("\n");
39910 }
39911 }
39912#endif
39913
Daniel Veillard3d97e662004-11-04 10:49:00 +000039914 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039915 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039916}
39917
39918
39919static int
39920test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039921 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039922
Daniel Veillarde43cc572004-11-03 11:50:29 +000039923#ifdef LIBXML_WRITER_ENABLED
39924 int mem_base;
39925 int ret_val;
39926 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39927 int n_writer;
39928 int indent; /* do indentation? */
39929 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039930
Daniel Veillarde43cc572004-11-03 11:50:29 +000039931 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39932 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
39933 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039934 writer = gen_xmlTextWriterPtr(n_writer, 0);
39935 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039936
39937 ret_val = xmlTextWriterSetIndent(writer, indent);
39938 desret_int(ret_val);
39939 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039940 des_xmlTextWriterPtr(n_writer, writer, 0);
39941 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039942 xmlResetLastError();
39943 if (mem_base != xmlMemBlocks()) {
39944 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
39945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039946 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039947 printf(" %d", n_writer);
39948 printf(" %d", n_indent);
39949 printf("\n");
39950 }
39951 }
39952 }
39953#endif
39954
Daniel Veillard3d97e662004-11-04 10:49:00 +000039955 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039956 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039957}
39958
39959
39960static int
39961test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039962 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039963
Daniel Veillarde43cc572004-11-03 11:50:29 +000039964#ifdef LIBXML_WRITER_ENABLED
39965 int mem_base;
39966 int ret_val;
39967 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39968 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000039969 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000039970 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039971
Daniel Veillarde43cc572004-11-03 11:50:29 +000039972 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39973 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
39974 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039975 writer = gen_xmlTextWriterPtr(n_writer, 0);
39976 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039977
39978 ret_val = xmlTextWriterSetIndentString(writer, str);
39979 desret_int(ret_val);
39980 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039981 des_xmlTextWriterPtr(n_writer, writer, 0);
39982 des_const_xmlChar_ptr(n_str, str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039983 xmlResetLastError();
39984 if (mem_base != xmlMemBlocks()) {
39985 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
39986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039987 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039988 printf(" %d", n_writer);
39989 printf(" %d", n_str);
39990 printf("\n");
39991 }
39992 }
39993 }
39994#endif
39995
Daniel Veillard3d97e662004-11-04 10:49:00 +000039996 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039998}
39999
40000
40001static int
40002test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040004
Daniel Veillarde43cc572004-11-03 11:50:29 +000040005#ifdef LIBXML_WRITER_ENABLED
40006 int mem_base;
40007 int ret_val;
40008 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40009 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040010 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040011 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040012
Daniel Veillarde43cc572004-11-03 11:50:29 +000040013 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40014 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40015 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040016 writer = gen_xmlTextWriterPtr(n_writer, 0);
40017 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040018
40019 ret_val = xmlTextWriterStartAttribute(writer, name);
40020 desret_int(ret_val);
40021 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040022 des_xmlTextWriterPtr(n_writer, writer, 0);
40023 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040024 xmlResetLastError();
40025 if (mem_base != xmlMemBlocks()) {
40026 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
40027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040028 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040029 printf(" %d", n_writer);
40030 printf(" %d", n_name);
40031 printf("\n");
40032 }
40033 }
40034 }
40035#endif
40036
Daniel Veillard3d97e662004-11-04 10:49:00 +000040037 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040039}
40040
40041
40042static int
40043test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040045
Daniel Veillarde43cc572004-11-03 11:50:29 +000040046#ifdef LIBXML_WRITER_ENABLED
40047 int mem_base;
40048 int ret_val;
40049 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40050 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040051 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040052 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040053 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040054 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040055 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040056 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040057
Daniel Veillarde43cc572004-11-03 11:50:29 +000040058 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40059 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40060 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40061 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40062 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040063 writer = gen_xmlTextWriterPtr(n_writer, 0);
40064 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40065 name = gen_const_xmlChar_ptr(n_name, 2);
40066 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040067
40068 ret_val = xmlTextWriterStartAttributeNS(writer, prefix, name, namespaceURI);
40069 desret_int(ret_val);
40070 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040071 des_xmlTextWriterPtr(n_writer, writer, 0);
40072 des_const_xmlChar_ptr(n_prefix, prefix, 1);
40073 des_const_xmlChar_ptr(n_name, name, 2);
40074 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040075 xmlResetLastError();
40076 if (mem_base != xmlMemBlocks()) {
40077 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
40078 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040079 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040080 printf(" %d", n_writer);
40081 printf(" %d", n_prefix);
40082 printf(" %d", n_name);
40083 printf(" %d", n_namespaceURI);
40084 printf("\n");
40085 }
40086 }
40087 }
40088 }
40089 }
40090#endif
40091
Daniel Veillard3d97e662004-11-04 10:49:00 +000040092 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040093 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040094}
40095
40096
40097static int
40098test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040099 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040100
Daniel Veillarde43cc572004-11-03 11:50:29 +000040101#ifdef LIBXML_WRITER_ENABLED
40102 int mem_base;
40103 int ret_val;
40104 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40105 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040106
Daniel Veillarde43cc572004-11-03 11:50:29 +000040107 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40108 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040109 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040110
40111 ret_val = xmlTextWriterStartCDATA(writer);
40112 desret_int(ret_val);
40113 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040114 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040115 xmlResetLastError();
40116 if (mem_base != xmlMemBlocks()) {
40117 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
40118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040119 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040120 printf(" %d", n_writer);
40121 printf("\n");
40122 }
40123 }
40124#endif
40125
Daniel Veillard3d97e662004-11-04 10:49:00 +000040126 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040127 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040128}
40129
40130
40131static int
40132test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040133 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040134
Daniel Veillarde43cc572004-11-03 11:50:29 +000040135#ifdef LIBXML_WRITER_ENABLED
40136 int mem_base;
40137 int ret_val;
40138 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40139 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040140
Daniel Veillarde43cc572004-11-03 11:50:29 +000040141 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40142 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040143 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040144
40145 ret_val = xmlTextWriterStartComment(writer);
40146 desret_int(ret_val);
40147 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040148 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040149 xmlResetLastError();
40150 if (mem_base != xmlMemBlocks()) {
40151 printf("Leak of %d blocks found in xmlTextWriterStartComment",
40152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040153 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040154 printf(" %d", n_writer);
40155 printf("\n");
40156 }
40157 }
40158#endif
40159
Daniel Veillard3d97e662004-11-04 10:49:00 +000040160 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040161 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040162}
40163
40164
40165static int
40166test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040167 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040168
Daniel Veillarde43cc572004-11-03 11:50:29 +000040169#ifdef LIBXML_WRITER_ENABLED
40170 int mem_base;
40171 int ret_val;
40172 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40173 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040174 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040175 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040176 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040177 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040178 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040179 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040180
Daniel Veillarde43cc572004-11-03 11:50:29 +000040181 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40182 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40183 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
40184 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
40185 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040186 writer = gen_xmlTextWriterPtr(n_writer, 0);
40187 name = gen_const_xmlChar_ptr(n_name, 1);
40188 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
40189 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040190
40191 ret_val = xmlTextWriterStartDTD(writer, name, pubid, sysid);
40192 desret_int(ret_val);
40193 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040194 des_xmlTextWriterPtr(n_writer, writer, 0);
40195 des_const_xmlChar_ptr(n_name, name, 1);
40196 des_const_xmlChar_ptr(n_pubid, pubid, 2);
40197 des_const_xmlChar_ptr(n_sysid, sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040198 xmlResetLastError();
40199 if (mem_base != xmlMemBlocks()) {
40200 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
40201 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040202 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040203 printf(" %d", n_writer);
40204 printf(" %d", n_name);
40205 printf(" %d", n_pubid);
40206 printf(" %d", n_sysid);
40207 printf("\n");
40208 }
40209 }
40210 }
40211 }
40212 }
40213#endif
40214
Daniel Veillard3d97e662004-11-04 10:49:00 +000040215 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040216 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040217}
40218
40219
40220static int
40221test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040222 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040223
Daniel Veillarde43cc572004-11-03 11:50:29 +000040224#ifdef LIBXML_WRITER_ENABLED
40225 int mem_base;
40226 int ret_val;
40227 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40228 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040229 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040230 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040231
Daniel Veillarde43cc572004-11-03 11:50:29 +000040232 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40233 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40234 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040235 writer = gen_xmlTextWriterPtr(n_writer, 0);
40236 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040237
40238 ret_val = xmlTextWriterStartDTDAttlist(writer, name);
40239 desret_int(ret_val);
40240 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040241 des_xmlTextWriterPtr(n_writer, writer, 0);
40242 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040243 xmlResetLastError();
40244 if (mem_base != xmlMemBlocks()) {
40245 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
40246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040247 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040248 printf(" %d", n_writer);
40249 printf(" %d", n_name);
40250 printf("\n");
40251 }
40252 }
40253 }
40254#endif
40255
Daniel Veillard3d97e662004-11-04 10:49:00 +000040256 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040257 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040258}
40259
40260
40261static int
40262test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040264
Daniel Veillarde43cc572004-11-03 11:50:29 +000040265#ifdef LIBXML_WRITER_ENABLED
40266 int mem_base;
40267 int ret_val;
40268 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40269 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040270 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040271 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040272
Daniel Veillarde43cc572004-11-03 11:50:29 +000040273 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40274 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40275 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040276 writer = gen_xmlTextWriterPtr(n_writer, 0);
40277 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040278
40279 ret_val = xmlTextWriterStartDTDElement(writer, name);
40280 desret_int(ret_val);
40281 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040282 des_xmlTextWriterPtr(n_writer, writer, 0);
40283 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040284 xmlResetLastError();
40285 if (mem_base != xmlMemBlocks()) {
40286 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
40287 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040288 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040289 printf(" %d", n_writer);
40290 printf(" %d", n_name);
40291 printf("\n");
40292 }
40293 }
40294 }
40295#endif
40296
Daniel Veillard3d97e662004-11-04 10:49:00 +000040297 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040298 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040299}
40300
40301
40302static int
40303test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040304 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040305
Daniel Veillarde43cc572004-11-03 11:50:29 +000040306#ifdef LIBXML_WRITER_ENABLED
40307 int mem_base;
40308 int ret_val;
40309 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40310 int n_writer;
40311 int pe; /* TRUE if this is a parameter entity, FALSE if not */
40312 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040313 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040314 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040315
Daniel Veillarde43cc572004-11-03 11:50:29 +000040316 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40317 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
40318 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40319 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040320 writer = gen_xmlTextWriterPtr(n_writer, 0);
40321 pe = gen_int(n_pe, 1);
40322 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040323
40324 ret_val = xmlTextWriterStartDTDEntity(writer, pe, name);
40325 desret_int(ret_val);
40326 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040327 des_xmlTextWriterPtr(n_writer, writer, 0);
40328 des_int(n_pe, pe, 1);
40329 des_const_xmlChar_ptr(n_name, name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040330 xmlResetLastError();
40331 if (mem_base != xmlMemBlocks()) {
40332 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
40333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040334 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040335 printf(" %d", n_writer);
40336 printf(" %d", n_pe);
40337 printf(" %d", n_name);
40338 printf("\n");
40339 }
40340 }
40341 }
40342 }
40343#endif
40344
Daniel Veillard3d97e662004-11-04 10:49:00 +000040345 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040346 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040347}
40348
40349
40350static int
40351test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040352 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040353
Daniel Veillarde43cc572004-11-03 11:50:29 +000040354#ifdef LIBXML_WRITER_ENABLED
40355 int mem_base;
40356 int ret_val;
40357 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40358 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040359 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040360 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040361 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040362 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040363 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040364 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040365
Daniel Veillarde43cc572004-11-03 11:50:29 +000040366 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40367 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
40368 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
40369 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
40370 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040371 writer = gen_xmlTextWriterPtr(n_writer, 0);
40372 version = gen_const_char_ptr(n_version, 1);
40373 encoding = gen_const_char_ptr(n_encoding, 2);
40374 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040375
40376 ret_val = xmlTextWriterStartDocument(writer, version, encoding, standalone);
40377 desret_int(ret_val);
40378 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040379 des_xmlTextWriterPtr(n_writer, writer, 0);
40380 des_const_char_ptr(n_version, version, 1);
40381 des_const_char_ptr(n_encoding, encoding, 2);
40382 des_const_char_ptr(n_standalone, standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040383 xmlResetLastError();
40384 if (mem_base != xmlMemBlocks()) {
40385 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
40386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040387 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040388 printf(" %d", n_writer);
40389 printf(" %d", n_version);
40390 printf(" %d", n_encoding);
40391 printf(" %d", n_standalone);
40392 printf("\n");
40393 }
40394 }
40395 }
40396 }
40397 }
40398#endif
40399
Daniel Veillard3d97e662004-11-04 10:49:00 +000040400 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040402}
40403
40404
40405static int
40406test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040408
Daniel Veillarde43cc572004-11-03 11:50:29 +000040409#ifdef LIBXML_WRITER_ENABLED
40410 int mem_base;
40411 int ret_val;
40412 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40413 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040414 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040415 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040416
Daniel Veillarde43cc572004-11-03 11:50:29 +000040417 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40418 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40419 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040420 writer = gen_xmlTextWriterPtr(n_writer, 0);
40421 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040422
40423 ret_val = xmlTextWriterStartElement(writer, name);
40424 desret_int(ret_val);
40425 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040426 des_xmlTextWriterPtr(n_writer, writer, 0);
40427 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040428 xmlResetLastError();
40429 if (mem_base != xmlMemBlocks()) {
40430 printf("Leak of %d blocks found in xmlTextWriterStartElement",
40431 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040432 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040433 printf(" %d", n_writer);
40434 printf(" %d", n_name);
40435 printf("\n");
40436 }
40437 }
40438 }
40439#endif
40440
Daniel Veillard3d97e662004-11-04 10:49:00 +000040441 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040442 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040443}
40444
40445
40446static int
40447test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040449
Daniel Veillarde43cc572004-11-03 11:50:29 +000040450#ifdef LIBXML_WRITER_ENABLED
40451 int mem_base;
40452 int ret_val;
40453 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40454 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040455 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040456 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040457 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040458 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040459 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040460 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040461
Daniel Veillarde43cc572004-11-03 11:50:29 +000040462 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40463 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40464 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40465 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40466 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040467 writer = gen_xmlTextWriterPtr(n_writer, 0);
40468 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40469 name = gen_const_xmlChar_ptr(n_name, 2);
40470 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040471
40472 ret_val = xmlTextWriterStartElementNS(writer, prefix, name, namespaceURI);
40473 desret_int(ret_val);
40474 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040475 des_xmlTextWriterPtr(n_writer, writer, 0);
40476 des_const_xmlChar_ptr(n_prefix, prefix, 1);
40477 des_const_xmlChar_ptr(n_name, name, 2);
40478 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040479 xmlResetLastError();
40480 if (mem_base != xmlMemBlocks()) {
40481 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
40482 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040483 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040484 printf(" %d", n_writer);
40485 printf(" %d", n_prefix);
40486 printf(" %d", n_name);
40487 printf(" %d", n_namespaceURI);
40488 printf("\n");
40489 }
40490 }
40491 }
40492 }
40493 }
40494#endif
40495
Daniel Veillard3d97e662004-11-04 10:49:00 +000040496 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040498}
40499
40500
40501static int
40502test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040504
Daniel Veillarde43cc572004-11-03 11:50:29 +000040505#ifdef LIBXML_WRITER_ENABLED
40506 int mem_base;
40507 int ret_val;
40508 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40509 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040510 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040511 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040512
Daniel Veillarde43cc572004-11-03 11:50:29 +000040513 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40514 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
40515 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040516 writer = gen_xmlTextWriterPtr(n_writer, 0);
40517 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040518
40519 ret_val = xmlTextWriterStartPI(writer, target);
40520 desret_int(ret_val);
40521 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040522 des_xmlTextWriterPtr(n_writer, writer, 0);
40523 des_const_xmlChar_ptr(n_target, target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040524 xmlResetLastError();
40525 if (mem_base != xmlMemBlocks()) {
40526 printf("Leak of %d blocks found in xmlTextWriterStartPI",
40527 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040528 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040529 printf(" %d", n_writer);
40530 printf(" %d", n_target);
40531 printf("\n");
40532 }
40533 }
40534 }
40535#endif
40536
Daniel Veillard3d97e662004-11-04 10:49:00 +000040537 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040539}
40540
40541
40542static int
40543test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040545
Daniel Veillarde43cc572004-11-03 11:50:29 +000040546#ifdef LIBXML_WRITER_ENABLED
40547 int mem_base;
40548 int ret_val;
40549 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40550 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040551 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040552 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040553 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040554 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040555
Daniel Veillarde43cc572004-11-03 11:50:29 +000040556 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40557 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40558 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
40559 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040560 writer = gen_xmlTextWriterPtr(n_writer, 0);
40561 name = gen_const_xmlChar_ptr(n_name, 1);
40562 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040563
40564 ret_val = xmlTextWriterWriteAttribute(writer, name, content);
40565 desret_int(ret_val);
40566 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040567 des_xmlTextWriterPtr(n_writer, writer, 0);
40568 des_const_xmlChar_ptr(n_name, name, 1);
40569 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040570 xmlResetLastError();
40571 if (mem_base != xmlMemBlocks()) {
40572 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
40573 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040574 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040575 printf(" %d", n_writer);
40576 printf(" %d", n_name);
40577 printf(" %d", n_content);
40578 printf("\n");
40579 }
40580 }
40581 }
40582 }
40583#endif
40584
Daniel Veillard3d97e662004-11-04 10:49:00 +000040585 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040586 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040587}
40588
40589
40590static int
40591test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040593
Daniel Veillarde43cc572004-11-03 11:50:29 +000040594#ifdef LIBXML_WRITER_ENABLED
40595 int mem_base;
40596 int ret_val;
40597 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40598 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040599 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040600 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040601 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040602 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040603 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040604 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040605 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040606 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040607
Daniel Veillarde43cc572004-11-03 11:50:29 +000040608 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40609 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40610 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40611 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40612 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
40613 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040614 writer = gen_xmlTextWriterPtr(n_writer, 0);
40615 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40616 name = gen_const_xmlChar_ptr(n_name, 2);
40617 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
40618 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040619
40620 ret_val = xmlTextWriterWriteAttributeNS(writer, prefix, name, namespaceURI, content);
40621 desret_int(ret_val);
40622 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040623 des_xmlTextWriterPtr(n_writer, writer, 0);
40624 des_const_xmlChar_ptr(n_prefix, prefix, 1);
40625 des_const_xmlChar_ptr(n_name, name, 2);
40626 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
40627 des_const_xmlChar_ptr(n_content, content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040628 xmlResetLastError();
40629 if (mem_base != xmlMemBlocks()) {
40630 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
40631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040632 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040633 printf(" %d", n_writer);
40634 printf(" %d", n_prefix);
40635 printf(" %d", n_name);
40636 printf(" %d", n_namespaceURI);
40637 printf(" %d", n_content);
40638 printf("\n");
40639 }
40640 }
40641 }
40642 }
40643 }
40644 }
40645#endif
40646
Daniel Veillard3d97e662004-11-04 10:49:00 +000040647 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040649}
40650
40651
40652static int
40653test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040655
Daniel Veillarde43cc572004-11-03 11:50:29 +000040656#ifdef LIBXML_WRITER_ENABLED
40657 int mem_base;
40658 int ret_val;
40659 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40660 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040661 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040662 int n_data;
40663 int start; /* the position within the data of the first byte to encode */
40664 int n_start;
40665 int len; /* the number of bytes to encode */
40666 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040667
Daniel Veillarde43cc572004-11-03 11:50:29 +000040668 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40669 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
40670 for (n_start = 0;n_start < gen_nb_int;n_start++) {
40671 for (n_len = 0;n_len < gen_nb_int;n_len++) {
40672 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040673 writer = gen_xmlTextWriterPtr(n_writer, 0);
40674 data = gen_const_char_ptr(n_data, 1);
40675 start = gen_int(n_start, 2);
40676 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040677
40678 ret_val = xmlTextWriterWriteBase64(writer, data, start, len);
40679 desret_int(ret_val);
40680 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040681 des_xmlTextWriterPtr(n_writer, writer, 0);
40682 des_const_char_ptr(n_data, data, 1);
40683 des_int(n_start, start, 2);
40684 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040685 xmlResetLastError();
40686 if (mem_base != xmlMemBlocks()) {
40687 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
40688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040689 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040690 printf(" %d", n_writer);
40691 printf(" %d", n_data);
40692 printf(" %d", n_start);
40693 printf(" %d", n_len);
40694 printf("\n");
40695 }
40696 }
40697 }
40698 }
40699 }
40700#endif
40701
Daniel Veillard3d97e662004-11-04 10:49:00 +000040702 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040704}
40705
40706
40707static int
40708test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040710
Daniel Veillarde43cc572004-11-03 11:50:29 +000040711#ifdef LIBXML_WRITER_ENABLED
40712 int mem_base;
40713 int ret_val;
40714 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40715 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040716 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040717 int n_data;
40718 int start; /* the position within the data of the first byte to encode */
40719 int n_start;
40720 int len; /* the number of bytes to encode */
40721 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040722
Daniel Veillarde43cc572004-11-03 11:50:29 +000040723 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40724 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
40725 for (n_start = 0;n_start < gen_nb_int;n_start++) {
40726 for (n_len = 0;n_len < gen_nb_int;n_len++) {
40727 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040728 writer = gen_xmlTextWriterPtr(n_writer, 0);
40729 data = gen_const_char_ptr(n_data, 1);
40730 start = gen_int(n_start, 2);
40731 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040732
40733 ret_val = xmlTextWriterWriteBinHex(writer, data, start, len);
40734 desret_int(ret_val);
40735 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040736 des_xmlTextWriterPtr(n_writer, writer, 0);
40737 des_const_char_ptr(n_data, data, 1);
40738 des_int(n_start, start, 2);
40739 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040740 xmlResetLastError();
40741 if (mem_base != xmlMemBlocks()) {
40742 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
40743 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040744 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040745 printf(" %d", n_writer);
40746 printf(" %d", n_data);
40747 printf(" %d", n_start);
40748 printf(" %d", n_len);
40749 printf("\n");
40750 }
40751 }
40752 }
40753 }
40754 }
40755#endif
40756
Daniel Veillard3d97e662004-11-04 10:49:00 +000040757 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040759}
40760
40761
40762static int
40763test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040765
Daniel Veillarde43cc572004-11-03 11:50:29 +000040766#ifdef LIBXML_WRITER_ENABLED
40767 int mem_base;
40768 int ret_val;
40769 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40770 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040771 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040772 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040773
Daniel Veillarde43cc572004-11-03 11:50:29 +000040774 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40775 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
40776 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040777 writer = gen_xmlTextWriterPtr(n_writer, 0);
40778 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040779
40780 ret_val = xmlTextWriterWriteCDATA(writer, content);
40781 desret_int(ret_val);
40782 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040783 des_xmlTextWriterPtr(n_writer, writer, 0);
40784 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040785 xmlResetLastError();
40786 if (mem_base != xmlMemBlocks()) {
40787 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
40788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040789 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040790 printf(" %d", n_writer);
40791 printf(" %d", n_content);
40792 printf("\n");
40793 }
40794 }
40795 }
40796#endif
40797
Daniel Veillard3d97e662004-11-04 10:49:00 +000040798 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040800}
40801
40802
40803static int
40804test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040806
Daniel Veillarde43cc572004-11-03 11:50:29 +000040807#ifdef LIBXML_WRITER_ENABLED
40808 int mem_base;
40809 int ret_val;
40810 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40811 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040812 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040813 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040814
Daniel Veillarde43cc572004-11-03 11:50:29 +000040815 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40816 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
40817 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040818 writer = gen_xmlTextWriterPtr(n_writer, 0);
40819 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040820
40821 ret_val = xmlTextWriterWriteComment(writer, content);
40822 desret_int(ret_val);
40823 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040824 des_xmlTextWriterPtr(n_writer, writer, 0);
40825 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040826 xmlResetLastError();
40827 if (mem_base != xmlMemBlocks()) {
40828 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
40829 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040830 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040831 printf(" %d", n_writer);
40832 printf(" %d", n_content);
40833 printf("\n");
40834 }
40835 }
40836 }
40837#endif
40838
Daniel Veillard3d97e662004-11-04 10:49:00 +000040839 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040840 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040841}
40842
40843
40844static int
40845test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040846 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040847
Daniel Veillarde43cc572004-11-03 11:50:29 +000040848#ifdef LIBXML_WRITER_ENABLED
40849 int mem_base;
40850 int ret_val;
40851 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40852 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040853 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040854 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040855 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040856 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040857 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040858 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040859 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040860 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040861
Daniel Veillarde43cc572004-11-03 11:50:29 +000040862 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40863 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40864 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
40865 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
40866 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
40867 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040868 writer = gen_xmlTextWriterPtr(n_writer, 0);
40869 name = gen_const_xmlChar_ptr(n_name, 1);
40870 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
40871 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
40872 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040873
40874 ret_val = xmlTextWriterWriteDTD(writer, name, pubid, sysid, subset);
40875 desret_int(ret_val);
40876 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040877 des_xmlTextWriterPtr(n_writer, writer, 0);
40878 des_const_xmlChar_ptr(n_name, name, 1);
40879 des_const_xmlChar_ptr(n_pubid, pubid, 2);
40880 des_const_xmlChar_ptr(n_sysid, sysid, 3);
40881 des_const_xmlChar_ptr(n_subset, subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040882 xmlResetLastError();
40883 if (mem_base != xmlMemBlocks()) {
40884 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
40885 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040886 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040887 printf(" %d", n_writer);
40888 printf(" %d", n_name);
40889 printf(" %d", n_pubid);
40890 printf(" %d", n_sysid);
40891 printf(" %d", n_subset);
40892 printf("\n");
40893 }
40894 }
40895 }
40896 }
40897 }
40898 }
40899#endif
40900
Daniel Veillard3d97e662004-11-04 10:49:00 +000040901 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040902 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040903}
40904
40905
40906static int
40907test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040908 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040909
Daniel Veillarde43cc572004-11-03 11:50:29 +000040910#ifdef LIBXML_WRITER_ENABLED
40911 int mem_base;
40912 int ret_val;
40913 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40914 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040915 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040916 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040917 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040918 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040919
Daniel Veillarde43cc572004-11-03 11:50:29 +000040920 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40921 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40922 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
40923 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040924 writer = gen_xmlTextWriterPtr(n_writer, 0);
40925 name = gen_const_xmlChar_ptr(n_name, 1);
40926 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040927
40928 ret_val = xmlTextWriterWriteDTDAttlist(writer, name, content);
40929 desret_int(ret_val);
40930 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040931 des_xmlTextWriterPtr(n_writer, writer, 0);
40932 des_const_xmlChar_ptr(n_name, name, 1);
40933 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040934 xmlResetLastError();
40935 if (mem_base != xmlMemBlocks()) {
40936 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
40937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040938 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040939 printf(" %d", n_writer);
40940 printf(" %d", n_name);
40941 printf(" %d", n_content);
40942 printf("\n");
40943 }
40944 }
40945 }
40946 }
40947#endif
40948
Daniel Veillard3d97e662004-11-04 10:49:00 +000040949 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040951}
40952
40953
40954static int
40955test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040957
Daniel Veillarde43cc572004-11-03 11:50:29 +000040958#ifdef LIBXML_WRITER_ENABLED
40959 int mem_base;
40960 int ret_val;
40961 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40962 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040963 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040964 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040965 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040966 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040967
Daniel Veillarde43cc572004-11-03 11:50:29 +000040968 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40969 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40970 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
40971 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040972 writer = gen_xmlTextWriterPtr(n_writer, 0);
40973 name = gen_const_xmlChar_ptr(n_name, 1);
40974 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040975
40976 ret_val = xmlTextWriterWriteDTDElement(writer, name, content);
40977 desret_int(ret_val);
40978 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040979 des_xmlTextWriterPtr(n_writer, writer, 0);
40980 des_const_xmlChar_ptr(n_name, name, 1);
40981 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040982 xmlResetLastError();
40983 if (mem_base != xmlMemBlocks()) {
40984 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
40985 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040986 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040987 printf(" %d", n_writer);
40988 printf(" %d", n_name);
40989 printf(" %d", n_content);
40990 printf("\n");
40991 }
40992 }
40993 }
40994 }
40995#endif
40996
Daniel Veillard3d97e662004-11-04 10:49:00 +000040997 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040999}
41000
41001
41002static int
41003test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041005
Daniel Veillarde43cc572004-11-03 11:50:29 +000041006#ifdef LIBXML_WRITER_ENABLED
41007 int mem_base;
41008 int ret_val;
41009 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41010 int n_writer;
41011 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41012 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041013 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041014 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041015 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041016 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041017 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041018 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041019 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041020 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041021 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041022 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041023
Daniel Veillarde43cc572004-11-03 11:50:29 +000041024 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41025 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41026 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41027 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41028 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41029 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41030 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41031 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041032 writer = gen_xmlTextWriterPtr(n_writer, 0);
41033 pe = gen_int(n_pe, 1);
41034 name = gen_const_xmlChar_ptr(n_name, 2);
41035 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41036 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41037 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
41038 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041039
41040 ret_val = xmlTextWriterWriteDTDEntity(writer, pe, name, pubid, sysid, ndataid, content);
41041 desret_int(ret_val);
41042 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041043 des_xmlTextWriterPtr(n_writer, writer, 0);
41044 des_int(n_pe, pe, 1);
41045 des_const_xmlChar_ptr(n_name, name, 2);
41046 des_const_xmlChar_ptr(n_pubid, pubid, 3);
41047 des_const_xmlChar_ptr(n_sysid, sysid, 4);
41048 des_const_xmlChar_ptr(n_ndataid, ndataid, 5);
41049 des_const_xmlChar_ptr(n_content, content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041050 xmlResetLastError();
41051 if (mem_base != xmlMemBlocks()) {
41052 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
41053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041054 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041055 printf(" %d", n_writer);
41056 printf(" %d", n_pe);
41057 printf(" %d", n_name);
41058 printf(" %d", n_pubid);
41059 printf(" %d", n_sysid);
41060 printf(" %d", n_ndataid);
41061 printf(" %d", n_content);
41062 printf("\n");
41063 }
41064 }
41065 }
41066 }
41067 }
41068 }
41069 }
41070 }
41071#endif
41072
Daniel Veillard3d97e662004-11-04 10:49:00 +000041073 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041074 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041075}
41076
41077
41078static int
41079test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041080 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041081
Daniel Veillarde43cc572004-11-03 11:50:29 +000041082#ifdef LIBXML_WRITER_ENABLED
41083 int mem_base;
41084 int ret_val;
41085 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41086 int n_writer;
41087 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41088 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041089 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041090 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041091 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041092 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041093 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041094 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041095 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041096 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041097
Daniel Veillarde43cc572004-11-03 11:50:29 +000041098 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41099 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41100 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41101 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41102 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41103 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41104 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041105 writer = gen_xmlTextWriterPtr(n_writer, 0);
41106 pe = gen_int(n_pe, 1);
41107 name = gen_const_xmlChar_ptr(n_name, 2);
41108 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41109 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41110 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041111
41112 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, name, pubid, sysid, ndataid);
41113 desret_int(ret_val);
41114 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041115 des_xmlTextWriterPtr(n_writer, writer, 0);
41116 des_int(n_pe, pe, 1);
41117 des_const_xmlChar_ptr(n_name, name, 2);
41118 des_const_xmlChar_ptr(n_pubid, pubid, 3);
41119 des_const_xmlChar_ptr(n_sysid, sysid, 4);
41120 des_const_xmlChar_ptr(n_ndataid, ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041121 xmlResetLastError();
41122 if (mem_base != xmlMemBlocks()) {
41123 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
41124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041125 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041126 printf(" %d", n_writer);
41127 printf(" %d", n_pe);
41128 printf(" %d", n_name);
41129 printf(" %d", n_pubid);
41130 printf(" %d", n_sysid);
41131 printf(" %d", n_ndataid);
41132 printf("\n");
41133 }
41134 }
41135 }
41136 }
41137 }
41138 }
41139 }
41140#endif
41141
Daniel Veillard3d97e662004-11-04 10:49:00 +000041142 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041143 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041144}
41145
41146
41147static int
41148test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041149 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041150
Daniel Veillarde43cc572004-11-03 11:50:29 +000041151#ifdef LIBXML_WRITER_ENABLED
41152 int mem_base;
41153 int ret_val;
41154 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41155 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041156 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041157 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041158 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041159 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041160 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041161 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041162
Daniel Veillarde43cc572004-11-03 11:50:29 +000041163 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41164 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41165 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41166 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41167 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041168 writer = gen_xmlTextWriterPtr(n_writer, 0);
41169 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
41170 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
41171 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041172
41173 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, pubid, sysid, ndataid);
41174 desret_int(ret_val);
41175 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041176 des_xmlTextWriterPtr(n_writer, writer, 0);
41177 des_const_xmlChar_ptr(n_pubid, pubid, 1);
41178 des_const_xmlChar_ptr(n_sysid, sysid, 2);
41179 des_const_xmlChar_ptr(n_ndataid, ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041180 xmlResetLastError();
41181 if (mem_base != xmlMemBlocks()) {
41182 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
41183 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041184 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041185 printf(" %d", n_writer);
41186 printf(" %d", n_pubid);
41187 printf(" %d", n_sysid);
41188 printf(" %d", n_ndataid);
41189 printf("\n");
41190 }
41191 }
41192 }
41193 }
41194 }
41195#endif
41196
Daniel Veillard3d97e662004-11-04 10:49:00 +000041197 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041199}
41200
41201
41202static int
41203test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041205
Daniel Veillarde43cc572004-11-03 11:50:29 +000041206#ifdef LIBXML_WRITER_ENABLED
41207 int mem_base;
41208 int ret_val;
41209 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41210 int n_writer;
41211 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41212 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041213 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041214 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041215 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041216 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041217
Daniel Veillarde43cc572004-11-03 11:50:29 +000041218 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41219 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41220 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41221 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41222 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041223 writer = gen_xmlTextWriterPtr(n_writer, 0);
41224 pe = gen_int(n_pe, 1);
41225 name = gen_const_xmlChar_ptr(n_name, 2);
41226 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041227
41228 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, name, content);
41229 desret_int(ret_val);
41230 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041231 des_xmlTextWriterPtr(n_writer, writer, 0);
41232 des_int(n_pe, pe, 1);
41233 des_const_xmlChar_ptr(n_name, name, 2);
41234 des_const_xmlChar_ptr(n_content, content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041235 xmlResetLastError();
41236 if (mem_base != xmlMemBlocks()) {
41237 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
41238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041239 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041240 printf(" %d", n_writer);
41241 printf(" %d", n_pe);
41242 printf(" %d", n_name);
41243 printf(" %d", n_content);
41244 printf("\n");
41245 }
41246 }
41247 }
41248 }
41249 }
41250#endif
41251
Daniel Veillard3d97e662004-11-04 10:49:00 +000041252 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041253 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041254}
41255
41256
41257static int
41258test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041259 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041260
Daniel Veillarde43cc572004-11-03 11:50:29 +000041261#ifdef LIBXML_WRITER_ENABLED
41262 int mem_base;
41263 int ret_val;
41264 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41265 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041266 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041267 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041268 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041269 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041270 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041271 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041272
Daniel Veillarde43cc572004-11-03 11:50:29 +000041273 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41274 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41275 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41276 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41277 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041278 writer = gen_xmlTextWriterPtr(n_writer, 0);
41279 name = gen_const_xmlChar_ptr(n_name, 1);
41280 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41281 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041282
41283 ret_val = xmlTextWriterWriteDTDNotation(writer, name, pubid, sysid);
41284 desret_int(ret_val);
41285 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041286 des_xmlTextWriterPtr(n_writer, writer, 0);
41287 des_const_xmlChar_ptr(n_name, name, 1);
41288 des_const_xmlChar_ptr(n_pubid, pubid, 2);
41289 des_const_xmlChar_ptr(n_sysid, sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041290 xmlResetLastError();
41291 if (mem_base != xmlMemBlocks()) {
41292 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
41293 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041294 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041295 printf(" %d", n_writer);
41296 printf(" %d", n_name);
41297 printf(" %d", n_pubid);
41298 printf(" %d", n_sysid);
41299 printf("\n");
41300 }
41301 }
41302 }
41303 }
41304 }
41305#endif
41306
Daniel Veillard3d97e662004-11-04 10:49:00 +000041307 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041309}
41310
41311
41312static int
41313test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041315
Daniel Veillarde43cc572004-11-03 11:50:29 +000041316#ifdef LIBXML_WRITER_ENABLED
41317 int mem_base;
41318 int ret_val;
41319 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41320 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041321 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041322 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041323 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041324 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041325
Daniel Veillarde43cc572004-11-03 11:50:29 +000041326 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41327 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41328 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41329 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041330 writer = gen_xmlTextWriterPtr(n_writer, 0);
41331 name = gen_const_xmlChar_ptr(n_name, 1);
41332 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041333
41334 ret_val = xmlTextWriterWriteElement(writer, name, content);
41335 desret_int(ret_val);
41336 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041337 des_xmlTextWriterPtr(n_writer, writer, 0);
41338 des_const_xmlChar_ptr(n_name, name, 1);
41339 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041340 xmlResetLastError();
41341 if (mem_base != xmlMemBlocks()) {
41342 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
41343 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041344 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041345 printf(" %d", n_writer);
41346 printf(" %d", n_name);
41347 printf(" %d", n_content);
41348 printf("\n");
41349 }
41350 }
41351 }
41352 }
41353#endif
41354
Daniel Veillard3d97e662004-11-04 10:49:00 +000041355 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041356 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041357}
41358
41359
41360static int
41361test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041362 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041363
Daniel Veillarde43cc572004-11-03 11:50:29 +000041364#ifdef LIBXML_WRITER_ENABLED
41365 int mem_base;
41366 int ret_val;
41367 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41368 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041369 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041370 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041371 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041372 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041373 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041374 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041375 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041376 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041377
Daniel Veillarde43cc572004-11-03 11:50:29 +000041378 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41379 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41380 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41381 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41382 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41383 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041384 writer = gen_xmlTextWriterPtr(n_writer, 0);
41385 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41386 name = gen_const_xmlChar_ptr(n_name, 2);
41387 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41388 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041389
41390 ret_val = xmlTextWriterWriteElementNS(writer, prefix, name, namespaceURI, content);
41391 desret_int(ret_val);
41392 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041393 des_xmlTextWriterPtr(n_writer, writer, 0);
41394 des_const_xmlChar_ptr(n_prefix, prefix, 1);
41395 des_const_xmlChar_ptr(n_name, name, 2);
41396 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
41397 des_const_xmlChar_ptr(n_content, content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041398 xmlResetLastError();
41399 if (mem_base != xmlMemBlocks()) {
41400 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
41401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041402 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041403 printf(" %d", n_writer);
41404 printf(" %d", n_prefix);
41405 printf(" %d", n_name);
41406 printf(" %d", n_namespaceURI);
41407 printf(" %d", n_content);
41408 printf("\n");
41409 }
41410 }
41411 }
41412 }
41413 }
41414 }
41415#endif
41416
Daniel Veillard3d97e662004-11-04 10:49:00 +000041417 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041418 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041419}
41420
41421
41422static int
41423test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041424 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041425
41426
41427 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041429}
41430
41431
41432static int
41433test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041435
41436
41437 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041438 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041439}
41440
41441
41442static int
41443test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041444 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041445
41446
41447 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041449}
41450
41451
41452static int
41453test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041454 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041455
41456
41457 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041458 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041459}
41460
41461
41462static int
41463test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041464 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041465
41466
41467 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041469}
41470
41471
41472static int
41473test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041474 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041475
41476
41477 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041478 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041479}
41480
41481
41482static int
41483test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041484 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041485
41486
41487 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041489}
41490
41491
41492static int
41493test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041495
41496
41497 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041498 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041499}
41500
41501
41502static int
41503test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041504 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041505
41506
41507 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041508 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041509}
41510
41511
41512static int
41513test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041515
41516
41517 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041518 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041519}
41520
41521
41522static int
41523test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041524 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041525
41526
41527 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041529}
41530
41531
41532static int
41533test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041535
41536
41537 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041539}
41540
41541
41542static int
41543test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041545
41546
41547 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041549}
41550
41551
41552static int
41553test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041555
Daniel Veillarde43cc572004-11-03 11:50:29 +000041556#ifdef LIBXML_WRITER_ENABLED
41557 int mem_base;
41558 int ret_val;
41559 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41560 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041561 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041562 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041563 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041564 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041565
Daniel Veillarde43cc572004-11-03 11:50:29 +000041566 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41567 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41568 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41569 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041570 writer = gen_xmlTextWriterPtr(n_writer, 0);
41571 target = gen_const_xmlChar_ptr(n_target, 1);
41572 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041573
41574 ret_val = xmlTextWriterWritePI(writer, target, content);
41575 desret_int(ret_val);
41576 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041577 des_xmlTextWriterPtr(n_writer, writer, 0);
41578 des_const_xmlChar_ptr(n_target, target, 1);
41579 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041580 xmlResetLastError();
41581 if (mem_base != xmlMemBlocks()) {
41582 printf("Leak of %d blocks found in xmlTextWriterWritePI",
41583 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041584 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041585 printf(" %d", n_writer);
41586 printf(" %d", n_target);
41587 printf(" %d", n_content);
41588 printf("\n");
41589 }
41590 }
41591 }
41592 }
41593#endif
41594
Daniel Veillard3d97e662004-11-04 10:49:00 +000041595 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041597}
41598
41599
41600static int
41601test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041603
Daniel Veillarde43cc572004-11-03 11:50:29 +000041604#ifdef LIBXML_WRITER_ENABLED
41605 int mem_base;
41606 int ret_val;
41607 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41608 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041609 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041610 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041611
Daniel Veillarde43cc572004-11-03 11:50:29 +000041612 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41613 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41614 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041615 writer = gen_xmlTextWriterPtr(n_writer, 0);
41616 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041617
41618 ret_val = xmlTextWriterWriteRaw(writer, content);
41619 desret_int(ret_val);
41620 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041621 des_xmlTextWriterPtr(n_writer, writer, 0);
41622 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041623 xmlResetLastError();
41624 if (mem_base != xmlMemBlocks()) {
41625 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
41626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041627 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041628 printf(" %d", n_writer);
41629 printf(" %d", n_content);
41630 printf("\n");
41631 }
41632 }
41633 }
41634#endif
41635
Daniel Veillard3d97e662004-11-04 10:49:00 +000041636 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041637 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041638}
41639
41640
41641static int
41642test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041643 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041644
Daniel Veillarde43cc572004-11-03 11:50:29 +000041645#ifdef LIBXML_WRITER_ENABLED
41646 int mem_base;
41647 int ret_val;
41648 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41649 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041650 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041651 int n_content;
41652 int len; /* length of the text string */
41653 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041654
Daniel Veillarde43cc572004-11-03 11:50:29 +000041655 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41656 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41657 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41658 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041659 writer = gen_xmlTextWriterPtr(n_writer, 0);
41660 content = gen_const_xmlChar_ptr(n_content, 1);
41661 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041662
41663 ret_val = xmlTextWriterWriteRawLen(writer, content, len);
41664 desret_int(ret_val);
41665 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041666 des_xmlTextWriterPtr(n_writer, writer, 0);
41667 des_const_xmlChar_ptr(n_content, content, 1);
41668 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041669 xmlResetLastError();
41670 if (mem_base != xmlMemBlocks()) {
41671 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
41672 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041673 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041674 printf(" %d", n_writer);
41675 printf(" %d", n_content);
41676 printf(" %d", n_len);
41677 printf("\n");
41678 }
41679 }
41680 }
41681 }
41682#endif
41683
Daniel Veillard3d97e662004-11-04 10:49:00 +000041684 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041686}
41687
41688
41689static int
41690test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041692
Daniel Veillarde43cc572004-11-03 11:50:29 +000041693#ifdef LIBXML_WRITER_ENABLED
41694 int mem_base;
41695 int ret_val;
41696 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41697 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041698 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041699 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041700
Daniel Veillarde43cc572004-11-03 11:50:29 +000041701 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41702 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41703 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041704 writer = gen_xmlTextWriterPtr(n_writer, 0);
41705 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041706
41707 ret_val = xmlTextWriterWriteString(writer, content);
41708 desret_int(ret_val);
41709 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041710 des_xmlTextWriterPtr(n_writer, writer, 0);
41711 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041712 xmlResetLastError();
41713 if (mem_base != xmlMemBlocks()) {
41714 printf("Leak of %d blocks found in xmlTextWriterWriteString",
41715 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041716 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041717 printf(" %d", n_writer);
41718 printf(" %d", n_content);
41719 printf("\n");
41720 }
41721 }
41722 }
41723#endif
41724
Daniel Veillard3d97e662004-11-04 10:49:00 +000041725 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041727}
41728
41729
41730static int
41731test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041732 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041733
41734
41735 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041736 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041737}
41738
41739
41740static int
41741test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041742 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041743
41744
41745 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041746 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041747}
41748
41749
41750static int
41751test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041752 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041753
41754
41755 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041756 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041757}
41758
41759
41760static int
41761test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041762 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041763
41764
41765 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041766 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041767}
41768
41769
41770static int
41771test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041772 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041773
41774
41775 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041776 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041777}
41778
41779
41780static int
41781test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041782 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041783
41784
41785 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041786 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041787}
41788
41789
41790static int
41791test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041792 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041793
41794
41795 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041797}
41798
41799
41800static int
41801test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041803
41804
41805 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041806 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041807}
41808
41809
41810static int
41811test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041812 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041813
41814
41815 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041817}
41818
41819
41820static int
41821test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041822 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041823
41824
41825 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041826 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041827}
41828
41829
41830static int
41831test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041832 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041833
41834
41835 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041837}
41838
41839
41840static int
41841test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041843
41844
41845 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041846 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041847}
41848
41849
41850static int
41851test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041852 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041853
41854
41855 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041857}
41858
41859static int
41860test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041861 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041862
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000041863 printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000041864 test_ret += test_xmlNewTextWriter();
41865 test_ret += test_xmlNewTextWriterFilename();
41866 test_ret += test_xmlNewTextWriterMemory();
41867 test_ret += test_xmlNewTextWriterPushParser();
41868 test_ret += test_xmlNewTextWriterTree();
41869 test_ret += test_xmlTextWriterEndAttribute();
41870 test_ret += test_xmlTextWriterEndCDATA();
41871 test_ret += test_xmlTextWriterEndComment();
41872 test_ret += test_xmlTextWriterEndDTD();
41873 test_ret += test_xmlTextWriterEndDTDAttlist();
41874 test_ret += test_xmlTextWriterEndDTDElement();
41875 test_ret += test_xmlTextWriterEndDTDEntity();
41876 test_ret += test_xmlTextWriterEndDocument();
41877 test_ret += test_xmlTextWriterEndElement();
41878 test_ret += test_xmlTextWriterEndPI();
41879 test_ret += test_xmlTextWriterFlush();
41880 test_ret += test_xmlTextWriterFullEndElement();
41881 test_ret += test_xmlTextWriterSetIndent();
41882 test_ret += test_xmlTextWriterSetIndentString();
41883 test_ret += test_xmlTextWriterStartAttribute();
41884 test_ret += test_xmlTextWriterStartAttributeNS();
41885 test_ret += test_xmlTextWriterStartCDATA();
41886 test_ret += test_xmlTextWriterStartComment();
41887 test_ret += test_xmlTextWriterStartDTD();
41888 test_ret += test_xmlTextWriterStartDTDAttlist();
41889 test_ret += test_xmlTextWriterStartDTDElement();
41890 test_ret += test_xmlTextWriterStartDTDEntity();
41891 test_ret += test_xmlTextWriterStartDocument();
41892 test_ret += test_xmlTextWriterStartElement();
41893 test_ret += test_xmlTextWriterStartElementNS();
41894 test_ret += test_xmlTextWriterStartPI();
41895 test_ret += test_xmlTextWriterWriteAttribute();
41896 test_ret += test_xmlTextWriterWriteAttributeNS();
41897 test_ret += test_xmlTextWriterWriteBase64();
41898 test_ret += test_xmlTextWriterWriteBinHex();
41899 test_ret += test_xmlTextWriterWriteCDATA();
41900 test_ret += test_xmlTextWriterWriteComment();
41901 test_ret += test_xmlTextWriterWriteDTD();
41902 test_ret += test_xmlTextWriterWriteDTDAttlist();
41903 test_ret += test_xmlTextWriterWriteDTDElement();
41904 test_ret += test_xmlTextWriterWriteDTDEntity();
41905 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
41906 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
41907 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
41908 test_ret += test_xmlTextWriterWriteDTDNotation();
41909 test_ret += test_xmlTextWriterWriteElement();
41910 test_ret += test_xmlTextWriterWriteElementNS();
41911 test_ret += test_xmlTextWriterWriteFormatAttribute();
41912 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
41913 test_ret += test_xmlTextWriterWriteFormatCDATA();
41914 test_ret += test_xmlTextWriterWriteFormatComment();
41915 test_ret += test_xmlTextWriterWriteFormatDTD();
41916 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
41917 test_ret += test_xmlTextWriterWriteFormatDTDElement();
41918 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
41919 test_ret += test_xmlTextWriterWriteFormatElement();
41920 test_ret += test_xmlTextWriterWriteFormatElementNS();
41921 test_ret += test_xmlTextWriterWriteFormatPI();
41922 test_ret += test_xmlTextWriterWriteFormatRaw();
41923 test_ret += test_xmlTextWriterWriteFormatString();
41924 test_ret += test_xmlTextWriterWritePI();
41925 test_ret += test_xmlTextWriterWriteRaw();
41926 test_ret += test_xmlTextWriterWriteRawLen();
41927 test_ret += test_xmlTextWriterWriteString();
41928 test_ret += test_xmlTextWriterWriteVFormatAttribute();
41929 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
41930 test_ret += test_xmlTextWriterWriteVFormatCDATA();
41931 test_ret += test_xmlTextWriterWriteVFormatComment();
41932 test_ret += test_xmlTextWriterWriteVFormatDTD();
41933 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
41934 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
41935 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
41936 test_ret += test_xmlTextWriterWriteVFormatElement();
41937 test_ret += test_xmlTextWriterWriteVFormatElementNS();
41938 test_ret += test_xmlTextWriterWriteVFormatPI();
41939 test_ret += test_xmlTextWriterWriteVFormatRaw();
41940 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000041941
Daniel Veillard42595322004-11-08 10:52:06 +000041942 if (test_ret != 0)
41943 printf("Module xmlwriter: %d errors\n", test_ret);
41944 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041945}
41946
41947static int
41948test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041950
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000041951#ifdef LIBXML_XPATH_ENABLED
41952 int mem_base;
41953 double ret_val;
41954 int val; /* a boolean */
41955 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041956
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000041957 for (n_val = 0;n_val < gen_nb_int;n_val++) {
41958 mem_base = xmlMemBlocks();
41959 val = gen_int(n_val, 0);
41960
41961 ret_val = xmlXPathCastBooleanToNumber(val);
41962 desret_double(ret_val);
41963 call_tests++;
41964 des_int(n_val, val, 0);
41965 xmlResetLastError();
41966 if (mem_base != xmlMemBlocks()) {
41967 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
41968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041969 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000041970 printf(" %d", n_val);
41971 printf("\n");
41972 }
41973 }
41974#endif
41975
41976 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041978}
41979
41980
41981static int
41982test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041984
Daniel Veillard8a32fe42004-11-02 22:10:16 +000041985#ifdef LIBXML_XPATH_ENABLED
41986 int mem_base;
41987 xmlChar * ret_val;
41988 int val; /* a boolean */
41989 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041990
Daniel Veillard8a32fe42004-11-02 22:10:16 +000041991 for (n_val = 0;n_val < gen_nb_int;n_val++) {
41992 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041993 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000041994
41995 ret_val = xmlXPathCastBooleanToString(val);
41996 desret_xmlChar_ptr(ret_val);
41997 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041998 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000041999 xmlResetLastError();
42000 if (mem_base != xmlMemBlocks()) {
42001 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
42002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042003 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042004 printf(" %d", n_val);
42005 printf("\n");
42006 }
42007 }
42008#endif
42009
Daniel Veillard3d97e662004-11-04 10:49:00 +000042010 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042011 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042012}
42013
42014
42015static int
42016test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042018
Daniel Veillardce682bc2004-11-05 17:22:25 +000042019#ifdef LIBXML_XPATH_ENABLED
42020 int mem_base;
42021 int ret_val;
42022 xmlNodeSetPtr ns; /* a node-set */
42023 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042024
Daniel Veillardce682bc2004-11-05 17:22:25 +000042025 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42026 mem_base = xmlMemBlocks();
42027 ns = gen_xmlNodeSetPtr(n_ns, 0);
42028
42029 ret_val = xmlXPathCastNodeSetToBoolean(ns);
42030 desret_int(ret_val);
42031 call_tests++;
42032 des_xmlNodeSetPtr(n_ns, ns, 0);
42033 xmlResetLastError();
42034 if (mem_base != xmlMemBlocks()) {
42035 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
42036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042037 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042038 printf(" %d", n_ns);
42039 printf("\n");
42040 }
42041 }
42042#endif
42043
42044 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042046}
42047
42048
42049static int
42050test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042052
Daniel Veillardce682bc2004-11-05 17:22:25 +000042053#ifdef LIBXML_XPATH_ENABLED
42054 int mem_base;
42055 double ret_val;
42056 xmlNodeSetPtr ns; /* a node-set */
42057 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042058
Daniel Veillardce682bc2004-11-05 17:22:25 +000042059 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42060 mem_base = xmlMemBlocks();
42061 ns = gen_xmlNodeSetPtr(n_ns, 0);
42062
42063 ret_val = xmlXPathCastNodeSetToNumber(ns);
42064 desret_double(ret_val);
42065 call_tests++;
42066 des_xmlNodeSetPtr(n_ns, ns, 0);
42067 xmlResetLastError();
42068 if (mem_base != xmlMemBlocks()) {
42069 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
42070 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042071 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042072 printf(" %d", n_ns);
42073 printf("\n");
42074 }
42075 }
42076#endif
42077
42078 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042080}
42081
42082
42083static int
42084test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042086
Daniel Veillardce682bc2004-11-05 17:22:25 +000042087#ifdef LIBXML_XPATH_ENABLED
42088 int mem_base;
42089 xmlChar * ret_val;
42090 xmlNodeSetPtr ns; /* a node-set */
42091 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042092
Daniel Veillardce682bc2004-11-05 17:22:25 +000042093 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42094 mem_base = xmlMemBlocks();
42095 ns = gen_xmlNodeSetPtr(n_ns, 0);
42096
42097 ret_val = xmlXPathCastNodeSetToString(ns);
42098 desret_xmlChar_ptr(ret_val);
42099 call_tests++;
42100 des_xmlNodeSetPtr(n_ns, ns, 0);
42101 xmlResetLastError();
42102 if (mem_base != xmlMemBlocks()) {
42103 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
42104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042105 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042106 printf(" %d", n_ns);
42107 printf("\n");
42108 }
42109 }
42110#endif
42111
42112 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042114}
42115
42116
42117static int
42118test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042120
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042121#ifdef LIBXML_XPATH_ENABLED
42122 int mem_base;
42123 double ret_val;
42124 xmlNodePtr node; /* a node */
42125 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042126
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042127 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42128 mem_base = xmlMemBlocks();
42129 node = gen_xmlNodePtr(n_node, 0);
42130
42131 ret_val = xmlXPathCastNodeToNumber(node);
42132 desret_double(ret_val);
42133 call_tests++;
42134 des_xmlNodePtr(n_node, node, 0);
42135 xmlResetLastError();
42136 if (mem_base != xmlMemBlocks()) {
42137 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
42138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042139 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042140 printf(" %d", n_node);
42141 printf("\n");
42142 }
42143 }
42144#endif
42145
42146 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042148}
42149
42150
42151static int
42152test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042154
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042155#ifdef LIBXML_XPATH_ENABLED
42156 int mem_base;
42157 xmlChar * ret_val;
42158 xmlNodePtr node; /* a node */
42159 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042160
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042161 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42162 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042163 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042164
42165 ret_val = xmlXPathCastNodeToString(node);
42166 desret_xmlChar_ptr(ret_val);
42167 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042168 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042169 xmlResetLastError();
42170 if (mem_base != xmlMemBlocks()) {
42171 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
42172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042173 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042174 printf(" %d", n_node);
42175 printf("\n");
42176 }
42177 }
42178#endif
42179
Daniel Veillard3d97e662004-11-04 10:49:00 +000042180 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042182}
42183
42184
42185static int
42186test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042188
Daniel Veillard3d95c732004-11-06 22:25:14 +000042189#ifdef LIBXML_XPATH_ENABLED
42190 int mem_base;
42191 int ret_val;
42192 double val; /* a number */
42193 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042194
Daniel Veillard3d95c732004-11-06 22:25:14 +000042195 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42196 mem_base = xmlMemBlocks();
42197 val = gen_double(n_val, 0);
42198
42199 ret_val = xmlXPathCastNumberToBoolean(val);
42200 desret_int(ret_val);
42201 call_tests++;
42202 des_double(n_val, val, 0);
42203 xmlResetLastError();
42204 if (mem_base != xmlMemBlocks()) {
42205 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
42206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042207 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042208 printf(" %d", n_val);
42209 printf("\n");
42210 }
42211 }
42212#endif
42213
42214 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042216}
42217
42218
42219static int
42220test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042222
Daniel Veillard3d95c732004-11-06 22:25:14 +000042223#ifdef LIBXML_XPATH_ENABLED
42224 int mem_base;
42225 xmlChar * ret_val;
42226 double val; /* a number */
42227 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042228
Daniel Veillard3d95c732004-11-06 22:25:14 +000042229 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42230 mem_base = xmlMemBlocks();
42231 val = gen_double(n_val, 0);
42232
42233 ret_val = xmlXPathCastNumberToString(val);
42234 desret_xmlChar_ptr(ret_val);
42235 call_tests++;
42236 des_double(n_val, val, 0);
42237 xmlResetLastError();
42238 if (mem_base != xmlMemBlocks()) {
42239 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
42240 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042241 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042242 printf(" %d", n_val);
42243 printf("\n");
42244 }
42245 }
42246#endif
42247
42248 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042249 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042250}
42251
42252
42253static int
42254test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042256
42257#ifdef LIBXML_XPATH_ENABLED
42258 int mem_base;
42259 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042260 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000042261 int n_val;
42262
42263 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42264 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042265 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042266
42267 ret_val = xmlXPathCastStringToBoolean(val);
42268 desret_int(ret_val);
42269 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042270 des_const_xmlChar_ptr(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042271 xmlResetLastError();
42272 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042273 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042275 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042276 printf(" %d", n_val);
42277 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042278 }
42279 }
42280#endif
42281
Daniel Veillard3d97e662004-11-04 10:49:00 +000042282 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042283 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042284}
42285
42286
42287static int
42288test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042289 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042290
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042291#ifdef LIBXML_XPATH_ENABLED
42292 int mem_base;
42293 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042294 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042295 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042296
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042297 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42298 mem_base = xmlMemBlocks();
42299 val = gen_const_xmlChar_ptr(n_val, 0);
42300
42301 ret_val = xmlXPathCastStringToNumber(val);
42302 desret_double(ret_val);
42303 call_tests++;
42304 des_const_xmlChar_ptr(n_val, val, 0);
42305 xmlResetLastError();
42306 if (mem_base != xmlMemBlocks()) {
42307 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
42308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042309 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042310 printf(" %d", n_val);
42311 printf("\n");
42312 }
42313 }
42314#endif
42315
42316 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042318}
42319
42320
42321static int
42322test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042324
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042325#ifdef LIBXML_XPATH_ENABLED
42326 int mem_base;
42327 int ret_val;
42328 xmlXPathObjectPtr val; /* an XPath object */
42329 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042330
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042331 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42332 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042333 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042334
42335 ret_val = xmlXPathCastToBoolean(val);
42336 desret_int(ret_val);
42337 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042338 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042339 xmlResetLastError();
42340 if (mem_base != xmlMemBlocks()) {
42341 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
42342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042343 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042344 printf(" %d", n_val);
42345 printf("\n");
42346 }
42347 }
42348#endif
42349
Daniel Veillard3d97e662004-11-04 10:49:00 +000042350 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042352}
42353
42354
42355static int
42356test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042357 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042358
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042359#ifdef LIBXML_XPATH_ENABLED
42360 int mem_base;
42361 double ret_val;
42362 xmlXPathObjectPtr val; /* an XPath object */
42363 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042364
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042365 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42366 mem_base = xmlMemBlocks();
42367 val = gen_xmlXPathObjectPtr(n_val, 0);
42368
42369 ret_val = xmlXPathCastToNumber(val);
42370 desret_double(ret_val);
42371 call_tests++;
42372 des_xmlXPathObjectPtr(n_val, val, 0);
42373 xmlResetLastError();
42374 if (mem_base != xmlMemBlocks()) {
42375 printf("Leak of %d blocks found in xmlXPathCastToNumber",
42376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042377 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042378 printf(" %d", n_val);
42379 printf("\n");
42380 }
42381 }
42382#endif
42383
42384 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042385 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042386}
42387
42388
42389static int
42390test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042391 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042392
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042393#ifdef LIBXML_XPATH_ENABLED
42394 int mem_base;
42395 xmlChar * ret_val;
42396 xmlXPathObjectPtr val; /* an XPath object */
42397 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042398
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042399 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42400 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042401 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042402
42403 ret_val = xmlXPathCastToString(val);
42404 desret_xmlChar_ptr(ret_val);
42405 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042406 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042407 xmlResetLastError();
42408 if (mem_base != xmlMemBlocks()) {
42409 printf("Leak of %d blocks found in xmlXPathCastToString",
42410 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042411 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042412 printf(" %d", n_val);
42413 printf("\n");
42414 }
42415 }
42416#endif
42417
Daniel Veillard3d97e662004-11-04 10:49:00 +000042418 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042420}
42421
42422
42423static int
42424test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042426
42427#ifdef LIBXML_XPATH_ENABLED
42428 int mem_base;
42429 int ret_val;
42430 xmlNodePtr node1; /* the first node */
42431 int n_node1;
42432 xmlNodePtr node2; /* the second node */
42433 int n_node2;
42434
42435 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
42436 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
42437 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042438 node1 = gen_xmlNodePtr(n_node1, 0);
42439 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042440
42441 ret_val = xmlXPathCmpNodes(node1, node2);
42442 desret_int(ret_val);
42443 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042444 des_xmlNodePtr(n_node1, node1, 0);
42445 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042446 xmlResetLastError();
42447 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042448 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042449 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042450 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042451 printf(" %d", n_node1);
42452 printf(" %d", n_node2);
42453 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042454 }
42455 }
42456 }
42457#endif
42458
Daniel Veillard3d97e662004-11-04 10:49:00 +000042459 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042460 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042461}
42462
42463
42464static int
42465test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042467
42468
42469 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042470 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042471}
42472
42473
Daniel Veillardce682bc2004-11-05 17:22:25 +000042474#define gen_nb_xmlXPathCompExprPtr 1
42475static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42476 return(NULL);
42477}
42478static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42479}
42480
42481#define gen_nb_xmlXPathContextPtr 1
42482static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42483 return(NULL);
42484}
42485static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42486}
42487
Daniel Veillardd93f6252004-11-02 15:53:51 +000042488static int
42489test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042491
Daniel Veillardce682bc2004-11-05 17:22:25 +000042492#ifdef LIBXML_XPATH_ENABLED
42493 int mem_base;
42494 xmlXPathObjectPtr ret_val;
42495 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
42496 int n_comp;
42497 xmlXPathContextPtr ctx; /* the XPath context */
42498 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042499
Daniel Veillardce682bc2004-11-05 17:22:25 +000042500 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
42501 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
42502 mem_base = xmlMemBlocks();
42503 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
42504 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
42505
42506 ret_val = xmlXPathCompiledEval(comp, ctx);
42507 desret_xmlXPathObjectPtr(ret_val);
42508 call_tests++;
42509 des_xmlXPathCompExprPtr(n_comp, comp, 0);
42510 des_xmlXPathContextPtr(n_ctx, ctx, 1);
42511 xmlResetLastError();
42512 if (mem_base != xmlMemBlocks()) {
42513 printf("Leak of %d blocks found in xmlXPathCompiledEval",
42514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042515 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042516 printf(" %d", n_comp);
42517 printf(" %d", n_ctx);
42518 printf("\n");
42519 }
42520 }
42521 }
42522#endif
42523
42524 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042525 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042526}
42527
42528
42529static int
42530test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042531 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042532
Daniel Veillard3d97e662004-11-04 10:49:00 +000042533#ifdef LIBXML_XPATH_ENABLED
42534 int mem_base;
42535 xmlXPathObjectPtr ret_val;
42536 xmlXPathObjectPtr val; /* an XPath object */
42537 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042538
Daniel Veillard3d97e662004-11-04 10:49:00 +000042539 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42540 mem_base = xmlMemBlocks();
42541 val = gen_xmlXPathObjectPtr(n_val, 0);
42542
42543 ret_val = xmlXPathConvertBoolean(val);
42544 val = NULL;
42545 desret_xmlXPathObjectPtr(ret_val);
42546 call_tests++;
42547 des_xmlXPathObjectPtr(n_val, val, 0);
42548 xmlResetLastError();
42549 if (mem_base != xmlMemBlocks()) {
42550 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
42551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042552 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042553 printf(" %d", n_val);
42554 printf("\n");
42555 }
42556 }
42557#endif
42558
42559 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042560 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042561}
42562
42563
42564static int
42565test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042566 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042567
Daniel Veillard3d97e662004-11-04 10:49:00 +000042568#ifdef LIBXML_XPATH_ENABLED
42569 int mem_base;
42570 xmlXPathObjectPtr ret_val;
42571 xmlXPathObjectPtr val; /* an XPath object */
42572 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042573
Daniel Veillard3d97e662004-11-04 10:49:00 +000042574 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42575 mem_base = xmlMemBlocks();
42576 val = gen_xmlXPathObjectPtr(n_val, 0);
42577
42578 ret_val = xmlXPathConvertNumber(val);
42579 val = NULL;
42580 desret_xmlXPathObjectPtr(ret_val);
42581 call_tests++;
42582 des_xmlXPathObjectPtr(n_val, val, 0);
42583 xmlResetLastError();
42584 if (mem_base != xmlMemBlocks()) {
42585 printf("Leak of %d blocks found in xmlXPathConvertNumber",
42586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042587 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042588 printf(" %d", n_val);
42589 printf("\n");
42590 }
42591 }
42592#endif
42593
42594 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042596}
42597
42598
42599static int
42600test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042602
Daniel Veillard3d97e662004-11-04 10:49:00 +000042603#ifdef LIBXML_XPATH_ENABLED
42604 int mem_base;
42605 xmlXPathObjectPtr ret_val;
42606 xmlXPathObjectPtr val; /* an XPath object */
42607 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042608
Daniel Veillard3d97e662004-11-04 10:49:00 +000042609 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42610 mem_base = xmlMemBlocks();
42611 val = gen_xmlXPathObjectPtr(n_val, 0);
42612
42613 ret_val = xmlXPathConvertString(val);
42614 val = NULL;
42615 desret_xmlXPathObjectPtr(ret_val);
42616 call_tests++;
42617 des_xmlXPathObjectPtr(n_val, val, 0);
42618 xmlResetLastError();
42619 if (mem_base != xmlMemBlocks()) {
42620 printf("Leak of %d blocks found in xmlXPathConvertString",
42621 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042622 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042623 printf(" %d", n_val);
42624 printf("\n");
42625 }
42626 }
42627#endif
42628
42629 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042631}
42632
42633
42634static int
42635test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042637
42638
42639 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042640 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042641}
42642
42643
42644static int
42645test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042647
Daniel Veillardce682bc2004-11-05 17:22:25 +000042648#ifdef LIBXML_XPATH_ENABLED
42649 int mem_base;
42650 xmlXPathObjectPtr ret_val;
42651 xmlChar * str; /* the XPath expression */
42652 int n_str;
42653 xmlXPathContextPtr ctx; /* the XPath context */
42654 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042655
Daniel Veillardce682bc2004-11-05 17:22:25 +000042656 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
42657 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
42658 mem_base = xmlMemBlocks();
42659 str = gen_const_xmlChar_ptr(n_str, 0);
42660 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
42661
42662 ret_val = xmlXPathEval(str, ctx);
42663 desret_xmlXPathObjectPtr(ret_val);
42664 call_tests++;
42665 des_const_xmlChar_ptr(n_str, str, 0);
42666 des_xmlXPathContextPtr(n_ctx, ctx, 1);
42667 xmlResetLastError();
42668 if (mem_base != xmlMemBlocks()) {
42669 printf("Leak of %d blocks found in xmlXPathEval",
42670 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042671 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042672 printf(" %d", n_str);
42673 printf(" %d", n_ctx);
42674 printf("\n");
42675 }
42676 }
42677 }
42678#endif
42679
42680 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042681 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042682}
42683
42684
42685static int
42686test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042688
Daniel Veillardce682bc2004-11-05 17:22:25 +000042689#ifdef LIBXML_XPATH_ENABLED
42690 int mem_base;
42691 xmlXPathObjectPtr ret_val;
42692 xmlChar * str; /* the XPath expression */
42693 int n_str;
42694 xmlXPathContextPtr ctxt; /* the XPath context */
42695 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042696
Daniel Veillardce682bc2004-11-05 17:22:25 +000042697 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
42698 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
42699 mem_base = xmlMemBlocks();
42700 str = gen_const_xmlChar_ptr(n_str, 0);
42701 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
42702
42703 ret_val = xmlXPathEvalExpression(str, ctxt);
42704 desret_xmlXPathObjectPtr(ret_val);
42705 call_tests++;
42706 des_const_xmlChar_ptr(n_str, str, 0);
42707 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
42708 xmlResetLastError();
42709 if (mem_base != xmlMemBlocks()) {
42710 printf("Leak of %d blocks found in xmlXPathEvalExpression",
42711 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042712 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042713 printf(" %d", n_str);
42714 printf(" %d", n_ctxt);
42715 printf("\n");
42716 }
42717 }
42718 }
42719#endif
42720
42721 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042722 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042723}
42724
42725
42726static int
42727test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042728 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042729
Daniel Veillardce682bc2004-11-05 17:22:25 +000042730#ifdef LIBXML_XPATH_ENABLED
42731 int mem_base;
42732 int ret_val;
42733 xmlXPathContextPtr ctxt; /* the XPath context */
42734 int n_ctxt;
42735 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
42736 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042737
Daniel Veillardce682bc2004-11-05 17:22:25 +000042738 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
42739 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
42740 mem_base = xmlMemBlocks();
42741 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
42742 res = gen_xmlXPathObjectPtr(n_res, 1);
42743
42744 ret_val = xmlXPathEvalPredicate(ctxt, res);
42745 desret_int(ret_val);
42746 call_tests++;
42747 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
42748 des_xmlXPathObjectPtr(n_res, res, 1);
42749 xmlResetLastError();
42750 if (mem_base != xmlMemBlocks()) {
42751 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
42752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042753 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042754 printf(" %d", n_ctxt);
42755 printf(" %d", n_res);
42756 printf("\n");
42757 }
42758 }
42759 }
42760#endif
42761
42762 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042764}
42765
42766
42767static int
42768test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042769 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042770
42771#ifdef LIBXML_XPATH_ENABLED
42772 int mem_base;
42773
42774 mem_base = xmlMemBlocks();
42775
42776 xmlXPathInit();
42777 call_tests++;
42778 xmlResetLastError();
42779 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042780 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042781 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042782 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042783 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042784 }
42785#endif
42786
Daniel Veillard3d97e662004-11-04 10:49:00 +000042787 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042789}
42790
42791
42792static int
42793test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042795
Daniel Veillard3d95c732004-11-06 22:25:14 +000042796#ifdef LIBXML_XPATH_ENABLED
42797 int mem_base;
42798 int ret_val;
42799 double val; /* a double value */
42800 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042801
Daniel Veillard3d95c732004-11-06 22:25:14 +000042802 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42803 mem_base = xmlMemBlocks();
42804 val = gen_double(n_val, 0);
42805
42806 ret_val = xmlXPathIsInf(val);
42807 desret_int(ret_val);
42808 call_tests++;
42809 des_double(n_val, val, 0);
42810 xmlResetLastError();
42811 if (mem_base != xmlMemBlocks()) {
42812 printf("Leak of %d blocks found in xmlXPathIsInf",
42813 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042814 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042815 printf(" %d", n_val);
42816 printf("\n");
42817 }
42818 }
42819#endif
42820
42821 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042823}
42824
42825
42826static int
42827test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042829
Daniel Veillard3d95c732004-11-06 22:25:14 +000042830#ifdef LIBXML_XPATH_ENABLED
42831 int mem_base;
42832 int ret_val;
42833 double val; /* a double value */
42834 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042835
Daniel Veillard3d95c732004-11-06 22:25:14 +000042836 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42837 mem_base = xmlMemBlocks();
42838 val = gen_double(n_val, 0);
42839
42840 ret_val = xmlXPathIsNaN(val);
42841 desret_int(ret_val);
42842 call_tests++;
42843 des_double(n_val, val, 0);
42844 xmlResetLastError();
42845 if (mem_base != xmlMemBlocks()) {
42846 printf("Leak of %d blocks found in xmlXPathIsNaN",
42847 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042848 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042849 printf(" %d", n_val);
42850 printf("\n");
42851 }
42852 }
42853#endif
42854
42855 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042857}
42858
42859
42860static int
42861test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042862 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042863
42864
42865 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042867}
42868
42869
42870static int
42871test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042872 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042873
42874
42875 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042876 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042877}
42878
42879
42880static int
42881test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042882 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042883
Daniel Veillard3d97e662004-11-04 10:49:00 +000042884#ifdef LIBXML_XPATH_ENABLED
42885 int mem_base;
42886 xmlXPathObjectPtr ret_val;
42887 xmlXPathObjectPtr val; /* the original object */
42888 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042889
Daniel Veillard3d97e662004-11-04 10:49:00 +000042890 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42891 mem_base = xmlMemBlocks();
42892 val = gen_xmlXPathObjectPtr(n_val, 0);
42893
42894 ret_val = xmlXPathObjectCopy(val);
42895 desret_xmlXPathObjectPtr(ret_val);
42896 call_tests++;
42897 des_xmlXPathObjectPtr(n_val, val, 0);
42898 xmlResetLastError();
42899 if (mem_base != xmlMemBlocks()) {
42900 printf("Leak of %d blocks found in xmlXPathObjectCopy",
42901 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042902 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042903 printf(" %d", n_val);
42904 printf("\n");
42905 }
42906 }
42907#endif
42908
42909 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042910 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042911}
42912
42913
42914static int
42915test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042916 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042917
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042918#ifdef LIBXML_XPATH_ENABLED
42919 int mem_base;
42920 long ret_val;
42921 xmlDocPtr doc; /* an input document */
42922 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042923
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042924 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
42925 mem_base = xmlMemBlocks();
42926 doc = gen_xmlDocPtr(n_doc, 0);
42927
42928 ret_val = xmlXPathOrderDocElems(doc);
42929 desret_long(ret_val);
42930 call_tests++;
42931 des_xmlDocPtr(n_doc, doc, 0);
42932 xmlResetLastError();
42933 if (mem_base != xmlMemBlocks()) {
42934 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
42935 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042936 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042937 printf(" %d", n_doc);
42938 printf("\n");
42939 }
42940 }
42941#endif
42942
42943 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042944 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042945}
42946
42947static int
42948test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042950
Daniel Veillard3d95c732004-11-06 22:25:14 +000042951 printf("Testing xpath : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000042952 test_ret += test_xmlXPathCastBooleanToNumber();
42953 test_ret += test_xmlXPathCastBooleanToString();
42954 test_ret += test_xmlXPathCastNodeSetToBoolean();
42955 test_ret += test_xmlXPathCastNodeSetToNumber();
42956 test_ret += test_xmlXPathCastNodeSetToString();
42957 test_ret += test_xmlXPathCastNodeToNumber();
42958 test_ret += test_xmlXPathCastNodeToString();
42959 test_ret += test_xmlXPathCastNumberToBoolean();
42960 test_ret += test_xmlXPathCastNumberToString();
42961 test_ret += test_xmlXPathCastStringToBoolean();
42962 test_ret += test_xmlXPathCastStringToNumber();
42963 test_ret += test_xmlXPathCastToBoolean();
42964 test_ret += test_xmlXPathCastToNumber();
42965 test_ret += test_xmlXPathCastToString();
42966 test_ret += test_xmlXPathCmpNodes();
42967 test_ret += test_xmlXPathCompile();
42968 test_ret += test_xmlXPathCompiledEval();
42969 test_ret += test_xmlXPathConvertBoolean();
42970 test_ret += test_xmlXPathConvertNumber();
42971 test_ret += test_xmlXPathConvertString();
42972 test_ret += test_xmlXPathCtxtCompile();
42973 test_ret += test_xmlXPathEval();
42974 test_ret += test_xmlXPathEvalExpression();
42975 test_ret += test_xmlXPathEvalPredicate();
42976 test_ret += test_xmlXPathInit();
42977 test_ret += test_xmlXPathIsInf();
42978 test_ret += test_xmlXPathIsNaN();
42979 test_ret += test_xmlXPathNewContext();
42980 test_ret += test_xmlXPathNodeSetCreate();
42981 test_ret += test_xmlXPathObjectCopy();
42982 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000042983
Daniel Veillard42595322004-11-08 10:52:06 +000042984 if (test_ret != 0)
42985 printf("Module xpath: %d errors\n", test_ret);
42986 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042987}
42988
Daniel Veillarda82b1822004-11-08 16:24:57 +000042989#define gen_nb_xmlXPathParserContextPtr 1
42990static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42991 return(NULL);
42992}
42993static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42994}
42995
42996static int
42997test_valuePop(void) {
42998 int test_ret = 0;
42999
43000#ifdef LIBXML_XPATH_ENABLED
43001 int mem_base;
43002 xmlXPathObjectPtr ret_val;
43003 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43004 int n_ctxt;
43005
43006 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43007 mem_base = xmlMemBlocks();
43008 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43009
43010 ret_val = valuePop(ctxt);
43011 desret_xmlXPathObjectPtr(ret_val);
43012 call_tests++;
43013 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43014 xmlResetLastError();
43015 if (mem_base != xmlMemBlocks()) {
43016 printf("Leak of %d blocks found in valuePop",
43017 xmlMemBlocks() - mem_base);
43018 test_ret++;
43019 printf(" %d", n_ctxt);
43020 printf("\n");
43021 }
43022 }
43023#endif
43024
43025 function_tests++;
43026 return(test_ret);
43027}
43028
43029
43030static int
43031test_valuePush(void) {
43032 int test_ret = 0;
43033
43034#ifdef LIBXML_XPATH_ENABLED
43035 int mem_base;
43036 int ret_val;
43037 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43038 int n_ctxt;
43039 xmlXPathObjectPtr value; /* the XPath object */
43040 int n_value;
43041
43042 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43043 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
43044 mem_base = xmlMemBlocks();
43045 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43046 value = gen_xmlXPathObjectPtr(n_value, 1);
43047
43048 ret_val = valuePush(ctxt, value);
43049 desret_int(ret_val);
43050 call_tests++;
43051 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43052 des_xmlXPathObjectPtr(n_value, value, 1);
43053 xmlResetLastError();
43054 if (mem_base != xmlMemBlocks()) {
43055 printf("Leak of %d blocks found in valuePush",
43056 xmlMemBlocks() - mem_base);
43057 test_ret++;
43058 printf(" %d", n_ctxt);
43059 printf(" %d", n_value);
43060 printf("\n");
43061 }
43062 }
43063 }
43064#endif
43065
43066 function_tests++;
43067 return(test_ret);
43068}
43069
43070
43071static int
43072test_xmlXPathAddValues(void) {
43073 int test_ret = 0;
43074
43075#ifdef LIBXML_XPATH_ENABLED
43076 int mem_base;
43077 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43078 int n_ctxt;
43079
43080 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43081 mem_base = xmlMemBlocks();
43082 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43083
43084 xmlXPathAddValues(ctxt);
43085 call_tests++;
43086 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43087 xmlResetLastError();
43088 if (mem_base != xmlMemBlocks()) {
43089 printf("Leak of %d blocks found in xmlXPathAddValues",
43090 xmlMemBlocks() - mem_base);
43091 test_ret++;
43092 printf(" %d", n_ctxt);
43093 printf("\n");
43094 }
43095 }
43096#endif
43097
43098 function_tests++;
43099 return(test_ret);
43100}
43101
43102
43103static int
43104test_xmlXPathBooleanFunction(void) {
43105 int test_ret = 0;
43106
43107#ifdef LIBXML_XPATH_ENABLED
43108 int mem_base;
43109 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43110 int n_ctxt;
43111 int nargs; /* the number of arguments */
43112 int n_nargs;
43113
43114 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43115 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43116 mem_base = xmlMemBlocks();
43117 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43118 nargs = gen_int(n_nargs, 1);
43119
43120 xmlXPathBooleanFunction(ctxt, nargs);
43121 call_tests++;
43122 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43123 des_int(n_nargs, nargs, 1);
43124 xmlResetLastError();
43125 if (mem_base != xmlMemBlocks()) {
43126 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
43127 xmlMemBlocks() - mem_base);
43128 test_ret++;
43129 printf(" %d", n_ctxt);
43130 printf(" %d", n_nargs);
43131 printf("\n");
43132 }
43133 }
43134 }
43135#endif
43136
43137 function_tests++;
43138 return(test_ret);
43139}
43140
43141
43142static int
43143test_xmlXPathCeilingFunction(void) {
43144 int test_ret = 0;
43145
43146#ifdef LIBXML_XPATH_ENABLED
43147 int mem_base;
43148 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43149 int n_ctxt;
43150 int nargs; /* the number of arguments */
43151 int n_nargs;
43152
43153 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43154 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43155 mem_base = xmlMemBlocks();
43156 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43157 nargs = gen_int(n_nargs, 1);
43158
43159 xmlXPathCeilingFunction(ctxt, nargs);
43160 call_tests++;
43161 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43162 des_int(n_nargs, nargs, 1);
43163 xmlResetLastError();
43164 if (mem_base != xmlMemBlocks()) {
43165 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
43166 xmlMemBlocks() - mem_base);
43167 test_ret++;
43168 printf(" %d", n_ctxt);
43169 printf(" %d", n_nargs);
43170 printf("\n");
43171 }
43172 }
43173 }
43174#endif
43175
43176 function_tests++;
43177 return(test_ret);
43178}
43179
43180
43181static int
43182test_xmlXPathCompareValues(void) {
43183 int test_ret = 0;
43184
43185#ifdef LIBXML_XPATH_ENABLED
43186 int mem_base;
43187 int ret_val;
43188 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43189 int n_ctxt;
43190 int inf; /* less than (1) or greater than (0) */
43191 int n_inf;
43192 int strict; /* is the comparison strict */
43193 int n_strict;
43194
43195 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43196 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
43197 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
43198 mem_base = xmlMemBlocks();
43199 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43200 inf = gen_int(n_inf, 1);
43201 strict = gen_int(n_strict, 2);
43202
43203 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
43204 desret_int(ret_val);
43205 call_tests++;
43206 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43207 des_int(n_inf, inf, 1);
43208 des_int(n_strict, strict, 2);
43209 xmlResetLastError();
43210 if (mem_base != xmlMemBlocks()) {
43211 printf("Leak of %d blocks found in xmlXPathCompareValues",
43212 xmlMemBlocks() - mem_base);
43213 test_ret++;
43214 printf(" %d", n_ctxt);
43215 printf(" %d", n_inf);
43216 printf(" %d", n_strict);
43217 printf("\n");
43218 }
43219 }
43220 }
43221 }
43222#endif
43223
43224 function_tests++;
43225 return(test_ret);
43226}
43227
43228
43229static int
43230test_xmlXPathConcatFunction(void) {
43231 int test_ret = 0;
43232
43233#ifdef LIBXML_XPATH_ENABLED
43234 int mem_base;
43235 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43236 int n_ctxt;
43237 int nargs; /* the number of arguments */
43238 int n_nargs;
43239
43240 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43241 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43242 mem_base = xmlMemBlocks();
43243 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43244 nargs = gen_int(n_nargs, 1);
43245
43246 xmlXPathConcatFunction(ctxt, nargs);
43247 call_tests++;
43248 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43249 des_int(n_nargs, nargs, 1);
43250 xmlResetLastError();
43251 if (mem_base != xmlMemBlocks()) {
43252 printf("Leak of %d blocks found in xmlXPathConcatFunction",
43253 xmlMemBlocks() - mem_base);
43254 test_ret++;
43255 printf(" %d", n_ctxt);
43256 printf(" %d", n_nargs);
43257 printf("\n");
43258 }
43259 }
43260 }
43261#endif
43262
43263 function_tests++;
43264 return(test_ret);
43265}
43266
43267
43268static int
43269test_xmlXPathContainsFunction(void) {
43270 int test_ret = 0;
43271
43272#ifdef LIBXML_XPATH_ENABLED
43273 int mem_base;
43274 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43275 int n_ctxt;
43276 int nargs; /* the number of arguments */
43277 int n_nargs;
43278
43279 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43280 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43281 mem_base = xmlMemBlocks();
43282 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43283 nargs = gen_int(n_nargs, 1);
43284
43285 xmlXPathContainsFunction(ctxt, nargs);
43286 call_tests++;
43287 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43288 des_int(n_nargs, nargs, 1);
43289 xmlResetLastError();
43290 if (mem_base != xmlMemBlocks()) {
43291 printf("Leak of %d blocks found in xmlXPathContainsFunction",
43292 xmlMemBlocks() - mem_base);
43293 test_ret++;
43294 printf(" %d", n_ctxt);
43295 printf(" %d", n_nargs);
43296 printf("\n");
43297 }
43298 }
43299 }
43300#endif
43301
43302 function_tests++;
43303 return(test_ret);
43304}
43305
43306
43307static int
43308test_xmlXPathCountFunction(void) {
43309 int test_ret = 0;
43310
43311#ifdef LIBXML_XPATH_ENABLED
43312 int mem_base;
43313 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43314 int n_ctxt;
43315 int nargs; /* the number of arguments */
43316 int n_nargs;
43317
43318 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43319 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43320 mem_base = xmlMemBlocks();
43321 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43322 nargs = gen_int(n_nargs, 1);
43323
43324 xmlXPathCountFunction(ctxt, nargs);
43325 call_tests++;
43326 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43327 des_int(n_nargs, nargs, 1);
43328 xmlResetLastError();
43329 if (mem_base != xmlMemBlocks()) {
43330 printf("Leak of %d blocks found in xmlXPathCountFunction",
43331 xmlMemBlocks() - mem_base);
43332 test_ret++;
43333 printf(" %d", n_ctxt);
43334 printf(" %d", n_nargs);
43335 printf("\n");
43336 }
43337 }
43338 }
43339#endif
43340
43341 function_tests++;
43342 return(test_ret);
43343}
43344
43345
43346static int
43347test_xmlXPathDebugDumpCompExpr(void) {
43348 int test_ret = 0;
43349
43350#ifdef LIBXML_XPATH_ENABLED
43351#ifdef LIBXML_DEBUG_ENABLED
43352 int mem_base;
43353 FILE * output; /* the FILE * for the output */
43354 int n_output;
43355 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
43356 int n_comp;
43357 int depth; /* the indentation level. */
43358 int n_depth;
43359
43360 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43361 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43362 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43363 mem_base = xmlMemBlocks();
43364 output = gen_FILE_ptr(n_output, 0);
43365 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
43366 depth = gen_int(n_depth, 2);
43367
43368 xmlXPathDebugDumpCompExpr(output, comp, depth);
43369 call_tests++;
43370 des_FILE_ptr(n_output, output, 0);
43371 des_xmlXPathCompExprPtr(n_comp, comp, 1);
43372 des_int(n_depth, depth, 2);
43373 xmlResetLastError();
43374 if (mem_base != xmlMemBlocks()) {
43375 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
43376 xmlMemBlocks() - mem_base);
43377 test_ret++;
43378 printf(" %d", n_output);
43379 printf(" %d", n_comp);
43380 printf(" %d", n_depth);
43381 printf("\n");
43382 }
43383 }
43384 }
43385 }
43386#endif
43387#endif
43388
43389 function_tests++;
43390 return(test_ret);
43391}
43392
43393
43394static int
43395test_xmlXPathDebugDumpObject(void) {
43396 int test_ret = 0;
43397
43398#ifdef LIBXML_XPATH_ENABLED
43399#ifdef LIBXML_DEBUG_ENABLED
43400 int mem_base;
43401 FILE * output; /* the FILE * to dump the output */
43402 int n_output;
43403 xmlXPathObjectPtr cur; /* the object to inspect */
43404 int n_cur;
43405 int depth; /* indentation level */
43406 int n_depth;
43407
43408 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43409 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
43410 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43411 mem_base = xmlMemBlocks();
43412 output = gen_FILE_ptr(n_output, 0);
43413 cur = gen_xmlXPathObjectPtr(n_cur, 1);
43414 depth = gen_int(n_depth, 2);
43415
43416 xmlXPathDebugDumpObject(output, cur, depth);
43417 call_tests++;
43418 des_FILE_ptr(n_output, output, 0);
43419 des_xmlXPathObjectPtr(n_cur, cur, 1);
43420 des_int(n_depth, depth, 2);
43421 xmlResetLastError();
43422 if (mem_base != xmlMemBlocks()) {
43423 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
43424 xmlMemBlocks() - mem_base);
43425 test_ret++;
43426 printf(" %d", n_output);
43427 printf(" %d", n_cur);
43428 printf(" %d", n_depth);
43429 printf("\n");
43430 }
43431 }
43432 }
43433 }
43434#endif
43435#endif
43436
43437 function_tests++;
43438 return(test_ret);
43439}
43440
43441
43442static int
43443test_xmlXPathDifference(void) {
43444 int test_ret = 0;
43445
43446
43447 /* missing type support */
43448 return(test_ret);
43449}
43450
43451
43452static int
43453test_xmlXPathDistinct(void) {
43454 int test_ret = 0;
43455
43456
43457 /* missing type support */
43458 return(test_ret);
43459}
43460
43461
43462static int
43463test_xmlXPathDistinctSorted(void) {
43464 int test_ret = 0;
43465
43466
43467 /* missing type support */
43468 return(test_ret);
43469}
43470
43471
43472static int
43473test_xmlXPathDivValues(void) {
43474 int test_ret = 0;
43475
43476#ifdef LIBXML_XPATH_ENABLED
43477 int mem_base;
43478 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43479 int n_ctxt;
43480
43481 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43482 mem_base = xmlMemBlocks();
43483 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43484
43485 xmlXPathDivValues(ctxt);
43486 call_tests++;
43487 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43488 xmlResetLastError();
43489 if (mem_base != xmlMemBlocks()) {
43490 printf("Leak of %d blocks found in xmlXPathDivValues",
43491 xmlMemBlocks() - mem_base);
43492 test_ret++;
43493 printf(" %d", n_ctxt);
43494 printf("\n");
43495 }
43496 }
43497#endif
43498
43499 function_tests++;
43500 return(test_ret);
43501}
43502
43503
43504static int
43505test_xmlXPathEqualValues(void) {
43506 int test_ret = 0;
43507
43508#ifdef LIBXML_XPATH_ENABLED
43509 int mem_base;
43510 int ret_val;
43511 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43512 int n_ctxt;
43513
43514 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43515 mem_base = xmlMemBlocks();
43516 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43517
43518 ret_val = xmlXPathEqualValues(ctxt);
43519 desret_int(ret_val);
43520 call_tests++;
43521 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43522 xmlResetLastError();
43523 if (mem_base != xmlMemBlocks()) {
43524 printf("Leak of %d blocks found in xmlXPathEqualValues",
43525 xmlMemBlocks() - mem_base);
43526 test_ret++;
43527 printf(" %d", n_ctxt);
43528 printf("\n");
43529 }
43530 }
43531#endif
43532
43533 function_tests++;
43534 return(test_ret);
43535}
43536
43537
43538static int
43539test_xmlXPathErr(void) {
43540 int test_ret = 0;
43541
43542#ifdef LIBXML_XPATH_ENABLED
43543 int mem_base;
43544 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
43545 int n_ctxt;
43546 int error; /* the error code */
43547 int n_error;
43548
43549 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43550 for (n_error = 0;n_error < gen_nb_int;n_error++) {
43551 mem_base = xmlMemBlocks();
43552 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43553 error = gen_int(n_error, 1);
43554
43555 xmlXPathErr(ctxt, error);
43556 call_tests++;
43557 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43558 des_int(n_error, error, 1);
43559 xmlResetLastError();
43560 if (mem_base != xmlMemBlocks()) {
43561 printf("Leak of %d blocks found in xmlXPathErr",
43562 xmlMemBlocks() - mem_base);
43563 test_ret++;
43564 printf(" %d", n_ctxt);
43565 printf(" %d", n_error);
43566 printf("\n");
43567 }
43568 }
43569 }
43570#endif
43571
43572 function_tests++;
43573 return(test_ret);
43574}
43575
43576
43577static int
43578test_xmlXPathEvalExpr(void) {
43579 int test_ret = 0;
43580
43581#ifdef LIBXML_XPATH_ENABLED
43582 int mem_base;
43583 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43584 int n_ctxt;
43585
43586 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43587 mem_base = xmlMemBlocks();
43588 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43589
43590 xmlXPathEvalExpr(ctxt);
43591 call_tests++;
43592 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43593 xmlResetLastError();
43594 if (mem_base != xmlMemBlocks()) {
43595 printf("Leak of %d blocks found in xmlXPathEvalExpr",
43596 xmlMemBlocks() - mem_base);
43597 test_ret++;
43598 printf(" %d", n_ctxt);
43599 printf("\n");
43600 }
43601 }
43602#endif
43603
43604 function_tests++;
43605 return(test_ret);
43606}
43607
43608
43609static int
43610test_xmlXPathEvaluatePredicateResult(void) {
43611 int test_ret = 0;
43612
43613#ifdef LIBXML_XPATH_ENABLED
43614 int mem_base;
43615 int ret_val;
43616 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43617 int n_ctxt;
43618 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43619 int n_res;
43620
43621 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43622 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43623 mem_base = xmlMemBlocks();
43624 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43625 res = gen_xmlXPathObjectPtr(n_res, 1);
43626
43627 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
43628 desret_int(ret_val);
43629 call_tests++;
43630 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43631 des_xmlXPathObjectPtr(n_res, res, 1);
43632 xmlResetLastError();
43633 if (mem_base != xmlMemBlocks()) {
43634 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
43635 xmlMemBlocks() - mem_base);
43636 test_ret++;
43637 printf(" %d", n_ctxt);
43638 printf(" %d", n_res);
43639 printf("\n");
43640 }
43641 }
43642 }
43643#endif
43644
43645 function_tests++;
43646 return(test_ret);
43647}
43648
43649
43650static int
43651test_xmlXPathFalseFunction(void) {
43652 int test_ret = 0;
43653
43654#ifdef LIBXML_XPATH_ENABLED
43655 int mem_base;
43656 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43657 int n_ctxt;
43658 int nargs; /* the number of arguments */
43659 int n_nargs;
43660
43661 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43662 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43663 mem_base = xmlMemBlocks();
43664 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43665 nargs = gen_int(n_nargs, 1);
43666
43667 xmlXPathFalseFunction(ctxt, nargs);
43668 call_tests++;
43669 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43670 des_int(n_nargs, nargs, 1);
43671 xmlResetLastError();
43672 if (mem_base != xmlMemBlocks()) {
43673 printf("Leak of %d blocks found in xmlXPathFalseFunction",
43674 xmlMemBlocks() - mem_base);
43675 test_ret++;
43676 printf(" %d", n_ctxt);
43677 printf(" %d", n_nargs);
43678 printf("\n");
43679 }
43680 }
43681 }
43682#endif
43683
43684 function_tests++;
43685 return(test_ret);
43686}
43687
43688
43689static int
43690test_xmlXPathFloorFunction(void) {
43691 int test_ret = 0;
43692
43693#ifdef LIBXML_XPATH_ENABLED
43694 int mem_base;
43695 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43696 int n_ctxt;
43697 int nargs; /* the number of arguments */
43698 int n_nargs;
43699
43700 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43701 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43702 mem_base = xmlMemBlocks();
43703 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43704 nargs = gen_int(n_nargs, 1);
43705
43706 xmlXPathFloorFunction(ctxt, nargs);
43707 call_tests++;
43708 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43709 des_int(n_nargs, nargs, 1);
43710 xmlResetLastError();
43711 if (mem_base != xmlMemBlocks()) {
43712 printf("Leak of %d blocks found in xmlXPathFloorFunction",
43713 xmlMemBlocks() - mem_base);
43714 test_ret++;
43715 printf(" %d", n_ctxt);
43716 printf(" %d", n_nargs);
43717 printf("\n");
43718 }
43719 }
43720 }
43721#endif
43722
43723 function_tests++;
43724 return(test_ret);
43725}
43726
43727
43728static int
43729test_xmlXPathFunctionLookup(void) {
43730 int test_ret = 0;
43731
43732
43733 /* missing type support */
43734 return(test_ret);
43735}
43736
43737
43738static int
43739test_xmlXPathFunctionLookupNS(void) {
43740 int test_ret = 0;
43741
43742
43743 /* missing type support */
43744 return(test_ret);
43745}
43746
43747
43748static int
43749test_xmlXPathHasSameNodes(void) {
43750 int test_ret = 0;
43751
43752#ifdef LIBXML_XPATH_ENABLED
43753 int mem_base;
43754 int ret_val;
43755 xmlNodeSetPtr nodes1; /* a node-set */
43756 int n_nodes1;
43757 xmlNodeSetPtr nodes2; /* a node-set */
43758 int n_nodes2;
43759
43760 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
43761 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
43762 mem_base = xmlMemBlocks();
43763 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
43764 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
43765
43766 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
43767 desret_int(ret_val);
43768 call_tests++;
43769 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
43770 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
43771 xmlResetLastError();
43772 if (mem_base != xmlMemBlocks()) {
43773 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
43774 xmlMemBlocks() - mem_base);
43775 test_ret++;
43776 printf(" %d", n_nodes1);
43777 printf(" %d", n_nodes2);
43778 printf("\n");
43779 }
43780 }
43781 }
43782#endif
43783
43784 function_tests++;
43785 return(test_ret);
43786}
43787
43788
43789static int
43790test_xmlXPathIdFunction(void) {
43791 int test_ret = 0;
43792
43793#ifdef LIBXML_XPATH_ENABLED
43794 int mem_base;
43795 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43796 int n_ctxt;
43797 int nargs; /* the number of arguments */
43798 int n_nargs;
43799
43800 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43801 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43802 mem_base = xmlMemBlocks();
43803 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43804 nargs = gen_int(n_nargs, 1);
43805
43806 xmlXPathIdFunction(ctxt, nargs);
43807 call_tests++;
43808 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43809 des_int(n_nargs, nargs, 1);
43810 xmlResetLastError();
43811 if (mem_base != xmlMemBlocks()) {
43812 printf("Leak of %d blocks found in xmlXPathIdFunction",
43813 xmlMemBlocks() - mem_base);
43814 test_ret++;
43815 printf(" %d", n_ctxt);
43816 printf(" %d", n_nargs);
43817 printf("\n");
43818 }
43819 }
43820 }
43821#endif
43822
43823 function_tests++;
43824 return(test_ret);
43825}
43826
43827
43828static int
43829test_xmlXPathIntersection(void) {
43830 int test_ret = 0;
43831
43832
43833 /* missing type support */
43834 return(test_ret);
43835}
43836
43837
43838static int
43839test_xmlXPathIsNodeType(void) {
43840 int test_ret = 0;
43841
43842#ifdef LIBXML_XPATH_ENABLED
43843 int mem_base;
43844 int ret_val;
43845 xmlChar * name; /* a name string */
43846 int n_name;
43847
43848 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
43849 mem_base = xmlMemBlocks();
43850 name = gen_const_xmlChar_ptr(n_name, 0);
43851
43852 ret_val = xmlXPathIsNodeType(name);
43853 desret_int(ret_val);
43854 call_tests++;
43855 des_const_xmlChar_ptr(n_name, name, 0);
43856 xmlResetLastError();
43857 if (mem_base != xmlMemBlocks()) {
43858 printf("Leak of %d blocks found in xmlXPathIsNodeType",
43859 xmlMemBlocks() - mem_base);
43860 test_ret++;
43861 printf(" %d", n_name);
43862 printf("\n");
43863 }
43864 }
43865#endif
43866
43867 function_tests++;
43868 return(test_ret);
43869}
43870
43871
43872static int
43873test_xmlXPathLangFunction(void) {
43874 int test_ret = 0;
43875
43876#ifdef LIBXML_XPATH_ENABLED
43877 int mem_base;
43878 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43879 int n_ctxt;
43880 int nargs; /* the number of arguments */
43881 int n_nargs;
43882
43883 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43884 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43885 mem_base = xmlMemBlocks();
43886 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43887 nargs = gen_int(n_nargs, 1);
43888
43889 xmlXPathLangFunction(ctxt, nargs);
43890 call_tests++;
43891 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43892 des_int(n_nargs, nargs, 1);
43893 xmlResetLastError();
43894 if (mem_base != xmlMemBlocks()) {
43895 printf("Leak of %d blocks found in xmlXPathLangFunction",
43896 xmlMemBlocks() - mem_base);
43897 test_ret++;
43898 printf(" %d", n_ctxt);
43899 printf(" %d", n_nargs);
43900 printf("\n");
43901 }
43902 }
43903 }
43904#endif
43905
43906 function_tests++;
43907 return(test_ret);
43908}
43909
43910
43911static int
43912test_xmlXPathLastFunction(void) {
43913 int test_ret = 0;
43914
43915#ifdef LIBXML_XPATH_ENABLED
43916 int mem_base;
43917 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43918 int n_ctxt;
43919 int nargs; /* the number of arguments */
43920 int n_nargs;
43921
43922 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43923 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43924 mem_base = xmlMemBlocks();
43925 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43926 nargs = gen_int(n_nargs, 1);
43927
43928 xmlXPathLastFunction(ctxt, nargs);
43929 call_tests++;
43930 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43931 des_int(n_nargs, nargs, 1);
43932 xmlResetLastError();
43933 if (mem_base != xmlMemBlocks()) {
43934 printf("Leak of %d blocks found in xmlXPathLastFunction",
43935 xmlMemBlocks() - mem_base);
43936 test_ret++;
43937 printf(" %d", n_ctxt);
43938 printf(" %d", n_nargs);
43939 printf("\n");
43940 }
43941 }
43942 }
43943#endif
43944
43945 function_tests++;
43946 return(test_ret);
43947}
43948
43949
43950static int
43951test_xmlXPathLeading(void) {
43952 int test_ret = 0;
43953
43954
43955 /* missing type support */
43956 return(test_ret);
43957}
43958
43959
43960static int
43961test_xmlXPathLeadingSorted(void) {
43962 int test_ret = 0;
43963
43964
43965 /* missing type support */
43966 return(test_ret);
43967}
43968
43969
43970static int
43971test_xmlXPathLocalNameFunction(void) {
43972 int test_ret = 0;
43973
43974#ifdef LIBXML_XPATH_ENABLED
43975 int mem_base;
43976 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43977 int n_ctxt;
43978 int nargs; /* the number of arguments */
43979 int n_nargs;
43980
43981 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43982 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43983 mem_base = xmlMemBlocks();
43984 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43985 nargs = gen_int(n_nargs, 1);
43986
43987 xmlXPathLocalNameFunction(ctxt, nargs);
43988 call_tests++;
43989 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43990 des_int(n_nargs, nargs, 1);
43991 xmlResetLastError();
43992 if (mem_base != xmlMemBlocks()) {
43993 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
43994 xmlMemBlocks() - mem_base);
43995 test_ret++;
43996 printf(" %d", n_ctxt);
43997 printf(" %d", n_nargs);
43998 printf("\n");
43999 }
44000 }
44001 }
44002#endif
44003
44004 function_tests++;
44005 return(test_ret);
44006}
44007
44008
44009static int
44010test_xmlXPathModValues(void) {
44011 int test_ret = 0;
44012
44013#ifdef LIBXML_XPATH_ENABLED
44014 int mem_base;
44015 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44016 int n_ctxt;
44017
44018 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44019 mem_base = xmlMemBlocks();
44020 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44021
44022 xmlXPathModValues(ctxt);
44023 call_tests++;
44024 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44025 xmlResetLastError();
44026 if (mem_base != xmlMemBlocks()) {
44027 printf("Leak of %d blocks found in xmlXPathModValues",
44028 xmlMemBlocks() - mem_base);
44029 test_ret++;
44030 printf(" %d", n_ctxt);
44031 printf("\n");
44032 }
44033 }
44034#endif
44035
44036 function_tests++;
44037 return(test_ret);
44038}
44039
44040
44041static int
44042test_xmlXPathMultValues(void) {
44043 int test_ret = 0;
44044
44045#ifdef LIBXML_XPATH_ENABLED
44046 int mem_base;
44047 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44048 int n_ctxt;
44049
44050 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44051 mem_base = xmlMemBlocks();
44052 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44053
44054 xmlXPathMultValues(ctxt);
44055 call_tests++;
44056 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44057 xmlResetLastError();
44058 if (mem_base != xmlMemBlocks()) {
44059 printf("Leak of %d blocks found in xmlXPathMultValues",
44060 xmlMemBlocks() - mem_base);
44061 test_ret++;
44062 printf(" %d", n_ctxt);
44063 printf("\n");
44064 }
44065 }
44066#endif
44067
44068 function_tests++;
44069 return(test_ret);
44070}
44071
44072
44073static int
44074test_xmlXPathNamespaceURIFunction(void) {
44075 int test_ret = 0;
44076
44077#ifdef LIBXML_XPATH_ENABLED
44078 int mem_base;
44079 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44080 int n_ctxt;
44081 int nargs; /* the number of arguments */
44082 int n_nargs;
44083
44084 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44085 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44086 mem_base = xmlMemBlocks();
44087 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44088 nargs = gen_int(n_nargs, 1);
44089
44090 xmlXPathNamespaceURIFunction(ctxt, nargs);
44091 call_tests++;
44092 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44093 des_int(n_nargs, nargs, 1);
44094 xmlResetLastError();
44095 if (mem_base != xmlMemBlocks()) {
44096 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
44097 xmlMemBlocks() - mem_base);
44098 test_ret++;
44099 printf(" %d", n_ctxt);
44100 printf(" %d", n_nargs);
44101 printf("\n");
44102 }
44103 }
44104 }
44105#endif
44106
44107 function_tests++;
44108 return(test_ret);
44109}
44110
44111
44112static int
44113test_xmlXPathNewBoolean(void) {
44114 int test_ret = 0;
44115
44116#ifdef LIBXML_XPATH_ENABLED
44117 int mem_base;
44118 xmlXPathObjectPtr ret_val;
44119 int val; /* the boolean value */
44120 int n_val;
44121
44122 for (n_val = 0;n_val < gen_nb_int;n_val++) {
44123 mem_base = xmlMemBlocks();
44124 val = gen_int(n_val, 0);
44125
44126 ret_val = xmlXPathNewBoolean(val);
44127 desret_xmlXPathObjectPtr(ret_val);
44128 call_tests++;
44129 des_int(n_val, val, 0);
44130 xmlResetLastError();
44131 if (mem_base != xmlMemBlocks()) {
44132 printf("Leak of %d blocks found in xmlXPathNewBoolean",
44133 xmlMemBlocks() - mem_base);
44134 test_ret++;
44135 printf(" %d", n_val);
44136 printf("\n");
44137 }
44138 }
44139#endif
44140
44141 function_tests++;
44142 return(test_ret);
44143}
44144
44145
44146static int
44147test_xmlXPathNewCString(void) {
44148 int test_ret = 0;
44149
44150#ifdef LIBXML_XPATH_ENABLED
44151 int mem_base;
44152 xmlXPathObjectPtr ret_val;
44153 char * val; /* the char * value */
44154 int n_val;
44155
44156 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
44157 mem_base = xmlMemBlocks();
44158 val = gen_const_char_ptr(n_val, 0);
44159
44160 ret_val = xmlXPathNewCString(val);
44161 desret_xmlXPathObjectPtr(ret_val);
44162 call_tests++;
44163 des_const_char_ptr(n_val, val, 0);
44164 xmlResetLastError();
44165 if (mem_base != xmlMemBlocks()) {
44166 printf("Leak of %d blocks found in xmlXPathNewCString",
44167 xmlMemBlocks() - mem_base);
44168 test_ret++;
44169 printf(" %d", n_val);
44170 printf("\n");
44171 }
44172 }
44173#endif
44174
44175 function_tests++;
44176 return(test_ret);
44177}
44178
44179
44180static int
44181test_xmlXPathNewFloat(void) {
44182 int test_ret = 0;
44183
44184#ifdef LIBXML_XPATH_ENABLED
44185 int mem_base;
44186 xmlXPathObjectPtr ret_val;
44187 double val; /* the double value */
44188 int n_val;
44189
44190 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44191 mem_base = xmlMemBlocks();
44192 val = gen_double(n_val, 0);
44193
44194 ret_val = xmlXPathNewFloat(val);
44195 desret_xmlXPathObjectPtr(ret_val);
44196 call_tests++;
44197 des_double(n_val, val, 0);
44198 xmlResetLastError();
44199 if (mem_base != xmlMemBlocks()) {
44200 printf("Leak of %d blocks found in xmlXPathNewFloat",
44201 xmlMemBlocks() - mem_base);
44202 test_ret++;
44203 printf(" %d", n_val);
44204 printf("\n");
44205 }
44206 }
44207#endif
44208
44209 function_tests++;
44210 return(test_ret);
44211}
44212
44213
44214static int
44215test_xmlXPathNewNodeSet(void) {
44216 int test_ret = 0;
44217
44218#ifdef LIBXML_XPATH_ENABLED
44219 int mem_base;
44220 xmlXPathObjectPtr ret_val;
44221 xmlNodePtr val; /* the NodePtr value */
44222 int n_val;
44223
44224 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
44225 mem_base = xmlMemBlocks();
44226 val = gen_xmlNodePtr(n_val, 0);
44227
44228 ret_val = xmlXPathNewNodeSet(val);
44229 desret_xmlXPathObjectPtr(ret_val);
44230 call_tests++;
44231 des_xmlNodePtr(n_val, val, 0);
44232 xmlResetLastError();
44233 if (mem_base != xmlMemBlocks()) {
44234 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
44235 xmlMemBlocks() - mem_base);
44236 test_ret++;
44237 printf(" %d", n_val);
44238 printf("\n");
44239 }
44240 }
44241#endif
44242
44243 function_tests++;
44244 return(test_ret);
44245}
44246
44247
44248static int
44249test_xmlXPathNewNodeSetList(void) {
44250 int test_ret = 0;
44251
44252#ifdef LIBXML_XPATH_ENABLED
44253 int mem_base;
44254 xmlXPathObjectPtr ret_val;
44255 xmlNodeSetPtr val; /* an existing NodeSet */
44256 int n_val;
44257
44258 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
44259 mem_base = xmlMemBlocks();
44260 val = gen_xmlNodeSetPtr(n_val, 0);
44261
44262 ret_val = xmlXPathNewNodeSetList(val);
44263 desret_xmlXPathObjectPtr(ret_val);
44264 call_tests++;
44265 des_xmlNodeSetPtr(n_val, val, 0);
44266 xmlResetLastError();
44267 if (mem_base != xmlMemBlocks()) {
44268 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
44269 xmlMemBlocks() - mem_base);
44270 test_ret++;
44271 printf(" %d", n_val);
44272 printf("\n");
44273 }
44274 }
44275#endif
44276
44277 function_tests++;
44278 return(test_ret);
44279}
44280
44281
44282static int
44283test_xmlXPathNewParserContext(void) {
44284 int test_ret = 0;
44285
44286
44287 /* missing type support */
44288 return(test_ret);
44289}
44290
44291
44292static int
44293test_xmlXPathNewString(void) {
44294 int test_ret = 0;
44295
44296#ifdef LIBXML_XPATH_ENABLED
44297 int mem_base;
44298 xmlXPathObjectPtr ret_val;
44299 xmlChar * val; /* the xmlChar * value */
44300 int n_val;
44301
44302 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
44303 mem_base = xmlMemBlocks();
44304 val = gen_const_xmlChar_ptr(n_val, 0);
44305
44306 ret_val = xmlXPathNewString(val);
44307 desret_xmlXPathObjectPtr(ret_val);
44308 call_tests++;
44309 des_const_xmlChar_ptr(n_val, val, 0);
44310 xmlResetLastError();
44311 if (mem_base != xmlMemBlocks()) {
44312 printf("Leak of %d blocks found in xmlXPathNewString",
44313 xmlMemBlocks() - mem_base);
44314 test_ret++;
44315 printf(" %d", n_val);
44316 printf("\n");
44317 }
44318 }
44319#endif
44320
44321 function_tests++;
44322 return(test_ret);
44323}
44324
44325
44326static int
44327test_xmlXPathNextAncestor(void) {
44328 int test_ret = 0;
44329
44330#ifdef LIBXML_XPATH_ENABLED
44331 int mem_base;
44332 xmlNodePtr ret_val;
44333 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44334 int n_ctxt;
44335 xmlNodePtr cur; /* the current node in the traversal */
44336 int n_cur;
44337
44338 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44339 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44340 mem_base = xmlMemBlocks();
44341 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44342 cur = gen_xmlNodePtr(n_cur, 1);
44343
44344 ret_val = xmlXPathNextAncestor(ctxt, cur);
44345 desret_xmlNodePtr(ret_val);
44346 call_tests++;
44347 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44348 des_xmlNodePtr(n_cur, cur, 1);
44349 xmlResetLastError();
44350 if (mem_base != xmlMemBlocks()) {
44351 printf("Leak of %d blocks found in xmlXPathNextAncestor",
44352 xmlMemBlocks() - mem_base);
44353 test_ret++;
44354 printf(" %d", n_ctxt);
44355 printf(" %d", n_cur);
44356 printf("\n");
44357 }
44358 }
44359 }
44360#endif
44361
44362 function_tests++;
44363 return(test_ret);
44364}
44365
44366
44367static int
44368test_xmlXPathNextAncestorOrSelf(void) {
44369 int test_ret = 0;
44370
44371#ifdef LIBXML_XPATH_ENABLED
44372 int mem_base;
44373 xmlNodePtr ret_val;
44374 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44375 int n_ctxt;
44376 xmlNodePtr cur; /* the current node in the traversal */
44377 int n_cur;
44378
44379 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44380 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44381 mem_base = xmlMemBlocks();
44382 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44383 cur = gen_xmlNodePtr(n_cur, 1);
44384
44385 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
44386 desret_xmlNodePtr(ret_val);
44387 call_tests++;
44388 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44389 des_xmlNodePtr(n_cur, cur, 1);
44390 xmlResetLastError();
44391 if (mem_base != xmlMemBlocks()) {
44392 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
44393 xmlMemBlocks() - mem_base);
44394 test_ret++;
44395 printf(" %d", n_ctxt);
44396 printf(" %d", n_cur);
44397 printf("\n");
44398 }
44399 }
44400 }
44401#endif
44402
44403 function_tests++;
44404 return(test_ret);
44405}
44406
44407
44408static int
44409test_xmlXPathNextAttribute(void) {
44410 int test_ret = 0;
44411
44412#ifdef LIBXML_XPATH_ENABLED
44413 int mem_base;
44414 xmlNodePtr ret_val;
44415 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44416 int n_ctxt;
44417 xmlNodePtr cur; /* the current attribute in the traversal */
44418 int n_cur;
44419
44420 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44421 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44422 mem_base = xmlMemBlocks();
44423 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44424 cur = gen_xmlNodePtr(n_cur, 1);
44425
44426 ret_val = xmlXPathNextAttribute(ctxt, cur);
44427 desret_xmlNodePtr(ret_val);
44428 call_tests++;
44429 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44430 des_xmlNodePtr(n_cur, cur, 1);
44431 xmlResetLastError();
44432 if (mem_base != xmlMemBlocks()) {
44433 printf("Leak of %d blocks found in xmlXPathNextAttribute",
44434 xmlMemBlocks() - mem_base);
44435 test_ret++;
44436 printf(" %d", n_ctxt);
44437 printf(" %d", n_cur);
44438 printf("\n");
44439 }
44440 }
44441 }
44442#endif
44443
44444 function_tests++;
44445 return(test_ret);
44446}
44447
44448
44449static int
44450test_xmlXPathNextChild(void) {
44451 int test_ret = 0;
44452
44453#ifdef LIBXML_XPATH_ENABLED
44454 int mem_base;
44455 xmlNodePtr ret_val;
44456 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44457 int n_ctxt;
44458 xmlNodePtr cur; /* the current node in the traversal */
44459 int n_cur;
44460
44461 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44462 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44463 mem_base = xmlMemBlocks();
44464 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44465 cur = gen_xmlNodePtr(n_cur, 1);
44466
44467 ret_val = xmlXPathNextChild(ctxt, cur);
44468 desret_xmlNodePtr(ret_val);
44469 call_tests++;
44470 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44471 des_xmlNodePtr(n_cur, cur, 1);
44472 xmlResetLastError();
44473 if (mem_base != xmlMemBlocks()) {
44474 printf("Leak of %d blocks found in xmlXPathNextChild",
44475 xmlMemBlocks() - mem_base);
44476 test_ret++;
44477 printf(" %d", n_ctxt);
44478 printf(" %d", n_cur);
44479 printf("\n");
44480 }
44481 }
44482 }
44483#endif
44484
44485 function_tests++;
44486 return(test_ret);
44487}
44488
44489
44490static int
44491test_xmlXPathNextDescendant(void) {
44492 int test_ret = 0;
44493
44494#ifdef LIBXML_XPATH_ENABLED
44495 int mem_base;
44496 xmlNodePtr ret_val;
44497 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44498 int n_ctxt;
44499 xmlNodePtr cur; /* the current node in the traversal */
44500 int n_cur;
44501
44502 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44503 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44504 mem_base = xmlMemBlocks();
44505 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44506 cur = gen_xmlNodePtr(n_cur, 1);
44507
44508 ret_val = xmlXPathNextDescendant(ctxt, cur);
44509 desret_xmlNodePtr(ret_val);
44510 call_tests++;
44511 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44512 des_xmlNodePtr(n_cur, cur, 1);
44513 xmlResetLastError();
44514 if (mem_base != xmlMemBlocks()) {
44515 printf("Leak of %d blocks found in xmlXPathNextDescendant",
44516 xmlMemBlocks() - mem_base);
44517 test_ret++;
44518 printf(" %d", n_ctxt);
44519 printf(" %d", n_cur);
44520 printf("\n");
44521 }
44522 }
44523 }
44524#endif
44525
44526 function_tests++;
44527 return(test_ret);
44528}
44529
44530
44531static int
44532test_xmlXPathNextDescendantOrSelf(void) {
44533 int test_ret = 0;
44534
44535#ifdef LIBXML_XPATH_ENABLED
44536 int mem_base;
44537 xmlNodePtr ret_val;
44538 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44539 int n_ctxt;
44540 xmlNodePtr cur; /* the current node in the traversal */
44541 int n_cur;
44542
44543 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44544 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44545 mem_base = xmlMemBlocks();
44546 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44547 cur = gen_xmlNodePtr(n_cur, 1);
44548
44549 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
44550 desret_xmlNodePtr(ret_val);
44551 call_tests++;
44552 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44553 des_xmlNodePtr(n_cur, cur, 1);
44554 xmlResetLastError();
44555 if (mem_base != xmlMemBlocks()) {
44556 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
44557 xmlMemBlocks() - mem_base);
44558 test_ret++;
44559 printf(" %d", n_ctxt);
44560 printf(" %d", n_cur);
44561 printf("\n");
44562 }
44563 }
44564 }
44565#endif
44566
44567 function_tests++;
44568 return(test_ret);
44569}
44570
44571
44572static int
44573test_xmlXPathNextFollowing(void) {
44574 int test_ret = 0;
44575
44576#ifdef LIBXML_XPATH_ENABLED
44577 int mem_base;
44578 xmlNodePtr ret_val;
44579 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44580 int n_ctxt;
44581 xmlNodePtr cur; /* the current node in the traversal */
44582 int n_cur;
44583
44584 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44585 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44586 mem_base = xmlMemBlocks();
44587 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44588 cur = gen_xmlNodePtr(n_cur, 1);
44589
44590 ret_val = xmlXPathNextFollowing(ctxt, cur);
44591 desret_xmlNodePtr(ret_val);
44592 call_tests++;
44593 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44594 des_xmlNodePtr(n_cur, cur, 1);
44595 xmlResetLastError();
44596 if (mem_base != xmlMemBlocks()) {
44597 printf("Leak of %d blocks found in xmlXPathNextFollowing",
44598 xmlMemBlocks() - mem_base);
44599 test_ret++;
44600 printf(" %d", n_ctxt);
44601 printf(" %d", n_cur);
44602 printf("\n");
44603 }
44604 }
44605 }
44606#endif
44607
44608 function_tests++;
44609 return(test_ret);
44610}
44611
44612
44613static int
44614test_xmlXPathNextFollowingSibling(void) {
44615 int test_ret = 0;
44616
44617#ifdef LIBXML_XPATH_ENABLED
44618 int mem_base;
44619 xmlNodePtr ret_val;
44620 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44621 int n_ctxt;
44622 xmlNodePtr cur; /* the current node in the traversal */
44623 int n_cur;
44624
44625 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44626 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44627 mem_base = xmlMemBlocks();
44628 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44629 cur = gen_xmlNodePtr(n_cur, 1);
44630
44631 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
44632 desret_xmlNodePtr(ret_val);
44633 call_tests++;
44634 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44635 des_xmlNodePtr(n_cur, cur, 1);
44636 xmlResetLastError();
44637 if (mem_base != xmlMemBlocks()) {
44638 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
44639 xmlMemBlocks() - mem_base);
44640 test_ret++;
44641 printf(" %d", n_ctxt);
44642 printf(" %d", n_cur);
44643 printf("\n");
44644 }
44645 }
44646 }
44647#endif
44648
44649 function_tests++;
44650 return(test_ret);
44651}
44652
44653
44654static int
44655test_xmlXPathNextNamespace(void) {
44656 int test_ret = 0;
44657
44658#ifdef LIBXML_XPATH_ENABLED
44659 int mem_base;
44660 xmlNodePtr ret_val;
44661 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44662 int n_ctxt;
44663 xmlNodePtr cur; /* the current attribute in the traversal */
44664 int n_cur;
44665
44666 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44667 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44668 mem_base = xmlMemBlocks();
44669 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44670 cur = gen_xmlNodePtr(n_cur, 1);
44671
44672 ret_val = xmlXPathNextNamespace(ctxt, cur);
44673 desret_xmlNodePtr(ret_val);
44674 call_tests++;
44675 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44676 des_xmlNodePtr(n_cur, cur, 1);
44677 xmlResetLastError();
44678 if (mem_base != xmlMemBlocks()) {
44679 printf("Leak of %d blocks found in xmlXPathNextNamespace",
44680 xmlMemBlocks() - mem_base);
44681 test_ret++;
44682 printf(" %d", n_ctxt);
44683 printf(" %d", n_cur);
44684 printf("\n");
44685 }
44686 }
44687 }
44688#endif
44689
44690 function_tests++;
44691 return(test_ret);
44692}
44693
44694
44695static int
44696test_xmlXPathNextParent(void) {
44697 int test_ret = 0;
44698
44699#ifdef LIBXML_XPATH_ENABLED
44700 int mem_base;
44701 xmlNodePtr ret_val;
44702 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44703 int n_ctxt;
44704 xmlNodePtr cur; /* the current node in the traversal */
44705 int n_cur;
44706
44707 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44708 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44709 mem_base = xmlMemBlocks();
44710 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44711 cur = gen_xmlNodePtr(n_cur, 1);
44712
44713 ret_val = xmlXPathNextParent(ctxt, cur);
44714 desret_xmlNodePtr(ret_val);
44715 call_tests++;
44716 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44717 des_xmlNodePtr(n_cur, cur, 1);
44718 xmlResetLastError();
44719 if (mem_base != xmlMemBlocks()) {
44720 printf("Leak of %d blocks found in xmlXPathNextParent",
44721 xmlMemBlocks() - mem_base);
44722 test_ret++;
44723 printf(" %d", n_ctxt);
44724 printf(" %d", n_cur);
44725 printf("\n");
44726 }
44727 }
44728 }
44729#endif
44730
44731 function_tests++;
44732 return(test_ret);
44733}
44734
44735
44736static int
44737test_xmlXPathNextPreceding(void) {
44738 int test_ret = 0;
44739
44740#ifdef LIBXML_XPATH_ENABLED
44741 int mem_base;
44742 xmlNodePtr ret_val;
44743 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44744 int n_ctxt;
44745 xmlNodePtr cur; /* the current node in the traversal */
44746 int n_cur;
44747
44748 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44749 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44750 mem_base = xmlMemBlocks();
44751 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44752 cur = gen_xmlNodePtr(n_cur, 1);
44753
44754 ret_val = xmlXPathNextPreceding(ctxt, cur);
44755 desret_xmlNodePtr(ret_val);
44756 call_tests++;
44757 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44758 des_xmlNodePtr(n_cur, cur, 1);
44759 xmlResetLastError();
44760 if (mem_base != xmlMemBlocks()) {
44761 printf("Leak of %d blocks found in xmlXPathNextPreceding",
44762 xmlMemBlocks() - mem_base);
44763 test_ret++;
44764 printf(" %d", n_ctxt);
44765 printf(" %d", n_cur);
44766 printf("\n");
44767 }
44768 }
44769 }
44770#endif
44771
44772 function_tests++;
44773 return(test_ret);
44774}
44775
44776
44777static int
44778test_xmlXPathNextPrecedingSibling(void) {
44779 int test_ret = 0;
44780
44781#ifdef LIBXML_XPATH_ENABLED
44782 int mem_base;
44783 xmlNodePtr ret_val;
44784 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44785 int n_ctxt;
44786 xmlNodePtr cur; /* the current node in the traversal */
44787 int n_cur;
44788
44789 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44790 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44791 mem_base = xmlMemBlocks();
44792 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44793 cur = gen_xmlNodePtr(n_cur, 1);
44794
44795 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
44796 desret_xmlNodePtr(ret_val);
44797 call_tests++;
44798 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44799 des_xmlNodePtr(n_cur, cur, 1);
44800 xmlResetLastError();
44801 if (mem_base != xmlMemBlocks()) {
44802 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
44803 xmlMemBlocks() - mem_base);
44804 test_ret++;
44805 printf(" %d", n_ctxt);
44806 printf(" %d", n_cur);
44807 printf("\n");
44808 }
44809 }
44810 }
44811#endif
44812
44813 function_tests++;
44814 return(test_ret);
44815}
44816
44817
44818static int
44819test_xmlXPathNextSelf(void) {
44820 int test_ret = 0;
44821
44822#ifdef LIBXML_XPATH_ENABLED
44823 int mem_base;
44824 xmlNodePtr ret_val;
44825 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44826 int n_ctxt;
44827 xmlNodePtr cur; /* the current node in the traversal */
44828 int n_cur;
44829
44830 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44831 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44832 mem_base = xmlMemBlocks();
44833 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44834 cur = gen_xmlNodePtr(n_cur, 1);
44835
44836 ret_val = xmlXPathNextSelf(ctxt, cur);
44837 desret_xmlNodePtr(ret_val);
44838 call_tests++;
44839 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44840 des_xmlNodePtr(n_cur, cur, 1);
44841 xmlResetLastError();
44842 if (mem_base != xmlMemBlocks()) {
44843 printf("Leak of %d blocks found in xmlXPathNextSelf",
44844 xmlMemBlocks() - mem_base);
44845 test_ret++;
44846 printf(" %d", n_ctxt);
44847 printf(" %d", n_cur);
44848 printf("\n");
44849 }
44850 }
44851 }
44852#endif
44853
44854 function_tests++;
44855 return(test_ret);
44856}
44857
44858
44859static int
44860test_xmlXPathNodeLeading(void) {
44861 int test_ret = 0;
44862
44863
44864 /* missing type support */
44865 return(test_ret);
44866}
44867
44868
44869static int
44870test_xmlXPathNodeLeadingSorted(void) {
44871 int test_ret = 0;
44872
44873
44874 /* missing type support */
44875 return(test_ret);
44876}
44877
44878
44879static int
44880test_xmlXPathNodeSetAdd(void) {
44881 int test_ret = 0;
44882
44883#ifdef LIBXML_XPATH_ENABLED
44884 int mem_base;
44885 xmlNodeSetPtr cur; /* the initial node set */
44886 int n_cur;
44887 xmlNodePtr val; /* a new xmlNodePtr */
44888 int n_val;
44889
44890 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
44891 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
44892 mem_base = xmlMemBlocks();
44893 cur = gen_xmlNodeSetPtr(n_cur, 0);
44894 val = gen_xmlNodePtr(n_val, 1);
44895
44896 xmlXPathNodeSetAdd(cur, val);
44897 call_tests++;
44898 des_xmlNodeSetPtr(n_cur, cur, 0);
44899 des_xmlNodePtr(n_val, val, 1);
44900 xmlResetLastError();
44901 if (mem_base != xmlMemBlocks()) {
44902 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
44903 xmlMemBlocks() - mem_base);
44904 test_ret++;
44905 printf(" %d", n_cur);
44906 printf(" %d", n_val);
44907 printf("\n");
44908 }
44909 }
44910 }
44911#endif
44912
44913 function_tests++;
44914 return(test_ret);
44915}
44916
44917
44918static int
44919test_xmlXPathNodeSetAddNs(void) {
44920 int test_ret = 0;
44921
44922#ifdef LIBXML_XPATH_ENABLED
44923 int mem_base;
44924 xmlNodeSetPtr cur; /* the initial node set */
44925 int n_cur;
44926 xmlNodePtr node; /* the hosting node */
44927 int n_node;
44928 xmlNsPtr ns; /* a the namespace node */
44929 int n_ns;
44930
44931 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
44932 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
44933 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
44934 mem_base = xmlMemBlocks();
44935 cur = gen_xmlNodeSetPtr(n_cur, 0);
44936 node = gen_xmlNodePtr(n_node, 1);
44937 ns = gen_xmlNsPtr(n_ns, 2);
44938
44939 xmlXPathNodeSetAddNs(cur, node, ns);
44940 call_tests++;
44941 des_xmlNodeSetPtr(n_cur, cur, 0);
44942 des_xmlNodePtr(n_node, node, 1);
44943 des_xmlNsPtr(n_ns, ns, 2);
44944 xmlResetLastError();
44945 if (mem_base != xmlMemBlocks()) {
44946 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
44947 xmlMemBlocks() - mem_base);
44948 test_ret++;
44949 printf(" %d", n_cur);
44950 printf(" %d", n_node);
44951 printf(" %d", n_ns);
44952 printf("\n");
44953 }
44954 }
44955 }
44956 }
44957#endif
44958
44959 function_tests++;
44960 return(test_ret);
44961}
44962
44963
44964static int
44965test_xmlXPathNodeSetAddUnique(void) {
44966 int test_ret = 0;
44967
44968#ifdef LIBXML_XPATH_ENABLED
44969 int mem_base;
44970 xmlNodeSetPtr cur; /* the initial node set */
44971 int n_cur;
44972 xmlNodePtr val; /* a new xmlNodePtr */
44973 int n_val;
44974
44975 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
44976 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
44977 mem_base = xmlMemBlocks();
44978 cur = gen_xmlNodeSetPtr(n_cur, 0);
44979 val = gen_xmlNodePtr(n_val, 1);
44980
44981 xmlXPathNodeSetAddUnique(cur, val);
44982 call_tests++;
44983 des_xmlNodeSetPtr(n_cur, cur, 0);
44984 des_xmlNodePtr(n_val, val, 1);
44985 xmlResetLastError();
44986 if (mem_base != xmlMemBlocks()) {
44987 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
44988 xmlMemBlocks() - mem_base);
44989 test_ret++;
44990 printf(" %d", n_cur);
44991 printf(" %d", n_val);
44992 printf("\n");
44993 }
44994 }
44995 }
44996#endif
44997
44998 function_tests++;
44999 return(test_ret);
45000}
45001
45002
45003static int
45004test_xmlXPathNodeSetContains(void) {
45005 int test_ret = 0;
45006
45007#ifdef LIBXML_XPATH_ENABLED
45008 int mem_base;
45009 int ret_val;
45010 xmlNodeSetPtr cur; /* the node-set */
45011 int n_cur;
45012 xmlNodePtr val; /* the node */
45013 int n_val;
45014
45015 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45016 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45017 mem_base = xmlMemBlocks();
45018 cur = gen_xmlNodeSetPtr(n_cur, 0);
45019 val = gen_xmlNodePtr(n_val, 1);
45020
45021 ret_val = xmlXPathNodeSetContains(cur, val);
45022 desret_int(ret_val);
45023 call_tests++;
45024 des_xmlNodeSetPtr(n_cur, cur, 0);
45025 des_xmlNodePtr(n_val, val, 1);
45026 xmlResetLastError();
45027 if (mem_base != xmlMemBlocks()) {
45028 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
45029 xmlMemBlocks() - mem_base);
45030 test_ret++;
45031 printf(" %d", n_cur);
45032 printf(" %d", n_val);
45033 printf("\n");
45034 }
45035 }
45036 }
45037#endif
45038
45039 function_tests++;
45040 return(test_ret);
45041}
45042
45043
45044static int
45045test_xmlXPathNodeSetDel(void) {
45046 int test_ret = 0;
45047
45048#ifdef LIBXML_XPATH_ENABLED
45049 int mem_base;
45050 xmlNodeSetPtr cur; /* the initial node set */
45051 int n_cur;
45052 xmlNodePtr val; /* an xmlNodePtr */
45053 int n_val;
45054
45055 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45056 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45057 mem_base = xmlMemBlocks();
45058 cur = gen_xmlNodeSetPtr(n_cur, 0);
45059 val = gen_xmlNodePtr(n_val, 1);
45060
45061 xmlXPathNodeSetDel(cur, val);
45062 call_tests++;
45063 des_xmlNodeSetPtr(n_cur, cur, 0);
45064 des_xmlNodePtr(n_val, val, 1);
45065 xmlResetLastError();
45066 if (mem_base != xmlMemBlocks()) {
45067 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
45068 xmlMemBlocks() - mem_base);
45069 test_ret++;
45070 printf(" %d", n_cur);
45071 printf(" %d", n_val);
45072 printf("\n");
45073 }
45074 }
45075 }
45076#endif
45077
45078 function_tests++;
45079 return(test_ret);
45080}
45081
45082
45083static int
45084test_xmlXPathNodeSetMerge(void) {
45085 int test_ret = 0;
45086
45087
45088 /* missing type support */
45089 return(test_ret);
45090}
45091
45092
45093static int
45094test_xmlXPathNodeSetRemove(void) {
45095 int test_ret = 0;
45096
45097#ifdef LIBXML_XPATH_ENABLED
45098 int mem_base;
45099 xmlNodeSetPtr cur; /* the initial node set */
45100 int n_cur;
45101 int val; /* the index to remove */
45102 int n_val;
45103
45104 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45105 for (n_val = 0;n_val < gen_nb_int;n_val++) {
45106 mem_base = xmlMemBlocks();
45107 cur = gen_xmlNodeSetPtr(n_cur, 0);
45108 val = gen_int(n_val, 1);
45109
45110 xmlXPathNodeSetRemove(cur, val);
45111 call_tests++;
45112 des_xmlNodeSetPtr(n_cur, cur, 0);
45113 des_int(n_val, val, 1);
45114 xmlResetLastError();
45115 if (mem_base != xmlMemBlocks()) {
45116 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
45117 xmlMemBlocks() - mem_base);
45118 test_ret++;
45119 printf(" %d", n_cur);
45120 printf(" %d", n_val);
45121 printf("\n");
45122 }
45123 }
45124 }
45125#endif
45126
45127 function_tests++;
45128 return(test_ret);
45129}
45130
45131
45132static int
45133test_xmlXPathNodeSetSort(void) {
45134 int test_ret = 0;
45135
45136#ifdef LIBXML_XPATH_ENABLED
45137 int mem_base;
45138 xmlNodeSetPtr set; /* the node set */
45139 int n_set;
45140
45141 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
45142 mem_base = xmlMemBlocks();
45143 set = gen_xmlNodeSetPtr(n_set, 0);
45144
45145 xmlXPathNodeSetSort(set);
45146 call_tests++;
45147 des_xmlNodeSetPtr(n_set, set, 0);
45148 xmlResetLastError();
45149 if (mem_base != xmlMemBlocks()) {
45150 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
45151 xmlMemBlocks() - mem_base);
45152 test_ret++;
45153 printf(" %d", n_set);
45154 printf("\n");
45155 }
45156 }
45157#endif
45158
45159 function_tests++;
45160 return(test_ret);
45161}
45162
45163
45164static int
45165test_xmlXPathNodeTrailing(void) {
45166 int test_ret = 0;
45167
45168
45169 /* missing type support */
45170 return(test_ret);
45171}
45172
45173
45174static int
45175test_xmlXPathNodeTrailingSorted(void) {
45176 int test_ret = 0;
45177
45178
45179 /* missing type support */
45180 return(test_ret);
45181}
45182
45183
45184static int
45185test_xmlXPathNormalizeFunction(void) {
45186 int test_ret = 0;
45187
45188#ifdef LIBXML_XPATH_ENABLED
45189 int mem_base;
45190 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45191 int n_ctxt;
45192 int nargs; /* the number of arguments */
45193 int n_nargs;
45194
45195 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45196 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45197 mem_base = xmlMemBlocks();
45198 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45199 nargs = gen_int(n_nargs, 1);
45200
45201 xmlXPathNormalizeFunction(ctxt, nargs);
45202 call_tests++;
45203 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45204 des_int(n_nargs, nargs, 1);
45205 xmlResetLastError();
45206 if (mem_base != xmlMemBlocks()) {
45207 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
45208 xmlMemBlocks() - mem_base);
45209 test_ret++;
45210 printf(" %d", n_ctxt);
45211 printf(" %d", n_nargs);
45212 printf("\n");
45213 }
45214 }
45215 }
45216#endif
45217
45218 function_tests++;
45219 return(test_ret);
45220}
45221
45222
45223static int
45224test_xmlXPathNotEqualValues(void) {
45225 int test_ret = 0;
45226
45227#ifdef LIBXML_XPATH_ENABLED
45228 int mem_base;
45229 int ret_val;
45230 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45231 int n_ctxt;
45232
45233 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45234 mem_base = xmlMemBlocks();
45235 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45236
45237 ret_val = xmlXPathNotEqualValues(ctxt);
45238 desret_int(ret_val);
45239 call_tests++;
45240 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45241 xmlResetLastError();
45242 if (mem_base != xmlMemBlocks()) {
45243 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
45244 xmlMemBlocks() - mem_base);
45245 test_ret++;
45246 printf(" %d", n_ctxt);
45247 printf("\n");
45248 }
45249 }
45250#endif
45251
45252 function_tests++;
45253 return(test_ret);
45254}
45255
45256
45257static int
45258test_xmlXPathNotFunction(void) {
45259 int test_ret = 0;
45260
45261#ifdef LIBXML_XPATH_ENABLED
45262 int mem_base;
45263 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45264 int n_ctxt;
45265 int nargs; /* the number of arguments */
45266 int n_nargs;
45267
45268 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45269 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45270 mem_base = xmlMemBlocks();
45271 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45272 nargs = gen_int(n_nargs, 1);
45273
45274 xmlXPathNotFunction(ctxt, nargs);
45275 call_tests++;
45276 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45277 des_int(n_nargs, nargs, 1);
45278 xmlResetLastError();
45279 if (mem_base != xmlMemBlocks()) {
45280 printf("Leak of %d blocks found in xmlXPathNotFunction",
45281 xmlMemBlocks() - mem_base);
45282 test_ret++;
45283 printf(" %d", n_ctxt);
45284 printf(" %d", n_nargs);
45285 printf("\n");
45286 }
45287 }
45288 }
45289#endif
45290
45291 function_tests++;
45292 return(test_ret);
45293}
45294
45295
45296static int
45297test_xmlXPathNsLookup(void) {
45298 int test_ret = 0;
45299
45300#ifdef LIBXML_XPATH_ENABLED
45301 int mem_base;
45302 const xmlChar * ret_val;
45303 xmlXPathContextPtr ctxt; /* the XPath context */
45304 int n_ctxt;
45305 xmlChar * prefix; /* the namespace prefix value */
45306 int n_prefix;
45307
45308 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
45309 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
45310 mem_base = xmlMemBlocks();
45311 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
45312 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
45313
45314 ret_val = xmlXPathNsLookup(ctxt, prefix);
45315 desret_const_xmlChar_ptr(ret_val);
45316 call_tests++;
45317 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
45318 des_const_xmlChar_ptr(n_prefix, prefix, 1);
45319 xmlResetLastError();
45320 if (mem_base != xmlMemBlocks()) {
45321 printf("Leak of %d blocks found in xmlXPathNsLookup",
45322 xmlMemBlocks() - mem_base);
45323 test_ret++;
45324 printf(" %d", n_ctxt);
45325 printf(" %d", n_prefix);
45326 printf("\n");
45327 }
45328 }
45329 }
45330#endif
45331
45332 function_tests++;
45333 return(test_ret);
45334}
45335
45336
45337static int
45338test_xmlXPathNumberFunction(void) {
45339 int test_ret = 0;
45340
45341#ifdef LIBXML_XPATH_ENABLED
45342 int mem_base;
45343 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45344 int n_ctxt;
45345 int nargs; /* the number of arguments */
45346 int n_nargs;
45347
45348 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45349 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45350 mem_base = xmlMemBlocks();
45351 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45352 nargs = gen_int(n_nargs, 1);
45353
45354 xmlXPathNumberFunction(ctxt, nargs);
45355 call_tests++;
45356 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45357 des_int(n_nargs, nargs, 1);
45358 xmlResetLastError();
45359 if (mem_base != xmlMemBlocks()) {
45360 printf("Leak of %d blocks found in xmlXPathNumberFunction",
45361 xmlMemBlocks() - mem_base);
45362 test_ret++;
45363 printf(" %d", n_ctxt);
45364 printf(" %d", n_nargs);
45365 printf("\n");
45366 }
45367 }
45368 }
45369#endif
45370
45371 function_tests++;
45372 return(test_ret);
45373}
45374
45375
45376static int
45377test_xmlXPathParseNCName(void) {
45378 int test_ret = 0;
45379
45380#ifdef LIBXML_XPATH_ENABLED
45381 int mem_base;
45382 xmlChar * ret_val;
45383 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45384 int n_ctxt;
45385
45386 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45387 mem_base = xmlMemBlocks();
45388 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45389
45390 ret_val = xmlXPathParseNCName(ctxt);
45391 desret_xmlChar_ptr(ret_val);
45392 call_tests++;
45393 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45394 xmlResetLastError();
45395 if (mem_base != xmlMemBlocks()) {
45396 printf("Leak of %d blocks found in xmlXPathParseNCName",
45397 xmlMemBlocks() - mem_base);
45398 test_ret++;
45399 printf(" %d", n_ctxt);
45400 printf("\n");
45401 }
45402 }
45403#endif
45404
45405 function_tests++;
45406 return(test_ret);
45407}
45408
45409
45410static int
45411test_xmlXPathParseName(void) {
45412 int test_ret = 0;
45413
45414#ifdef LIBXML_XPATH_ENABLED
45415 int mem_base;
45416 xmlChar * ret_val;
45417 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45418 int n_ctxt;
45419
45420 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45421 mem_base = xmlMemBlocks();
45422 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45423
45424 ret_val = xmlXPathParseName(ctxt);
45425 desret_xmlChar_ptr(ret_val);
45426 call_tests++;
45427 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45428 xmlResetLastError();
45429 if (mem_base != xmlMemBlocks()) {
45430 printf("Leak of %d blocks found in xmlXPathParseName",
45431 xmlMemBlocks() - mem_base);
45432 test_ret++;
45433 printf(" %d", n_ctxt);
45434 printf("\n");
45435 }
45436 }
45437#endif
45438
45439 function_tests++;
45440 return(test_ret);
45441}
45442
45443
45444static int
45445test_xmlXPathPopBoolean(void) {
45446 int test_ret = 0;
45447
45448#ifdef LIBXML_XPATH_ENABLED
45449 int mem_base;
45450 int ret_val;
45451 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
45452 int n_ctxt;
45453
45454 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45455 mem_base = xmlMemBlocks();
45456 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45457
45458 ret_val = xmlXPathPopBoolean(ctxt);
45459 desret_int(ret_val);
45460 call_tests++;
45461 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45462 xmlResetLastError();
45463 if (mem_base != xmlMemBlocks()) {
45464 printf("Leak of %d blocks found in xmlXPathPopBoolean",
45465 xmlMemBlocks() - mem_base);
45466 test_ret++;
45467 printf(" %d", n_ctxt);
45468 printf("\n");
45469 }
45470 }
45471#endif
45472
45473 function_tests++;
45474 return(test_ret);
45475}
45476
45477
45478static int
45479test_xmlXPathPopExternal(void) {
45480 int test_ret = 0;
45481
45482#ifdef LIBXML_XPATH_ENABLED
45483 int mem_base;
45484 void * ret_val;
45485 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
45486 int n_ctxt;
45487
45488 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45489 mem_base = xmlMemBlocks();
45490 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45491
45492 ret_val = xmlXPathPopExternal(ctxt);
45493 desret_void_ptr(ret_val);
45494 call_tests++;
45495 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45496 xmlResetLastError();
45497 if (mem_base != xmlMemBlocks()) {
45498 printf("Leak of %d blocks found in xmlXPathPopExternal",
45499 xmlMemBlocks() - mem_base);
45500 test_ret++;
45501 printf(" %d", n_ctxt);
45502 printf("\n");
45503 }
45504 }
45505#endif
45506
45507 function_tests++;
45508 return(test_ret);
45509}
45510
45511
45512static int
45513test_xmlXPathPopNodeSet(void) {
45514 int test_ret = 0;
45515
45516
45517 /* missing type support */
45518 return(test_ret);
45519}
45520
45521
45522static int
45523test_xmlXPathPopNumber(void) {
45524 int test_ret = 0;
45525
45526#ifdef LIBXML_XPATH_ENABLED
45527 int mem_base;
45528 double ret_val;
45529 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
45530 int n_ctxt;
45531
45532 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45533 mem_base = xmlMemBlocks();
45534 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45535
45536 ret_val = xmlXPathPopNumber(ctxt);
45537 desret_double(ret_val);
45538 call_tests++;
45539 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45540 xmlResetLastError();
45541 if (mem_base != xmlMemBlocks()) {
45542 printf("Leak of %d blocks found in xmlXPathPopNumber",
45543 xmlMemBlocks() - mem_base);
45544 test_ret++;
45545 printf(" %d", n_ctxt);
45546 printf("\n");
45547 }
45548 }
45549#endif
45550
45551 function_tests++;
45552 return(test_ret);
45553}
45554
45555
45556static int
45557test_xmlXPathPopString(void) {
45558 int test_ret = 0;
45559
45560#ifdef LIBXML_XPATH_ENABLED
45561 int mem_base;
45562 xmlChar * ret_val;
45563 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
45564 int n_ctxt;
45565
45566 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45567 mem_base = xmlMemBlocks();
45568 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45569
45570 ret_val = xmlXPathPopString(ctxt);
45571 desret_xmlChar_ptr(ret_val);
45572 call_tests++;
45573 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45574 xmlResetLastError();
45575 if (mem_base != xmlMemBlocks()) {
45576 printf("Leak of %d blocks found in xmlXPathPopString",
45577 xmlMemBlocks() - mem_base);
45578 test_ret++;
45579 printf(" %d", n_ctxt);
45580 printf("\n");
45581 }
45582 }
45583#endif
45584
45585 function_tests++;
45586 return(test_ret);
45587}
45588
45589
45590static int
45591test_xmlXPathPositionFunction(void) {
45592 int test_ret = 0;
45593
45594#ifdef LIBXML_XPATH_ENABLED
45595 int mem_base;
45596 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45597 int n_ctxt;
45598 int nargs; /* the number of arguments */
45599 int n_nargs;
45600
45601 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45602 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45603 mem_base = xmlMemBlocks();
45604 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45605 nargs = gen_int(n_nargs, 1);
45606
45607 xmlXPathPositionFunction(ctxt, nargs);
45608 call_tests++;
45609 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45610 des_int(n_nargs, nargs, 1);
45611 xmlResetLastError();
45612 if (mem_base != xmlMemBlocks()) {
45613 printf("Leak of %d blocks found in xmlXPathPositionFunction",
45614 xmlMemBlocks() - mem_base);
45615 test_ret++;
45616 printf(" %d", n_ctxt);
45617 printf(" %d", n_nargs);
45618 printf("\n");
45619 }
45620 }
45621 }
45622#endif
45623
45624 function_tests++;
45625 return(test_ret);
45626}
45627
45628
45629static int
45630test_xmlXPathRegisterAllFunctions(void) {
45631 int test_ret = 0;
45632
45633#ifdef LIBXML_XPATH_ENABLED
45634 int mem_base;
45635 xmlXPathContextPtr ctxt; /* the XPath context */
45636 int n_ctxt;
45637
45638 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
45639 mem_base = xmlMemBlocks();
45640 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
45641
45642 xmlXPathRegisterAllFunctions(ctxt);
45643 call_tests++;
45644 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
45645 xmlResetLastError();
45646 if (mem_base != xmlMemBlocks()) {
45647 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
45648 xmlMemBlocks() - mem_base);
45649 test_ret++;
45650 printf(" %d", n_ctxt);
45651 printf("\n");
45652 }
45653 }
45654#endif
45655
45656 function_tests++;
45657 return(test_ret);
45658}
45659
45660
45661static int
45662test_xmlXPathRegisterFunc(void) {
45663 int test_ret = 0;
45664
45665
45666 /* missing type support */
45667 return(test_ret);
45668}
45669
45670
45671static int
45672test_xmlXPathRegisterFuncLookup(void) {
45673 int test_ret = 0;
45674
45675
45676 /* missing type support */
45677 return(test_ret);
45678}
45679
45680
45681static int
45682test_xmlXPathRegisterFuncNS(void) {
45683 int test_ret = 0;
45684
45685
45686 /* missing type support */
45687 return(test_ret);
45688}
45689
45690
45691static int
45692test_xmlXPathRegisterNs(void) {
45693 int test_ret = 0;
45694
45695#ifdef LIBXML_XPATH_ENABLED
45696 int mem_base;
45697 int ret_val;
45698 xmlXPathContextPtr ctxt; /* the XPath context */
45699 int n_ctxt;
45700 xmlChar * prefix; /* the namespace prefix */
45701 int n_prefix;
45702 xmlChar * ns_uri; /* the namespace name */
45703 int n_ns_uri;
45704
45705 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
45706 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
45707 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
45708 mem_base = xmlMemBlocks();
45709 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
45710 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
45711 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
45712
45713 ret_val = xmlXPathRegisterNs(ctxt, prefix, ns_uri);
45714 desret_int(ret_val);
45715 call_tests++;
45716 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
45717 des_const_xmlChar_ptr(n_prefix, prefix, 1);
45718 des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2);
45719 xmlResetLastError();
45720 if (mem_base != xmlMemBlocks()) {
45721 printf("Leak of %d blocks found in xmlXPathRegisterNs",
45722 xmlMemBlocks() - mem_base);
45723 test_ret++;
45724 printf(" %d", n_ctxt);
45725 printf(" %d", n_prefix);
45726 printf(" %d", n_ns_uri);
45727 printf("\n");
45728 }
45729 }
45730 }
45731 }
45732#endif
45733
45734 function_tests++;
45735 return(test_ret);
45736}
45737
45738
45739static int
45740test_xmlXPathRegisterVariable(void) {
45741 int test_ret = 0;
45742
45743#ifdef LIBXML_XPATH_ENABLED
45744 int mem_base;
45745 int ret_val;
45746 xmlXPathContextPtr ctxt; /* the XPath context */
45747 int n_ctxt;
45748 xmlChar * name; /* the variable name */
45749 int n_name;
45750 xmlXPathObjectPtr value; /* the variable value or NULL */
45751 int n_value;
45752
45753 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
45754 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
45755 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
45756 mem_base = xmlMemBlocks();
45757 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
45758 name = gen_const_xmlChar_ptr(n_name, 1);
45759 value = gen_xmlXPathObjectPtr(n_value, 2);
45760
45761 ret_val = xmlXPathRegisterVariable(ctxt, name, value);
45762 desret_int(ret_val);
45763 call_tests++;
45764 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
45765 des_const_xmlChar_ptr(n_name, name, 1);
45766 des_xmlXPathObjectPtr(n_value, value, 2);
45767 xmlResetLastError();
45768 if (mem_base != xmlMemBlocks()) {
45769 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
45770 xmlMemBlocks() - mem_base);
45771 test_ret++;
45772 printf(" %d", n_ctxt);
45773 printf(" %d", n_name);
45774 printf(" %d", n_value);
45775 printf("\n");
45776 }
45777 }
45778 }
45779 }
45780#endif
45781
45782 function_tests++;
45783 return(test_ret);
45784}
45785
45786
45787static int
45788test_xmlXPathRegisterVariableLookup(void) {
45789 int test_ret = 0;
45790
45791
45792 /* missing type support */
45793 return(test_ret);
45794}
45795
45796
45797static int
45798test_xmlXPathRegisterVariableNS(void) {
45799 int test_ret = 0;
45800
45801#ifdef LIBXML_XPATH_ENABLED
45802 int mem_base;
45803 int ret_val;
45804 xmlXPathContextPtr ctxt; /* the XPath context */
45805 int n_ctxt;
45806 xmlChar * name; /* the variable name */
45807 int n_name;
45808 xmlChar * ns_uri; /* the variable namespace URI */
45809 int n_ns_uri;
45810 xmlXPathObjectPtr value; /* the variable value or NULL */
45811 int n_value;
45812
45813 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
45814 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
45815 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
45816 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
45817 mem_base = xmlMemBlocks();
45818 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
45819 name = gen_const_xmlChar_ptr(n_name, 1);
45820 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
45821 value = gen_xmlXPathObjectPtr(n_value, 3);
45822
45823 ret_val = xmlXPathRegisterVariableNS(ctxt, name, ns_uri, value);
45824 desret_int(ret_val);
45825 call_tests++;
45826 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
45827 des_const_xmlChar_ptr(n_name, name, 1);
45828 des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2);
45829 des_xmlXPathObjectPtr(n_value, value, 3);
45830 xmlResetLastError();
45831 if (mem_base != xmlMemBlocks()) {
45832 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
45833 xmlMemBlocks() - mem_base);
45834 test_ret++;
45835 printf(" %d", n_ctxt);
45836 printf(" %d", n_name);
45837 printf(" %d", n_ns_uri);
45838 printf(" %d", n_value);
45839 printf("\n");
45840 }
45841 }
45842 }
45843 }
45844 }
45845#endif
45846
45847 function_tests++;
45848 return(test_ret);
45849}
45850
45851
45852static int
45853test_xmlXPathRegisteredFuncsCleanup(void) {
45854 int test_ret = 0;
45855
45856#ifdef LIBXML_XPATH_ENABLED
45857 int mem_base;
45858 xmlXPathContextPtr ctxt; /* the XPath context */
45859 int n_ctxt;
45860
45861 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
45862 mem_base = xmlMemBlocks();
45863 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
45864
45865 xmlXPathRegisteredFuncsCleanup(ctxt);
45866 call_tests++;
45867 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
45868 xmlResetLastError();
45869 if (mem_base != xmlMemBlocks()) {
45870 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
45871 xmlMemBlocks() - mem_base);
45872 test_ret++;
45873 printf(" %d", n_ctxt);
45874 printf("\n");
45875 }
45876 }
45877#endif
45878
45879 function_tests++;
45880 return(test_ret);
45881}
45882
45883
45884static int
45885test_xmlXPathRegisteredNsCleanup(void) {
45886 int test_ret = 0;
45887
45888#ifdef LIBXML_XPATH_ENABLED
45889 int mem_base;
45890 xmlXPathContextPtr ctxt; /* the XPath context */
45891 int n_ctxt;
45892
45893 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
45894 mem_base = xmlMemBlocks();
45895 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
45896
45897 xmlXPathRegisteredNsCleanup(ctxt);
45898 call_tests++;
45899 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
45900 xmlResetLastError();
45901 if (mem_base != xmlMemBlocks()) {
45902 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
45903 xmlMemBlocks() - mem_base);
45904 test_ret++;
45905 printf(" %d", n_ctxt);
45906 printf("\n");
45907 }
45908 }
45909#endif
45910
45911 function_tests++;
45912 return(test_ret);
45913}
45914
45915
45916static int
45917test_xmlXPathRegisteredVariablesCleanup(void) {
45918 int test_ret = 0;
45919
45920#ifdef LIBXML_XPATH_ENABLED
45921 int mem_base;
45922 xmlXPathContextPtr ctxt; /* the XPath context */
45923 int n_ctxt;
45924
45925 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
45926 mem_base = xmlMemBlocks();
45927 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
45928
45929 xmlXPathRegisteredVariablesCleanup(ctxt);
45930 call_tests++;
45931 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
45932 xmlResetLastError();
45933 if (mem_base != xmlMemBlocks()) {
45934 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
45935 xmlMemBlocks() - mem_base);
45936 test_ret++;
45937 printf(" %d", n_ctxt);
45938 printf("\n");
45939 }
45940 }
45941#endif
45942
45943 function_tests++;
45944 return(test_ret);
45945}
45946
45947
45948static int
45949test_xmlXPathRoot(void) {
45950 int test_ret = 0;
45951
45952#ifdef LIBXML_XPATH_ENABLED
45953 int mem_base;
45954 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45955 int n_ctxt;
45956
45957 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45958 mem_base = xmlMemBlocks();
45959 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45960
45961 xmlXPathRoot(ctxt);
45962 call_tests++;
45963 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45964 xmlResetLastError();
45965 if (mem_base != xmlMemBlocks()) {
45966 printf("Leak of %d blocks found in xmlXPathRoot",
45967 xmlMemBlocks() - mem_base);
45968 test_ret++;
45969 printf(" %d", n_ctxt);
45970 printf("\n");
45971 }
45972 }
45973#endif
45974
45975 function_tests++;
45976 return(test_ret);
45977}
45978
45979
45980static int
45981test_xmlXPathRoundFunction(void) {
45982 int test_ret = 0;
45983
45984#ifdef LIBXML_XPATH_ENABLED
45985 int mem_base;
45986 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45987 int n_ctxt;
45988 int nargs; /* the number of arguments */
45989 int n_nargs;
45990
45991 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45992 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45993 mem_base = xmlMemBlocks();
45994 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45995 nargs = gen_int(n_nargs, 1);
45996
45997 xmlXPathRoundFunction(ctxt, nargs);
45998 call_tests++;
45999 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46000 des_int(n_nargs, nargs, 1);
46001 xmlResetLastError();
46002 if (mem_base != xmlMemBlocks()) {
46003 printf("Leak of %d blocks found in xmlXPathRoundFunction",
46004 xmlMemBlocks() - mem_base);
46005 test_ret++;
46006 printf(" %d", n_ctxt);
46007 printf(" %d", n_nargs);
46008 printf("\n");
46009 }
46010 }
46011 }
46012#endif
46013
46014 function_tests++;
46015 return(test_ret);
46016}
46017
46018
46019static int
46020test_xmlXPathStartsWithFunction(void) {
46021 int test_ret = 0;
46022
46023#ifdef LIBXML_XPATH_ENABLED
46024 int mem_base;
46025 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46026 int n_ctxt;
46027 int nargs; /* the number of arguments */
46028 int n_nargs;
46029
46030 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46031 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46032 mem_base = xmlMemBlocks();
46033 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46034 nargs = gen_int(n_nargs, 1);
46035
46036 xmlXPathStartsWithFunction(ctxt, nargs);
46037 call_tests++;
46038 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46039 des_int(n_nargs, nargs, 1);
46040 xmlResetLastError();
46041 if (mem_base != xmlMemBlocks()) {
46042 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
46043 xmlMemBlocks() - mem_base);
46044 test_ret++;
46045 printf(" %d", n_ctxt);
46046 printf(" %d", n_nargs);
46047 printf("\n");
46048 }
46049 }
46050 }
46051#endif
46052
46053 function_tests++;
46054 return(test_ret);
46055}
46056
46057
46058static int
46059test_xmlXPathStringEvalNumber(void) {
46060 int test_ret = 0;
46061
46062#ifdef LIBXML_XPATH_ENABLED
46063 int mem_base;
46064 double ret_val;
46065 xmlChar * str; /* A string to scan */
46066 int n_str;
46067
46068 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
46069 mem_base = xmlMemBlocks();
46070 str = gen_const_xmlChar_ptr(n_str, 0);
46071
46072 ret_val = xmlXPathStringEvalNumber(str);
46073 desret_double(ret_val);
46074 call_tests++;
46075 des_const_xmlChar_ptr(n_str, str, 0);
46076 xmlResetLastError();
46077 if (mem_base != xmlMemBlocks()) {
46078 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
46079 xmlMemBlocks() - mem_base);
46080 test_ret++;
46081 printf(" %d", n_str);
46082 printf("\n");
46083 }
46084 }
46085#endif
46086
46087 function_tests++;
46088 return(test_ret);
46089}
46090
46091
46092static int
46093test_xmlXPathStringFunction(void) {
46094 int test_ret = 0;
46095
46096#ifdef LIBXML_XPATH_ENABLED
46097 int mem_base;
46098 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46099 int n_ctxt;
46100 int nargs; /* the number of arguments */
46101 int n_nargs;
46102
46103 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46104 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46105 mem_base = xmlMemBlocks();
46106 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46107 nargs = gen_int(n_nargs, 1);
46108
46109 xmlXPathStringFunction(ctxt, nargs);
46110 call_tests++;
46111 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46112 des_int(n_nargs, nargs, 1);
46113 xmlResetLastError();
46114 if (mem_base != xmlMemBlocks()) {
46115 printf("Leak of %d blocks found in xmlXPathStringFunction",
46116 xmlMemBlocks() - mem_base);
46117 test_ret++;
46118 printf(" %d", n_ctxt);
46119 printf(" %d", n_nargs);
46120 printf("\n");
46121 }
46122 }
46123 }
46124#endif
46125
46126 function_tests++;
46127 return(test_ret);
46128}
46129
46130
46131static int
46132test_xmlXPathStringLengthFunction(void) {
46133 int test_ret = 0;
46134
46135#ifdef LIBXML_XPATH_ENABLED
46136 int mem_base;
46137 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46138 int n_ctxt;
46139 int nargs; /* the number of arguments */
46140 int n_nargs;
46141
46142 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46143 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46144 mem_base = xmlMemBlocks();
46145 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46146 nargs = gen_int(n_nargs, 1);
46147
46148 xmlXPathStringLengthFunction(ctxt, nargs);
46149 call_tests++;
46150 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46151 des_int(n_nargs, nargs, 1);
46152 xmlResetLastError();
46153 if (mem_base != xmlMemBlocks()) {
46154 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
46155 xmlMemBlocks() - mem_base);
46156 test_ret++;
46157 printf(" %d", n_ctxt);
46158 printf(" %d", n_nargs);
46159 printf("\n");
46160 }
46161 }
46162 }
46163#endif
46164
46165 function_tests++;
46166 return(test_ret);
46167}
46168
46169
46170static int
46171test_xmlXPathSubValues(void) {
46172 int test_ret = 0;
46173
46174#ifdef LIBXML_XPATH_ENABLED
46175 int mem_base;
46176 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46177 int n_ctxt;
46178
46179 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46180 mem_base = xmlMemBlocks();
46181 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46182
46183 xmlXPathSubValues(ctxt);
46184 call_tests++;
46185 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46186 xmlResetLastError();
46187 if (mem_base != xmlMemBlocks()) {
46188 printf("Leak of %d blocks found in xmlXPathSubValues",
46189 xmlMemBlocks() - mem_base);
46190 test_ret++;
46191 printf(" %d", n_ctxt);
46192 printf("\n");
46193 }
46194 }
46195#endif
46196
46197 function_tests++;
46198 return(test_ret);
46199}
46200
46201
46202static int
46203test_xmlXPathSubstringAfterFunction(void) {
46204 int test_ret = 0;
46205
46206#ifdef LIBXML_XPATH_ENABLED
46207 int mem_base;
46208 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46209 int n_ctxt;
46210 int nargs; /* the number of arguments */
46211 int n_nargs;
46212
46213 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46214 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46215 mem_base = xmlMemBlocks();
46216 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46217 nargs = gen_int(n_nargs, 1);
46218
46219 xmlXPathSubstringAfterFunction(ctxt, nargs);
46220 call_tests++;
46221 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46222 des_int(n_nargs, nargs, 1);
46223 xmlResetLastError();
46224 if (mem_base != xmlMemBlocks()) {
46225 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
46226 xmlMemBlocks() - mem_base);
46227 test_ret++;
46228 printf(" %d", n_ctxt);
46229 printf(" %d", n_nargs);
46230 printf("\n");
46231 }
46232 }
46233 }
46234#endif
46235
46236 function_tests++;
46237 return(test_ret);
46238}
46239
46240
46241static int
46242test_xmlXPathSubstringBeforeFunction(void) {
46243 int test_ret = 0;
46244
46245#ifdef LIBXML_XPATH_ENABLED
46246 int mem_base;
46247 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46248 int n_ctxt;
46249 int nargs; /* the number of arguments */
46250 int n_nargs;
46251
46252 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46253 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46254 mem_base = xmlMemBlocks();
46255 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46256 nargs = gen_int(n_nargs, 1);
46257
46258 xmlXPathSubstringBeforeFunction(ctxt, nargs);
46259 call_tests++;
46260 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46261 des_int(n_nargs, nargs, 1);
46262 xmlResetLastError();
46263 if (mem_base != xmlMemBlocks()) {
46264 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
46265 xmlMemBlocks() - mem_base);
46266 test_ret++;
46267 printf(" %d", n_ctxt);
46268 printf(" %d", n_nargs);
46269 printf("\n");
46270 }
46271 }
46272 }
46273#endif
46274
46275 function_tests++;
46276 return(test_ret);
46277}
46278
46279
46280static int
46281test_xmlXPathSubstringFunction(void) {
46282 int test_ret = 0;
46283
46284#ifdef LIBXML_XPATH_ENABLED
46285 int mem_base;
46286 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46287 int n_ctxt;
46288 int nargs; /* the number of arguments */
46289 int n_nargs;
46290
46291 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46292 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46293 mem_base = xmlMemBlocks();
46294 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46295 nargs = gen_int(n_nargs, 1);
46296
46297 xmlXPathSubstringFunction(ctxt, nargs);
46298 call_tests++;
46299 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46300 des_int(n_nargs, nargs, 1);
46301 xmlResetLastError();
46302 if (mem_base != xmlMemBlocks()) {
46303 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
46304 xmlMemBlocks() - mem_base);
46305 test_ret++;
46306 printf(" %d", n_ctxt);
46307 printf(" %d", n_nargs);
46308 printf("\n");
46309 }
46310 }
46311 }
46312#endif
46313
46314 function_tests++;
46315 return(test_ret);
46316}
46317
46318
46319static int
46320test_xmlXPathSumFunction(void) {
46321 int test_ret = 0;
46322
46323#ifdef LIBXML_XPATH_ENABLED
46324 int mem_base;
46325 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46326 int n_ctxt;
46327 int nargs; /* the number of arguments */
46328 int n_nargs;
46329
46330 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46331 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46332 mem_base = xmlMemBlocks();
46333 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46334 nargs = gen_int(n_nargs, 1);
46335
46336 xmlXPathSumFunction(ctxt, nargs);
46337 call_tests++;
46338 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46339 des_int(n_nargs, nargs, 1);
46340 xmlResetLastError();
46341 if (mem_base != xmlMemBlocks()) {
46342 printf("Leak of %d blocks found in xmlXPathSumFunction",
46343 xmlMemBlocks() - mem_base);
46344 test_ret++;
46345 printf(" %d", n_ctxt);
46346 printf(" %d", n_nargs);
46347 printf("\n");
46348 }
46349 }
46350 }
46351#endif
46352
46353 function_tests++;
46354 return(test_ret);
46355}
46356
46357
46358static int
46359test_xmlXPathTrailing(void) {
46360 int test_ret = 0;
46361
46362
46363 /* missing type support */
46364 return(test_ret);
46365}
46366
46367
46368static int
46369test_xmlXPathTrailingSorted(void) {
46370 int test_ret = 0;
46371
46372
46373 /* missing type support */
46374 return(test_ret);
46375}
46376
46377
46378static int
46379test_xmlXPathTranslateFunction(void) {
46380 int test_ret = 0;
46381
46382#ifdef LIBXML_XPATH_ENABLED
46383 int mem_base;
46384 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46385 int n_ctxt;
46386 int nargs; /* the number of arguments */
46387 int n_nargs;
46388
46389 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46390 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46391 mem_base = xmlMemBlocks();
46392 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46393 nargs = gen_int(n_nargs, 1);
46394
46395 xmlXPathTranslateFunction(ctxt, nargs);
46396 call_tests++;
46397 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46398 des_int(n_nargs, nargs, 1);
46399 xmlResetLastError();
46400 if (mem_base != xmlMemBlocks()) {
46401 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
46402 xmlMemBlocks() - mem_base);
46403 test_ret++;
46404 printf(" %d", n_ctxt);
46405 printf(" %d", n_nargs);
46406 printf("\n");
46407 }
46408 }
46409 }
46410#endif
46411
46412 function_tests++;
46413 return(test_ret);
46414}
46415
46416
46417static int
46418test_xmlXPathTrueFunction(void) {
46419 int test_ret = 0;
46420
46421#ifdef LIBXML_XPATH_ENABLED
46422 int mem_base;
46423 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46424 int n_ctxt;
46425 int nargs; /* the number of arguments */
46426 int n_nargs;
46427
46428 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46429 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46430 mem_base = xmlMemBlocks();
46431 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46432 nargs = gen_int(n_nargs, 1);
46433
46434 xmlXPathTrueFunction(ctxt, nargs);
46435 call_tests++;
46436 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46437 des_int(n_nargs, nargs, 1);
46438 xmlResetLastError();
46439 if (mem_base != xmlMemBlocks()) {
46440 printf("Leak of %d blocks found in xmlXPathTrueFunction",
46441 xmlMemBlocks() - mem_base);
46442 test_ret++;
46443 printf(" %d", n_ctxt);
46444 printf(" %d", n_nargs);
46445 printf("\n");
46446 }
46447 }
46448 }
46449#endif
46450
46451 function_tests++;
46452 return(test_ret);
46453}
46454
46455
46456static int
46457test_xmlXPathValueFlipSign(void) {
46458 int test_ret = 0;
46459
46460#ifdef LIBXML_XPATH_ENABLED
46461 int mem_base;
46462 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46463 int n_ctxt;
46464
46465 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46466 mem_base = xmlMemBlocks();
46467 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46468
46469 xmlXPathValueFlipSign(ctxt);
46470 call_tests++;
46471 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46472 xmlResetLastError();
46473 if (mem_base != xmlMemBlocks()) {
46474 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
46475 xmlMemBlocks() - mem_base);
46476 test_ret++;
46477 printf(" %d", n_ctxt);
46478 printf("\n");
46479 }
46480 }
46481#endif
46482
46483 function_tests++;
46484 return(test_ret);
46485}
46486
46487
46488static int
46489test_xmlXPathVariableLookup(void) {
46490 int test_ret = 0;
46491
46492#ifdef LIBXML_XPATH_ENABLED
46493 int mem_base;
46494 xmlXPathObjectPtr ret_val;
46495 xmlXPathContextPtr ctxt; /* the XPath context */
46496 int n_ctxt;
46497 xmlChar * name; /* the variable name */
46498 int n_name;
46499
46500 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46501 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46502 mem_base = xmlMemBlocks();
46503 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46504 name = gen_const_xmlChar_ptr(n_name, 1);
46505
46506 ret_val = xmlXPathVariableLookup(ctxt, name);
46507 desret_xmlXPathObjectPtr(ret_val);
46508 call_tests++;
46509 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46510 des_const_xmlChar_ptr(n_name, name, 1);
46511 xmlResetLastError();
46512 if (mem_base != xmlMemBlocks()) {
46513 printf("Leak of %d blocks found in xmlXPathVariableLookup",
46514 xmlMemBlocks() - mem_base);
46515 test_ret++;
46516 printf(" %d", n_ctxt);
46517 printf(" %d", n_name);
46518 printf("\n");
46519 }
46520 }
46521 }
46522#endif
46523
46524 function_tests++;
46525 return(test_ret);
46526}
46527
46528
46529static int
46530test_xmlXPathVariableLookupNS(void) {
46531 int test_ret = 0;
46532
46533#ifdef LIBXML_XPATH_ENABLED
46534 int mem_base;
46535 xmlXPathObjectPtr ret_val;
46536 xmlXPathContextPtr ctxt; /* the XPath context */
46537 int n_ctxt;
46538 xmlChar * name; /* the variable name */
46539 int n_name;
46540 xmlChar * ns_uri; /* the variable namespace URI */
46541 int n_ns_uri;
46542
46543 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46544 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46545 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46546 mem_base = xmlMemBlocks();
46547 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46548 name = gen_const_xmlChar_ptr(n_name, 1);
46549 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46550
46551 ret_val = xmlXPathVariableLookupNS(ctxt, name, ns_uri);
46552 desret_xmlXPathObjectPtr(ret_val);
46553 call_tests++;
46554 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46555 des_const_xmlChar_ptr(n_name, name, 1);
46556 des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2);
46557 xmlResetLastError();
46558 if (mem_base != xmlMemBlocks()) {
46559 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
46560 xmlMemBlocks() - mem_base);
46561 test_ret++;
46562 printf(" %d", n_ctxt);
46563 printf(" %d", n_name);
46564 printf(" %d", n_ns_uri);
46565 printf("\n");
46566 }
46567 }
46568 }
46569 }
46570#endif
46571
46572 function_tests++;
46573 return(test_ret);
46574}
46575
46576
46577static int
46578test_xmlXPathWrapCString(void) {
46579 int test_ret = 0;
46580
46581#ifdef LIBXML_XPATH_ENABLED
46582 int mem_base;
46583 xmlXPathObjectPtr ret_val;
46584 char * val; /* the char * value */
46585 int n_val;
46586
46587 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
46588 mem_base = xmlMemBlocks();
46589 val = gen_char_ptr(n_val, 0);
46590
46591 ret_val = xmlXPathWrapCString(val);
46592 desret_xmlXPathObjectPtr(ret_val);
46593 call_tests++;
46594 des_char_ptr(n_val, val, 0);
46595 xmlResetLastError();
46596 if (mem_base != xmlMemBlocks()) {
46597 printf("Leak of %d blocks found in xmlXPathWrapCString",
46598 xmlMemBlocks() - mem_base);
46599 test_ret++;
46600 printf(" %d", n_val);
46601 printf("\n");
46602 }
46603 }
46604#endif
46605
46606 function_tests++;
46607 return(test_ret);
46608}
46609
46610
46611static int
46612test_xmlXPathWrapExternal(void) {
46613 int test_ret = 0;
46614
46615#ifdef LIBXML_XPATH_ENABLED
46616 int mem_base;
46617 xmlXPathObjectPtr ret_val;
46618 void * val; /* the user data */
46619 int n_val;
46620
46621 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
46622 mem_base = xmlMemBlocks();
46623 val = gen_void_ptr(n_val, 0);
46624
46625 ret_val = xmlXPathWrapExternal(val);
46626 desret_xmlXPathObjectPtr(ret_val);
46627 call_tests++;
46628 des_void_ptr(n_val, val, 0);
46629 xmlResetLastError();
46630 if (mem_base != xmlMemBlocks()) {
46631 printf("Leak of %d blocks found in xmlXPathWrapExternal",
46632 xmlMemBlocks() - mem_base);
46633 test_ret++;
46634 printf(" %d", n_val);
46635 printf("\n");
46636 }
46637 }
46638#endif
46639
46640 function_tests++;
46641 return(test_ret);
46642}
46643
46644
46645static int
46646test_xmlXPathWrapNodeSet(void) {
46647 int test_ret = 0;
46648
46649#ifdef LIBXML_XPATH_ENABLED
46650 int mem_base;
46651 xmlXPathObjectPtr ret_val;
46652 xmlNodeSetPtr val; /* the NodePtr value */
46653 int n_val;
46654
46655 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
46656 mem_base = xmlMemBlocks();
46657 val = gen_xmlNodeSetPtr(n_val, 0);
46658
46659 ret_val = xmlXPathWrapNodeSet(val);
46660 desret_xmlXPathObjectPtr(ret_val);
46661 call_tests++;
46662 des_xmlNodeSetPtr(n_val, val, 0);
46663 xmlResetLastError();
46664 if (mem_base != xmlMemBlocks()) {
46665 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
46666 xmlMemBlocks() - mem_base);
46667 test_ret++;
46668 printf(" %d", n_val);
46669 printf("\n");
46670 }
46671 }
46672#endif
46673
46674 function_tests++;
46675 return(test_ret);
46676}
46677
46678
46679static int
46680test_xmlXPatherror(void) {
46681 int test_ret = 0;
46682
46683#ifdef LIBXML_XPATH_ENABLED
46684 int mem_base;
46685 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46686 int n_ctxt;
46687 const char * file; /* the file name */
46688 int n_file;
46689 int line; /* the line number */
46690 int n_line;
46691 int no; /* the error number */
46692 int n_no;
46693
46694 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46695 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
46696 for (n_line = 0;n_line < gen_nb_int;n_line++) {
46697 for (n_no = 0;n_no < gen_nb_int;n_no++) {
46698 mem_base = xmlMemBlocks();
46699 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46700 file = gen_filepath(n_file, 1);
46701 line = gen_int(n_line, 2);
46702 no = gen_int(n_no, 3);
46703
46704 xmlXPatherror(ctxt, file, line, no);
46705 call_tests++;
46706 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46707 des_filepath(n_file, file, 1);
46708 des_int(n_line, line, 2);
46709 des_int(n_no, no, 3);
46710 xmlResetLastError();
46711 if (mem_base != xmlMemBlocks()) {
46712 printf("Leak of %d blocks found in xmlXPatherror",
46713 xmlMemBlocks() - mem_base);
46714 test_ret++;
46715 printf(" %d", n_ctxt);
46716 printf(" %d", n_file);
46717 printf(" %d", n_line);
46718 printf(" %d", n_no);
46719 printf("\n");
46720 }
46721 }
46722 }
46723 }
46724 }
46725#endif
46726
46727 function_tests++;
46728 return(test_ret);
46729}
46730
46731static int
46732test_xpathInternals(void) {
46733 int test_ret = 0;
46734
46735 printf("Testing xpathInternals : 92 of 117 functions ...\n");
46736 test_ret += test_valuePop();
46737 test_ret += test_valuePush();
46738 test_ret += test_xmlXPathAddValues();
46739 test_ret += test_xmlXPathBooleanFunction();
46740 test_ret += test_xmlXPathCeilingFunction();
46741 test_ret += test_xmlXPathCompareValues();
46742 test_ret += test_xmlXPathConcatFunction();
46743 test_ret += test_xmlXPathContainsFunction();
46744 test_ret += test_xmlXPathCountFunction();
46745 test_ret += test_xmlXPathDebugDumpCompExpr();
46746 test_ret += test_xmlXPathDebugDumpObject();
46747 test_ret += test_xmlXPathDifference();
46748 test_ret += test_xmlXPathDistinct();
46749 test_ret += test_xmlXPathDistinctSorted();
46750 test_ret += test_xmlXPathDivValues();
46751 test_ret += test_xmlXPathEqualValues();
46752 test_ret += test_xmlXPathErr();
46753 test_ret += test_xmlXPathEvalExpr();
46754 test_ret += test_xmlXPathEvaluatePredicateResult();
46755 test_ret += test_xmlXPathFalseFunction();
46756 test_ret += test_xmlXPathFloorFunction();
46757 test_ret += test_xmlXPathFunctionLookup();
46758 test_ret += test_xmlXPathFunctionLookupNS();
46759 test_ret += test_xmlXPathHasSameNodes();
46760 test_ret += test_xmlXPathIdFunction();
46761 test_ret += test_xmlXPathIntersection();
46762 test_ret += test_xmlXPathIsNodeType();
46763 test_ret += test_xmlXPathLangFunction();
46764 test_ret += test_xmlXPathLastFunction();
46765 test_ret += test_xmlXPathLeading();
46766 test_ret += test_xmlXPathLeadingSorted();
46767 test_ret += test_xmlXPathLocalNameFunction();
46768 test_ret += test_xmlXPathModValues();
46769 test_ret += test_xmlXPathMultValues();
46770 test_ret += test_xmlXPathNamespaceURIFunction();
46771 test_ret += test_xmlXPathNewBoolean();
46772 test_ret += test_xmlXPathNewCString();
46773 test_ret += test_xmlXPathNewFloat();
46774 test_ret += test_xmlXPathNewNodeSet();
46775 test_ret += test_xmlXPathNewNodeSetList();
46776 test_ret += test_xmlXPathNewParserContext();
46777 test_ret += test_xmlXPathNewString();
46778 test_ret += test_xmlXPathNextAncestor();
46779 test_ret += test_xmlXPathNextAncestorOrSelf();
46780 test_ret += test_xmlXPathNextAttribute();
46781 test_ret += test_xmlXPathNextChild();
46782 test_ret += test_xmlXPathNextDescendant();
46783 test_ret += test_xmlXPathNextDescendantOrSelf();
46784 test_ret += test_xmlXPathNextFollowing();
46785 test_ret += test_xmlXPathNextFollowingSibling();
46786 test_ret += test_xmlXPathNextNamespace();
46787 test_ret += test_xmlXPathNextParent();
46788 test_ret += test_xmlXPathNextPreceding();
46789 test_ret += test_xmlXPathNextPrecedingSibling();
46790 test_ret += test_xmlXPathNextSelf();
46791 test_ret += test_xmlXPathNodeLeading();
46792 test_ret += test_xmlXPathNodeLeadingSorted();
46793 test_ret += test_xmlXPathNodeSetAdd();
46794 test_ret += test_xmlXPathNodeSetAddNs();
46795 test_ret += test_xmlXPathNodeSetAddUnique();
46796 test_ret += test_xmlXPathNodeSetContains();
46797 test_ret += test_xmlXPathNodeSetDel();
46798 test_ret += test_xmlXPathNodeSetMerge();
46799 test_ret += test_xmlXPathNodeSetRemove();
46800 test_ret += test_xmlXPathNodeSetSort();
46801 test_ret += test_xmlXPathNodeTrailing();
46802 test_ret += test_xmlXPathNodeTrailingSorted();
46803 test_ret += test_xmlXPathNormalizeFunction();
46804 test_ret += test_xmlXPathNotEqualValues();
46805 test_ret += test_xmlXPathNotFunction();
46806 test_ret += test_xmlXPathNsLookup();
46807 test_ret += test_xmlXPathNumberFunction();
46808 test_ret += test_xmlXPathParseNCName();
46809 test_ret += test_xmlXPathParseName();
46810 test_ret += test_xmlXPathPopBoolean();
46811 test_ret += test_xmlXPathPopExternal();
46812 test_ret += test_xmlXPathPopNodeSet();
46813 test_ret += test_xmlXPathPopNumber();
46814 test_ret += test_xmlXPathPopString();
46815 test_ret += test_xmlXPathPositionFunction();
46816 test_ret += test_xmlXPathRegisterAllFunctions();
46817 test_ret += test_xmlXPathRegisterFunc();
46818 test_ret += test_xmlXPathRegisterFuncLookup();
46819 test_ret += test_xmlXPathRegisterFuncNS();
46820 test_ret += test_xmlXPathRegisterNs();
46821 test_ret += test_xmlXPathRegisterVariable();
46822 test_ret += test_xmlXPathRegisterVariableLookup();
46823 test_ret += test_xmlXPathRegisterVariableNS();
46824 test_ret += test_xmlXPathRegisteredFuncsCleanup();
46825 test_ret += test_xmlXPathRegisteredNsCleanup();
46826 test_ret += test_xmlXPathRegisteredVariablesCleanup();
46827 test_ret += test_xmlXPathRoot();
46828 test_ret += test_xmlXPathRoundFunction();
46829 test_ret += test_xmlXPathStartsWithFunction();
46830 test_ret += test_xmlXPathStringEvalNumber();
46831 test_ret += test_xmlXPathStringFunction();
46832 test_ret += test_xmlXPathStringLengthFunction();
46833 test_ret += test_xmlXPathSubValues();
46834 test_ret += test_xmlXPathSubstringAfterFunction();
46835 test_ret += test_xmlXPathSubstringBeforeFunction();
46836 test_ret += test_xmlXPathSubstringFunction();
46837 test_ret += test_xmlXPathSumFunction();
46838 test_ret += test_xmlXPathTrailing();
46839 test_ret += test_xmlXPathTrailingSorted();
46840 test_ret += test_xmlXPathTranslateFunction();
46841 test_ret += test_xmlXPathTrueFunction();
46842 test_ret += test_xmlXPathValueFlipSign();
46843 test_ret += test_xmlXPathVariableLookup();
46844 test_ret += test_xmlXPathVariableLookupNS();
46845 test_ret += test_xmlXPathWrapCString();
46846 test_ret += test_xmlXPathWrapExternal();
46847 test_ret += test_xmlXPathWrapNodeSet();
46848 test_ret += test_xmlXPatherror();
46849
46850 if (test_ret != 0)
46851 printf("Module xpathInternals: %d errors\n", test_ret);
46852 return(test_ret);
46853}
46854
Daniel Veillardd93f6252004-11-02 15:53:51 +000046855static int
46856test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000046857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000046858
Daniel Veillardd005b9e2004-11-03 17:07:05 +000046859#ifdef LIBXML_XPTR_ENABLED
46860 int mem_base;
46861 xmlNodePtr ret_val;
46862 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
46863 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000046864
Daniel Veillardd005b9e2004-11-03 17:07:05 +000046865 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
46866 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000046867 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000046868
46869 ret_val = xmlXPtrBuildNodeList(obj);
46870 desret_xmlNodePtr(ret_val);
46871 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000046872 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000046873 xmlResetLastError();
46874 if (mem_base != xmlMemBlocks()) {
46875 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
46876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000046877 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000046878 printf(" %d", n_obj);
46879 printf("\n");
46880 }
46881 }
46882#endif
46883
Daniel Veillard3d97e662004-11-04 10:49:00 +000046884 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000046885 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000046886}
46887
46888
46889static int
46890test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000046891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000046892
Daniel Veillardce682bc2004-11-05 17:22:25 +000046893#ifdef LIBXML_XPTR_ENABLED
46894 int mem_base;
46895 xmlXPathObjectPtr ret_val;
46896 xmlChar * str; /* the XPointer expression */
46897 int n_str;
46898 xmlXPathContextPtr ctx; /* the XPointer context */
46899 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000046900
Daniel Veillardce682bc2004-11-05 17:22:25 +000046901 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
46902 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
46903 mem_base = xmlMemBlocks();
46904 str = gen_const_xmlChar_ptr(n_str, 0);
46905 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
46906
46907 ret_val = xmlXPtrEval(str, ctx);
46908 desret_xmlXPathObjectPtr(ret_val);
46909 call_tests++;
46910 des_const_xmlChar_ptr(n_str, str, 0);
46911 des_xmlXPathContextPtr(n_ctx, ctx, 1);
46912 xmlResetLastError();
46913 if (mem_base != xmlMemBlocks()) {
46914 printf("Leak of %d blocks found in xmlXPtrEval",
46915 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000046916 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000046917 printf(" %d", n_str);
46918 printf(" %d", n_ctx);
46919 printf("\n");
46920 }
46921 }
46922 }
46923#endif
46924
46925 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000046926 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000046927}
46928
46929
46930static int
46931test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000046932 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000046933
Daniel Veillardce682bc2004-11-05 17:22:25 +000046934#ifdef LIBXML_XPTR_ENABLED
46935 int mem_base;
46936 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
46937 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000046938
Daniel Veillardce682bc2004-11-05 17:22:25 +000046939 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46940 mem_base = xmlMemBlocks();
46941 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46942
46943 xmlXPtrEvalRangePredicate(ctxt);
46944 call_tests++;
46945 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46946 xmlResetLastError();
46947 if (mem_base != xmlMemBlocks()) {
46948 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
46949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000046950 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000046951 printf(" %d", n_ctxt);
46952 printf("\n");
46953 }
46954 }
46955#endif
46956
46957 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000046958 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000046959}
46960
46961
Daniel Veillardce682bc2004-11-05 17:22:25 +000046962#define gen_nb_xmlLocationSetPtr 1
46963static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
46964 return(NULL);
46965}
46966static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
46967}
46968
Daniel Veillardd93f6252004-11-02 15:53:51 +000046969static int
46970test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000046971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000046972
Daniel Veillardce682bc2004-11-05 17:22:25 +000046973#ifdef LIBXML_XPTR_ENABLED
46974 int mem_base;
46975 xmlLocationSetPtr cur; /* the initial range set */
46976 int n_cur;
46977 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
46978 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000046979
Daniel Veillardce682bc2004-11-05 17:22:25 +000046980 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
46981 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
46982 mem_base = xmlMemBlocks();
46983 cur = gen_xmlLocationSetPtr(n_cur, 0);
46984 val = gen_xmlXPathObjectPtr(n_val, 1);
46985
46986 xmlXPtrLocationSetAdd(cur, val);
46987 call_tests++;
46988 des_xmlLocationSetPtr(n_cur, cur, 0);
46989 des_xmlXPathObjectPtr(n_val, val, 1);
46990 xmlResetLastError();
46991 if (mem_base != xmlMemBlocks()) {
46992 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
46993 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000046994 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000046995 printf(" %d", n_cur);
46996 printf(" %d", n_val);
46997 printf("\n");
46998 }
46999 }
47000 }
47001#endif
47002
47003 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047005}
47006
47007
47008static int
47009test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047011
47012
47013 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000047014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047015}
47016
47017
47018static int
47019test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047021
Daniel Veillardce682bc2004-11-05 17:22:25 +000047022#ifdef LIBXML_XPTR_ENABLED
47023 int mem_base;
47024 xmlLocationSetPtr cur; /* the initial range set */
47025 int n_cur;
47026 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
47027 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047028
Daniel Veillardce682bc2004-11-05 17:22:25 +000047029 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47030 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
47031 mem_base = xmlMemBlocks();
47032 cur = gen_xmlLocationSetPtr(n_cur, 0);
47033 val = gen_xmlXPathObjectPtr(n_val, 1);
47034
47035 xmlXPtrLocationSetDel(cur, val);
47036 call_tests++;
47037 des_xmlLocationSetPtr(n_cur, cur, 0);
47038 des_xmlXPathObjectPtr(n_val, val, 1);
47039 xmlResetLastError();
47040 if (mem_base != xmlMemBlocks()) {
47041 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
47042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047043 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047044 printf(" %d", n_cur);
47045 printf(" %d", n_val);
47046 printf("\n");
47047 }
47048 }
47049 }
47050#endif
47051
47052 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047053 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047054}
47055
47056
47057static int
47058test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047059 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047060
47061
47062 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000047063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047064}
47065
47066
47067static int
47068test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047070
Daniel Veillardce682bc2004-11-05 17:22:25 +000047071#ifdef LIBXML_XPTR_ENABLED
47072 int mem_base;
47073 xmlLocationSetPtr cur; /* the initial range set */
47074 int n_cur;
47075 int val; /* the index to remove */
47076 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047077
Daniel Veillardce682bc2004-11-05 17:22:25 +000047078 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47079 for (n_val = 0;n_val < gen_nb_int;n_val++) {
47080 mem_base = xmlMemBlocks();
47081 cur = gen_xmlLocationSetPtr(n_cur, 0);
47082 val = gen_int(n_val, 1);
47083
47084 xmlXPtrLocationSetRemove(cur, val);
47085 call_tests++;
47086 des_xmlLocationSetPtr(n_cur, cur, 0);
47087 des_int(n_val, val, 1);
47088 xmlResetLastError();
47089 if (mem_base != xmlMemBlocks()) {
47090 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
47091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047092 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047093 printf(" %d", n_cur);
47094 printf(" %d", n_val);
47095 printf("\n");
47096 }
47097 }
47098 }
47099#endif
47100
47101 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047103}
47104
47105
47106static int
47107test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047109
Daniel Veillard3d97e662004-11-04 10:49:00 +000047110#ifdef LIBXML_XPTR_ENABLED
47111 int mem_base;
47112 xmlXPathObjectPtr ret_val;
47113 xmlNodePtr start; /* the starting and ending node */
47114 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047115
Daniel Veillard3d97e662004-11-04 10:49:00 +000047116 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
47117 mem_base = xmlMemBlocks();
47118 start = gen_xmlNodePtr(n_start, 0);
47119
47120 ret_val = xmlXPtrNewCollapsedRange(start);
47121 desret_xmlXPathObjectPtr(ret_val);
47122 call_tests++;
47123 des_xmlNodePtr(n_start, start, 0);
47124 xmlResetLastError();
47125 if (mem_base != xmlMemBlocks()) {
47126 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
47127 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047128 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047129 printf(" %d", n_start);
47130 printf("\n");
47131 }
47132 }
47133#endif
47134
47135 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047137}
47138
47139
47140static int
47141test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047143
47144
47145 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000047146 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047147}
47148
47149
47150static int
47151test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047152 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047153
Daniel Veillardce682bc2004-11-05 17:22:25 +000047154#ifdef LIBXML_XPTR_ENABLED
47155 int mem_base;
47156 xmlXPathObjectPtr ret_val;
47157 xmlNodeSetPtr set; /* a node set */
47158 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047159
Daniel Veillardce682bc2004-11-05 17:22:25 +000047160 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
47161 mem_base = xmlMemBlocks();
47162 set = gen_xmlNodeSetPtr(n_set, 0);
47163
47164 ret_val = xmlXPtrNewLocationSetNodeSet(set);
47165 desret_xmlXPathObjectPtr(ret_val);
47166 call_tests++;
47167 des_xmlNodeSetPtr(n_set, set, 0);
47168 xmlResetLastError();
47169 if (mem_base != xmlMemBlocks()) {
47170 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
47171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047172 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047173 printf(" %d", n_set);
47174 printf("\n");
47175 }
47176 }
47177#endif
47178
47179 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047181}
47182
47183
47184static int
47185test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047187
Daniel Veillard3d97e662004-11-04 10:49:00 +000047188#ifdef LIBXML_XPTR_ENABLED
47189 int mem_base;
47190 xmlXPathObjectPtr ret_val;
47191 xmlNodePtr start; /* the start NodePtr value */
47192 int n_start;
47193 xmlNodePtr end; /* the end NodePtr value or NULL */
47194 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047195
Daniel Veillard3d97e662004-11-04 10:49:00 +000047196 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
47197 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
47198 mem_base = xmlMemBlocks();
47199 start = gen_xmlNodePtr(n_start, 0);
47200 end = gen_xmlNodePtr(n_end, 1);
47201
47202 ret_val = xmlXPtrNewLocationSetNodes(start, end);
47203 desret_xmlXPathObjectPtr(ret_val);
47204 call_tests++;
47205 des_xmlNodePtr(n_start, start, 0);
47206 des_xmlNodePtr(n_end, end, 1);
47207 xmlResetLastError();
47208 if (mem_base != xmlMemBlocks()) {
47209 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
47210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047211 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047212 printf(" %d", n_start);
47213 printf(" %d", n_end);
47214 printf("\n");
47215 }
47216 }
47217 }
47218#endif
47219
47220 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047222}
47223
47224
47225static int
47226test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047228
Daniel Veillard3d97e662004-11-04 10:49:00 +000047229#ifdef LIBXML_XPTR_ENABLED
47230 int mem_base;
47231 xmlXPathObjectPtr ret_val;
47232 xmlNodePtr start; /* the starting node */
47233 int n_start;
47234 int startindex; /* the start index */
47235 int n_startindex;
47236 xmlNodePtr end; /* the ending point */
47237 int n_end;
47238 int endindex; /* the ending index */
47239 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047240
Daniel Veillard3d97e662004-11-04 10:49:00 +000047241 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
47242 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
47243 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
47244 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
47245 mem_base = xmlMemBlocks();
47246 start = gen_xmlNodePtr(n_start, 0);
47247 startindex = gen_int(n_startindex, 1);
47248 end = gen_xmlNodePtr(n_end, 2);
47249 endindex = gen_int(n_endindex, 3);
47250
47251 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
47252 desret_xmlXPathObjectPtr(ret_val);
47253 call_tests++;
47254 des_xmlNodePtr(n_start, start, 0);
47255 des_int(n_startindex, startindex, 1);
47256 des_xmlNodePtr(n_end, end, 2);
47257 des_int(n_endindex, endindex, 3);
47258 xmlResetLastError();
47259 if (mem_base != xmlMemBlocks()) {
47260 printf("Leak of %d blocks found in xmlXPtrNewRange",
47261 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047262 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047263 printf(" %d", n_start);
47264 printf(" %d", n_startindex);
47265 printf(" %d", n_end);
47266 printf(" %d", n_endindex);
47267 printf("\n");
47268 }
47269 }
47270 }
47271 }
47272 }
47273#endif
47274
47275 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047276 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047277}
47278
47279
47280static int
47281test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047282 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047283
Daniel Veillard3d97e662004-11-04 10:49:00 +000047284#ifdef LIBXML_XPTR_ENABLED
47285 int mem_base;
47286 xmlXPathObjectPtr ret_val;
47287 xmlNodePtr start; /* the starting node */
47288 int n_start;
47289 xmlXPathObjectPtr end; /* the ending object */
47290 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047291
Daniel Veillard3d97e662004-11-04 10:49:00 +000047292 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
47293 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
47294 mem_base = xmlMemBlocks();
47295 start = gen_xmlNodePtr(n_start, 0);
47296 end = gen_xmlXPathObjectPtr(n_end, 1);
47297
47298 ret_val = xmlXPtrNewRangeNodeObject(start, end);
47299 desret_xmlXPathObjectPtr(ret_val);
47300 call_tests++;
47301 des_xmlNodePtr(n_start, start, 0);
47302 des_xmlXPathObjectPtr(n_end, end, 1);
47303 xmlResetLastError();
47304 if (mem_base != xmlMemBlocks()) {
47305 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
47306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047307 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047308 printf(" %d", n_start);
47309 printf(" %d", n_end);
47310 printf("\n");
47311 }
47312 }
47313 }
47314#endif
47315
47316 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047318}
47319
47320
47321static int
47322test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047324
Daniel Veillard3d97e662004-11-04 10:49:00 +000047325#ifdef LIBXML_XPTR_ENABLED
47326 int mem_base;
47327 xmlXPathObjectPtr ret_val;
47328 xmlNodePtr start; /* the starting node */
47329 int n_start;
47330 xmlXPathObjectPtr end; /* the ending point */
47331 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047332
Daniel Veillard3d97e662004-11-04 10:49:00 +000047333 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
47334 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
47335 mem_base = xmlMemBlocks();
47336 start = gen_xmlNodePtr(n_start, 0);
47337 end = gen_xmlXPathObjectPtr(n_end, 1);
47338
47339 ret_val = xmlXPtrNewRangeNodePoint(start, end);
47340 desret_xmlXPathObjectPtr(ret_val);
47341 call_tests++;
47342 des_xmlNodePtr(n_start, start, 0);
47343 des_xmlXPathObjectPtr(n_end, end, 1);
47344 xmlResetLastError();
47345 if (mem_base != xmlMemBlocks()) {
47346 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
47347 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047348 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047349 printf(" %d", n_start);
47350 printf(" %d", n_end);
47351 printf("\n");
47352 }
47353 }
47354 }
47355#endif
47356
47357 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047359}
47360
47361
47362static int
47363test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047365
Daniel Veillard3d97e662004-11-04 10:49:00 +000047366#ifdef LIBXML_XPTR_ENABLED
47367 int mem_base;
47368 xmlXPathObjectPtr ret_val;
47369 xmlNodePtr start; /* the starting node */
47370 int n_start;
47371 xmlNodePtr end; /* the ending node */
47372 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047373
Daniel Veillard3d97e662004-11-04 10:49:00 +000047374 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
47375 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
47376 mem_base = xmlMemBlocks();
47377 start = gen_xmlNodePtr(n_start, 0);
47378 end = gen_xmlNodePtr(n_end, 1);
47379
47380 ret_val = xmlXPtrNewRangeNodes(start, end);
47381 desret_xmlXPathObjectPtr(ret_val);
47382 call_tests++;
47383 des_xmlNodePtr(n_start, start, 0);
47384 des_xmlNodePtr(n_end, end, 1);
47385 xmlResetLastError();
47386 if (mem_base != xmlMemBlocks()) {
47387 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
47388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047389 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047390 printf(" %d", n_start);
47391 printf(" %d", n_end);
47392 printf("\n");
47393 }
47394 }
47395 }
47396#endif
47397
47398 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047399 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047400}
47401
47402
47403static int
47404test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047405 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047406
Daniel Veillard3d97e662004-11-04 10:49:00 +000047407#ifdef LIBXML_XPTR_ENABLED
47408 int mem_base;
47409 xmlXPathObjectPtr ret_val;
47410 xmlXPathObjectPtr start; /* the starting point */
47411 int n_start;
47412 xmlNodePtr end; /* the ending node */
47413 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047414
Daniel Veillard3d97e662004-11-04 10:49:00 +000047415 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
47416 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
47417 mem_base = xmlMemBlocks();
47418 start = gen_xmlXPathObjectPtr(n_start, 0);
47419 end = gen_xmlNodePtr(n_end, 1);
47420
47421 ret_val = xmlXPtrNewRangePointNode(start, end);
47422 desret_xmlXPathObjectPtr(ret_val);
47423 call_tests++;
47424 des_xmlXPathObjectPtr(n_start, start, 0);
47425 des_xmlNodePtr(n_end, end, 1);
47426 xmlResetLastError();
47427 if (mem_base != xmlMemBlocks()) {
47428 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
47429 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047430 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047431 printf(" %d", n_start);
47432 printf(" %d", n_end);
47433 printf("\n");
47434 }
47435 }
47436 }
47437#endif
47438
47439 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047441}
47442
47443
47444static int
47445test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047447
Daniel Veillard3d97e662004-11-04 10:49:00 +000047448#ifdef LIBXML_XPTR_ENABLED
47449 int mem_base;
47450 xmlXPathObjectPtr ret_val;
47451 xmlXPathObjectPtr start; /* the starting point */
47452 int n_start;
47453 xmlXPathObjectPtr end; /* the ending point */
47454 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047455
Daniel Veillard3d97e662004-11-04 10:49:00 +000047456 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
47457 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
47458 mem_base = xmlMemBlocks();
47459 start = gen_xmlXPathObjectPtr(n_start, 0);
47460 end = gen_xmlXPathObjectPtr(n_end, 1);
47461
47462 ret_val = xmlXPtrNewRangePoints(start, end);
47463 desret_xmlXPathObjectPtr(ret_val);
47464 call_tests++;
47465 des_xmlXPathObjectPtr(n_start, start, 0);
47466 des_xmlXPathObjectPtr(n_end, end, 1);
47467 xmlResetLastError();
47468 if (mem_base != xmlMemBlocks()) {
47469 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
47470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047471 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047472 printf(" %d", n_start);
47473 printf(" %d", n_end);
47474 printf("\n");
47475 }
47476 }
47477 }
47478#endif
47479
47480 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047482}
47483
47484
47485static int
47486test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047488
Daniel Veillardce682bc2004-11-05 17:22:25 +000047489#ifdef LIBXML_XPTR_ENABLED
47490 int mem_base;
47491 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
47492 int n_ctxt;
47493 int nargs; /* the number of args */
47494 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047495
Daniel Veillardce682bc2004-11-05 17:22:25 +000047496 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47497 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47498 mem_base = xmlMemBlocks();
47499 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47500 nargs = gen_int(n_nargs, 1);
47501
47502 xmlXPtrRangeToFunction(ctxt, nargs);
47503 call_tests++;
47504 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47505 des_int(n_nargs, nargs, 1);
47506 xmlResetLastError();
47507 if (mem_base != xmlMemBlocks()) {
47508 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
47509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047510 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047511 printf(" %d", n_ctxt);
47512 printf(" %d", n_nargs);
47513 printf("\n");
47514 }
47515 }
47516 }
47517#endif
47518
47519 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047520 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047521}
47522
47523
47524static int
47525test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047526 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047527
Daniel Veillardce682bc2004-11-05 17:22:25 +000047528#ifdef LIBXML_XPTR_ENABLED
47529 int mem_base;
47530 xmlXPathObjectPtr ret_val;
47531 xmlLocationSetPtr val; /* the LocationSet value */
47532 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047533
Daniel Veillardce682bc2004-11-05 17:22:25 +000047534 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
47535 mem_base = xmlMemBlocks();
47536 val = gen_xmlLocationSetPtr(n_val, 0);
47537
47538 ret_val = xmlXPtrWrapLocationSet(val);
47539 desret_xmlXPathObjectPtr(ret_val);
47540 call_tests++;
47541 des_xmlLocationSetPtr(n_val, val, 0);
47542 xmlResetLastError();
47543 if (mem_base != xmlMemBlocks()) {
47544 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
47545 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047546 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047547 printf(" %d", n_val);
47548 printf("\n");
47549 }
47550 }
47551#endif
47552
47553 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047554 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047555}
47556
47557static int
47558test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047559 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047560
Daniel Veillardce682bc2004-11-05 17:22:25 +000047561 printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000047562 test_ret += test_xmlXPtrBuildNodeList();
47563 test_ret += test_xmlXPtrEval();
47564 test_ret += test_xmlXPtrEvalRangePredicate();
47565 test_ret += test_xmlXPtrLocationSetAdd();
47566 test_ret += test_xmlXPtrLocationSetCreate();
47567 test_ret += test_xmlXPtrLocationSetDel();
47568 test_ret += test_xmlXPtrLocationSetMerge();
47569 test_ret += test_xmlXPtrLocationSetRemove();
47570 test_ret += test_xmlXPtrNewCollapsedRange();
47571 test_ret += test_xmlXPtrNewContext();
47572 test_ret += test_xmlXPtrNewLocationSetNodeSet();
47573 test_ret += test_xmlXPtrNewLocationSetNodes();
47574 test_ret += test_xmlXPtrNewRange();
47575 test_ret += test_xmlXPtrNewRangeNodeObject();
47576 test_ret += test_xmlXPtrNewRangeNodePoint();
47577 test_ret += test_xmlXPtrNewRangeNodes();
47578 test_ret += test_xmlXPtrNewRangePointNode();
47579 test_ret += test_xmlXPtrNewRangePoints();
47580 test_ret += test_xmlXPtrRangeToFunction();
47581 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000047582
Daniel Veillard42595322004-11-08 10:52:06 +000047583 if (test_ret != 0)
47584 printf("Module xpointer: %d errors\n", test_ret);
47585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047586}
Daniel Veillardce244ad2004-11-05 10:03:46 +000047587static int
47588test_module(const char *module) {
47589 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
47590 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000047591 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000047592 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000047593 if (!strcmp(module, "catalog")) return(test_catalog());
47594 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000047595 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000047596 if (!strcmp(module, "dict")) return(test_dict());
47597 if (!strcmp(module, "encoding")) return(test_encoding());
47598 if (!strcmp(module, "entities")) return(test_entities());
47599 if (!strcmp(module, "hash")) return(test_hash());
47600 if (!strcmp(module, "list")) return(test_list());
47601 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
47602 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
47603 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000047604 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000047605 if (!strcmp(module, "pattern")) return(test_pattern());
47606 if (!strcmp(module, "relaxng")) return(test_relaxng());
47607 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
47608 if (!strcmp(module, "tree")) return(test_tree());
47609 if (!strcmp(module, "uri")) return(test_uri());
47610 if (!strcmp(module, "valid")) return(test_valid());
47611 if (!strcmp(module, "xinclude")) return(test_xinclude());
47612 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000047613 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000047614 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
47615 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000047616 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000047617 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
47618 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
47619 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
47620 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000047621 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000047622 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
47623 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000047624 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000047625 if (!strcmp(module, "xpointer")) return(test_xpointer());
47626 return(0);
47627}