blob: 10a5dddf8feb74172a83c0a7bfd60349e5bd4928 [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) {
92 static int nr = 0;
93 xmlChar name[20];
94
95 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
96 get_api_root();
97 }
98 if (api_root == NULL)
99 return(NULL);
100 if (api_root->properties != NULL) {
101 api_attr = api_root->properties;
102 return(api_root->properties);
103 }
104 snprintf((char *) name, 20, "foo%d", nr++);
105 api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar");
106 return(api_attr);
107}
108
109int main(int argc, char **argv) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000110 int ret;
111 int blocks, mem;
112
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000113 memset(chartab, 0, sizeof(chartab));
114 strncpy(chartab, " chartab\n", 20);
115 memset(inttab, 0, sizeof(inttab));
116 memset(longtab, 0, sizeof(longtab));
117
Daniel Veillarda03e3652004-11-02 18:45:30 +0000118 xmlInitParser();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000119#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000120 xmlRelaxNGInitTypes();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000121#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +0000122
Daniel Veillardd93f6252004-11-02 15:53:51 +0000123 LIBXML_TEST_VERSION
124
125 xmlSetStructuredErrorFunc(NULL, structured_errors);
126
Daniel Veillardce244ad2004-11-05 10:03:46 +0000127 if (argc == 2)
128 ret = test_module(argv[1]);
129 else
130 ret = testlibxml2();
Daniel Veillardd93f6252004-11-02 15:53:51 +0000131
132 xmlCleanupParser();
133 blocks = xmlMemBlocks();
134 mem = xmlMemUsed();
135 if ((blocks != 0) || (mem != 0)) {
136 printf("testapi leaked %d bytes in %d blocks\n", mem, blocks);
137 }
138 xmlMemoryDump();
139
140 return (ret != 0);
141}
142
143#include <libxml/HTMLparser.h>
144#include <libxml/HTMLtree.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000145#include <libxml/catalog.h>
146#include <libxml/chvalid.h>
147#include <libxml/dict.h>
148#include <libxml/encoding.h>
149#include <libxml/entities.h>
150#include <libxml/hash.h>
151#include <libxml/list.h>
152#include <libxml/nanoftp.h>
153#include <libxml/nanohttp.h>
154#include <libxml/parser.h>
155#include <libxml/pattern.h>
156#include <libxml/relaxng.h>
157#include <libxml/schemasInternals.h>
158#include <libxml/tree.h>
159#include <libxml/uri.h>
160#include <libxml/valid.h>
161#include <libxml/xinclude.h>
162#include <libxml/xmlIO.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000163#include <libxml/xmlerror.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000164#include <libxml/xmlreader.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000165#include <libxml/xmlsave.h>
166#include <libxml/xmlschemas.h>
167#include <libxml/xmlschemastypes.h>
168#include <libxml/xmlstring.h>
169#include <libxml/xmlwriter.h>
170#include <libxml/xpath.h>
171#include <libxml/xpointer.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000172
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000173#define gen_nb_void_ptr 2
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000174
Daniel Veillard3d97e662004-11-04 10:49:00 +0000175static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000176 return(NULL);
177}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000178static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000179}
180
Daniel Veillardce244ad2004-11-05 10:03:46 +0000181#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000182#define gen_nb_const_void_ptr 2
183
184static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) {
185 if (no == 0) return((const void *) "immutable string");
186 return(NULL);
187}
188static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
189}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000190#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000191
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000192#define gen_nb_userdata 3
193
Daniel Veillard3d97e662004-11-04 10:49:00 +0000194static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000195 if (no == 0) return((void *) &call_tests);
196 if (no == 1) return((void *) -1);
197 return(NULL);
198}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000199static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000200}
201
202
Daniel Veillardd93f6252004-11-02 15:53:51 +0000203#define gen_nb_int 4
204
Daniel Veillard3d97e662004-11-04 10:49:00 +0000205static int gen_int(int no, int nr ATTRIBUTE_UNUSED) {
206 if (no == 0) return(0);
207 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000208 if (no == 2) return(-1);
209 if (no == 3) return(122);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000210 return(-1);
211}
212
213static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
214}
215
Daniel Veillardce244ad2004-11-05 10:03:46 +0000216#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000217#define gen_nb_long 4
218
219static long gen_long(int no, int nr ATTRIBUTE_UNUSED) {
220 if (no == 0) return(0);
221 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000222 if (no == 2) return(-1);
223 if (no == 3) return(122);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000224 return(-1);
225}
226
227static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
228}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000229#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000230
Daniel Veillard3d97e662004-11-04 10:49:00 +0000231#define gen_nb_unsigned_int 3
232
233static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000234 if (no == 0) return(0);
235 if (no == 1) return(1);
236 if (no == 2) return(122);
237 return(-1);
238}
239
Daniel Veillard3d97e662004-11-04 10:49:00 +0000240static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000241}
242
Daniel Veillard3d95c732004-11-06 22:25:14 +0000243#define gen_nb_unsigned_long 4
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000244
245static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
246 if (no == 0) return(0);
247 if (no == 1) return(1);
248 if (no == 2) return(122);
249 return(-1);
250}
251
252static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
253}
254
Daniel Veillard3d95c732004-11-06 22:25:14 +0000255#define gen_nb_double 4
256
257static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
258 if (no == 0) return(0);
259 if (no == 1) return(-1.1);
260 if (no == 2) return(xmlXPathNAN);
261 return(-1);
262}
263
264static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
265}
266
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000267#define gen_nb_unsigned_long_ptr 2
268
269static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
270 if (no == 0) return(&longtab[nr]);
271 return(NULL);
272}
273
274static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
275}
276
277#define gen_nb_int_ptr 2
278
279static int *gen_int_ptr(int no, int nr) {
280 if (no == 0) return(&inttab[nr]);
281 return(NULL);
282}
283
284static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
285}
286
Daniel Veillardd93f6252004-11-02 15:53:51 +0000287#define gen_nb_const_char_ptr 4
288
Daniel Veillardce682bc2004-11-05 17:22:25 +0000289static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) {
290 if (no == 0) return((char *) "foo");
291 if (no == 1) return((char *) "<foo/>");
292 if (no == 2) return((char *) "test/ent2");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000293 return(NULL);
294}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000295static 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 +0000296}
297
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000298#define gen_nb_xmlChar_ptr 2
299
Daniel Veillard3d97e662004-11-04 10:49:00 +0000300static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000301 if (no == 0) return(&chartab[0]);
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000302 return(NULL);
303}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000304static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000305}
306
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000307#define gen_nb_FILE_ptr 2
308
309static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) {
310 if (no == 0) return(fopen("test.out", "a+"));
311 return(NULL);
312}
313static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
314 if (val != NULL) fclose(val);
315}
316
Daniel Veillardd93f6252004-11-02 15:53:51 +0000317#define gen_nb_const_xmlChar_ptr 5
318
Daniel Veillardce682bc2004-11-05 17:22:25 +0000319static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
320 if (no == 0) return((xmlChar *) "foo");
321 if (no == 1) return((xmlChar *) "<foo/>");
322 if (no == 2) return((xmlChar *) "nøne");
323 if (no == 3) return((xmlChar *) " 2ab ");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000324 return(NULL);
325}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000326static 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 +0000327}
328
329#define gen_nb_filepath 8
330
Daniel Veillard3d97e662004-11-04 10:49:00 +0000331static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000332 if (no == 0) return("missing.xml");
333 if (no == 1) return("<foo/>");
334 if (no == 2) return("test/ent2");
335 if (no == 3) return("test/valid/REC-xml-19980210.xml");
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000336 if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000337 if (no == 5) return("http://missing.example.org/");
338 if (no == 6) return("http://missing. example.org/");
339 return(NULL);
340}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000341static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000342}
343
Daniel Veillard27f20102004-11-05 11:50:11 +0000344#define gen_nb_eaten_name 2
345
346static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000347 if (no == 0) return(xmlStrdup(BAD_CAST "eaten"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000348 return(NULL);
349}
350static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
351}
352
Daniel Veillardd93f6252004-11-02 15:53:51 +0000353#define gen_nb_fileoutput 6
354
Daniel Veillard3d97e662004-11-04 10:49:00 +0000355static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000356 if (no == 0) return("/missing.xml");
357 if (no == 1) return("<foo/>");
358 if (no == 2) return("ftp://missing.example.org/foo");
359 if (no == 3) return("http://missing.example.org/");
360 if (no == 4) return("http://missing. example.org/");
361 return(NULL);
362}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000363static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000364}
365
366#define gen_nb_xmlParserCtxtPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000367static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000368 if (no == 0) return(xmlNewParserCtxt());
369 return(NULL);
370}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000371static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000372 if (val != NULL)
373 xmlFreeParserCtxt(val);
374}
375
Daniel Veillard34099b42004-11-04 17:34:35 +0000376#define gen_nb_xmlSAXHandlerPtr 2
377static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
378 if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
379 return(NULL);
380}
381static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
382}
383
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000384#define gen_nb_xmlValidCtxtPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000385static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000386 if (no == 0) return(xmlNewValidCtxt());
387 return(NULL);
388}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000389static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000390 if (val != NULL)
391 xmlFreeValidCtxt(val);
392}
393
Daniel Veillard34099b42004-11-04 17:34:35 +0000394#define gen_nb_xmlParserInputBufferPtr 8
395
396static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
397 if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE));
398 if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE));
399 if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE));
400 if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE));
401 if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE));
402 if (no == 5) return(xmlParserInputBufferCreateFilename("http://missing.example.org/", XML_CHAR_ENCODING_NONE));
403 if (no == 6) return(xmlParserInputBufferCreateFilename("http://missing. example.org/", XML_CHAR_ENCODING_NONE));
404 return(NULL);
405}
406static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
407 xmlFreeParserInputBuffer(val);
408}
409
Daniel Veillardd93f6252004-11-02 15:53:51 +0000410#define gen_nb_xmlDocPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000411static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000412 if (no == 0) return(xmlNewDoc(BAD_CAST "1.0"));
413 if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0));
414 return(NULL);
415}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000416static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000417 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
Daniel Veillardd93f6252004-11-02 15:53:51 +0000418 xmlFreeDoc(val);
419}
420
Daniel Veillardce244ad2004-11-05 10:03:46 +0000421#define gen_nb_xmlAttrPtr 2
422static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) {
423 if (no == 0) return(get_api_attr());
424 return(NULL);
425}
426static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
427 if (no == 0) free_api_doc();
428}
429
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000430#define gen_nb_xmlDictPtr 2
431static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) {
432 if (no == 0) return(xmlDictCreate());
433 return(NULL);
434}
435static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) {
436 if (val != NULL)
437 xmlDictFree(val);
438}
439
Daniel Veillardce244ad2004-11-05 10:03:46 +0000440#define gen_nb_xmlNodePtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000441static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000442 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
Daniel Veillardce244ad2004-11-05 10:03:46 +0000443 if (no == 1) return(get_api_root());
Daniel Veillardd93f6252004-11-02 15:53:51 +0000444 return(NULL);
Daniel Veillardce244ad2004-11-05 10:03:46 +0000445/* if (no == 2) return((xmlNodePtr) get_api_doc()); */
Daniel Veillardd93f6252004-11-02 15:53:51 +0000446}
Daniel Veillard27f20102004-11-05 11:50:11 +0000447static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000448 if (no == 1) free_api_doc();
449 else if (val != NULL) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000450 xmlUnlinkNode(val);
451 xmlFreeNode(val);
452 }
453}
454
Daniel Veillard27f20102004-11-05 11:50:11 +0000455#define gen_nb_xmlDtdPtr 3
456static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000457 if (no == 0)
458 return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000459 if (no == 1) return(get_api_dtd());
460 return(NULL);
461}
462static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) {
463 if (no == 1) free_api_doc();
464 else if (val != NULL) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000465 xmlUnlinkNode((xmlNodePtr) val);
466 xmlFreeNode((xmlNodePtr) val);
Daniel Veillard27f20102004-11-05 11:50:11 +0000467 }
468}
469
470#define gen_nb_xmlNsPtr 2
471static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) {
472 if (no == 0) return(get_api_ns());
473 return(NULL);
474}
475static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
476 if (no == 0) free_api_doc();
477}
478
Daniel Veillardd93f6252004-11-02 15:53:51 +0000479#define gen_nb_xmlNodePtr_in 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000480static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000481 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
482 if (no == 0) return(xmlNewText(BAD_CAST "text"));
483 return(NULL);
484}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000485static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000486}
487
Daniel Veillarde43cc572004-11-03 11:50:29 +0000488#define gen_nb_xmlTextWriterPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000489static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000490 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
491 return(NULL);
492}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000493static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000494 if (val != NULL) xmlFreeTextWriter(val);
495}
496
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000497#define gen_nb_xmlTextReaderPtr 4
Daniel Veillard3d97e662004-11-04 10:49:00 +0000498static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000499 if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
500 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
501 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
502 return(NULL);
503}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000504static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000505 if (val != NULL) xmlFreeTextReader(val);
506}
507
Daniel Veillard34099b42004-11-04 17:34:35 +0000508#define gen_nb_xmlBufferPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000509static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000510 if (no == 0) return(xmlBufferCreate());
Daniel Veillardce244ad2004-11-05 10:03:46 +0000511 if (no == 1) return(xmlBufferCreateStatic((void *)"a static buffer", 13));
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000512 return(NULL);
513}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000514static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000515 if (val != NULL) {
516 xmlBufferFree(val);
517 }
518}
519
520#define gen_nb_xmlListPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000521static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000522 if (no == 0) return(xmlListCreate(NULL, NULL));
523 return(NULL);
524}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000525static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000526 if (val != NULL) {
527 xmlListDelete(val);
528 }
529}
530
531#define gen_nb_xmlHashTablePtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000532static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000533 if (no == 0) return(xmlHashCreate(10));
534 return(NULL);
535}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000536static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000537 if (val != NULL) {
538 xmlHashFree(val, NULL);
539 }
540}
541
542#include <libxml/xpathInternals.h>
543
544#define gen_nb_xmlXPathObjectPtr 5
Daniel Veillard3d97e662004-11-04 10:49:00 +0000545static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000546 if (no == 0) return(xmlXPathNewString(BAD_CAST "string object"));
547 if (no == 1) return(xmlXPathNewFloat(1.1));
548 if (no == 2) return(xmlXPathNewBoolean(1));
549 if (no == 3) return(xmlXPathNewNodeSet(NULL));
550 return(NULL);
551}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000552static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000553 if (val != NULL) {
554 xmlXPathFreeObject(val);
555 }
556}
557
Daniel Veillard3d97e662004-11-04 10:49:00 +0000558#define gen_nb_xmlOutputBufferPtr 2
559static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
560 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0));
561 return(NULL);
562}
563static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
564 if (val != NULL) {
565 xmlOutputBufferClose(val);
566 }
567}
568
Daniel Veillard27f20102004-11-05 11:50:11 +0000569#define gen_nb_xmlNanoFTPCtxtPtr 4
570static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
571 if (no == 0) return(xmlNanoFTPNewCtxt("ftp://example.com/"));
572 if (no == 1) return(xmlNanoFTPNewCtxt("http://example.com/"));
573 if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
574 return(NULL);
575}
576static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
577 if (val != NULL) {
578 xmlNanoFTPFreeCtxt(val);
579 }
580}
581
582#define gen_nb_xmlNanoHTTPCtxtPtr 1
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000583static void *gen_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard27f20102004-11-05 11:50:11 +0000584 return(NULL);
585}
586static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
587}
588
Daniel Veillard3d97e662004-11-04 10:49:00 +0000589#define gen_nb_xmlCharEncoding 4
590static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) {
591 if (no == 0) return(XML_CHAR_ENCODING_UTF8);
592 if (no == 1) return(XML_CHAR_ENCODING_NONE);
593 if (no == 0) return(XML_CHAR_ENCODING_8859_1);
594 return(XML_CHAR_ENCODING_ERROR);
595}
596static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
597}
598
Daniel Veillard42595322004-11-08 10:52:06 +0000599#define gen_nb_xmlHashDeallocator 2
600static void
601test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) {
602}
603
604static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
605 if (no == 0) return(test_xmlHashDeallocator);
606 return(NULL);
607}
608static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
609}
610
Daniel Veillardd93f6252004-11-02 15:53:51 +0000611
612static void desret_int(int val ATTRIBUTE_UNUSED) {
613}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000614static void desret_long(long val ATTRIBUTE_UNUSED) {
615}
616static void desret_double(double val ATTRIBUTE_UNUSED) {
617}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000618static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
619}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000620#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000621static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
622}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000623#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000624static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
625}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000626static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
627}
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000628static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
629}
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000630static void desret_xmlChar_ptr(xmlChar *val) {
631 if (val != NULL)
632 xmlFree(val);
633}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000634static void desret_xmlDocPtr(xmlDocPtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000635 if (val != api_doc)
636 xmlFreeDoc(val);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000637}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000638static void desret_xmlDictPtr(xmlDictPtr val) {
639 xmlDictFree(val);
640}
Daniel Veillard3d95c732004-11-06 22:25:14 +0000641static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
642 xmlOutputBufferClose(val);
643}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000644static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
645 xmlFreeTextReader(val);
646}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000647static void desret_xmlNodePtr(xmlNodePtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000648 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
649 xmlUnlinkNode(val);
650 xmlFreeNode(val);
651 }
Daniel Veillardd93f6252004-11-02 15:53:51 +0000652}
Daniel Veillard57b25162004-11-06 14:50:18 +0000653static void desret_xmlAttrPtr(xmlAttrPtr val) {
654 if (val != NULL) {
655 xmlUnlinkNode((xmlNodePtr) val);
656 xmlFreeNode((xmlNodePtr) val);
657 }
658}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000659static void desret_xmlEntityPtr(xmlEntityPtr val) {
660 if (val != NULL) {
661 xmlUnlinkNode((xmlNodePtr) val);
662 xmlFreeNode((xmlNodePtr) val);
663 }
664}
Daniel Veillard42595322004-11-08 10:52:06 +0000665static void desret_xmlElementPtr(xmlElementPtr val) {
666 if (val != NULL) {
667 xmlUnlinkNode((xmlNodePtr) val);
668 }
669}
670static void desret_xmlAttributePtr(xmlAttributePtr val) {
671 if (val != NULL) {
672 xmlUnlinkNode((xmlNodePtr) val);
673 }
674}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000675static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
676}
Daniel Veillard34099b42004-11-04 17:34:35 +0000677static void desret_xmlDtdPtr(xmlDtdPtr val) {
678 desret_xmlNodePtr((xmlNodePtr)val);
679}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000680static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000681 xmlXPathFreeObject(val);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000682}
Daniel Veillard34099b42004-11-04 17:34:35 +0000683static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
684 xmlFreeParserCtxt(val);
685}
686
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000687static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
688 xmlFreeParserInputBuffer(val);
689}
Daniel Veillard42595322004-11-08 10:52:06 +0000690static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
691 xmlFreeInputStream(val);
692}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000693static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
694 xmlFreeTextWriter(val);
695}
Daniel Veillard3d95c732004-11-06 22:25:14 +0000696static void desret_xmlBufferPtr(xmlBufferPtr val) {
697 xmlBufferFree(val);
698}
Daniel Veillard42595322004-11-08 10:52:06 +0000699static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
700 xmlSchemaFreeParserCtxt(val);
701}
702static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
703}
704static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
705 xmlRelaxNGFreeParserCtxt(val);
706}
707static void desret_const_htmlEntityDesc_ptr(const htmlEntityDescPtr val ATTRIBUTE_UNUSED) {
708}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000709
710/************************************************************************
711 * *
712 * WARNING: end of the manually maintained part of the test code *
713 * do not remove or alter the CUT HERE line *
714 * *
715 ************************************************************************/
716
Daniel Veillard34099b42004-11-04 17:34:35 +0000717/* CUT HERE: everything below that line is generated */
Daniel Veillard57b25162004-11-06 14:50:18 +0000718#define gen_nb_htmlParserOption 4
719static htmlParserOption gen_htmlParserOption(int no, int nr ATTRIBUTE_UNUSED) {
720 if (no == 1) return(HTML_PARSE_NOBLANKS);
721 if (no == 2) return(HTML_PARSE_NOERROR);
722 if (no == 3) return(HTML_PARSE_NONET);
723 if (no == 4) return(HTML_PARSE_NOWARNING);
724 return(0);
725}
726static void des_htmlParserOption(int no ATTRIBUTE_UNUSED, htmlParserOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
727}
728static void desret_htmlParserOption(htmlParserOption val ATTRIBUTE_UNUSED) {
729}
730
731#define gen_nb_htmlStatus 4
732static htmlStatus gen_htmlStatus(int no, int nr ATTRIBUTE_UNUSED) {
733 if (no == 1) return(HTML_DEPRECATED);
734 if (no == 2) return(HTML_INVALID);
735 if (no == 3) return(HTML_NA);
736 if (no == 4) return(HTML_REQUIRED);
737 return(0);
738}
739static void des_htmlStatus(int no ATTRIBUTE_UNUSED, htmlStatus val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
740}
741static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
742}
743
744#define gen_nb_xlinkActuate 3
745static xlinkActuate gen_xlinkActuate(int no, int nr ATTRIBUTE_UNUSED) {
746 if (no == 1) return(XLINK_ACTUATE_AUTO);
747 if (no == 2) return(XLINK_ACTUATE_NONE);
748 if (no == 3) return(XLINK_ACTUATE_ONREQUEST);
749 return(0);
750}
751static void des_xlinkActuate(int no ATTRIBUTE_UNUSED, xlinkActuate val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
752}
753static void desret_xlinkActuate(xlinkActuate val ATTRIBUTE_UNUSED) {
754}
755
756#define gen_nb_xlinkShow 4
757static xlinkShow gen_xlinkShow(int no, int nr ATTRIBUTE_UNUSED) {
758 if (no == 1) return(XLINK_SHOW_EMBED);
759 if (no == 2) return(XLINK_SHOW_NEW);
760 if (no == 3) return(XLINK_SHOW_NONE);
761 if (no == 4) return(XLINK_SHOW_REPLACE);
762 return(0);
763}
764static void des_xlinkShow(int no ATTRIBUTE_UNUSED, xlinkShow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
765}
766static void desret_xlinkShow(xlinkShow val ATTRIBUTE_UNUSED) {
767}
768
769#define gen_nb_xlinkType 4
770static xlinkType gen_xlinkType(int no, int nr ATTRIBUTE_UNUSED) {
771 if (no == 1) return(XLINK_TYPE_EXTENDED);
772 if (no == 2) return(XLINK_TYPE_EXTENDED_SET);
773 if (no == 3) return(XLINK_TYPE_NONE);
774 if (no == 4) return(XLINK_TYPE_SIMPLE);
775 return(0);
776}
777static void des_xlinkType(int no ATTRIBUTE_UNUSED, xlinkType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
778}
779static void desret_xlinkType(xlinkType val ATTRIBUTE_UNUSED) {
780}
781
782#define gen_nb_xmlAttributeDefault 4
783static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
784 if (no == 1) return(XML_ATTRIBUTE_FIXED);
785 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
786 if (no == 3) return(XML_ATTRIBUTE_NONE);
787 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
788 return(0);
789}
790static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
791}
792static void desret_xmlAttributeDefault(xmlAttributeDefault val ATTRIBUTE_UNUSED) {
793}
794
795#define gen_nb_xmlAttributeType 4
796static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
797 if (no == 1) return(XML_ATTRIBUTE_CDATA);
798 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
799 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
800 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
801 return(0);
802}
803static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
804}
805static void desret_xmlAttributeType(xmlAttributeType val ATTRIBUTE_UNUSED) {
806}
807
808#define gen_nb_xmlBufferAllocationScheme 3
809static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
810 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
811 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
812 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
813 return(0);
814}
815static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
816}
817static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
818}
819
820#define gen_nb_xmlCatalogAllow 4
821static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
822 if (no == 1) return(XML_CATA_ALLOW_ALL);
823 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
824 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
825 if (no == 4) return(XML_CATA_ALLOW_NONE);
826 return(0);
827}
828static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
829}
830static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
831}
832
833#define gen_nb_xmlCatalogPrefer 3
834static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
835 if (no == 1) return(XML_CATA_PREFER_NONE);
836 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
837 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
838 return(0);
839}
840static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
841}
842static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
843}
844
845#define gen_nb_xmlElementContentOccur 4
846static xmlElementContentOccur gen_xmlElementContentOccur(int no, int nr ATTRIBUTE_UNUSED) {
847 if (no == 1) return(XML_ELEMENT_CONTENT_MULT);
848 if (no == 2) return(XML_ELEMENT_CONTENT_ONCE);
849 if (no == 3) return(XML_ELEMENT_CONTENT_OPT);
850 if (no == 4) return(XML_ELEMENT_CONTENT_PLUS);
851 return(0);
852}
853static void des_xmlElementContentOccur(int no ATTRIBUTE_UNUSED, xmlElementContentOccur val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
854}
855static void desret_xmlElementContentOccur(xmlElementContentOccur val ATTRIBUTE_UNUSED) {
856}
857
858#define gen_nb_xmlElementContentType 4
859static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
860 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
861 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
862 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
863 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
864 return(0);
865}
866static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
867}
868static void desret_xmlElementContentType(xmlElementContentType val ATTRIBUTE_UNUSED) {
869}
870
871#define gen_nb_xmlElementType 4
872static xmlElementType gen_xmlElementType(int no, int nr ATTRIBUTE_UNUSED) {
873 if (no == 1) return(XML_ATTRIBUTE_DECL);
874 if (no == 2) return(XML_ATTRIBUTE_NODE);
875 if (no == 3) return(XML_CDATA_SECTION_NODE);
876 if (no == 4) return(XML_COMMENT_NODE);
877 return(0);
878}
879static void des_xmlElementType(int no ATTRIBUTE_UNUSED, xmlElementType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
880}
881static void desret_xmlElementType(xmlElementType val ATTRIBUTE_UNUSED) {
882}
883
884#define gen_nb_xmlElementTypeVal 4
885static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
886 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
887 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
888 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
889 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
890 return(0);
891}
892static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
893}
894static void desret_xmlElementTypeVal(xmlElementTypeVal val ATTRIBUTE_UNUSED) {
895}
896
897#define gen_nb_xmlEntityType 4
898static xmlEntityType gen_xmlEntityType(int no, int nr ATTRIBUTE_UNUSED) {
899 if (no == 1) return(XML_EXTERNAL_GENERAL_PARSED_ENTITY);
900 if (no == 2) return(XML_EXTERNAL_GENERAL_UNPARSED_ENTITY);
901 if (no == 3) return(XML_EXTERNAL_PARAMETER_ENTITY);
902 if (no == 4) return(XML_INTERNAL_GENERAL_ENTITY);
903 return(0);
904}
905static void des_xmlEntityType(int no ATTRIBUTE_UNUSED, xmlEntityType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
906}
907static void desret_xmlEntityType(xmlEntityType val ATTRIBUTE_UNUSED) {
908}
909
910#define gen_nb_xmlErrorDomain 4
911static xmlErrorDomain gen_xmlErrorDomain(int no, int nr ATTRIBUTE_UNUSED) {
912 if (no == 1) return(XML_FROM_C14N);
913 if (no == 2) return(XML_FROM_CATALOG);
914 if (no == 3) return(XML_FROM_CHECK);
915 if (no == 4) return(XML_FROM_DATATYPE);
916 return(0);
917}
918static void des_xmlErrorDomain(int no ATTRIBUTE_UNUSED, xmlErrorDomain val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
919}
920static void desret_xmlErrorDomain(xmlErrorDomain val ATTRIBUTE_UNUSED) {
921}
922
923#define gen_nb_xmlErrorLevel 4
924static xmlErrorLevel gen_xmlErrorLevel(int no, int nr ATTRIBUTE_UNUSED) {
925 if (no == 1) return(XML_ERR_ERROR);
926 if (no == 2) return(XML_ERR_FATAL);
927 if (no == 3) return(XML_ERR_NONE);
928 if (no == 4) return(XML_ERR_WARNING);
929 return(0);
930}
931static void des_xmlErrorLevel(int no ATTRIBUTE_UNUSED, xmlErrorLevel val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
932}
933static void desret_xmlErrorLevel(xmlErrorLevel val ATTRIBUTE_UNUSED) {
934}
935
936#define gen_nb_xmlParserErrors 4
937static xmlParserErrors gen_xmlParserErrors(int no, int nr ATTRIBUTE_UNUSED) {
938 if (no == 1) return(XML_C14N_CREATE_CTXT);
939 if (no == 2) return(XML_C14N_CREATE_STACK);
940 if (no == 3) return(XML_C14N_INVALID_NODE);
941 if (no == 4) return(XML_C14N_REQUIRES_UTF8);
942 return(0);
943}
944static void des_xmlParserErrors(int no ATTRIBUTE_UNUSED, xmlParserErrors val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
945}
946static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
947}
948
949#define gen_nb_xmlParserInputState 4
950static xmlParserInputState gen_xmlParserInputState(int no, int nr ATTRIBUTE_UNUSED) {
951 if (no == 1) return(XML_PARSER_ATTRIBUTE_VALUE);
952 if (no == 2) return(XML_PARSER_CDATA_SECTION);
953 if (no == 3) return(XML_PARSER_COMMENT);
954 if (no == 4) return(XML_PARSER_CONTENT);
955 return(0);
956}
957static void des_xmlParserInputState(int no ATTRIBUTE_UNUSED, xmlParserInputState val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
958}
959static void desret_xmlParserInputState(xmlParserInputState val ATTRIBUTE_UNUSED) {
960}
961
962#define gen_nb_xmlParserMode 4
963static xmlParserMode gen_xmlParserMode(int no, int nr ATTRIBUTE_UNUSED) {
964 if (no == 1) return(XML_PARSE_DOM);
965 if (no == 2) return(XML_PARSE_PUSH_DOM);
966 if (no == 3) return(XML_PARSE_PUSH_SAX);
967 if (no == 4) return(XML_PARSE_READER);
968 return(0);
969}
970static void des_xmlParserMode(int no ATTRIBUTE_UNUSED, xmlParserMode val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
971}
972static void desret_xmlParserMode(xmlParserMode val ATTRIBUTE_UNUSED) {
973}
974
975#define gen_nb_xmlParserOption 4
976static xmlParserOption gen_xmlParserOption(int no, int nr ATTRIBUTE_UNUSED) {
977 if (no == 1) return(XML_PARSE_DTDATTR);
978 if (no == 2) return(XML_PARSE_DTDLOAD);
979 if (no == 3) return(XML_PARSE_DTDVALID);
980 if (no == 4) return(XML_PARSE_NOBLANKS);
981 return(0);
982}
983static void des_xmlParserOption(int no ATTRIBUTE_UNUSED, xmlParserOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
984}
985static void desret_xmlParserOption(xmlParserOption val ATTRIBUTE_UNUSED) {
986}
987
988#define gen_nb_xmlParserProperties 4
989static xmlParserProperties gen_xmlParserProperties(int no, int nr ATTRIBUTE_UNUSED) {
990 if (no == 1) return(XML_PARSER_DEFAULTATTRS);
991 if (no == 2) return(XML_PARSER_LOADDTD);
992 if (no == 3) return(XML_PARSER_SUBST_ENTITIES);
993 if (no == 4) return(XML_PARSER_VALIDATE);
994 return(0);
995}
996static void des_xmlParserProperties(int no ATTRIBUTE_UNUSED, xmlParserProperties val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
997}
998static void desret_xmlParserProperties(xmlParserProperties val ATTRIBUTE_UNUSED) {
999}
1000
1001#define gen_nb_xmlParserSeverities 4
1002static xmlParserSeverities gen_xmlParserSeverities(int no, int nr ATTRIBUTE_UNUSED) {
1003 if (no == 1) return(XML_PARSER_SEVERITY_ERROR);
1004 if (no == 2) return(XML_PARSER_SEVERITY_VALIDITY_ERROR);
1005 if (no == 3) return(XML_PARSER_SEVERITY_VALIDITY_WARNING);
1006 if (no == 4) return(XML_PARSER_SEVERITY_WARNING);
1007 return(0);
1008}
1009static void des_xmlParserSeverities(int no ATTRIBUTE_UNUSED, xmlParserSeverities val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1010}
1011static void desret_xmlParserSeverities(xmlParserSeverities val ATTRIBUTE_UNUSED) {
1012}
1013
1014#define gen_nb_xmlReaderTypes 4
1015static xmlReaderTypes gen_xmlReaderTypes(int no, int nr ATTRIBUTE_UNUSED) {
1016 if (no == 1) return(XML_READER_TYPE_ATTRIBUTE);
1017 if (no == 2) return(XML_READER_TYPE_CDATA);
1018 if (no == 3) return(XML_READER_TYPE_COMMENT);
1019 if (no == 4) return(XML_READER_TYPE_DOCUMENT);
1020 return(0);
1021}
1022static void des_xmlReaderTypes(int no ATTRIBUTE_UNUSED, xmlReaderTypes val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1023}
1024static void desret_xmlReaderTypes(xmlReaderTypes val ATTRIBUTE_UNUSED) {
1025}
1026
1027#define gen_nb_xmlRelaxNGParserFlag 3
1028static xmlRelaxNGParserFlag gen_xmlRelaxNGParserFlag(int no, int nr ATTRIBUTE_UNUSED) {
1029 if (no == 1) return(XML_RELAXNGP_CRNG);
1030 if (no == 2) return(XML_RELAXNGP_FREE_DOC);
1031 if (no == 3) return(XML_RELAXNGP_NONE);
1032 return(0);
1033}
1034static void des_xmlRelaxNGParserFlag(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserFlag val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1035}
1036static void desret_xmlRelaxNGParserFlag(xmlRelaxNGParserFlag val ATTRIBUTE_UNUSED) {
1037}
1038
1039#define gen_nb_xmlRelaxNGValidErr 4
1040static xmlRelaxNGValidErr gen_xmlRelaxNGValidErr(int no, int nr ATTRIBUTE_UNUSED) {
1041 if (no == 1) return(XML_RELAXNG_ERR_ATTREXTRANS);
1042 if (no == 2) return(XML_RELAXNG_ERR_ATTRNAME);
1043 if (no == 3) return(XML_RELAXNG_ERR_ATTRNONS);
1044 if (no == 4) return(XML_RELAXNG_ERR_ATTRVALID);
1045 return(0);
1046}
1047static void des_xmlRelaxNGValidErr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidErr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1048}
1049static void desret_xmlRelaxNGValidErr(xmlRelaxNGValidErr val ATTRIBUTE_UNUSED) {
1050}
1051
1052#define gen_nb_xmlSchemaContentType 4
1053static xmlSchemaContentType gen_xmlSchemaContentType(int no, int nr ATTRIBUTE_UNUSED) {
1054 if (no == 1) return(XML_SCHEMA_CONTENT_ANY);
1055 if (no == 2) return(XML_SCHEMA_CONTENT_BASIC);
1056 if (no == 3) return(XML_SCHEMA_CONTENT_ELEMENTS);
1057 if (no == 4) return(XML_SCHEMA_CONTENT_EMPTY);
1058 return(0);
1059}
1060static void des_xmlSchemaContentType(int no ATTRIBUTE_UNUSED, xmlSchemaContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1061}
1062static void desret_xmlSchemaContentType(xmlSchemaContentType val ATTRIBUTE_UNUSED) {
1063}
1064
1065#define gen_nb_xmlSchemaTypeType 4
1066static xmlSchemaTypeType gen_xmlSchemaTypeType(int no, int nr ATTRIBUTE_UNUSED) {
1067 if (no == 1) return(XML_SCHEMA_FACET_ENUMERATION);
1068 if (no == 2) return(XML_SCHEMA_FACET_FRACTIONDIGITS);
1069 if (no == 3) return(XML_SCHEMA_FACET_LENGTH);
1070 if (no == 4) return(XML_SCHEMA_FACET_MAXEXCLUSIVE);
1071 return(0);
1072}
1073static void des_xmlSchemaTypeType(int no ATTRIBUTE_UNUSED, xmlSchemaTypeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1074}
1075static void desret_xmlSchemaTypeType(xmlSchemaTypeType val ATTRIBUTE_UNUSED) {
1076}
1077
1078#define gen_nb_xmlSchemaValType 4
1079static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1080 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1081 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1082 if (no == 3) return(XML_SCHEMAS_ANYURI);
1083 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1084 return(0);
1085}
1086static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1087}
1088static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED) {
1089}
1090
1091#define gen_nb_xmlSchemaValidError 4
1092static xmlSchemaValidError gen_xmlSchemaValidError(int no, int nr ATTRIBUTE_UNUSED) {
1093 if (no == 1) return(XML_SCHEMAS_ERR_);
1094 if (no == 2) return(XML_SCHEMAS_ERR_ATTRINVALID);
1095 if (no == 3) return(XML_SCHEMAS_ERR_ATTRUNKNOWN);
1096 if (no == 4) return(XML_SCHEMAS_ERR_CONSTRUCT);
1097 return(0);
1098}
1099static void des_xmlSchemaValidError(int no ATTRIBUTE_UNUSED, xmlSchemaValidError val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1100}
1101static void desret_xmlSchemaValidError(xmlSchemaValidError val ATTRIBUTE_UNUSED) {
1102}
1103
1104#define gen_nb_xmlSchemaValidOption 1
1105static xmlSchemaValidOption gen_xmlSchemaValidOption(int no, int nr ATTRIBUTE_UNUSED) {
1106 if (no == 1) return(XML_SCHEMA_VAL_VC_I_CREATE);
1107 return(0);
1108}
1109static void des_xmlSchemaValidOption(int no ATTRIBUTE_UNUSED, xmlSchemaValidOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1110}
1111static void desret_xmlSchemaValidOption(xmlSchemaValidOption val ATTRIBUTE_UNUSED) {
1112}
1113
1114#define gen_nb_xmlTextReaderMode 4
1115static xmlTextReaderMode gen_xmlTextReaderMode(int no, int nr ATTRIBUTE_UNUSED) {
1116 if (no == 1) return(XML_TEXTREADER_MODE_CLOSED);
1117 if (no == 2) return(XML_TEXTREADER_MODE_EOF);
1118 if (no == 3) return(XML_TEXTREADER_MODE_ERROR);
1119 if (no == 4) return(XML_TEXTREADER_MODE_INITIAL);
1120 return(0);
1121}
1122static void des_xmlTextReaderMode(int no ATTRIBUTE_UNUSED, xmlTextReaderMode val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1123}
1124static void desret_xmlTextReaderMode(xmlTextReaderMode val ATTRIBUTE_UNUSED) {
1125}
1126
1127#define gen_nb_xmlXPathError 4
1128static xmlXPathError gen_xmlXPathError(int no, int nr ATTRIBUTE_UNUSED) {
1129 if (no == 1) return(XPATH_ENCODING_ERROR);
1130 if (no == 2) return(XPATH_EXPRESSION_OK);
1131 if (no == 3) return(XPATH_EXPR_ERROR);
1132 if (no == 4) return(XPATH_INVALID_ARITY);
1133 return(0);
1134}
1135static void des_xmlXPathError(int no ATTRIBUTE_UNUSED, xmlXPathError val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1136}
1137static void desret_xmlXPathError(xmlXPathError val ATTRIBUTE_UNUSED) {
1138}
1139
1140#define gen_nb_xmlXPathObjectType 4
1141static xmlXPathObjectType gen_xmlXPathObjectType(int no, int nr ATTRIBUTE_UNUSED) {
1142 if (no == 1) return(XPATH_BOOLEAN);
1143 if (no == 2) return(XPATH_LOCATIONSET);
1144 if (no == 3) return(XPATH_NODESET);
1145 if (no == 4) return(XPATH_NUMBER);
1146 return(0);
1147}
1148static void des_xmlXPathObjectType(int no ATTRIBUTE_UNUSED, xmlXPathObjectType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1149}
1150static void desret_xmlXPathObjectType(xmlXPathObjectType val ATTRIBUTE_UNUSED) {
1151}
1152
Daniel Veillard34099b42004-11-04 17:34:35 +00001153#include <libxml/HTMLparser.h>
1154#include <libxml/HTMLtree.h>
1155#include <libxml/catalog.h>
1156#include <libxml/chvalid.h>
1157#include <libxml/dict.h>
1158#include <libxml/encoding.h>
1159#include <libxml/entities.h>
1160#include <libxml/hash.h>
1161#include <libxml/list.h>
1162#include <libxml/nanoftp.h>
1163#include <libxml/nanohttp.h>
1164#include <libxml/parser.h>
1165#include <libxml/pattern.h>
1166#include <libxml/relaxng.h>
1167#include <libxml/schemasInternals.h>
1168#include <libxml/tree.h>
1169#include <libxml/uri.h>
1170#include <libxml/valid.h>
1171#include <libxml/xinclude.h>
1172#include <libxml/xmlIO.h>
1173#include <libxml/xmlerror.h>
1174#include <libxml/xmlreader.h>
1175#include <libxml/xmlsave.h>
1176#include <libxml/xmlschemas.h>
1177#include <libxml/xmlschemastypes.h>
1178#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001179#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001180#include <libxml/xmlwriter.h>
1181#include <libxml/xpath.h>
1182#include <libxml/xpointer.h>
1183static int test_HTMLparser(void);
1184static int test_HTMLtree(void);
1185static int test_catalog(void);
1186static int test_chvalid(void);
1187static int test_dict(void);
1188static int test_encoding(void);
1189static int test_entities(void);
1190static int test_hash(void);
1191static int test_list(void);
1192static int test_nanoftp(void);
1193static int test_nanohttp(void);
1194static int test_parser(void);
1195static int test_pattern(void);
1196static int test_relaxng(void);
1197static int test_schemasInternals(void);
1198static int test_tree(void);
1199static int test_uri(void);
1200static int test_valid(void);
1201static int test_xinclude(void);
1202static int test_xmlIO(void);
1203static int test_xmlerror(void);
1204static int test_xmlreader(void);
1205static int test_xmlsave(void);
1206static int test_xmlschemas(void);
1207static int test_xmlschemastypes(void);
1208static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001209static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001210static int test_xmlwriter(void);
1211static int test_xpath(void);
1212static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001213
1214/**
1215 * testlibxml2:
1216 *
1217 * Main entry point of the tester for the full libxml2 module,
1218 * it calls all the tester entry point for each module.
1219 *
1220 * Returns the number of error found
1221 */
1222static int
1223testlibxml2(void)
1224{
Daniel Veillard42595322004-11-08 10:52:06 +00001225 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001226
Daniel Veillard42595322004-11-08 10:52:06 +00001227 test_ret += test_HTMLparser();
1228 test_ret += test_HTMLtree();
1229 test_ret += test_catalog();
1230 test_ret += test_chvalid();
1231 test_ret += test_dict();
1232 test_ret += test_encoding();
1233 test_ret += test_entities();
1234 test_ret += test_hash();
1235 test_ret += test_list();
1236 test_ret += test_nanoftp();
1237 test_ret += test_nanohttp();
1238 test_ret += test_parser();
1239 test_ret += test_pattern();
1240 test_ret += test_relaxng();
1241 test_ret += test_schemasInternals();
1242 test_ret += test_tree();
1243 test_ret += test_uri();
1244 test_ret += test_valid();
1245 test_ret += test_xinclude();
1246 test_ret += test_xmlIO();
1247 test_ret += test_xmlerror();
1248 test_ret += test_xmlreader();
1249 test_ret += test_xmlsave();
1250 test_ret += test_xmlschemas();
1251 test_ret += test_xmlschemastypes();
1252 test_ret += test_xmlstring();
1253 test_ret += test_xmlunicode();
1254 test_ret += test_xmlwriter();
1255 test_ret += test_xpath();
1256 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001257
Daniel Veillard3d97e662004-11-04 10:49:00 +00001258 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001259 function_tests, call_tests, test_ret);
1260 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001261}
1262
1263
Daniel Veillardce682bc2004-11-05 17:22:25 +00001264#define gen_nb_unsigned_char_ptr 1
1265static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1266 return(NULL);
1267}
1268static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1269}
1270
1271#define gen_nb_const_unsigned_char_ptr 1
1272static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1273 return(NULL);
1274}
1275static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1276}
1277
Daniel Veillardd93f6252004-11-02 15:53:51 +00001278static int
1279test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001280 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001281
Daniel Veillardce682bc2004-11-05 17:22:25 +00001282#ifdef LIBXML_HTML_ENABLED
1283 int mem_base;
1284 int ret_val;
1285 unsigned char * out; /* a pointer to an array of bytes to store the result */
1286 int n_out;
1287 int * outlen; /* the length of @out */
1288 int n_outlen;
1289 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1290 int n_in;
1291 int * inlen; /* the length of @in */
1292 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001293
Daniel Veillardce682bc2004-11-05 17:22:25 +00001294 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1295 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1296 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1297 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1298 mem_base = xmlMemBlocks();
1299 out = gen_unsigned_char_ptr(n_out, 0);
1300 outlen = gen_int_ptr(n_outlen, 1);
1301 in = gen_const_unsigned_char_ptr(n_in, 2);
1302 inlen = gen_int_ptr(n_inlen, 3);
1303
1304 ret_val = UTF8ToHtml(out, outlen, in, inlen);
1305 desret_int(ret_val);
1306 call_tests++;
1307 des_unsigned_char_ptr(n_out, out, 0);
1308 des_int_ptr(n_outlen, outlen, 1);
1309 des_const_unsigned_char_ptr(n_in, in, 2);
1310 des_int_ptr(n_inlen, inlen, 3);
1311 xmlResetLastError();
1312 if (mem_base != xmlMemBlocks()) {
1313 printf("Leak of %d blocks found in UTF8ToHtml",
1314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001315 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001316 printf(" %d", n_out);
1317 printf(" %d", n_outlen);
1318 printf(" %d", n_in);
1319 printf(" %d", n_inlen);
1320 printf("\n");
1321 }
1322 }
1323 }
1324 }
1325 }
1326#endif
1327
1328 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001330}
1331
1332
Daniel Veillardce682bc2004-11-05 17:22:25 +00001333#define gen_nb_const_htmlElemDesc_ptr 1
1334static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1335 return(NULL);
1336}
1337static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1338}
1339
Daniel Veillardd93f6252004-11-02 15:53:51 +00001340static int
1341test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001342 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001343
Daniel Veillard57b25162004-11-06 14:50:18 +00001344#ifdef LIBXML_HTML_ENABLED
1345 int mem_base;
1346 htmlStatus ret_val;
1347 htmlElemDesc * elt; /* HTML element */
1348 int n_elt;
1349 xmlChar * attr; /* HTML attribute */
1350 int n_attr;
1351 int legacy; /* whether to allow deprecated attributes */
1352 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001353
Daniel Veillard57b25162004-11-06 14:50:18 +00001354 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1355 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1356 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1357 mem_base = xmlMemBlocks();
1358 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1359 attr = gen_const_xmlChar_ptr(n_attr, 1);
1360 legacy = gen_int(n_legacy, 2);
1361
1362 ret_val = htmlAttrAllowed(elt, attr, legacy);
1363 desret_htmlStatus(ret_val);
1364 call_tests++;
1365 des_const_htmlElemDesc_ptr(n_elt, elt, 0);
1366 des_const_xmlChar_ptr(n_attr, attr, 1);
1367 des_int(n_legacy, legacy, 2);
1368 xmlResetLastError();
1369 if (mem_base != xmlMemBlocks()) {
1370 printf("Leak of %d blocks found in htmlAttrAllowed",
1371 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001372 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001373 printf(" %d", n_elt);
1374 printf(" %d", n_attr);
1375 printf(" %d", n_legacy);
1376 printf("\n");
1377 }
1378 }
1379 }
1380 }
1381#endif
1382
1383 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001384 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001385}
1386
1387
1388static int
1389test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001390 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001391
Daniel Veillarda03e3652004-11-02 18:45:30 +00001392#ifdef LIBXML_HTML_ENABLED
1393 int mem_base;
1394 int ret_val;
1395 htmlDocPtr doc; /* the HTML document */
1396 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001397 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001398 int n_name;
1399 htmlNodePtr elem; /* the HTML element */
1400 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001401
Daniel Veillarda03e3652004-11-02 18:45:30 +00001402 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
1403 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1404 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
1405 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001406 doc = gen_xmlDocPtr(n_doc, 0);
1407 name = gen_const_xmlChar_ptr(n_name, 1);
1408 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001409
1410 ret_val = htmlAutoCloseTag(doc, name, elem);
1411 desret_int(ret_val);
1412 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001413 des_xmlDocPtr(n_doc, doc, 0);
1414 des_const_xmlChar_ptr(n_name, name, 1);
1415 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001416 xmlResetLastError();
1417 if (mem_base != xmlMemBlocks()) {
1418 printf("Leak of %d blocks found in htmlAutoCloseTag",
1419 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001420 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001421 printf(" %d", n_doc);
1422 printf(" %d", n_name);
1423 printf(" %d", n_elem);
1424 printf("\n");
1425 }
1426 }
1427 }
1428 }
1429#endif
1430
Daniel Veillard3d97e662004-11-04 10:49:00 +00001431 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001433}
1434
1435
1436static int
1437test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001438 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001439
Daniel Veillard34099b42004-11-04 17:34:35 +00001440#ifdef LIBXML_HTML_ENABLED
1441 int mem_base;
1442 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001443 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001444 int n_buffer;
1445 int size; /* the size of the array */
1446 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001447
Daniel Veillard34099b42004-11-04 17:34:35 +00001448 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1449 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1450 mem_base = xmlMemBlocks();
1451 buffer = gen_const_char_ptr(n_buffer, 0);
1452 size = gen_int(n_size, 1);
1453
1454 ret_val = htmlCreateMemoryParserCtxt(buffer, size);
1455 desret_xmlParserCtxtPtr(ret_val);
1456 call_tests++;
1457 des_const_char_ptr(n_buffer, buffer, 0);
1458 des_int(n_size, size, 1);
1459 xmlResetLastError();
1460 if (mem_base != xmlMemBlocks()) {
1461 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001463 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001464 printf(" %d", n_buffer);
1465 printf(" %d", n_size);
1466 printf("\n");
1467 }
1468 }
1469 }
1470#endif
1471
1472 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001474}
1475
1476
Daniel Veillardce682bc2004-11-05 17:22:25 +00001477#define gen_nb_htmlSAXHandlerPtr 1
1478static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1479 return(NULL);
1480}
1481static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1482}
1483
Daniel Veillardd93f6252004-11-02 15:53:51 +00001484static int
1485test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001487
Daniel Veillardce682bc2004-11-05 17:22:25 +00001488#ifdef LIBXML_HTML_ENABLED
1489#ifdef LIBXML_PUSH_ENABLED
1490 int mem_base;
1491 htmlParserCtxtPtr ret_val;
1492 htmlSAXHandlerPtr sax; /* a SAX handler */
1493 int n_sax;
1494 void * user_data; /* The user data returned on SAX callbacks */
1495 int n_user_data;
1496 char * chunk; /* a pointer to an array of chars */
1497 int n_chunk;
1498 int size; /* number of chars in the array */
1499 int n_size;
1500 const char * filename; /* an optional file name or URI */
1501 int n_filename;
1502 xmlCharEncoding enc; /* an optional encoding */
1503 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001504
Daniel Veillardce682bc2004-11-05 17:22:25 +00001505 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1506 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1507 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1508 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001509 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001510 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1511 mem_base = xmlMemBlocks();
1512 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1513 user_data = gen_userdata(n_user_data, 1);
1514 chunk = gen_const_char_ptr(n_chunk, 2);
1515 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001516 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001517 enc = gen_xmlCharEncoding(n_enc, 5);
1518
1519 ret_val = htmlCreatePushParserCtxt(sax, user_data, chunk, size, filename, enc);
1520 desret_xmlParserCtxtPtr(ret_val);
1521 call_tests++;
1522 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1523 des_userdata(n_user_data, user_data, 1);
1524 des_const_char_ptr(n_chunk, chunk, 2);
1525 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001526 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001527 des_xmlCharEncoding(n_enc, enc, 5);
1528 xmlResetLastError();
1529 if (mem_base != xmlMemBlocks()) {
1530 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001532 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001533 printf(" %d", n_sax);
1534 printf(" %d", n_user_data);
1535 printf(" %d", n_chunk);
1536 printf(" %d", n_size);
1537 printf(" %d", n_filename);
1538 printf(" %d", n_enc);
1539 printf("\n");
1540 }
1541 }
1542 }
1543 }
1544 }
1545 }
1546 }
1547#endif
1548#endif
1549
1550 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001551 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001552}
1553
1554
1555static int
1556test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001557 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001558
Daniel Veillarda03e3652004-11-02 18:45:30 +00001559#ifdef LIBXML_HTML_ENABLED
1560 int mem_base;
1561 htmlDocPtr ret_val;
1562 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1563 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001564 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001565 int n_cur;
1566 const char * URL; /* the base URL to use for the document */
1567 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001568 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001569 int n_encoding;
1570 int options; /* a combination of htmlParserOption(s) */
1571 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001572
Daniel Veillarda03e3652004-11-02 18:45:30 +00001573 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
1574 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1575 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1576 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1577 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1578 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001579 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
1580 cur = gen_const_xmlChar_ptr(n_cur, 1);
1581 URL = gen_filepath(n_URL, 2);
1582 encoding = gen_const_char_ptr(n_encoding, 3);
1583 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001584
Daniel Veillarda03e3652004-11-02 18:45:30 +00001585 ret_val = htmlCtxtReadDoc(ctxt, cur, URL, encoding, options);
1586 desret_xmlDocPtr(ret_val);
1587 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001588 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
1589 des_const_xmlChar_ptr(n_cur, cur, 1);
1590 des_filepath(n_URL, URL, 2);
1591 des_const_char_ptr(n_encoding, encoding, 3);
1592 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001593 xmlResetLastError();
1594 if (mem_base != xmlMemBlocks()) {
1595 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1596 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001597 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001598 printf(" %d", n_ctxt);
1599 printf(" %d", n_cur);
1600 printf(" %d", n_URL);
1601 printf(" %d", n_encoding);
1602 printf(" %d", n_options);
1603 printf("\n");
1604 }
1605 }
1606 }
1607 }
1608 }
1609 }
1610#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001611
Daniel Veillard3d97e662004-11-04 10:49:00 +00001612 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001614}
1615
1616
1617static int
1618test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001620
Daniel Veillarda03e3652004-11-02 18:45:30 +00001621#ifdef LIBXML_HTML_ENABLED
1622 int mem_base;
1623 htmlDocPtr ret_val;
1624 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1625 int n_ctxt;
1626 const char * filename; /* a file or URL */
1627 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001628 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001629 int n_encoding;
1630 int options; /* a combination of htmlParserOption(s) */
1631 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001632
Daniel Veillarda03e3652004-11-02 18:45:30 +00001633 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
1634 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1635 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1636 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1637 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001638 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
1639 filename = gen_filepath(n_filename, 1);
1640 encoding = gen_const_char_ptr(n_encoding, 2);
1641 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001642
1643 ret_val = htmlCtxtReadFile(ctxt, filename, encoding, options);
1644 desret_xmlDocPtr(ret_val);
1645 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001646 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
1647 des_filepath(n_filename, filename, 1);
1648 des_const_char_ptr(n_encoding, encoding, 2);
1649 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001650 xmlResetLastError();
1651 if (mem_base != xmlMemBlocks()) {
1652 printf("Leak of %d blocks found in htmlCtxtReadFile",
1653 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001654 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001655 printf(" %d", n_ctxt);
1656 printf(" %d", n_filename);
1657 printf(" %d", n_encoding);
1658 printf(" %d", n_options);
1659 printf("\n");
1660 }
1661 }
1662 }
1663 }
1664 }
1665#endif
1666
Daniel Veillard3d97e662004-11-04 10:49:00 +00001667 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001668 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001669}
1670
1671
1672static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001673test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001674 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001675
Daniel Veillarda03e3652004-11-02 18:45:30 +00001676#ifdef LIBXML_HTML_ENABLED
1677 int mem_base;
1678 htmlDocPtr ret_val;
1679 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1680 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001681 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001682 int n_buffer;
1683 int size; /* the size of the array */
1684 int n_size;
1685 const char * URL; /* the base URL to use for the document */
1686 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001687 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001688 int n_encoding;
1689 int options; /* a combination of htmlParserOption(s) */
1690 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001691
Daniel Veillarda03e3652004-11-02 18:45:30 +00001692 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
1693 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1694 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1695 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
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 buffer = gen_const_char_ptr(n_buffer, 1);
1701 size = gen_int(n_size, 2);
1702 URL = gen_filepath(n_URL, 3);
1703 encoding = gen_const_char_ptr(n_encoding, 4);
1704 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001705
1706 ret_val = htmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options);
1707 desret_xmlDocPtr(ret_val);
1708 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001709 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
1710 des_const_char_ptr(n_buffer, buffer, 1);
1711 des_int(n_size, size, 2);
1712 des_filepath(n_URL, URL, 3);
1713 des_const_char_ptr(n_encoding, encoding, 4);
1714 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001715 xmlResetLastError();
1716 if (mem_base != xmlMemBlocks()) {
1717 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1718 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001719 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001720 printf(" %d", n_ctxt);
1721 printf(" %d", n_buffer);
1722 printf(" %d", n_size);
1723 printf(" %d", n_URL);
1724 printf(" %d", n_encoding);
1725 printf(" %d", n_options);
1726 printf("\n");
1727 }
1728 }
1729 }
1730 }
1731 }
1732 }
1733 }
1734#endif
1735
Daniel Veillard3d97e662004-11-04 10:49:00 +00001736 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001737 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001738}
1739
1740
1741static int
1742test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001743 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001744
Daniel Veillarda03e3652004-11-02 18:45:30 +00001745#ifdef LIBXML_HTML_ENABLED
1746 int mem_base;
1747 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1748 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001749
Daniel Veillarda03e3652004-11-02 18:45:30 +00001750 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
1751 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001752 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001753
1754 htmlCtxtReset(ctxt);
1755 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001756 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001757 xmlResetLastError();
1758 if (mem_base != xmlMemBlocks()) {
1759 printf("Leak of %d blocks found in htmlCtxtReset",
1760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001761 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001762 printf(" %d", n_ctxt);
1763 printf("\n");
1764 }
1765 }
1766#endif
1767
Daniel Veillard3d97e662004-11-04 10:49:00 +00001768 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001770}
1771
1772
1773static int
1774test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001776
Daniel Veillarda03e3652004-11-02 18:45:30 +00001777#ifdef LIBXML_HTML_ENABLED
1778 int mem_base;
1779 int ret_val;
1780 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1781 int n_ctxt;
1782 int options; /* a combination of htmlParserOption(s) */
1783 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001784
Daniel Veillarda03e3652004-11-02 18:45:30 +00001785 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
1786 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1787 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001788 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
1789 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001790
1791 ret_val = htmlCtxtUseOptions(ctxt, options);
1792 desret_int(ret_val);
1793 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001794 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
1795 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001796 xmlResetLastError();
1797 if (mem_base != xmlMemBlocks()) {
1798 printf("Leak of %d blocks found in htmlCtxtUseOptions",
1799 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001800 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001801 printf(" %d", n_ctxt);
1802 printf(" %d", n_options);
1803 printf("\n");
1804 }
1805 }
1806 }
1807#endif
1808
Daniel Veillard3d97e662004-11-04 10:49:00 +00001809 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001811}
1812
1813
1814static int
1815test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001817
Daniel Veillardce682bc2004-11-05 17:22:25 +00001818#ifdef LIBXML_HTML_ENABLED
1819 int mem_base;
1820 int ret_val;
1821 htmlElemDesc * parent; /* HTML parent element */
1822 int n_parent;
1823 xmlChar * elt; /* HTML element */
1824 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001825
Daniel Veillardce682bc2004-11-05 17:22:25 +00001826 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1827 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
1828 mem_base = xmlMemBlocks();
1829 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1830 elt = gen_const_xmlChar_ptr(n_elt, 1);
1831
1832 ret_val = htmlElementAllowedHere(parent, elt);
1833 desret_int(ret_val);
1834 call_tests++;
1835 des_const_htmlElemDesc_ptr(n_parent, parent, 0);
1836 des_const_xmlChar_ptr(n_elt, elt, 1);
1837 xmlResetLastError();
1838 if (mem_base != xmlMemBlocks()) {
1839 printf("Leak of %d blocks found in htmlElementAllowedHere",
1840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001841 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001842 printf(" %d", n_parent);
1843 printf(" %d", n_elt);
1844 printf("\n");
1845 }
1846 }
1847 }
1848#endif
1849
1850 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001852}
1853
1854
1855static int
1856test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001858
Daniel Veillard57b25162004-11-06 14:50:18 +00001859#ifdef LIBXML_HTML_ENABLED
1860 int mem_base;
1861 htmlStatus ret_val;
1862 htmlElemDesc * parent; /* HTML parent element */
1863 int n_parent;
1864 htmlElemDesc * elt; /* HTML element */
1865 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001866
Daniel Veillard57b25162004-11-06 14:50:18 +00001867 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1868 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1869 mem_base = xmlMemBlocks();
1870 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1871 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1872
1873 ret_val = htmlElementStatusHere(parent, elt);
1874 desret_htmlStatus(ret_val);
1875 call_tests++;
1876 des_const_htmlElemDesc_ptr(n_parent, parent, 0);
1877 des_const_htmlElemDesc_ptr(n_elt, elt, 1);
1878 xmlResetLastError();
1879 if (mem_base != xmlMemBlocks()) {
1880 printf("Leak of %d blocks found in htmlElementStatusHere",
1881 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001882 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001883 printf(" %d", n_parent);
1884 printf(" %d", n_elt);
1885 printf("\n");
1886 }
1887 }
1888 }
1889#endif
1890
1891 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001892 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001893}
1894
1895
1896static int
1897test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001898 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001899
Daniel Veillardce682bc2004-11-05 17:22:25 +00001900#ifdef LIBXML_HTML_ENABLED
1901 int mem_base;
1902 int ret_val;
1903 unsigned char * out; /* a pointer to an array of bytes to store the result */
1904 int n_out;
1905 int * outlen; /* the length of @out */
1906 int n_outlen;
1907 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1908 int n_in;
1909 int * inlen; /* the length of @in */
1910 int n_inlen;
1911 int quoteChar; /* the quote character to escape (' or ") or zero. */
1912 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001913
Daniel Veillardce682bc2004-11-05 17:22:25 +00001914 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1915 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1916 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1917 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1918 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
1919 mem_base = xmlMemBlocks();
1920 out = gen_unsigned_char_ptr(n_out, 0);
1921 outlen = gen_int_ptr(n_outlen, 1);
1922 in = gen_const_unsigned_char_ptr(n_in, 2);
1923 inlen = gen_int_ptr(n_inlen, 3);
1924 quoteChar = gen_int(n_quoteChar, 4);
1925
1926 ret_val = htmlEncodeEntities(out, outlen, in, inlen, quoteChar);
1927 desret_int(ret_val);
1928 call_tests++;
1929 des_unsigned_char_ptr(n_out, out, 0);
1930 des_int_ptr(n_outlen, outlen, 1);
1931 des_const_unsigned_char_ptr(n_in, in, 2);
1932 des_int_ptr(n_inlen, inlen, 3);
1933 des_int(n_quoteChar, quoteChar, 4);
1934 xmlResetLastError();
1935 if (mem_base != xmlMemBlocks()) {
1936 printf("Leak of %d blocks found in htmlEncodeEntities",
1937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001938 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001939 printf(" %d", n_out);
1940 printf(" %d", n_outlen);
1941 printf(" %d", n_in);
1942 printf(" %d", n_inlen);
1943 printf(" %d", n_quoteChar);
1944 printf("\n");
1945 }
1946 }
1947 }
1948 }
1949 }
1950 }
1951#endif
1952
1953 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001954 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001955}
1956
1957
1958static int
1959test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001960 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001961
Daniel Veillard42595322004-11-08 10:52:06 +00001962#ifdef LIBXML_HTML_ENABLED
1963 int mem_base;
1964 const htmlEntityDesc * ret_val;
1965 xmlChar * name; /* the entity name */
1966 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001967
Daniel Veillard42595322004-11-08 10:52:06 +00001968 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1969 mem_base = xmlMemBlocks();
1970 name = gen_const_xmlChar_ptr(n_name, 0);
1971
1972 ret_val = htmlEntityLookup(name);
1973 desret_const_htmlEntityDesc_ptr(ret_val);
1974 call_tests++;
1975 des_const_xmlChar_ptr(n_name, name, 0);
1976 xmlResetLastError();
1977 if (mem_base != xmlMemBlocks()) {
1978 printf("Leak of %d blocks found in htmlEntityLookup",
1979 xmlMemBlocks() - mem_base);
1980 test_ret++;
1981 printf(" %d", n_name);
1982 printf("\n");
1983 }
1984 }
1985#endif
1986
1987 function_tests++;
1988 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001989}
1990
1991
1992static int
1993test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001994 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001995
Daniel Veillard42595322004-11-08 10:52:06 +00001996#ifdef LIBXML_HTML_ENABLED
1997 int mem_base;
1998 const htmlEntityDesc * ret_val;
1999 unsigned int value; /* the entity's unicode value */
2000 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002001
Daniel Veillard42595322004-11-08 10:52:06 +00002002 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
2003 mem_base = xmlMemBlocks();
2004 value = gen_unsigned_int(n_value, 0);
2005
2006 ret_val = htmlEntityValueLookup(value);
2007 desret_const_htmlEntityDesc_ptr(ret_val);
2008 call_tests++;
2009 des_unsigned_int(n_value, value, 0);
2010 xmlResetLastError();
2011 if (mem_base != xmlMemBlocks()) {
2012 printf("Leak of %d blocks found in htmlEntityValueLookup",
2013 xmlMemBlocks() - mem_base);
2014 test_ret++;
2015 printf(" %d", n_value);
2016 printf("\n");
2017 }
2018 }
2019#endif
2020
2021 function_tests++;
2022 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002023}
2024
2025
2026static int
2027test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002028 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002029
2030#ifdef LIBXML_HTML_ENABLED
2031 int mem_base;
2032 int ret_val;
2033 int val; /* int 0 or 1 */
2034 int n_val;
2035
2036 for (n_val = 0;n_val < gen_nb_int;n_val++) {
2037 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002038 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002039
2040 ret_val = htmlHandleOmittedElem(val);
2041 desret_int(ret_val);
2042 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002043 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002044 xmlResetLastError();
2045 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002046 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002047 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002048 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002049 printf(" %d", n_val);
2050 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002051 }
2052 }
2053#endif
2054
Daniel Veillard3d97e662004-11-04 10:49:00 +00002055 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002057}
2058
2059
2060static int
2061test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002062 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002063
Daniel Veillarda03e3652004-11-02 18:45:30 +00002064#ifdef LIBXML_HTML_ENABLED
2065 int mem_base;
2066 int ret_val;
2067 htmlDocPtr doc; /* the HTML document */
2068 int n_doc;
2069 htmlNodePtr elem; /* the HTML element */
2070 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002071
Daniel Veillarda03e3652004-11-02 18:45:30 +00002072 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
2073 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
2074 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002075 doc = gen_xmlDocPtr(n_doc, 0);
2076 elem = gen_xmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002077
2078 ret_val = htmlIsAutoClosed(doc, elem);
2079 desret_int(ret_val);
2080 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002081 des_xmlDocPtr(n_doc, doc, 0);
2082 des_xmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002083 xmlResetLastError();
2084 if (mem_base != xmlMemBlocks()) {
2085 printf("Leak of %d blocks found in htmlIsAutoClosed",
2086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002087 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002088 printf(" %d", n_doc);
2089 printf(" %d", n_elem);
2090 printf("\n");
2091 }
2092 }
2093 }
2094#endif
2095
Daniel Veillard3d97e662004-11-04 10:49:00 +00002096 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002097 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002098}
2099
2100
2101static int
2102test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002103 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002104
2105#ifdef LIBXML_HTML_ENABLED
2106 int mem_base;
2107 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002108 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002109 int n_name;
2110
2111 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2112 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002113 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002114
2115 ret_val = htmlIsScriptAttribute(name);
2116 desret_int(ret_val);
2117 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002118 des_const_xmlChar_ptr(n_name, name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002119 xmlResetLastError();
2120 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002121 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002123 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002124 printf(" %d", n_name);
2125 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002126 }
2127 }
2128#endif
2129
Daniel Veillard3d97e662004-11-04 10:49:00 +00002130 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002131 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002132}
2133
2134
Daniel Veillardce682bc2004-11-05 17:22:25 +00002135#define gen_nb_const_xmlNodePtr 1
2136static htmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2137 return(NULL);
2138}
2139static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2140}
2141
Daniel Veillardd93f6252004-11-02 15:53:51 +00002142static int
2143test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002145
Daniel Veillard57b25162004-11-06 14:50:18 +00002146#ifdef LIBXML_HTML_ENABLED
2147 int mem_base;
2148 htmlStatus ret_val;
2149 htmlNodePtr node; /* an htmlNodePtr in a tree */
2150 int n_node;
2151 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2152 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002153
Daniel Veillard57b25162004-11-06 14:50:18 +00002154 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
2155 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2156 mem_base = xmlMemBlocks();
2157 node = gen_const_xmlNodePtr(n_node, 0);
2158 legacy = gen_int(n_legacy, 1);
2159
2160 ret_val = htmlNodeStatus(node, legacy);
2161 desret_htmlStatus(ret_val);
2162 call_tests++;
2163 des_const_xmlNodePtr(n_node, node, 0);
2164 des_int(n_legacy, legacy, 1);
2165 xmlResetLastError();
2166 if (mem_base != xmlMemBlocks()) {
2167 printf("Leak of %d blocks found in htmlNodeStatus",
2168 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002169 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002170 printf(" %d", n_node);
2171 printf(" %d", n_legacy);
2172 printf("\n");
2173 }
2174 }
2175 }
2176#endif
2177
2178 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002180}
2181
2182
2183static int
2184test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002186
Daniel Veillarda03e3652004-11-02 18:45:30 +00002187#ifdef LIBXML_HTML_ENABLED
2188 int mem_base;
2189 int ret_val;
2190 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2191 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002192
Daniel Veillarda03e3652004-11-02 18:45:30 +00002193 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
2194 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002195 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002196
2197 ret_val = htmlParseCharRef(ctxt);
2198 desret_int(ret_val);
2199 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002200 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002201 xmlResetLastError();
2202 if (mem_base != xmlMemBlocks()) {
2203 printf("Leak of %d blocks found in htmlParseCharRef",
2204 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002205 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002206 printf(" %d", n_ctxt);
2207 printf("\n");
2208 }
2209 }
2210#endif
2211
Daniel Veillard3d97e662004-11-04 10:49:00 +00002212 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002213 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002214}
2215
2216
2217static int
2218test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002220
Daniel Veillarda03e3652004-11-02 18:45:30 +00002221#ifdef LIBXML_HTML_ENABLED
2222#ifdef LIBXML_PUSH_ENABLED
2223 int mem_base;
2224 int ret_val;
2225 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2226 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002227 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002228 int n_chunk;
2229 int size; /* the size in byte of the chunk */
2230 int n_size;
2231 int terminate; /* last chunk indicator */
2232 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002233
Daniel Veillarda03e3652004-11-02 18:45:30 +00002234 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
2235 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2236 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2237 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2238 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002239 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
2240 chunk = gen_const_char_ptr(n_chunk, 1);
2241 size = gen_int(n_size, 2);
2242 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002243
2244 ret_val = htmlParseChunk(ctxt, chunk, size, terminate);
2245 desret_int(ret_val);
2246 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002247 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
2248 des_const_char_ptr(n_chunk, chunk, 1);
2249 des_int(n_size, size, 2);
2250 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002251 xmlResetLastError();
2252 if (mem_base != xmlMemBlocks()) {
2253 printf("Leak of %d blocks found in htmlParseChunk",
2254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002255 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002256 printf(" %d", n_ctxt);
2257 printf(" %d", n_chunk);
2258 printf(" %d", n_size);
2259 printf(" %d", n_terminate);
2260 printf("\n");
2261 }
2262 }
2263 }
2264 }
2265 }
2266#endif
2267#endif
2268
Daniel Veillard3d97e662004-11-04 10:49:00 +00002269 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002271}
2272
2273
2274static int
2275test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002277
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002278#ifdef LIBXML_HTML_ENABLED
2279 int mem_base;
2280 htmlDocPtr ret_val;
2281 xmlChar * cur; /* a pointer to an array of xmlChar */
2282 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002283 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002284 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002285
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002286 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2287 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2288 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002289 cur = gen_xmlChar_ptr(n_cur, 0);
2290 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002291
2292 ret_val = htmlParseDoc(cur, encoding);
2293 desret_xmlDocPtr(ret_val);
2294 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002295 des_xmlChar_ptr(n_cur, cur, 0);
2296 des_const_char_ptr(n_encoding, encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002297 xmlResetLastError();
2298 if (mem_base != xmlMemBlocks()) {
2299 printf("Leak of %d blocks found in htmlParseDoc",
2300 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002301 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002302 printf(" %d", n_cur);
2303 printf(" %d", n_encoding);
2304 printf("\n");
2305 }
2306 }
2307 }
2308#endif
2309
Daniel Veillard3d97e662004-11-04 10:49:00 +00002310 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002312}
2313
2314
2315static int
2316test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002318
Daniel Veillarda03e3652004-11-02 18:45:30 +00002319#ifdef LIBXML_HTML_ENABLED
2320 int mem_base;
2321 int ret_val;
2322 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2323 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002324
Daniel Veillarda03e3652004-11-02 18:45:30 +00002325 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
2326 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002327 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002328
2329 ret_val = htmlParseDocument(ctxt);
2330 desret_int(ret_val);
2331 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002332 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002333 xmlResetLastError();
2334 if (mem_base != xmlMemBlocks()) {
2335 printf("Leak of %d blocks found in htmlParseDocument",
2336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002337 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002338 printf(" %d", n_ctxt);
2339 printf("\n");
2340 }
2341 }
2342#endif
2343
Daniel Veillard3d97e662004-11-04 10:49:00 +00002344 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002346}
2347
2348
2349static int
2350test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002351 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002352
Daniel Veillarda03e3652004-11-02 18:45:30 +00002353#ifdef LIBXML_HTML_ENABLED
2354 int mem_base;
2355 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2356 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002357
Daniel Veillarda03e3652004-11-02 18:45:30 +00002358 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
2359 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002360 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002361
2362 htmlParseElement(ctxt);
2363 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002364 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002365 xmlResetLastError();
2366 if (mem_base != xmlMemBlocks()) {
2367 printf("Leak of %d blocks found in htmlParseElement",
2368 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002369 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002370 printf(" %d", n_ctxt);
2371 printf("\n");
2372 }
2373 }
2374#endif
2375
Daniel Veillard3d97e662004-11-04 10:49:00 +00002376 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002378}
2379
2380
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002381#define gen_nb_const_xmlChar_ptr_ptr 1
2382static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2383 return(NULL);
2384}
2385static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2386}
2387
Daniel Veillardd93f6252004-11-02 15:53:51 +00002388static int
2389test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002390 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002391
Daniel Veillard42595322004-11-08 10:52:06 +00002392#ifdef LIBXML_HTML_ENABLED
2393 int mem_base;
2394 const htmlEntityDesc * ret_val;
2395 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2396 int n_ctxt;
2397 xmlChar ** str; /* location to store the entity name */
2398 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002399
Daniel Veillard42595322004-11-08 10:52:06 +00002400 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
2401 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2402 mem_base = xmlMemBlocks();
2403 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
2404 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2405
2406 ret_val = htmlParseEntityRef(ctxt, str);
2407 desret_const_htmlEntityDesc_ptr(ret_val);
2408 call_tests++;
2409 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
2410 des_const_xmlChar_ptr_ptr(n_str, str, 1);
2411 xmlResetLastError();
2412 if (mem_base != xmlMemBlocks()) {
2413 printf("Leak of %d blocks found in htmlParseEntityRef",
2414 xmlMemBlocks() - mem_base);
2415 test_ret++;
2416 printf(" %d", n_ctxt);
2417 printf(" %d", n_str);
2418 printf("\n");
2419 }
2420 }
2421 }
2422#endif
2423
2424 function_tests++;
2425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002426}
2427
2428
2429static int
2430test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002432
Daniel Veillarda03e3652004-11-02 18:45:30 +00002433#ifdef LIBXML_HTML_ENABLED
2434 htmlDocPtr ret_val;
2435 const char * filename; /* the filename */
2436 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002437 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002438 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002439
Daniel Veillarda03e3652004-11-02 18:45:30 +00002440 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2441 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002442 filename = gen_filepath(n_filename, 0);
2443 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002444
2445 ret_val = htmlParseFile(filename, encoding);
2446 desret_xmlDocPtr(ret_val);
2447 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002448 des_filepath(n_filename, filename, 0);
2449 des_const_char_ptr(n_encoding, encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002450 xmlResetLastError();
2451 }
2452 }
2453#endif
2454
Daniel Veillard3d97e662004-11-04 10:49:00 +00002455 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002457}
2458
2459
2460static int
2461test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002463
Daniel Veillarda03e3652004-11-02 18:45:30 +00002464#ifdef LIBXML_HTML_ENABLED
2465 int mem_base;
2466 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002467 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002468 int n_cur;
2469 const char * URL; /* the base URL to use for the document */
2470 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002471 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002472 int n_encoding;
2473 int options; /* a combination of htmlParserOption(s) */
2474 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002475
Daniel Veillarda03e3652004-11-02 18:45:30 +00002476 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2477 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2478 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2479 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2480 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002481 cur = gen_const_xmlChar_ptr(n_cur, 0);
2482 URL = gen_filepath(n_URL, 1);
2483 encoding = gen_const_char_ptr(n_encoding, 2);
2484 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002485
Daniel Veillarda03e3652004-11-02 18:45:30 +00002486 ret_val = htmlReadDoc(cur, URL, encoding, options);
2487 desret_xmlDocPtr(ret_val);
2488 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002489 des_const_xmlChar_ptr(n_cur, cur, 0);
2490 des_filepath(n_URL, URL, 1);
2491 des_const_char_ptr(n_encoding, encoding, 2);
2492 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002493 xmlResetLastError();
2494 if (mem_base != xmlMemBlocks()) {
2495 printf("Leak of %d blocks found in htmlReadDoc",
2496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002497 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002498 printf(" %d", n_cur);
2499 printf(" %d", n_URL);
2500 printf(" %d", n_encoding);
2501 printf(" %d", n_options);
2502 printf("\n");
2503 }
2504 }
2505 }
2506 }
2507 }
2508#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002509
Daniel Veillard3d97e662004-11-04 10:49:00 +00002510 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002511 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002512}
2513
2514
2515static int
2516test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002517 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002518
Daniel Veillarda03e3652004-11-02 18:45:30 +00002519#ifdef LIBXML_HTML_ENABLED
2520 int mem_base;
2521 htmlDocPtr ret_val;
2522 const char * filename; /* a file or URL */
2523 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002524 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002525 int n_encoding;
2526 int options; /* a combination of htmlParserOption(s) */
2527 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002528
Daniel Veillarda03e3652004-11-02 18:45:30 +00002529 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2530 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2531 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2532 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002533 filename = gen_filepath(n_filename, 0);
2534 encoding = gen_const_char_ptr(n_encoding, 1);
2535 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002536
2537 ret_val = htmlReadFile(filename, encoding, options);
2538 desret_xmlDocPtr(ret_val);
2539 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002540 des_filepath(n_filename, filename, 0);
2541 des_const_char_ptr(n_encoding, encoding, 1);
2542 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002543 xmlResetLastError();
2544 if (mem_base != xmlMemBlocks()) {
2545 printf("Leak of %d blocks found in htmlReadFile",
2546 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002547 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002548 printf(" %d", n_filename);
2549 printf(" %d", n_encoding);
2550 printf(" %d", n_options);
2551 printf("\n");
2552 }
2553 }
2554 }
2555 }
2556#endif
2557
Daniel Veillard3d97e662004-11-04 10:49:00 +00002558 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002559 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002560}
2561
2562
2563static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002564test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002565 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002566
Daniel Veillarda03e3652004-11-02 18:45:30 +00002567#ifdef LIBXML_HTML_ENABLED
2568 int mem_base;
2569 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002570 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002571 int n_buffer;
2572 int size; /* the size of the array */
2573 int n_size;
2574 const char * URL; /* the base URL to use for the document */
2575 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002576 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002577 int n_encoding;
2578 int options; /* a combination of htmlParserOption(s) */
2579 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002580
Daniel Veillarda03e3652004-11-02 18:45:30 +00002581 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2582 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2583 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2584 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2585 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2586 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002587 buffer = gen_const_char_ptr(n_buffer, 0);
2588 size = gen_int(n_size, 1);
2589 URL = gen_filepath(n_URL, 2);
2590 encoding = gen_const_char_ptr(n_encoding, 3);
2591 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002592
2593 ret_val = htmlReadMemory(buffer, size, URL, encoding, options);
2594 desret_xmlDocPtr(ret_val);
2595 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002596 des_const_char_ptr(n_buffer, buffer, 0);
2597 des_int(n_size, size, 1);
2598 des_filepath(n_URL, URL, 2);
2599 des_const_char_ptr(n_encoding, encoding, 3);
2600 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002601 xmlResetLastError();
2602 if (mem_base != xmlMemBlocks()) {
2603 printf("Leak of %d blocks found in htmlReadMemory",
2604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002605 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002606 printf(" %d", n_buffer);
2607 printf(" %d", n_size);
2608 printf(" %d", n_URL);
2609 printf(" %d", n_encoding);
2610 printf(" %d", n_options);
2611 printf("\n");
2612 }
2613 }
2614 }
2615 }
2616 }
2617 }
2618#endif
2619
Daniel Veillard3d97e662004-11-04 10:49:00 +00002620 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002622}
2623
2624
2625static int
2626test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002628
Daniel Veillardce682bc2004-11-05 17:22:25 +00002629#ifdef LIBXML_HTML_ENABLED
2630 int mem_base;
2631 htmlDocPtr ret_val;
2632 xmlChar * cur; /* a pointer to an array of xmlChar */
2633 int n_cur;
2634 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2635 int n_encoding;
2636 htmlSAXHandlerPtr sax; /* the SAX handler block */
2637 int n_sax;
2638 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2639 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002640
Daniel Veillardce682bc2004-11-05 17:22:25 +00002641 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2642 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2643 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2644 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2645 mem_base = xmlMemBlocks();
2646 cur = gen_xmlChar_ptr(n_cur, 0);
2647 encoding = gen_const_char_ptr(n_encoding, 1);
2648 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2649 userData = gen_userdata(n_userData, 3);
2650
2651 ret_val = htmlSAXParseDoc(cur, encoding, sax, userData);
2652 desret_xmlDocPtr(ret_val);
2653 call_tests++;
2654 des_xmlChar_ptr(n_cur, cur, 0);
2655 des_const_char_ptr(n_encoding, encoding, 1);
2656 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2657 des_userdata(n_userData, userData, 3);
2658 xmlResetLastError();
2659 if (mem_base != xmlMemBlocks()) {
2660 printf("Leak of %d blocks found in htmlSAXParseDoc",
2661 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002662 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002663 printf(" %d", n_cur);
2664 printf(" %d", n_encoding);
2665 printf(" %d", n_sax);
2666 printf(" %d", n_userData);
2667 printf("\n");
2668 }
2669 }
2670 }
2671 }
2672 }
2673#endif
2674
2675 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002677}
2678
2679
2680static int
2681test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002683
Daniel Veillardce682bc2004-11-05 17:22:25 +00002684#ifdef LIBXML_HTML_ENABLED
2685 int mem_base;
2686 htmlDocPtr ret_val;
2687 const char * filename; /* the filename */
2688 int n_filename;
2689 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2690 int n_encoding;
2691 htmlSAXHandlerPtr sax; /* the SAX handler block */
2692 int n_sax;
2693 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2694 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002695
Daniel Veillardce682bc2004-11-05 17:22:25 +00002696 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2697 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2698 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2699 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2700 mem_base = xmlMemBlocks();
2701 filename = gen_filepath(n_filename, 0);
2702 encoding = gen_const_char_ptr(n_encoding, 1);
2703 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2704 userData = gen_userdata(n_userData, 3);
2705
2706 ret_val = htmlSAXParseFile(filename, encoding, sax, userData);
2707 desret_xmlDocPtr(ret_val);
2708 call_tests++;
2709 des_filepath(n_filename, filename, 0);
2710 des_const_char_ptr(n_encoding, encoding, 1);
2711 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2712 des_userdata(n_userData, userData, 3);
2713 xmlResetLastError();
2714 if (mem_base != xmlMemBlocks()) {
2715 printf("Leak of %d blocks found in htmlSAXParseFile",
2716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002717 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002718 printf(" %d", n_filename);
2719 printf(" %d", n_encoding);
2720 printf(" %d", n_sax);
2721 printf(" %d", n_userData);
2722 printf("\n");
2723 }
2724 }
2725 }
2726 }
2727 }
2728#endif
2729
2730 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002732}
2733
2734
2735static int
2736test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002738
2739
2740 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002741 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002742}
2743
2744static int
2745test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002747
Daniel Veillard42595322004-11-08 10:52:06 +00002748 printf("Testing HTMLparser : 31 of 37 functions ...\n");
2749 test_ret += test_UTF8ToHtml();
2750 test_ret += test_htmlAttrAllowed();
2751 test_ret += test_htmlAutoCloseTag();
2752 test_ret += test_htmlCreateMemoryParserCtxt();
2753 test_ret += test_htmlCreatePushParserCtxt();
2754 test_ret += test_htmlCtxtReadDoc();
2755 test_ret += test_htmlCtxtReadFile();
2756 test_ret += test_htmlCtxtReadMemory();
2757 test_ret += test_htmlCtxtReset();
2758 test_ret += test_htmlCtxtUseOptions();
2759 test_ret += test_htmlElementAllowedHere();
2760 test_ret += test_htmlElementStatusHere();
2761 test_ret += test_htmlEncodeEntities();
2762 test_ret += test_htmlEntityLookup();
2763 test_ret += test_htmlEntityValueLookup();
2764 test_ret += test_htmlHandleOmittedElem();
2765 test_ret += test_htmlIsAutoClosed();
2766 test_ret += test_htmlIsScriptAttribute();
2767 test_ret += test_htmlNodeStatus();
2768 test_ret += test_htmlParseCharRef();
2769 test_ret += test_htmlParseChunk();
2770 test_ret += test_htmlParseDoc();
2771 test_ret += test_htmlParseDocument();
2772 test_ret += test_htmlParseElement();
2773 test_ret += test_htmlParseEntityRef();
2774 test_ret += test_htmlParseFile();
2775 test_ret += test_htmlReadDoc();
2776 test_ret += test_htmlReadFile();
2777 test_ret += test_htmlReadMemory();
2778 test_ret += test_htmlSAXParseDoc();
2779 test_ret += test_htmlSAXParseFile();
2780 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00002781
Daniel Veillard42595322004-11-08 10:52:06 +00002782 if (test_ret != 0)
2783 printf("Module HTMLparser: %d errors\n", test_ret);
2784 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002785}
2786
2787static int
2788test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002789 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002790
Daniel Veillard3d97e662004-11-04 10:49:00 +00002791#ifdef LIBXML_HTML_ENABLED
2792#ifdef LIBXML_OUTPUT_ENABLED
2793 int mem_base;
2794 xmlOutputBufferPtr buf; /* the HTML buffer output */
2795 int n_buf;
2796 xmlDocPtr cur; /* the document */
2797 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002798 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002799 int n_encoding;
2800 int format; /* should formatting spaces been added */
2801 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002802
Daniel Veillard3d97e662004-11-04 10:49:00 +00002803 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2804 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2805 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2806 for (n_format = 0;n_format < gen_nb_int;n_format++) {
2807 mem_base = xmlMemBlocks();
2808 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2809 cur = gen_xmlDocPtr(n_cur, 1);
2810 encoding = gen_const_char_ptr(n_encoding, 2);
2811 format = gen_int(n_format, 3);
2812
2813 htmlDocContentDumpFormatOutput(buf, cur, encoding, format);
2814 call_tests++;
2815 des_xmlOutputBufferPtr(n_buf, buf, 0);
2816 des_xmlDocPtr(n_cur, cur, 1);
2817 des_const_char_ptr(n_encoding, encoding, 2);
2818 des_int(n_format, format, 3);
2819 xmlResetLastError();
2820 if (mem_base != xmlMemBlocks()) {
2821 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002823 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002824 printf(" %d", n_buf);
2825 printf(" %d", n_cur);
2826 printf(" %d", n_encoding);
2827 printf(" %d", n_format);
2828 printf("\n");
2829 }
2830 }
2831 }
2832 }
2833 }
2834#endif
2835#endif
2836
2837 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002838 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002839}
2840
2841
2842static int
2843test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002844 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002845
Daniel Veillard3d97e662004-11-04 10:49:00 +00002846#ifdef LIBXML_HTML_ENABLED
2847#ifdef LIBXML_OUTPUT_ENABLED
2848 int mem_base;
2849 xmlOutputBufferPtr buf; /* the HTML buffer output */
2850 int n_buf;
2851 xmlDocPtr cur; /* the document */
2852 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002853 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002854 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002855
Daniel Veillard3d97e662004-11-04 10:49:00 +00002856 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2857 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2858 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2859 mem_base = xmlMemBlocks();
2860 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2861 cur = gen_xmlDocPtr(n_cur, 1);
2862 encoding = gen_const_char_ptr(n_encoding, 2);
2863
2864 htmlDocContentDumpOutput(buf, cur, encoding);
2865 call_tests++;
2866 des_xmlOutputBufferPtr(n_buf, buf, 0);
2867 des_xmlDocPtr(n_cur, cur, 1);
2868 des_const_char_ptr(n_encoding, encoding, 2);
2869 xmlResetLastError();
2870 if (mem_base != xmlMemBlocks()) {
2871 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
2872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002873 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002874 printf(" %d", n_buf);
2875 printf(" %d", n_cur);
2876 printf(" %d", n_encoding);
2877 printf("\n");
2878 }
2879 }
2880 }
2881 }
2882#endif
2883#endif
2884
2885 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002886 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002887}
2888
2889
2890static int
2891test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002892 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002893
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002894#ifdef LIBXML_HTML_ENABLED
2895#ifdef LIBXML_OUTPUT_ENABLED
2896 int mem_base;
2897 int ret_val;
2898 FILE * f; /* the FILE* */
2899 int n_f;
2900 xmlDocPtr cur; /* the document */
2901 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002902
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002903 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
2904 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2905 mem_base = xmlMemBlocks();
2906 f = gen_FILE_ptr(n_f, 0);
2907 cur = gen_xmlDocPtr(n_cur, 1);
2908
2909 ret_val = htmlDocDump(f, cur);
2910 desret_int(ret_val);
2911 call_tests++;
2912 des_FILE_ptr(n_f, f, 0);
2913 des_xmlDocPtr(n_cur, cur, 1);
2914 xmlResetLastError();
2915 if (mem_base != xmlMemBlocks()) {
2916 printf("Leak of %d blocks found in htmlDocDump",
2917 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002918 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002919 printf(" %d", n_f);
2920 printf(" %d", n_cur);
2921 printf("\n");
2922 }
2923 }
2924 }
2925#endif
2926#endif
2927
2928 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002930}
2931
2932
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002933#define gen_nb_xmlChar_ptr_ptr 1
2934static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2935 return(NULL);
2936}
2937static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2938}
2939
Daniel Veillardd93f6252004-11-02 15:53:51 +00002940static int
2941test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002942 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002943
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002944#ifdef LIBXML_HTML_ENABLED
2945#ifdef LIBXML_OUTPUT_ENABLED
2946 int mem_base;
2947 xmlDocPtr cur; /* the document */
2948 int n_cur;
2949 xmlChar ** mem; /* OUT: the memory pointer */
2950 int n_mem;
2951 int * size; /* OUT: the memory length */
2952 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002953
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002954 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2955 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
2956 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
2957 mem_base = xmlMemBlocks();
2958 cur = gen_xmlDocPtr(n_cur, 0);
2959 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
2960 size = gen_int_ptr(n_size, 2);
2961
2962 htmlDocDumpMemory(cur, mem, size);
2963 call_tests++;
2964 des_xmlDocPtr(n_cur, cur, 0);
2965 des_xmlChar_ptr_ptr(n_mem, mem, 1);
2966 des_int_ptr(n_size, size, 2);
2967 xmlResetLastError();
2968 if (mem_base != xmlMemBlocks()) {
2969 printf("Leak of %d blocks found in htmlDocDumpMemory",
2970 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002971 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002972 printf(" %d", n_cur);
2973 printf(" %d", n_mem);
2974 printf(" %d", n_size);
2975 printf("\n");
2976 }
2977 }
2978 }
2979 }
2980#endif
2981#endif
2982
2983 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002985}
2986
2987
2988static int
2989test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002991
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002992#ifdef LIBXML_HTML_ENABLED
2993 int mem_base;
2994 const xmlChar * ret_val;
2995 htmlDocPtr doc; /* the document */
2996 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002997
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002998 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
2999 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003000 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003001
3002 ret_val = htmlGetMetaEncoding(doc);
3003 desret_const_xmlChar_ptr(ret_val);
3004 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003005 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003006 xmlResetLastError();
3007 if (mem_base != xmlMemBlocks()) {
3008 printf("Leak of %d blocks found in htmlGetMetaEncoding",
3009 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003010 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003011 printf(" %d", n_doc);
3012 printf("\n");
3013 }
3014 }
3015#endif
3016
Daniel Veillard3d97e662004-11-04 10:49:00 +00003017 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003019}
3020
3021
3022static int
3023test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003024 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003025
3026#ifdef LIBXML_HTML_ENABLED
3027 int mem_base;
3028 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003029 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003030 int n_name;
3031
3032 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3033 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003034 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003035
3036 ret_val = htmlIsBooleanAttr(name);
3037 desret_int(ret_val);
3038 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003039 des_const_xmlChar_ptr(n_name, name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003040 xmlResetLastError();
3041 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003042 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003043 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003044 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003045 printf(" %d", n_name);
3046 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003047 }
3048 }
3049#endif
3050
Daniel Veillard3d97e662004-11-04 10:49:00 +00003051 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003053}
3054
3055
3056static int
3057test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003058 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003059
Daniel Veillarda03e3652004-11-02 18:45:30 +00003060#ifdef LIBXML_HTML_ENABLED
3061 int mem_base;
3062 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003063 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003064 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003065 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003066 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003067
Daniel Veillarda03e3652004-11-02 18:45:30 +00003068 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3069 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3070 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003071 URI = gen_const_xmlChar_ptr(n_URI, 0);
3072 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003073
3074 ret_val = htmlNewDoc(URI, ExternalID);
3075 desret_xmlDocPtr(ret_val);
3076 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003077 des_const_xmlChar_ptr(n_URI, URI, 0);
3078 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003079 xmlResetLastError();
3080 if (mem_base != xmlMemBlocks()) {
3081 printf("Leak of %d blocks found in htmlNewDoc",
3082 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003083 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003084 printf(" %d", n_URI);
3085 printf(" %d", n_ExternalID);
3086 printf("\n");
3087 }
3088 }
3089 }
3090#endif
3091
Daniel Veillard3d97e662004-11-04 10:49:00 +00003092 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003093 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003094}
3095
3096
3097static int
3098test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003099 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003100
Daniel Veillarda03e3652004-11-02 18:45:30 +00003101#ifdef LIBXML_HTML_ENABLED
3102 int mem_base;
3103 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003104 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003105 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003106 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003107 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003108
Daniel Veillarda03e3652004-11-02 18:45:30 +00003109 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3110 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3111 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003112 URI = gen_const_xmlChar_ptr(n_URI, 0);
3113 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003114
3115 ret_val = htmlNewDocNoDtD(URI, ExternalID);
3116 desret_xmlDocPtr(ret_val);
3117 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003118 des_const_xmlChar_ptr(n_URI, URI, 0);
3119 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003120 xmlResetLastError();
3121 if (mem_base != xmlMemBlocks()) {
3122 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3123 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003124 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003125 printf(" %d", n_URI);
3126 printf(" %d", n_ExternalID);
3127 printf("\n");
3128 }
3129 }
3130 }
3131#endif
3132
Daniel Veillard3d97e662004-11-04 10:49:00 +00003133 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003134 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003135}
3136
3137
3138static int
3139test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003140 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003141
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003142#ifdef LIBXML_HTML_ENABLED
3143#ifdef LIBXML_OUTPUT_ENABLED
3144 int mem_base;
3145 int ret_val;
3146 xmlBufferPtr buf; /* the HTML buffer output */
3147 int n_buf;
3148 xmlDocPtr doc; /* the document */
3149 int n_doc;
3150 xmlNodePtr cur; /* the current node */
3151 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003152
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003153 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3154 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3155 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3156 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003157 buf = gen_xmlBufferPtr(n_buf, 0);
3158 doc = gen_xmlDocPtr(n_doc, 1);
3159 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003160
3161 ret_val = htmlNodeDump(buf, doc, cur);
3162 desret_int(ret_val);
3163 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003164 des_xmlBufferPtr(n_buf, buf, 0);
3165 des_xmlDocPtr(n_doc, doc, 1);
3166 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003167 xmlResetLastError();
3168 if (mem_base != xmlMemBlocks()) {
3169 printf("Leak of %d blocks found in htmlNodeDump",
3170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003171 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003172 printf(" %d", n_buf);
3173 printf(" %d", n_doc);
3174 printf(" %d", n_cur);
3175 printf("\n");
3176 }
3177 }
3178 }
3179 }
3180#endif
3181#endif
3182
Daniel Veillard3d97e662004-11-04 10:49:00 +00003183 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003185}
3186
3187
3188static int
3189test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003191
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003192#ifdef LIBXML_HTML_ENABLED
3193#ifdef LIBXML_OUTPUT_ENABLED
3194 int mem_base;
3195 FILE * out; /* the FILE pointer */
3196 int n_out;
3197 xmlDocPtr doc; /* the document */
3198 int n_doc;
3199 xmlNodePtr cur; /* the current node */
3200 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003201
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003202 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3203 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3204 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3205 mem_base = xmlMemBlocks();
3206 out = gen_FILE_ptr(n_out, 0);
3207 doc = gen_xmlDocPtr(n_doc, 1);
3208 cur = gen_xmlNodePtr(n_cur, 2);
3209
3210 htmlNodeDumpFile(out, doc, cur);
3211 call_tests++;
3212 des_FILE_ptr(n_out, out, 0);
3213 des_xmlDocPtr(n_doc, doc, 1);
3214 des_xmlNodePtr(n_cur, cur, 2);
3215 xmlResetLastError();
3216 if (mem_base != xmlMemBlocks()) {
3217 printf("Leak of %d blocks found in htmlNodeDumpFile",
3218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003219 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003220 printf(" %d", n_out);
3221 printf(" %d", n_doc);
3222 printf(" %d", n_cur);
3223 printf("\n");
3224 }
3225 }
3226 }
3227 }
3228#endif
3229#endif
3230
3231 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003233}
3234
3235
3236static int
3237test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003239
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003240#ifdef LIBXML_HTML_ENABLED
3241#ifdef LIBXML_OUTPUT_ENABLED
3242 int mem_base;
3243 int ret_val;
3244 FILE * out; /* the FILE pointer */
3245 int n_out;
3246 xmlDocPtr doc; /* the document */
3247 int n_doc;
3248 xmlNodePtr cur; /* the current node */
3249 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003250 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003251 int n_encoding;
3252 int format; /* should formatting spaces been added */
3253 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003254
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003255 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3256 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3257 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3258 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3259 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3260 mem_base = xmlMemBlocks();
3261 out = gen_FILE_ptr(n_out, 0);
3262 doc = gen_xmlDocPtr(n_doc, 1);
3263 cur = gen_xmlNodePtr(n_cur, 2);
3264 encoding = gen_const_char_ptr(n_encoding, 3);
3265 format = gen_int(n_format, 4);
3266
3267 ret_val = htmlNodeDumpFileFormat(out, doc, cur, encoding, format);
3268 desret_int(ret_val);
3269 call_tests++;
3270 des_FILE_ptr(n_out, out, 0);
3271 des_xmlDocPtr(n_doc, doc, 1);
3272 des_xmlNodePtr(n_cur, cur, 2);
3273 des_const_char_ptr(n_encoding, encoding, 3);
3274 des_int(n_format, format, 4);
3275 xmlResetLastError();
3276 if (mem_base != xmlMemBlocks()) {
3277 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3278 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003279 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003280 printf(" %d", n_out);
3281 printf(" %d", n_doc);
3282 printf(" %d", n_cur);
3283 printf(" %d", n_encoding);
3284 printf(" %d", n_format);
3285 printf("\n");
3286 }
3287 }
3288 }
3289 }
3290 }
3291 }
3292#endif
3293#endif
3294
3295 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003296 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003297}
3298
3299
3300static int
3301test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003302 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003303
Daniel Veillard3d97e662004-11-04 10:49:00 +00003304#ifdef LIBXML_HTML_ENABLED
3305#ifdef LIBXML_OUTPUT_ENABLED
3306 int mem_base;
3307 xmlOutputBufferPtr buf; /* the HTML buffer output */
3308 int n_buf;
3309 xmlDocPtr doc; /* the document */
3310 int n_doc;
3311 xmlNodePtr cur; /* the current node */
3312 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003313 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003314 int n_encoding;
3315 int format; /* should formatting spaces been added */
3316 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003317
Daniel Veillard3d97e662004-11-04 10:49:00 +00003318 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3319 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3320 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3321 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3322 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3323 mem_base = xmlMemBlocks();
3324 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3325 doc = gen_xmlDocPtr(n_doc, 1);
3326 cur = gen_xmlNodePtr(n_cur, 2);
3327 encoding = gen_const_char_ptr(n_encoding, 3);
3328 format = gen_int(n_format, 4);
3329
3330 htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format);
3331 call_tests++;
3332 des_xmlOutputBufferPtr(n_buf, buf, 0);
3333 des_xmlDocPtr(n_doc, doc, 1);
3334 des_xmlNodePtr(n_cur, cur, 2);
3335 des_const_char_ptr(n_encoding, encoding, 3);
3336 des_int(n_format, format, 4);
3337 xmlResetLastError();
3338 if (mem_base != xmlMemBlocks()) {
3339 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003341 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003342 printf(" %d", n_buf);
3343 printf(" %d", n_doc);
3344 printf(" %d", n_cur);
3345 printf(" %d", n_encoding);
3346 printf(" %d", n_format);
3347 printf("\n");
3348 }
3349 }
3350 }
3351 }
3352 }
3353 }
3354#endif
3355#endif
3356
3357 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003359}
3360
3361
3362static int
3363test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003365
Daniel Veillard3d97e662004-11-04 10:49:00 +00003366#ifdef LIBXML_HTML_ENABLED
3367#ifdef LIBXML_OUTPUT_ENABLED
3368 int mem_base;
3369 xmlOutputBufferPtr buf; /* the HTML buffer output */
3370 int n_buf;
3371 xmlDocPtr doc; /* the document */
3372 int n_doc;
3373 xmlNodePtr cur; /* the current node */
3374 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003375 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003376 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003377
Daniel Veillard3d97e662004-11-04 10:49:00 +00003378 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3379 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3380 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3381 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3382 mem_base = xmlMemBlocks();
3383 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3384 doc = gen_xmlDocPtr(n_doc, 1);
3385 cur = gen_xmlNodePtr(n_cur, 2);
3386 encoding = gen_const_char_ptr(n_encoding, 3);
3387
3388 htmlNodeDumpOutput(buf, doc, cur, encoding);
3389 call_tests++;
3390 des_xmlOutputBufferPtr(n_buf, buf, 0);
3391 des_xmlDocPtr(n_doc, doc, 1);
3392 des_xmlNodePtr(n_cur, cur, 2);
3393 des_const_char_ptr(n_encoding, encoding, 3);
3394 xmlResetLastError();
3395 if (mem_base != xmlMemBlocks()) {
3396 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3397 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003398 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003399 printf(" %d", n_buf);
3400 printf(" %d", n_doc);
3401 printf(" %d", n_cur);
3402 printf(" %d", n_encoding);
3403 printf("\n");
3404 }
3405 }
3406 }
3407 }
3408 }
3409#endif
3410#endif
3411
3412 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003414}
3415
3416
3417static int
3418test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003420
3421#ifdef LIBXML_HTML_ENABLED
3422#ifdef LIBXML_OUTPUT_ENABLED
3423 int mem_base;
3424 int ret_val;
3425 const char * filename; /* the filename (or URL) */
3426 int n_filename;
3427 xmlDocPtr cur; /* the document */
3428 int n_cur;
3429
3430 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3431 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3432 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003433 filename = gen_fileoutput(n_filename, 0);
3434 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003435
3436 ret_val = htmlSaveFile(filename, cur);
3437 desret_int(ret_val);
3438 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003439 des_fileoutput(n_filename, filename, 0);
3440 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003441 xmlResetLastError();
3442 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003443 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003445 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003446 printf(" %d", n_filename);
3447 printf(" %d", n_cur);
3448 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003449 }
3450 }
3451 }
3452#endif
3453#endif
3454
Daniel Veillard3d97e662004-11-04 10:49:00 +00003455 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003457}
3458
3459
3460static int
3461test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003463
3464#ifdef LIBXML_HTML_ENABLED
3465#ifdef LIBXML_OUTPUT_ENABLED
3466 int mem_base;
3467 int ret_val;
3468 const char * filename; /* the filename */
3469 int n_filename;
3470 xmlDocPtr cur; /* the document */
3471 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003472 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003473 int n_encoding;
3474
3475 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3476 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3477 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3478 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003479 filename = gen_fileoutput(n_filename, 0);
3480 cur = gen_xmlDocPtr(n_cur, 1);
3481 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003482
3483 ret_val = htmlSaveFileEnc(filename, cur, encoding);
3484 desret_int(ret_val);
3485 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003486 des_fileoutput(n_filename, filename, 0);
3487 des_xmlDocPtr(n_cur, cur, 1);
3488 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003489 xmlResetLastError();
3490 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003491 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003493 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003494 printf(" %d", n_filename);
3495 printf(" %d", n_cur);
3496 printf(" %d", n_encoding);
3497 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003498 }
3499 }
3500 }
3501 }
3502#endif
3503#endif
3504
Daniel Veillard3d97e662004-11-04 10:49:00 +00003505 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003507}
3508
3509
3510static int
3511test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003513
3514#ifdef LIBXML_HTML_ENABLED
3515#ifdef LIBXML_OUTPUT_ENABLED
3516 int mem_base;
3517 int ret_val;
3518 const char * filename; /* the filename */
3519 int n_filename;
3520 xmlDocPtr cur; /* the document */
3521 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003522 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003523 int n_encoding;
3524 int format; /* should formatting spaces been added */
3525 int n_format;
3526
3527 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3528 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3529 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3530 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3531 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003532 filename = gen_fileoutput(n_filename, 0);
3533 cur = gen_xmlDocPtr(n_cur, 1);
3534 encoding = gen_const_char_ptr(n_encoding, 2);
3535 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003536
3537 ret_val = htmlSaveFileFormat(filename, cur, encoding, format);
3538 desret_int(ret_val);
3539 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003540 des_fileoutput(n_filename, filename, 0);
3541 des_xmlDocPtr(n_cur, cur, 1);
3542 des_const_char_ptr(n_encoding, encoding, 2);
3543 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003544 xmlResetLastError();
3545 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003546 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003548 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003549 printf(" %d", n_filename);
3550 printf(" %d", n_cur);
3551 printf(" %d", n_encoding);
3552 printf(" %d", n_format);
3553 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003554 }
3555 }
3556 }
3557 }
3558 }
3559#endif
3560#endif
3561
Daniel Veillard3d97e662004-11-04 10:49:00 +00003562 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003564}
3565
3566
3567static int
3568test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003570
Daniel Veillarda03e3652004-11-02 18:45:30 +00003571#ifdef LIBXML_HTML_ENABLED
3572 int mem_base;
3573 int ret_val;
3574 htmlDocPtr doc; /* the document */
3575 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003576 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003577 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003578
Daniel Veillarda03e3652004-11-02 18:45:30 +00003579 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3580 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3581 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003582 doc = gen_xmlDocPtr(n_doc, 0);
3583 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003584
3585 ret_val = htmlSetMetaEncoding(doc, encoding);
3586 desret_int(ret_val);
3587 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003588 des_xmlDocPtr(n_doc, doc, 0);
3589 des_const_xmlChar_ptr(n_encoding, encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003590 xmlResetLastError();
3591 if (mem_base != xmlMemBlocks()) {
3592 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3593 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003594 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003595 printf(" %d", n_doc);
3596 printf(" %d", n_encoding);
3597 printf("\n");
3598 }
3599 }
3600 }
3601#endif
3602
Daniel Veillard3d97e662004-11-04 10:49:00 +00003603 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003604 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003605}
3606
3607static int
3608test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003610
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003611 printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003612 test_ret += test_htmlDocContentDumpFormatOutput();
3613 test_ret += test_htmlDocContentDumpOutput();
3614 test_ret += test_htmlDocDump();
3615 test_ret += test_htmlDocDumpMemory();
3616 test_ret += test_htmlGetMetaEncoding();
3617 test_ret += test_htmlIsBooleanAttr();
3618 test_ret += test_htmlNewDoc();
3619 test_ret += test_htmlNewDocNoDtD();
3620 test_ret += test_htmlNodeDump();
3621 test_ret += test_htmlNodeDumpFile();
3622 test_ret += test_htmlNodeDumpFileFormat();
3623 test_ret += test_htmlNodeDumpFormatOutput();
3624 test_ret += test_htmlNodeDumpOutput();
3625 test_ret += test_htmlSaveFile();
3626 test_ret += test_htmlSaveFileEnc();
3627 test_ret += test_htmlSaveFileFormat();
3628 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003629
Daniel Veillard42595322004-11-08 10:52:06 +00003630 if (test_ret != 0)
3631 printf("Module HTMLtree: %d errors\n", test_ret);
3632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003633}
3634
Daniel Veillardce682bc2004-11-05 17:22:25 +00003635#define gen_nb_xmlCatalogPtr 1
3636static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3637 return(NULL);
3638}
3639static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3640}
3641
Daniel Veillardd93f6252004-11-02 15:53:51 +00003642static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00003643test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003644 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003645
Daniel Veillardce682bc2004-11-05 17:22:25 +00003646#ifdef LIBXML_CATALOG_ENABLED
3647 int mem_base;
3648 int ret_val;
3649 xmlCatalogPtr catal; /* a Catalog */
3650 int n_catal;
3651 xmlChar * type; /* the type of record to add to the catalog */
3652 int n_type;
3653 xmlChar * orig; /* the system, public or prefix to match */
3654 int n_orig;
3655 xmlChar * replace; /* the replacement value for the match */
3656 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003657
Daniel Veillardce682bc2004-11-05 17:22:25 +00003658 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
3659 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
3660 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
3661 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
3662 mem_base = xmlMemBlocks();
3663 catal = gen_xmlCatalogPtr(n_catal, 0);
3664 type = gen_const_xmlChar_ptr(n_type, 1);
3665 orig = gen_const_xmlChar_ptr(n_orig, 2);
3666 replace = gen_const_xmlChar_ptr(n_replace, 3);
3667
3668 ret_val = xmlACatalogAdd(catal, type, orig, replace);
3669 desret_int(ret_val);
3670 call_tests++;
3671 des_xmlCatalogPtr(n_catal, catal, 0);
3672 des_const_xmlChar_ptr(n_type, type, 1);
3673 des_const_xmlChar_ptr(n_orig, orig, 2);
3674 des_const_xmlChar_ptr(n_replace, replace, 3);
3675 xmlResetLastError();
3676 if (mem_base != xmlMemBlocks()) {
3677 printf("Leak of %d blocks found in xmlACatalogAdd",
3678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003679 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003680 printf(" %d", n_catal);
3681 printf(" %d", n_type);
3682 printf(" %d", n_orig);
3683 printf(" %d", n_replace);
3684 printf("\n");
3685 }
3686 }
3687 }
3688 }
3689 }
3690#endif
3691
3692 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003693 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003694}
3695
3696
3697static int
3698test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003699 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003700
Daniel Veillardce682bc2004-11-05 17:22:25 +00003701#ifdef LIBXML_CATALOG_ENABLED
3702#ifdef LIBXML_OUTPUT_ENABLED
3703 int mem_base;
3704 xmlCatalogPtr catal; /* a Catalog */
3705 int n_catal;
3706 FILE * out; /* the file. */
3707 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003708
Daniel Veillardce682bc2004-11-05 17:22:25 +00003709 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
3710 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3711 mem_base = xmlMemBlocks();
3712 catal = gen_xmlCatalogPtr(n_catal, 0);
3713 out = gen_FILE_ptr(n_out, 1);
3714
3715 xmlACatalogDump(catal, out);
3716 call_tests++;
3717 des_xmlCatalogPtr(n_catal, catal, 0);
3718 des_FILE_ptr(n_out, out, 1);
3719 xmlResetLastError();
3720 if (mem_base != xmlMemBlocks()) {
3721 printf("Leak of %d blocks found in xmlACatalogDump",
3722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003723 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003724 printf(" %d", n_catal);
3725 printf(" %d", n_out);
3726 printf("\n");
3727 }
3728 }
3729 }
3730#endif
3731#endif
3732
3733 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003735}
3736
3737
3738static int
3739test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003741
Daniel Veillardce682bc2004-11-05 17:22:25 +00003742#ifdef LIBXML_CATALOG_ENABLED
3743 int mem_base;
3744 int ret_val;
3745 xmlCatalogPtr catal; /* a Catalog */
3746 int n_catal;
3747 xmlChar * value; /* the value to remove */
3748 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003749
Daniel Veillardce682bc2004-11-05 17:22:25 +00003750 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
3751 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3752 mem_base = xmlMemBlocks();
3753 catal = gen_xmlCatalogPtr(n_catal, 0);
3754 value = gen_const_xmlChar_ptr(n_value, 1);
3755
3756 ret_val = xmlACatalogRemove(catal, value);
3757 desret_int(ret_val);
3758 call_tests++;
3759 des_xmlCatalogPtr(n_catal, catal, 0);
3760 des_const_xmlChar_ptr(n_value, value, 1);
3761 xmlResetLastError();
3762 if (mem_base != xmlMemBlocks()) {
3763 printf("Leak of %d blocks found in xmlACatalogRemove",
3764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003765 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003766 printf(" %d", n_catal);
3767 printf(" %d", n_value);
3768 printf("\n");
3769 }
3770 }
3771 }
3772#endif
3773
3774 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003776}
3777
3778
3779static int
3780test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003782
Daniel Veillardce682bc2004-11-05 17:22:25 +00003783#ifdef LIBXML_CATALOG_ENABLED
3784 int mem_base;
3785 xmlChar * ret_val;
3786 xmlCatalogPtr catal; /* a Catalog */
3787 int n_catal;
3788 xmlChar * pubID; /* the public ID string */
3789 int n_pubID;
3790 xmlChar * sysID; /* the system ID string */
3791 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003792
Daniel Veillardce682bc2004-11-05 17:22:25 +00003793 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
3794 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
3795 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
3796 mem_base = xmlMemBlocks();
3797 catal = gen_xmlCatalogPtr(n_catal, 0);
3798 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
3799 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
3800
3801 ret_val = xmlACatalogResolve(catal, pubID, sysID);
3802 desret_xmlChar_ptr(ret_val);
3803 call_tests++;
3804 des_xmlCatalogPtr(n_catal, catal, 0);
3805 des_const_xmlChar_ptr(n_pubID, pubID, 1);
3806 des_const_xmlChar_ptr(n_sysID, sysID, 2);
3807 xmlResetLastError();
3808 if (mem_base != xmlMemBlocks()) {
3809 printf("Leak of %d blocks found in xmlACatalogResolve",
3810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003811 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003812 printf(" %d", n_catal);
3813 printf(" %d", n_pubID);
3814 printf(" %d", n_sysID);
3815 printf("\n");
3816 }
3817 }
3818 }
3819 }
3820#endif
3821
3822 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003824}
3825
3826
3827static int
3828test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003830
Daniel Veillardce682bc2004-11-05 17:22:25 +00003831#ifdef LIBXML_CATALOG_ENABLED
3832 int mem_base;
3833 xmlChar * ret_val;
3834 xmlCatalogPtr catal; /* a Catalog */
3835 int n_catal;
3836 xmlChar * pubID; /* the public ID string */
3837 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003838
Daniel Veillardce682bc2004-11-05 17:22:25 +00003839 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
3840 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
3841 mem_base = xmlMemBlocks();
3842 catal = gen_xmlCatalogPtr(n_catal, 0);
3843 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
3844
3845 ret_val = xmlACatalogResolvePublic(catal, pubID);
3846 desret_xmlChar_ptr(ret_val);
3847 call_tests++;
3848 des_xmlCatalogPtr(n_catal, catal, 0);
3849 des_const_xmlChar_ptr(n_pubID, pubID, 1);
3850 xmlResetLastError();
3851 if (mem_base != xmlMemBlocks()) {
3852 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
3853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003854 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003855 printf(" %d", n_catal);
3856 printf(" %d", n_pubID);
3857 printf("\n");
3858 }
3859 }
3860 }
3861#endif
3862
3863 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003864 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003865}
3866
3867
3868static int
3869test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003870 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003871
Daniel Veillardce682bc2004-11-05 17:22:25 +00003872#ifdef LIBXML_CATALOG_ENABLED
3873 int mem_base;
3874 xmlChar * ret_val;
3875 xmlCatalogPtr catal; /* a Catalog */
3876 int n_catal;
3877 xmlChar * sysID; /* the system ID string */
3878 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003879
Daniel Veillardce682bc2004-11-05 17:22:25 +00003880 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
3881 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
3882 mem_base = xmlMemBlocks();
3883 catal = gen_xmlCatalogPtr(n_catal, 0);
3884 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
3885
3886 ret_val = xmlACatalogResolveSystem(catal, sysID);
3887 desret_xmlChar_ptr(ret_val);
3888 call_tests++;
3889 des_xmlCatalogPtr(n_catal, catal, 0);
3890 des_const_xmlChar_ptr(n_sysID, sysID, 1);
3891 xmlResetLastError();
3892 if (mem_base != xmlMemBlocks()) {
3893 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
3894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003895 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003896 printf(" %d", n_catal);
3897 printf(" %d", n_sysID);
3898 printf("\n");
3899 }
3900 }
3901 }
3902#endif
3903
3904 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003906}
3907
3908
3909static int
3910test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003912
Daniel Veillardce682bc2004-11-05 17:22:25 +00003913#ifdef LIBXML_CATALOG_ENABLED
3914 int mem_base;
3915 xmlChar * ret_val;
3916 xmlCatalogPtr catal; /* a Catalog */
3917 int n_catal;
3918 xmlChar * URI; /* the URI */
3919 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003920
Daniel Veillardce682bc2004-11-05 17:22:25 +00003921 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
3922 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3923 mem_base = xmlMemBlocks();
3924 catal = gen_xmlCatalogPtr(n_catal, 0);
3925 URI = gen_const_xmlChar_ptr(n_URI, 1);
3926
3927 ret_val = xmlACatalogResolveURI(catal, URI);
3928 desret_xmlChar_ptr(ret_val);
3929 call_tests++;
3930 des_xmlCatalogPtr(n_catal, catal, 0);
3931 des_const_xmlChar_ptr(n_URI, URI, 1);
3932 xmlResetLastError();
3933 if (mem_base != xmlMemBlocks()) {
3934 printf("Leak of %d blocks found in xmlACatalogResolveURI",
3935 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003936 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003937 printf(" %d", n_catal);
3938 printf(" %d", n_URI);
3939 printf("\n");
3940 }
3941 }
3942 }
3943#endif
3944
3945 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003947}
3948
3949
3950static int
3951test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003952 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003953
3954#ifdef LIBXML_CATALOG_ENABLED
3955 int mem_base;
3956 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003957 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003958 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003959 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003960 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003961 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003962 int n_replace;
3963
3964 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
3965 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
3966 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
3967 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003968 type = gen_const_xmlChar_ptr(n_type, 0);
3969 orig = gen_const_xmlChar_ptr(n_orig, 1);
3970 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003971
3972 ret_val = xmlCatalogAdd(type, orig, replace);
3973 desret_int(ret_val);
3974 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003975 des_const_xmlChar_ptr(n_type, type, 0);
3976 des_const_xmlChar_ptr(n_orig, orig, 1);
3977 des_const_xmlChar_ptr(n_replace, replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003978 xmlResetLastError();
3979 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003980 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003981 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003982 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003983 printf(" %d", n_type);
3984 printf(" %d", n_orig);
3985 printf(" %d", n_replace);
3986 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003987 }
3988 }
3989 }
3990 }
3991#endif
3992
Daniel Veillard3d97e662004-11-04 10:49:00 +00003993 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003995}
3996
3997
3998static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00003999test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004000 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004001
4002#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00004003
Daniel Veillardd93f6252004-11-02 15:53:51 +00004004
4005 xmlCatalogCleanup();
4006 call_tests++;
4007 xmlResetLastError();
Daniel Veillardd93f6252004-11-02 15:53:51 +00004008#endif
4009
Daniel Veillard3d97e662004-11-04 10:49:00 +00004010 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004011 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004012}
4013
4014
4015static int
4016test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004018
4019#ifdef LIBXML_CATALOG_ENABLED
4020 int ret_val;
4021
4022
4023 ret_val = xmlCatalogConvert();
4024 desret_int(ret_val);
4025 call_tests++;
4026 xmlResetLastError();
4027#endif
4028
Daniel Veillard3d97e662004-11-04 10:49:00 +00004029 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004031}
4032
4033
4034static int
4035test_xmlCatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004037
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00004038#ifdef LIBXML_CATALOG_ENABLED
4039#ifdef LIBXML_OUTPUT_ENABLED
4040 int mem_base;
4041 FILE * out; /* the file. */
4042 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004043
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00004044 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
4045 mem_base = xmlMemBlocks();
4046 out = gen_FILE_ptr(n_out, 0);
4047
4048 xmlCatalogDump(out);
4049 call_tests++;
4050 des_FILE_ptr(n_out, out, 0);
4051 xmlResetLastError();
4052 if (mem_base != xmlMemBlocks()) {
4053 printf("Leak of %d blocks found in xmlCatalogDump",
4054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004055 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00004056 printf(" %d", n_out);
4057 printf("\n");
4058 }
4059 }
4060#endif
4061#endif
4062
4063 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004064 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004065}
4066
4067
4068static int
4069test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004070 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004071
Daniel Veillard57b25162004-11-06 14:50:18 +00004072#ifdef LIBXML_CATALOG_ENABLED
4073 int mem_base;
4074 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004075
Daniel Veillard57b25162004-11-06 14:50:18 +00004076 mem_base = xmlMemBlocks();
4077
4078 ret_val = xmlCatalogGetDefaults();
4079 desret_xmlCatalogAllow(ret_val);
4080 call_tests++;
4081 xmlResetLastError();
4082 if (mem_base != xmlMemBlocks()) {
4083 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
4084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004085 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00004086 printf("\n");
4087 }
4088#endif
4089
4090 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004092}
4093
4094
4095static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00004096test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004098
Daniel Veillardce682bc2004-11-05 17:22:25 +00004099#ifdef LIBXML_CATALOG_ENABLED
4100 int mem_base;
4101 int ret_val;
4102 xmlCatalogPtr catal; /* should this create an SGML catalog */
4103 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004104
Daniel Veillardce682bc2004-11-05 17:22:25 +00004105 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
4106 mem_base = xmlMemBlocks();
4107 catal = gen_xmlCatalogPtr(n_catal, 0);
4108
4109 ret_val = xmlCatalogIsEmpty(catal);
4110 desret_int(ret_val);
4111 call_tests++;
4112 des_xmlCatalogPtr(n_catal, catal, 0);
4113 xmlResetLastError();
4114 if (mem_base != xmlMemBlocks()) {
4115 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
4116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004117 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00004118 printf(" %d", n_catal);
4119 printf("\n");
4120 }
4121 }
4122#endif
4123
4124 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004125 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004126}
4127
4128
4129static int
4130test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004131 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004132
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00004133#ifdef LIBXML_CATALOG_ENABLED
4134 int mem_base;
4135 xmlChar * ret_val;
4136 void * catalogs; /* a document's list of catalogs */
4137 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00004138 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00004139 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00004140 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00004141 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004142
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00004143 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
4144 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
4145 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
4146 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00004147 catalogs = gen_void_ptr(n_catalogs, 0);
4148 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
4149 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00004150
4151 ret_val = xmlCatalogLocalResolve(catalogs, pubID, sysID);
4152 desret_xmlChar_ptr(ret_val);
4153 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004154 des_void_ptr(n_catalogs, catalogs, 0);
4155 des_const_xmlChar_ptr(n_pubID, pubID, 1);
4156 des_const_xmlChar_ptr(n_sysID, sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00004157 xmlResetLastError();
4158 if (mem_base != xmlMemBlocks()) {
4159 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
4160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004161 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00004162 printf(" %d", n_catalogs);
4163 printf(" %d", n_pubID);
4164 printf(" %d", n_sysID);
4165 printf("\n");
4166 }
4167 }
4168 }
4169 }
4170#endif
4171
Daniel Veillard3d97e662004-11-04 10:49:00 +00004172 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004174}
4175
4176
4177static int
4178test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004179 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004180
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00004181#ifdef LIBXML_CATALOG_ENABLED
4182 int mem_base;
4183 xmlChar * ret_val;
4184 void * catalogs; /* a document's list of catalogs */
4185 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00004186 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00004187 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004188
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00004189 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
4190 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4191 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00004192 catalogs = gen_void_ptr(n_catalogs, 0);
4193 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00004194
4195 ret_val = xmlCatalogLocalResolveURI(catalogs, URI);
4196 desret_xmlChar_ptr(ret_val);
4197 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004198 des_void_ptr(n_catalogs, catalogs, 0);
4199 des_const_xmlChar_ptr(n_URI, URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00004200 xmlResetLastError();
4201 if (mem_base != xmlMemBlocks()) {
4202 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
4203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004204 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00004205 printf(" %d", n_catalogs);
4206 printf(" %d", n_URI);
4207 printf("\n");
4208 }
4209 }
4210 }
4211#endif
4212
Daniel Veillard3d97e662004-11-04 10:49:00 +00004213 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004215}
4216
4217
4218static int
4219test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004221
4222#ifdef LIBXML_CATALOG_ENABLED
4223 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00004224 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00004225 int n_value;
4226
4227 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00004228 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004229
4230 ret_val = xmlCatalogRemove(value);
4231 desret_int(ret_val);
4232 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004233 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004234 xmlResetLastError();
4235 }
4236#endif
4237
Daniel Veillard3d97e662004-11-04 10:49:00 +00004238 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004239 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004240}
4241
4242
4243static int
4244test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004245 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004246
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004247#ifdef LIBXML_CATALOG_ENABLED
4248 int mem_base;
4249 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00004250 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004251 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00004252 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004253 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004254
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004255 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
4256 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
4257 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00004258 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
4259 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004260
4261 ret_val = xmlCatalogResolve(pubID, sysID);
4262 desret_xmlChar_ptr(ret_val);
4263 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004264 des_const_xmlChar_ptr(n_pubID, pubID, 0);
4265 des_const_xmlChar_ptr(n_sysID, sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004266 xmlResetLastError();
4267 if (mem_base != xmlMemBlocks()) {
4268 printf("Leak of %d blocks found in xmlCatalogResolve",
4269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004270 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004271 printf(" %d", n_pubID);
4272 printf(" %d", n_sysID);
4273 printf("\n");
4274 }
4275 }
4276 }
4277#endif
4278
Daniel Veillard3d97e662004-11-04 10:49:00 +00004279 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004280 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004281}
4282
4283
4284static int
4285test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004287
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004288#ifdef LIBXML_CATALOG_ENABLED
4289 int mem_base;
4290 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00004291 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004292 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004293
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004294 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
4295 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00004296 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004297
4298 ret_val = xmlCatalogResolvePublic(pubID);
4299 desret_xmlChar_ptr(ret_val);
4300 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004301 des_const_xmlChar_ptr(n_pubID, pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004302 xmlResetLastError();
4303 if (mem_base != xmlMemBlocks()) {
4304 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
4305 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004306 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004307 printf(" %d", n_pubID);
4308 printf("\n");
4309 }
4310 }
4311#endif
4312
Daniel Veillard3d97e662004-11-04 10:49:00 +00004313 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004315}
4316
4317
4318static int
4319test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004320 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004321
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004322#ifdef LIBXML_CATALOG_ENABLED
4323 int mem_base;
4324 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00004325 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004326 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004327
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004328 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
4329 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00004330 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004331
4332 ret_val = xmlCatalogResolveSystem(sysID);
4333 desret_xmlChar_ptr(ret_val);
4334 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004335 des_const_xmlChar_ptr(n_sysID, sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004336 xmlResetLastError();
4337 if (mem_base != xmlMemBlocks()) {
4338 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
4339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004340 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004341 printf(" %d", n_sysID);
4342 printf("\n");
4343 }
4344 }
4345#endif
4346
Daniel Veillard3d97e662004-11-04 10:49:00 +00004347 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004349}
4350
4351
4352static int
4353test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004355
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004356#ifdef LIBXML_CATALOG_ENABLED
4357 int mem_base;
4358 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00004359 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004360 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004361
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004362 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4363 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00004364 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004365
4366 ret_val = xmlCatalogResolveURI(URI);
4367 desret_xmlChar_ptr(ret_val);
4368 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004369 des_const_xmlChar_ptr(n_URI, URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004370 xmlResetLastError();
4371 if (mem_base != xmlMemBlocks()) {
4372 printf("Leak of %d blocks found in xmlCatalogResolveURI",
4373 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004374 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00004375 printf(" %d", n_URI);
4376 printf("\n");
4377 }
4378 }
4379#endif
4380
Daniel Veillard3d97e662004-11-04 10:49:00 +00004381 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004382 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004383}
4384
4385
4386static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00004387test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004388 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004389
Daniel Veillard57b25162004-11-06 14:50:18 +00004390#ifdef LIBXML_CATALOG_ENABLED
4391 int mem_base;
4392 xmlCatalogPrefer ret_val;
4393 xmlCatalogPrefer prefer; /* the default preference for delegation */
4394 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004395
Daniel Veillard57b25162004-11-06 14:50:18 +00004396 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
4397 mem_base = xmlMemBlocks();
4398 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
4399
4400 ret_val = xmlCatalogSetDefaultPrefer(prefer);
4401 desret_xmlCatalogPrefer(ret_val);
4402 call_tests++;
4403 des_xmlCatalogPrefer(n_prefer, prefer, 0);
4404 xmlResetLastError();
4405 if (mem_base != xmlMemBlocks()) {
4406 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
4407 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004408 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00004409 printf(" %d", n_prefer);
4410 printf("\n");
4411 }
4412 }
4413#endif
4414
4415 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004416 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004417}
4418
4419
4420static int
4421test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004422 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004423
Daniel Veillard57b25162004-11-06 14:50:18 +00004424#ifdef LIBXML_CATALOG_ENABLED
4425 int mem_base;
4426 xmlCatalogAllow allow; /* what catalogs should be accepted */
4427 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004428
Daniel Veillard57b25162004-11-06 14:50:18 +00004429 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
4430 mem_base = xmlMemBlocks();
4431 allow = gen_xmlCatalogAllow(n_allow, 0);
4432
4433 xmlCatalogSetDefaults(allow);
4434 call_tests++;
4435 des_xmlCatalogAllow(n_allow, allow, 0);
4436 xmlResetLastError();
4437 if (mem_base != xmlMemBlocks()) {
4438 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
4439 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004440 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00004441 printf(" %d", n_allow);
4442 printf("\n");
4443 }
4444 }
4445#endif
4446
4447 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004449}
4450
4451
4452static int
4453test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004454 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004455
Daniel Veillardce682bc2004-11-05 17:22:25 +00004456#ifdef LIBXML_CATALOG_ENABLED
4457 int mem_base;
4458 int ret_val;
4459 xmlCatalogPtr catal; /* the catalog */
4460 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004461
Daniel Veillardce682bc2004-11-05 17:22:25 +00004462 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
4463 mem_base = xmlMemBlocks();
4464 catal = gen_xmlCatalogPtr(n_catal, 0);
4465
4466 ret_val = xmlConvertSGMLCatalog(catal);
4467 desret_int(ret_val);
4468 call_tests++;
4469 des_xmlCatalogPtr(n_catal, catal, 0);
4470 xmlResetLastError();
4471 if (mem_base != xmlMemBlocks()) {
4472 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
4473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004474 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00004475 printf(" %d", n_catal);
4476 printf("\n");
4477 }
4478 }
4479#endif
4480
4481 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004483}
4484
4485
4486static int
4487test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004489
4490#ifdef LIBXML_CATALOG_ENABLED
4491 int mem_base;
4492
4493 mem_base = xmlMemBlocks();
4494
4495 xmlInitializeCatalog();
4496 call_tests++;
4497 xmlResetLastError();
4498 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00004499 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00004500 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004501 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00004502 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00004503 }
4504#endif
4505
Daniel Veillard3d97e662004-11-04 10:49:00 +00004506 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004508}
4509
4510
4511static int
4512test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004514
4515
4516 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00004517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004518}
4519
4520
4521static int
4522test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004524
4525#ifdef LIBXML_CATALOG_ENABLED
4526 int ret_val;
4527 const char * filename; /* a file path */
4528 int n_filename;
4529
4530 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00004531 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004532
4533 ret_val = xmlLoadCatalog(filename);
4534 desret_int(ret_val);
4535 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004536 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004537 xmlResetLastError();
4538 }
4539#endif
4540
Daniel Veillard3d97e662004-11-04 10:49:00 +00004541 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004542 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004543}
4544
4545
4546static int
4547test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004549
4550#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00004551 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00004552 int n_pathss;
4553
4554 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00004555 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004556
4557 xmlLoadCatalogs(pathss);
4558 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004559 des_const_char_ptr(n_pathss, pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004560 xmlResetLastError();
4561 }
4562#endif
4563
Daniel Veillard3d97e662004-11-04 10:49:00 +00004564 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004565 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004566}
4567
4568
4569static int
4570test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004571 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004572
4573
4574 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00004575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004576}
4577
4578
4579static int
4580test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004582
4583
4584 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00004585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004586}
4587
4588
4589static int
4590test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004592
4593#ifdef LIBXML_CATALOG_ENABLED
4594 int mem_base;
4595 xmlDocPtr ret_val;
4596 const char * filename; /* the filename */
4597 int n_filename;
4598
4599 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
4600 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00004601 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004602
4603 ret_val = xmlParseCatalogFile(filename);
4604 desret_xmlDocPtr(ret_val);
4605 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004606 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004607 xmlResetLastError();
4608 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00004609 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00004610 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004611 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00004612 printf(" %d", n_filename);
4613 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00004614 }
4615 }
4616#endif
4617
Daniel Veillard3d97e662004-11-04 10:49:00 +00004618 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004620}
4621
4622static int
4623test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004624 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004625
Daniel Veillardc2c894f2004-11-07 12:17:35 +00004626 printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00004627 test_ret += test_xmlACatalogAdd();
4628 test_ret += test_xmlACatalogDump();
4629 test_ret += test_xmlACatalogRemove();
4630 test_ret += test_xmlACatalogResolve();
4631 test_ret += test_xmlACatalogResolvePublic();
4632 test_ret += test_xmlACatalogResolveSystem();
4633 test_ret += test_xmlACatalogResolveURI();
4634 test_ret += test_xmlCatalogAdd();
4635 test_ret += test_xmlCatalogCleanup();
4636 test_ret += test_xmlCatalogConvert();
4637 test_ret += test_xmlCatalogDump();
4638 test_ret += test_xmlCatalogGetDefaults();
4639 test_ret += test_xmlCatalogIsEmpty();
4640 test_ret += test_xmlCatalogLocalResolve();
4641 test_ret += test_xmlCatalogLocalResolveURI();
4642 test_ret += test_xmlCatalogRemove();
4643 test_ret += test_xmlCatalogResolve();
4644 test_ret += test_xmlCatalogResolvePublic();
4645 test_ret += test_xmlCatalogResolveSystem();
4646 test_ret += test_xmlCatalogResolveURI();
4647 test_ret += test_xmlCatalogSetDefaultPrefer();
4648 test_ret += test_xmlCatalogSetDefaults();
4649 test_ret += test_xmlConvertSGMLCatalog();
4650 test_ret += test_xmlInitializeCatalog();
4651 test_ret += test_xmlLoadACatalog();
4652 test_ret += test_xmlLoadCatalog();
4653 test_ret += test_xmlLoadCatalogs();
4654 test_ret += test_xmlLoadSGMLSuperCatalog();
4655 test_ret += test_xmlNewCatalog();
4656 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00004657
Daniel Veillard42595322004-11-08 10:52:06 +00004658 if (test_ret != 0)
4659 printf("Module catalog: %d errors\n", test_ret);
4660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004661}
4662
Daniel Veillardce682bc2004-11-05 17:22:25 +00004663#define gen_nb_const_xmlChRangeGroupPtr 1
4664static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4665 return(NULL);
4666}
4667static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4668}
4669
Daniel Veillardd93f6252004-11-02 15:53:51 +00004670static int
4671test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004672 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004673
Daniel Veillardce682bc2004-11-05 17:22:25 +00004674 int mem_base;
4675 int ret_val;
4676 unsigned int val; /* character to be validated */
4677 int n_val;
4678 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
4679 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004680
Daniel Veillardce682bc2004-11-05 17:22:25 +00004681 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
4682 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
4683 mem_base = xmlMemBlocks();
4684 val = gen_unsigned_int(n_val, 0);
4685 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
4686
4687 ret_val = xmlCharInRange(val, rptr);
4688 desret_int(ret_val);
4689 call_tests++;
4690 des_unsigned_int(n_val, val, 0);
4691 des_const_xmlChRangeGroupPtr(n_rptr, rptr, 1);
4692 xmlResetLastError();
4693 if (mem_base != xmlMemBlocks()) {
4694 printf("Leak of %d blocks found in xmlCharInRange",
4695 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004696 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00004697 printf(" %d", n_val);
4698 printf(" %d", n_rptr);
4699 printf("\n");
4700 }
4701 }
4702 }
4703
4704 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004705 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004706}
4707
4708
4709static int
4710test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004712
Daniel Veillard3d97e662004-11-04 10:49:00 +00004713 int mem_base;
4714 int ret_val;
4715 unsigned int ch; /* character to validate */
4716 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004717
Daniel Veillard3d97e662004-11-04 10:49:00 +00004718 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
4719 mem_base = xmlMemBlocks();
4720 ch = gen_unsigned_int(n_ch, 0);
4721
4722 ret_val = xmlIsBaseChar(ch);
4723 desret_int(ret_val);
4724 call_tests++;
4725 des_unsigned_int(n_ch, ch, 0);
4726 xmlResetLastError();
4727 if (mem_base != xmlMemBlocks()) {
4728 printf("Leak of %d blocks found in xmlIsBaseChar",
4729 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004730 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004731 printf(" %d", n_ch);
4732 printf("\n");
4733 }
4734 }
4735
4736 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004737 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004738}
4739
4740
4741static int
4742test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004743 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004744
Daniel Veillard3d97e662004-11-04 10:49:00 +00004745 int mem_base;
4746 int ret_val;
4747 unsigned int ch; /* character to validate */
4748 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004749
Daniel Veillard3d97e662004-11-04 10:49:00 +00004750 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
4751 mem_base = xmlMemBlocks();
4752 ch = gen_unsigned_int(n_ch, 0);
4753
4754 ret_val = xmlIsBlank(ch);
4755 desret_int(ret_val);
4756 call_tests++;
4757 des_unsigned_int(n_ch, ch, 0);
4758 xmlResetLastError();
4759 if (mem_base != xmlMemBlocks()) {
4760 printf("Leak of %d blocks found in xmlIsBlank",
4761 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004762 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004763 printf(" %d", n_ch);
4764 printf("\n");
4765 }
4766 }
4767
4768 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004770}
4771
4772
4773static int
4774test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004776
Daniel Veillard3d97e662004-11-04 10:49:00 +00004777 int mem_base;
4778 int ret_val;
4779 unsigned int ch; /* character to validate */
4780 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004781
Daniel Veillard3d97e662004-11-04 10:49:00 +00004782 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
4783 mem_base = xmlMemBlocks();
4784 ch = gen_unsigned_int(n_ch, 0);
4785
4786 ret_val = xmlIsChar(ch);
4787 desret_int(ret_val);
4788 call_tests++;
4789 des_unsigned_int(n_ch, ch, 0);
4790 xmlResetLastError();
4791 if (mem_base != xmlMemBlocks()) {
4792 printf("Leak of %d blocks found in xmlIsChar",
4793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004794 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004795 printf(" %d", n_ch);
4796 printf("\n");
4797 }
4798 }
4799
4800 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004802}
4803
4804
4805static int
4806test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004808
Daniel Veillard3d97e662004-11-04 10:49:00 +00004809 int mem_base;
4810 int ret_val;
4811 unsigned int ch; /* character to validate */
4812 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004813
Daniel Veillard3d97e662004-11-04 10:49:00 +00004814 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
4815 mem_base = xmlMemBlocks();
4816 ch = gen_unsigned_int(n_ch, 0);
4817
4818 ret_val = xmlIsCombining(ch);
4819 desret_int(ret_val);
4820 call_tests++;
4821 des_unsigned_int(n_ch, ch, 0);
4822 xmlResetLastError();
4823 if (mem_base != xmlMemBlocks()) {
4824 printf("Leak of %d blocks found in xmlIsCombining",
4825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004826 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004827 printf(" %d", n_ch);
4828 printf("\n");
4829 }
4830 }
4831
4832 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004834}
4835
4836
4837static int
4838test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004840
Daniel Veillard3d97e662004-11-04 10:49:00 +00004841 int mem_base;
4842 int ret_val;
4843 unsigned int ch; /* character to validate */
4844 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004845
Daniel Veillard3d97e662004-11-04 10:49:00 +00004846 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
4847 mem_base = xmlMemBlocks();
4848 ch = gen_unsigned_int(n_ch, 0);
4849
4850 ret_val = xmlIsDigit(ch);
4851 desret_int(ret_val);
4852 call_tests++;
4853 des_unsigned_int(n_ch, ch, 0);
4854 xmlResetLastError();
4855 if (mem_base != xmlMemBlocks()) {
4856 printf("Leak of %d blocks found in xmlIsDigit",
4857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004858 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004859 printf(" %d", n_ch);
4860 printf("\n");
4861 }
4862 }
4863
4864 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004865 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004866}
4867
4868
4869static int
4870test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004871 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004872
Daniel Veillard3d97e662004-11-04 10:49:00 +00004873 int mem_base;
4874 int ret_val;
4875 unsigned int ch; /* character to validate */
4876 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004877
Daniel Veillard3d97e662004-11-04 10:49:00 +00004878 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
4879 mem_base = xmlMemBlocks();
4880 ch = gen_unsigned_int(n_ch, 0);
4881
4882 ret_val = xmlIsExtender(ch);
4883 desret_int(ret_val);
4884 call_tests++;
4885 des_unsigned_int(n_ch, ch, 0);
4886 xmlResetLastError();
4887 if (mem_base != xmlMemBlocks()) {
4888 printf("Leak of %d blocks found in xmlIsExtender",
4889 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004890 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004891 printf(" %d", n_ch);
4892 printf("\n");
4893 }
4894 }
4895
4896 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004897 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004898}
4899
4900
4901static int
4902test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004904
Daniel Veillard3d97e662004-11-04 10:49:00 +00004905 int mem_base;
4906 int ret_val;
4907 unsigned int ch; /* character to validate */
4908 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004909
Daniel Veillard3d97e662004-11-04 10:49:00 +00004910 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
4911 mem_base = xmlMemBlocks();
4912 ch = gen_unsigned_int(n_ch, 0);
4913
4914 ret_val = xmlIsIdeographic(ch);
4915 desret_int(ret_val);
4916 call_tests++;
4917 des_unsigned_int(n_ch, ch, 0);
4918 xmlResetLastError();
4919 if (mem_base != xmlMemBlocks()) {
4920 printf("Leak of %d blocks found in xmlIsIdeographic",
4921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004922 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004923 printf(" %d", n_ch);
4924 printf("\n");
4925 }
4926 }
4927
4928 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004930}
4931
4932
4933static int
4934test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004936
Daniel Veillard3d97e662004-11-04 10:49:00 +00004937 int mem_base;
4938 int ret_val;
4939 unsigned int ch; /* character to validate */
4940 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004941
Daniel Veillard3d97e662004-11-04 10:49:00 +00004942 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
4943 mem_base = xmlMemBlocks();
4944 ch = gen_unsigned_int(n_ch, 0);
4945
4946 ret_val = xmlIsPubidChar(ch);
4947 desret_int(ret_val);
4948 call_tests++;
4949 des_unsigned_int(n_ch, ch, 0);
4950 xmlResetLastError();
4951 if (mem_base != xmlMemBlocks()) {
4952 printf("Leak of %d blocks found in xmlIsPubidChar",
4953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00004954 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00004955 printf(" %d", n_ch);
4956 printf("\n");
4957 }
4958 }
4959
4960 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00004961 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004962}
4963
4964static int
4965test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004967
Daniel Veillardce682bc2004-11-05 17:22:25 +00004968 printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00004969 test_ret += test_xmlCharInRange();
4970 test_ret += test_xmlIsBaseChar();
4971 test_ret += test_xmlIsBlank();
4972 test_ret += test_xmlIsChar();
4973 test_ret += test_xmlIsCombining();
4974 test_ret += test_xmlIsDigit();
4975 test_ret += test_xmlIsExtender();
4976 test_ret += test_xmlIsIdeographic();
4977 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00004978
Daniel Veillard42595322004-11-08 10:52:06 +00004979 if (test_ret != 0)
4980 printf("Module chvalid: %d errors\n", test_ret);
4981 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00004982}
4983
4984static int
4985test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00004986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004987
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00004988 int mem_base;
4989 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00004990
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00004991 mem_base = xmlMemBlocks();
4992
4993 ret_val = xmlDictCreate();
4994 desret_xmlDictPtr(ret_val);
4995 call_tests++;
4996 xmlResetLastError();
4997 if (mem_base != xmlMemBlocks()) {
4998 printf("Leak of %d blocks found in xmlDictCreate",
4999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005000 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005001 printf("\n");
5002 }
5003
5004 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005005 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005006}
5007
5008
5009static int
5010test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005011 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005012
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005013 int mem_base;
5014 xmlDictPtr ret_val;
5015 xmlDictPtr sub; /* an existing dictionnary */
5016 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005017
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005018 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
5019 mem_base = xmlMemBlocks();
5020 sub = gen_xmlDictPtr(n_sub, 0);
5021
5022 ret_val = xmlDictCreateSub(sub);
5023 desret_xmlDictPtr(ret_val);
5024 call_tests++;
5025 des_xmlDictPtr(n_sub, sub, 0);
5026 xmlResetLastError();
5027 if (mem_base != xmlMemBlocks()) {
5028 printf("Leak of %d blocks found in xmlDictCreateSub",
5029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005030 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005031 printf(" %d", n_sub);
5032 printf("\n");
5033 }
5034 }
5035
5036 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005038}
5039
5040
5041static int
5042test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005043 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005044
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005045 int mem_base;
5046 const xmlChar * ret_val;
5047 xmlDictPtr dict; /* the dictionnary */
5048 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005049 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005050 int n_name;
5051 int len; /* the length of the name, if -1 it is recomputed */
5052 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005053
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005054 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
5055 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5056 for (n_len = 0;n_len < gen_nb_int;n_len++) {
5057 mem_base = xmlMemBlocks();
5058 dict = gen_xmlDictPtr(n_dict, 0);
5059 name = gen_const_xmlChar_ptr(n_name, 1);
5060 len = gen_int(n_len, 2);
5061
5062 ret_val = xmlDictLookup(dict, name, len);
5063 desret_const_xmlChar_ptr(ret_val);
5064 call_tests++;
5065 des_xmlDictPtr(n_dict, dict, 0);
5066 des_const_xmlChar_ptr(n_name, name, 1);
5067 des_int(n_len, len, 2);
5068 xmlResetLastError();
5069 if (mem_base != xmlMemBlocks()) {
5070 printf("Leak of %d blocks found in xmlDictLookup",
5071 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005072 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005073 printf(" %d", n_dict);
5074 printf(" %d", n_name);
5075 printf(" %d", n_len);
5076 printf("\n");
5077 }
5078 }
5079 }
5080 }
5081
5082 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005084}
5085
5086
5087static int
5088test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005090
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005091 int mem_base;
5092 int ret_val;
5093 xmlDictPtr dict; /* the dictionnary */
5094 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005095 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005096 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005097
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005098 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
5099 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
5100 mem_base = xmlMemBlocks();
5101 dict = gen_xmlDictPtr(n_dict, 0);
5102 str = gen_const_xmlChar_ptr(n_str, 1);
5103
5104 ret_val = xmlDictOwns(dict, str);
5105 desret_int(ret_val);
5106 call_tests++;
5107 des_xmlDictPtr(n_dict, dict, 0);
5108 des_const_xmlChar_ptr(n_str, str, 1);
5109 xmlResetLastError();
5110 if (mem_base != xmlMemBlocks()) {
5111 printf("Leak of %d blocks found in xmlDictOwns",
5112 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005113 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005114 printf(" %d", n_dict);
5115 printf(" %d", n_str);
5116 printf("\n");
5117 }
5118 }
5119 }
5120
5121 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005123}
5124
5125
5126static int
5127test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005129
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005130 int mem_base;
5131 const xmlChar * ret_val;
5132 xmlDictPtr dict; /* the dictionnary */
5133 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005134 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005135 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005136 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005137 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005138
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005139 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
5140 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
5141 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5142 mem_base = xmlMemBlocks();
5143 dict = gen_xmlDictPtr(n_dict, 0);
5144 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
5145 name = gen_const_xmlChar_ptr(n_name, 2);
5146
5147 ret_val = xmlDictQLookup(dict, prefix, name);
5148 desret_const_xmlChar_ptr(ret_val);
5149 call_tests++;
5150 des_xmlDictPtr(n_dict, dict, 0);
5151 des_const_xmlChar_ptr(n_prefix, prefix, 1);
5152 des_const_xmlChar_ptr(n_name, name, 2);
5153 xmlResetLastError();
5154 if (mem_base != xmlMemBlocks()) {
5155 printf("Leak of %d blocks found in xmlDictQLookup",
5156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005157 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005158 printf(" %d", n_dict);
5159 printf(" %d", n_prefix);
5160 printf(" %d", n_name);
5161 printf("\n");
5162 }
5163 }
5164 }
5165 }
5166
5167 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005169}
5170
5171
5172static int
5173test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005175
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005176 int mem_base;
5177 int ret_val;
5178 xmlDictPtr dict; /* the dictionnary */
5179 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005180
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005181 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
5182 mem_base = xmlMemBlocks();
5183 dict = gen_xmlDictPtr(n_dict, 0);
5184
5185 ret_val = xmlDictReference(dict);
5186 xmlDictFree(dict);
5187 desret_int(ret_val);
5188 call_tests++;
5189 des_xmlDictPtr(n_dict, dict, 0);
5190 xmlResetLastError();
5191 if (mem_base != xmlMemBlocks()) {
5192 printf("Leak of %d blocks found in xmlDictReference",
5193 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005194 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005195 printf(" %d", n_dict);
5196 printf("\n");
5197 }
5198 }
5199
5200 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005201 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005202}
5203
5204
5205static int
5206test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005208
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005209 int mem_base;
5210 int ret_val;
5211 xmlDictPtr dict; /* the dictionnary */
5212 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005213
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005214 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
5215 mem_base = xmlMemBlocks();
5216 dict = gen_xmlDictPtr(n_dict, 0);
5217
5218 ret_val = xmlDictSize(dict);
5219 desret_int(ret_val);
5220 call_tests++;
5221 des_xmlDictPtr(n_dict, dict, 0);
5222 xmlResetLastError();
5223 if (mem_base != xmlMemBlocks()) {
5224 printf("Leak of %d blocks found in xmlDictSize",
5225 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005226 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005227 printf(" %d", n_dict);
5228 printf("\n");
5229 }
5230 }
5231
5232 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005234}
5235
5236static int
5237test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005239
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005240 printf("Testing dict : 7 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00005241 test_ret += test_xmlDictCreate();
5242 test_ret += test_xmlDictCreateSub();
5243 test_ret += test_xmlDictLookup();
5244 test_ret += test_xmlDictOwns();
5245 test_ret += test_xmlDictQLookup();
5246 test_ret += test_xmlDictReference();
5247 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00005248
Daniel Veillard42595322004-11-08 10:52:06 +00005249 if (test_ret != 0)
5250 printf("Module dict: %d errors\n", test_ret);
5251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005252}
5253
5254static int
5255test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005257
Daniel Veillardce682bc2004-11-05 17:22:25 +00005258 int mem_base;
5259 int ret_val;
5260 unsigned char * out; /* a pointer to an array of bytes to store the result */
5261 int n_out;
5262 int * outlen; /* the length of @out */
5263 int n_outlen;
5264 unsigned char * in; /* a pointer to an array of UTF-8 chars */
5265 int n_in;
5266 int * inlen; /* the length of @in */
5267 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005268
Daniel Veillardce682bc2004-11-05 17:22:25 +00005269 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
5270 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
5271 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
5272 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
5273 mem_base = xmlMemBlocks();
5274 out = gen_unsigned_char_ptr(n_out, 0);
5275 outlen = gen_int_ptr(n_outlen, 1);
5276 in = gen_const_unsigned_char_ptr(n_in, 2);
5277 inlen = gen_int_ptr(n_inlen, 3);
5278
5279 ret_val = UTF8Toisolat1(out, outlen, in, inlen);
5280 desret_int(ret_val);
5281 call_tests++;
5282 des_unsigned_char_ptr(n_out, out, 0);
5283 des_int_ptr(n_outlen, outlen, 1);
5284 des_const_unsigned_char_ptr(n_in, in, 2);
5285 des_int_ptr(n_inlen, inlen, 3);
5286 xmlResetLastError();
5287 if (mem_base != xmlMemBlocks()) {
5288 printf("Leak of %d blocks found in UTF8Toisolat1",
5289 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005290 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005291 printf(" %d", n_out);
5292 printf(" %d", n_outlen);
5293 printf(" %d", n_in);
5294 printf(" %d", n_inlen);
5295 printf("\n");
5296 }
5297 }
5298 }
5299 }
5300 }
5301
5302 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005303 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005304}
5305
5306
5307static int
5308test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005309 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005310
Daniel Veillardce682bc2004-11-05 17:22:25 +00005311 int mem_base;
5312 int ret_val;
5313 unsigned char * out; /* a pointer to an array of bytes to store the result */
5314 int n_out;
5315 int * outlen; /* the length of @out */
5316 int n_outlen;
5317 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
5318 int n_in;
5319 int * inlen; /* the length of @in */
5320 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005321
Daniel Veillardce682bc2004-11-05 17:22:25 +00005322 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
5323 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
5324 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
5325 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
5326 mem_base = xmlMemBlocks();
5327 out = gen_unsigned_char_ptr(n_out, 0);
5328 outlen = gen_int_ptr(n_outlen, 1);
5329 in = gen_const_unsigned_char_ptr(n_in, 2);
5330 inlen = gen_int_ptr(n_inlen, 3);
5331
5332 ret_val = isolat1ToUTF8(out, outlen, in, inlen);
5333 desret_int(ret_val);
5334 call_tests++;
5335 des_unsigned_char_ptr(n_out, out, 0);
5336 des_int_ptr(n_outlen, outlen, 1);
5337 des_const_unsigned_char_ptr(n_in, in, 2);
5338 des_int_ptr(n_inlen, inlen, 3);
5339 xmlResetLastError();
5340 if (mem_base != xmlMemBlocks()) {
5341 printf("Leak of %d blocks found in isolat1ToUTF8",
5342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005343 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005344 printf(" %d", n_out);
5345 printf(" %d", n_outlen);
5346 printf(" %d", n_in);
5347 printf(" %d", n_inlen);
5348 printf("\n");
5349 }
5350 }
5351 }
5352 }
5353 }
5354
5355 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005356 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005357}
5358
5359
5360static int
5361test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005362 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005363
5364 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005365 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005366 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005367 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005368 int n_alias;
5369
5370 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
5371 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00005372 name = gen_const_char_ptr(n_name, 0);
5373 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005374
5375 ret_val = xmlAddEncodingAlias(name, alias);
5376 desret_int(ret_val);
5377 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005378 des_const_char_ptr(n_name, name, 0);
5379 des_const_char_ptr(n_alias, alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005380 xmlResetLastError();
5381 }
5382 }
5383
Daniel Veillard3d97e662004-11-04 10:49:00 +00005384 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005385 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005386}
5387
5388
Daniel Veillardce682bc2004-11-05 17:22:25 +00005389#define gen_nb_xmlCharEncodingHandler_ptr 1
5390static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5391 return(NULL);
5392}
5393static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5394}
5395
Daniel Veillardd93f6252004-11-02 15:53:51 +00005396static int
5397test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005399
Daniel Veillardce682bc2004-11-05 17:22:25 +00005400 int mem_base;
5401 int ret_val;
5402 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
5403 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005404
Daniel Veillardce682bc2004-11-05 17:22:25 +00005405 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
5406 mem_base = xmlMemBlocks();
5407 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
5408
5409 ret_val = xmlCharEncCloseFunc(handler);
5410 desret_int(ret_val);
5411 call_tests++;
5412 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
5413 xmlResetLastError();
5414 if (mem_base != xmlMemBlocks()) {
5415 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
5416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005417 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005418 printf(" %d", n_handler);
5419 printf("\n");
5420 }
5421 }
5422
5423 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005424 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005425}
5426
5427
5428static int
5429test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005430 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005431
Daniel Veillardce682bc2004-11-05 17:22:25 +00005432 int mem_base;
5433 int ret_val;
5434 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
5435 int n_handler;
5436 xmlBufferPtr out; /* an xmlBuffer for the output. */
5437 int n_out;
5438 xmlBufferPtr in; /* an xmlBuffer for the input */
5439 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005440
Daniel Veillardce682bc2004-11-05 17:22:25 +00005441 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
5442 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
5443 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
5444 mem_base = xmlMemBlocks();
5445 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
5446 out = gen_xmlBufferPtr(n_out, 1);
5447 in = gen_xmlBufferPtr(n_in, 2);
5448
5449 ret_val = xmlCharEncFirstLine(handler, out, in);
5450 desret_int(ret_val);
5451 call_tests++;
5452 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
5453 des_xmlBufferPtr(n_out, out, 1);
5454 des_xmlBufferPtr(n_in, in, 2);
5455 xmlResetLastError();
5456 if (mem_base != xmlMemBlocks()) {
5457 printf("Leak of %d blocks found in xmlCharEncFirstLine",
5458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005459 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005460 printf(" %d", n_handler);
5461 printf(" %d", n_out);
5462 printf(" %d", n_in);
5463 printf("\n");
5464 }
5465 }
5466 }
5467 }
5468
5469 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005470 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005471}
5472
5473
5474static int
5475test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005476 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005477
Daniel Veillardce682bc2004-11-05 17:22:25 +00005478 int mem_base;
5479 int ret_val;
5480 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
5481 int n_handler;
5482 xmlBufferPtr out; /* an xmlBuffer for the output. */
5483 int n_out;
5484 xmlBufferPtr in; /* an xmlBuffer for the input */
5485 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005486
Daniel Veillardce682bc2004-11-05 17:22:25 +00005487 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
5488 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
5489 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
5490 mem_base = xmlMemBlocks();
5491 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
5492 out = gen_xmlBufferPtr(n_out, 1);
5493 in = gen_xmlBufferPtr(n_in, 2);
5494
5495 ret_val = xmlCharEncInFunc(handler, out, in);
5496 desret_int(ret_val);
5497 call_tests++;
5498 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
5499 des_xmlBufferPtr(n_out, out, 1);
5500 des_xmlBufferPtr(n_in, in, 2);
5501 xmlResetLastError();
5502 if (mem_base != xmlMemBlocks()) {
5503 printf("Leak of %d blocks found in xmlCharEncInFunc",
5504 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005505 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005506 printf(" %d", n_handler);
5507 printf(" %d", n_out);
5508 printf(" %d", n_in);
5509 printf("\n");
5510 }
5511 }
5512 }
5513 }
5514
5515 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005516 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005517}
5518
5519
5520static int
5521test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005522 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005523
Daniel Veillardce682bc2004-11-05 17:22:25 +00005524 int mem_base;
5525 int ret_val;
5526 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
5527 int n_handler;
5528 xmlBufferPtr out; /* an xmlBuffer for the output. */
5529 int n_out;
5530 xmlBufferPtr in; /* an xmlBuffer for the input */
5531 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005532
Daniel Veillardce682bc2004-11-05 17:22:25 +00005533 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
5534 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
5535 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
5536 mem_base = xmlMemBlocks();
5537 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
5538 out = gen_xmlBufferPtr(n_out, 1);
5539 in = gen_xmlBufferPtr(n_in, 2);
5540
5541 ret_val = xmlCharEncOutFunc(handler, out, in);
5542 desret_int(ret_val);
5543 call_tests++;
5544 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
5545 des_xmlBufferPtr(n_out, out, 1);
5546 des_xmlBufferPtr(n_in, in, 2);
5547 xmlResetLastError();
5548 if (mem_base != xmlMemBlocks()) {
5549 printf("Leak of %d blocks found in xmlCharEncOutFunc",
5550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005551 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005552 printf(" %d", n_handler);
5553 printf(" %d", n_out);
5554 printf(" %d", n_in);
5555 printf("\n");
5556 }
5557 }
5558 }
5559 }
5560
5561 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005563}
5564
5565
5566static int
5567test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005569
5570
5571
5572 xmlCleanupCharEncodingHandlers();
5573 call_tests++;
5574 xmlResetLastError();
5575
Daniel Veillard3d97e662004-11-04 10:49:00 +00005576 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005577 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005578}
5579
5580
5581static int
5582test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005583 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005584
5585 int mem_base;
5586
5587 mem_base = xmlMemBlocks();
5588
5589 xmlCleanupEncodingAliases();
5590 call_tests++;
5591 xmlResetLastError();
5592 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005593 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005595 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005596 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005597 }
5598
Daniel Veillard3d97e662004-11-04 10:49:00 +00005599 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005600 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005601}
5602
5603
5604static int
5605test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005606 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005607
5608 int mem_base;
5609 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005610 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005611 int n_alias;
5612
5613 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
5614 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005615 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005616
5617 ret_val = xmlDelEncodingAlias(alias);
5618 desret_int(ret_val);
5619 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005620 des_const_char_ptr(n_alias, alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005621 xmlResetLastError();
5622 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005623 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005625 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005626 printf(" %d", n_alias);
5627 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005628 }
5629 }
5630
Daniel Veillard3d97e662004-11-04 10:49:00 +00005631 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005633}
5634
5635
5636static int
5637test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005639
Daniel Veillardce682bc2004-11-05 17:22:25 +00005640 int mem_base;
5641 xmlCharEncoding ret_val;
5642 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). */
5643 int n_in;
5644 int len; /* pointer to the length of the buffer */
5645 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005646
Daniel Veillardce682bc2004-11-05 17:22:25 +00005647 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
5648 for (n_len = 0;n_len < gen_nb_int;n_len++) {
5649 mem_base = xmlMemBlocks();
5650 in = gen_const_unsigned_char_ptr(n_in, 0);
5651 len = gen_int(n_len, 1);
5652
5653 ret_val = xmlDetectCharEncoding(in, len);
5654 desret_xmlCharEncoding(ret_val);
5655 call_tests++;
5656 des_const_unsigned_char_ptr(n_in, in, 0);
5657 des_int(n_len, len, 1);
5658 xmlResetLastError();
5659 if (mem_base != xmlMemBlocks()) {
5660 printf("Leak of %d blocks found in xmlDetectCharEncoding",
5661 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005662 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005663 printf(" %d", n_in);
5664 printf(" %d", n_len);
5665 printf("\n");
5666 }
5667 }
5668 }
5669
5670 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005671 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005672}
5673
5674
5675static int
5676test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005677 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005678
5679
5680 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00005681 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005682}
5683
5684
5685static int
5686test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005688
5689
5690 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00005691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005692}
5693
5694
5695static int
5696test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005698
Daniel Veillard3d97e662004-11-04 10:49:00 +00005699 int mem_base;
5700 const char * ret_val;
5701 xmlCharEncoding enc; /* the encoding */
5702 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005703
Daniel Veillard3d97e662004-11-04 10:49:00 +00005704 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
5705 mem_base = xmlMemBlocks();
5706 enc = gen_xmlCharEncoding(n_enc, 0);
5707
5708 ret_val = xmlGetCharEncodingName(enc);
5709 desret_const_char_ptr(ret_val);
5710 call_tests++;
5711 des_xmlCharEncoding(n_enc, enc, 0);
5712 xmlResetLastError();
5713 if (mem_base != xmlMemBlocks()) {
5714 printf("Leak of %d blocks found in xmlGetCharEncodingName",
5715 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005716 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005717 printf(" %d", n_enc);
5718 printf("\n");
5719 }
5720 }
5721
5722 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005724}
5725
5726
5727static int
5728test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005730
5731 int mem_base;
5732 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005733 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005734 int n_alias;
5735
5736 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
5737 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005738 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005739
5740 ret_val = xmlGetEncodingAlias(alias);
5741 desret_const_char_ptr(ret_val);
5742 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005743 des_const_char_ptr(n_alias, alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005744 xmlResetLastError();
5745 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005746 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005747 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005748 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005749 printf(" %d", n_alias);
5750 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005751 }
5752 }
5753
Daniel Veillard3d97e662004-11-04 10:49:00 +00005754 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005756}
5757
5758
5759static int
5760test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005762
5763
5764
5765 xmlInitCharEncodingHandlers();
5766 call_tests++;
5767 xmlResetLastError();
5768
Daniel Veillard3d97e662004-11-04 10:49:00 +00005769 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005770 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005771}
5772
5773
5774static int
5775test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005776 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005777
5778
5779 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00005780 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005781}
5782
5783
5784static int
5785test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005786 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005787
Daniel Veillard3d97e662004-11-04 10:49:00 +00005788 int mem_base;
5789 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005790 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00005791 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005792
Daniel Veillard3d97e662004-11-04 10:49:00 +00005793 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
5794 mem_base = xmlMemBlocks();
5795 name = gen_const_char_ptr(n_name, 0);
5796
5797 ret_val = xmlParseCharEncoding(name);
5798 desret_xmlCharEncoding(ret_val);
5799 call_tests++;
5800 des_const_char_ptr(n_name, name, 0);
5801 xmlResetLastError();
5802 if (mem_base != xmlMemBlocks()) {
5803 printf("Leak of %d blocks found in xmlParseCharEncoding",
5804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005805 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005806 printf(" %d", n_name);
5807 printf("\n");
5808 }
5809 }
5810
5811 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005813}
5814
5815
Daniel Veillardce682bc2004-11-05 17:22:25 +00005816#define gen_nb_xmlCharEncodingHandlerPtr 1
5817static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5818 return(NULL);
5819}
5820static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5821}
5822
Daniel Veillardd93f6252004-11-02 15:53:51 +00005823static int
5824test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005825 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005826
Daniel Veillardce682bc2004-11-05 17:22:25 +00005827 int mem_base;
5828 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
5829 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005830
Daniel Veillardce682bc2004-11-05 17:22:25 +00005831 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
5832 mem_base = xmlMemBlocks();
5833 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
5834
5835 xmlRegisterCharEncodingHandler(handler);
5836 call_tests++;
5837 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
5838 xmlResetLastError();
5839 if (mem_base != xmlMemBlocks()) {
5840 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
5841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005842 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005843 printf(" %d", n_handler);
5844 printf("\n");
5845 }
5846 }
5847
5848 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005850}
5851
5852static int
5853test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005855
Daniel Veillardce682bc2004-11-05 17:22:25 +00005856 printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00005857 test_ret += test_UTF8Toisolat1();
5858 test_ret += test_isolat1ToUTF8();
5859 test_ret += test_xmlAddEncodingAlias();
5860 test_ret += test_xmlCharEncCloseFunc();
5861 test_ret += test_xmlCharEncFirstLine();
5862 test_ret += test_xmlCharEncInFunc();
5863 test_ret += test_xmlCharEncOutFunc();
5864 test_ret += test_xmlCleanupCharEncodingHandlers();
5865 test_ret += test_xmlCleanupEncodingAliases();
5866 test_ret += test_xmlDelEncodingAlias();
5867 test_ret += test_xmlDetectCharEncoding();
5868 test_ret += test_xmlFindCharEncodingHandler();
5869 test_ret += test_xmlGetCharEncodingHandler();
5870 test_ret += test_xmlGetCharEncodingName();
5871 test_ret += test_xmlGetEncodingAlias();
5872 test_ret += test_xmlInitCharEncodingHandlers();
5873 test_ret += test_xmlNewCharEncodingHandler();
5874 test_ret += test_xmlParseCharEncoding();
5875 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00005876
Daniel Veillard42595322004-11-08 10:52:06 +00005877 if (test_ret != 0)
5878 printf("Module encoding: %d errors\n", test_ret);
5879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005880}
5881
5882static int
5883test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005885
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00005886 int mem_base;
5887 xmlEntityPtr ret_val;
5888 xmlDocPtr doc; /* the document */
5889 int n_doc;
5890 xmlChar * name; /* the entity name */
5891 int n_name;
5892 int type; /* the entity type XML_xxx_yyy_ENTITY */
5893 int n_type;
5894 xmlChar * ExternalID; /* the entity external ID if available */
5895 int n_ExternalID;
5896 xmlChar * SystemID; /* the entity system ID if available */
5897 int n_SystemID;
5898 xmlChar * content; /* the entity content */
5899 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005900
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00005901 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5902 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5903 for (n_type = 0;n_type < gen_nb_int;n_type++) {
5904 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
5905 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
5906 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
5907 mem_base = xmlMemBlocks();
5908 doc = gen_xmlDocPtr(n_doc, 0);
5909 name = gen_const_xmlChar_ptr(n_name, 1);
5910 type = gen_int(n_type, 2);
5911 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
5912 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
5913 content = gen_const_xmlChar_ptr(n_content, 5);
5914
5915 ret_val = xmlAddDocEntity(doc, name, type, ExternalID, SystemID, content);
5916 desret_xmlEntityPtr(ret_val);
5917 call_tests++;
5918 des_xmlDocPtr(n_doc, doc, 0);
5919 des_const_xmlChar_ptr(n_name, name, 1);
5920 des_int(n_type, type, 2);
5921 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3);
5922 des_const_xmlChar_ptr(n_SystemID, SystemID, 4);
5923 des_const_xmlChar_ptr(n_content, content, 5);
5924 xmlResetLastError();
5925 if (mem_base != xmlMemBlocks()) {
5926 printf("Leak of %d blocks found in xmlAddDocEntity",
5927 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005928 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00005929 printf(" %d", n_doc);
5930 printf(" %d", n_name);
5931 printf(" %d", n_type);
5932 printf(" %d", n_ExternalID);
5933 printf(" %d", n_SystemID);
5934 printf(" %d", n_content);
5935 printf("\n");
5936 }
5937 }
5938 }
5939 }
5940 }
5941 }
5942 }
5943
5944 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005945 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005946}
5947
5948
5949static int
5950test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005952
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00005953 int mem_base;
5954 xmlEntityPtr ret_val;
5955 xmlDocPtr doc; /* the document */
5956 int n_doc;
5957 xmlChar * name; /* the entity name */
5958 int n_name;
5959 int type; /* the entity type XML_xxx_yyy_ENTITY */
5960 int n_type;
5961 xmlChar * ExternalID; /* the entity external ID if available */
5962 int n_ExternalID;
5963 xmlChar * SystemID; /* the entity system ID if available */
5964 int n_SystemID;
5965 xmlChar * content; /* the entity content */
5966 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005967
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00005968 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5969 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5970 for (n_type = 0;n_type < gen_nb_int;n_type++) {
5971 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
5972 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
5973 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
5974 mem_base = xmlMemBlocks();
5975 doc = gen_xmlDocPtr(n_doc, 0);
5976 name = gen_const_xmlChar_ptr(n_name, 1);
5977 type = gen_int(n_type, 2);
5978 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
5979 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
5980 content = gen_const_xmlChar_ptr(n_content, 5);
5981
5982 ret_val = xmlAddDtdEntity(doc, name, type, ExternalID, SystemID, content);
5983 desret_xmlEntityPtr(ret_val);
5984 call_tests++;
5985 des_xmlDocPtr(n_doc, doc, 0);
5986 des_const_xmlChar_ptr(n_name, name, 1);
5987 des_int(n_type, type, 2);
5988 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3);
5989 des_const_xmlChar_ptr(n_SystemID, SystemID, 4);
5990 des_const_xmlChar_ptr(n_content, content, 5);
5991 xmlResetLastError();
5992 if (mem_base != xmlMemBlocks()) {
5993 printf("Leak of %d blocks found in xmlAddDtdEntity",
5994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005995 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00005996 printf(" %d", n_doc);
5997 printf(" %d", n_name);
5998 printf(" %d", n_type);
5999 printf(" %d", n_ExternalID);
6000 printf(" %d", n_SystemID);
6001 printf(" %d", n_content);
6002 printf("\n");
6003 }
6004 }
6005 }
6006 }
6007 }
6008 }
6009 }
6010
6011 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006013}
6014
6015
6016static int
6017test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006019
6020 int mem_base;
6021
6022 mem_base = xmlMemBlocks();
6023
6024 xmlCleanupPredefinedEntities();
6025 call_tests++;
6026 xmlResetLastError();
6027 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006028 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006030 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006031 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006032 }
6033
Daniel Veillard3d97e662004-11-04 10:49:00 +00006034 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006036}
6037
6038
Daniel Veillardce682bc2004-11-05 17:22:25 +00006039#define gen_nb_xmlEntitiesTablePtr 1
6040static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6041 return(NULL);
6042}
6043static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6044}
6045
Daniel Veillardd93f6252004-11-02 15:53:51 +00006046static int
6047test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006049
6050
6051 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006053}
6054
6055
6056static int
6057test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006058 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006059
6060
6061 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006063}
6064
6065
6066static int
6067test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006069
Daniel Veillardce682bc2004-11-05 17:22:25 +00006070#ifdef LIBXML_OUTPUT_ENABLED
6071 int mem_base;
6072 xmlBufferPtr buf; /* An XML buffer. */
6073 int n_buf;
6074 xmlEntitiesTablePtr table; /* An entity table */
6075 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006076
Daniel Veillardce682bc2004-11-05 17:22:25 +00006077 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
6078 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
6079 mem_base = xmlMemBlocks();
6080 buf = gen_xmlBufferPtr(n_buf, 0);
6081 table = gen_xmlEntitiesTablePtr(n_table, 1);
6082
6083 xmlDumpEntitiesTable(buf, table);
6084 call_tests++;
6085 des_xmlBufferPtr(n_buf, buf, 0);
6086 des_xmlEntitiesTablePtr(n_table, table, 1);
6087 xmlResetLastError();
6088 if (mem_base != xmlMemBlocks()) {
6089 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
6090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006091 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006092 printf(" %d", n_buf);
6093 printf(" %d", n_table);
6094 printf("\n");
6095 }
6096 }
6097 }
6098#endif
6099
6100 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006102}
6103
6104
Daniel Veillardce682bc2004-11-05 17:22:25 +00006105#define gen_nb_xmlEntityPtr 1
6106static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6107 return(NULL);
6108}
6109static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6110}
6111
Daniel Veillardd93f6252004-11-02 15:53:51 +00006112static int
6113test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006115
Daniel Veillardce682bc2004-11-05 17:22:25 +00006116#ifdef LIBXML_OUTPUT_ENABLED
6117 int mem_base;
6118 xmlBufferPtr buf; /* An XML buffer. */
6119 int n_buf;
6120 xmlEntityPtr ent; /* An entity table */
6121 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006122
Daniel Veillardce682bc2004-11-05 17:22:25 +00006123 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
6124 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
6125 mem_base = xmlMemBlocks();
6126 buf = gen_xmlBufferPtr(n_buf, 0);
6127 ent = gen_xmlEntityPtr(n_ent, 1);
6128
6129 xmlDumpEntityDecl(buf, ent);
6130 call_tests++;
6131 des_xmlBufferPtr(n_buf, buf, 0);
6132 des_xmlEntityPtr(n_ent, ent, 1);
6133 xmlResetLastError();
6134 if (mem_base != xmlMemBlocks()) {
6135 printf("Leak of %d blocks found in xmlDumpEntityDecl",
6136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006137 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006138 printf(" %d", n_buf);
6139 printf(" %d", n_ent);
6140 printf("\n");
6141 }
6142 }
6143 }
6144#endif
6145
6146 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006148}
6149
6150
6151static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006152test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006154
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006155 int mem_base;
6156 xmlChar * ret_val;
6157 xmlDocPtr doc; /* the document containing the string */
6158 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006159 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006160 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006161
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006162 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6163 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
6164 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006165 doc = gen_xmlDocPtr(n_doc, 0);
6166 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006167
6168 ret_val = xmlEncodeEntitiesReentrant(doc, input);
6169 desret_xmlChar_ptr(ret_val);
6170 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006171 des_xmlDocPtr(n_doc, doc, 0);
6172 des_const_xmlChar_ptr(n_input, input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006173 xmlResetLastError();
6174 if (mem_base != xmlMemBlocks()) {
6175 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
6176 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006177 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006178 printf(" %d", n_doc);
6179 printf(" %d", n_input);
6180 printf("\n");
6181 }
6182 }
6183 }
6184
Daniel Veillard3d97e662004-11-04 10:49:00 +00006185 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006186 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006187}
6188
6189
6190static int
6191test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006192 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006193
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006194 int mem_base;
6195 xmlChar * ret_val;
6196 xmlDocPtr doc; /* the document containing the string */
6197 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006198 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006199 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006200
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006201 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6202 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
6203 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006204 doc = gen_xmlDocPtr(n_doc, 0);
6205 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006206
6207 ret_val = xmlEncodeSpecialChars(doc, input);
6208 desret_xmlChar_ptr(ret_val);
6209 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006210 des_xmlDocPtr(n_doc, doc, 0);
6211 des_const_xmlChar_ptr(n_input, input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006212 xmlResetLastError();
6213 if (mem_base != xmlMemBlocks()) {
6214 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
6215 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006216 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006217 printf(" %d", n_doc);
6218 printf(" %d", n_input);
6219 printf("\n");
6220 }
6221 }
6222 }
6223
Daniel Veillard3d97e662004-11-04 10:49:00 +00006224 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006226}
6227
6228
6229static int
6230test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006232
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00006233 int mem_base;
6234 xmlEntityPtr ret_val;
6235 xmlDocPtr doc; /* the document referencing the entity */
6236 int n_doc;
6237 xmlChar * name; /* the entity name */
6238 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006239
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00006240 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6241 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
6242 mem_base = xmlMemBlocks();
6243 doc = gen_xmlDocPtr(n_doc, 0);
6244 name = gen_const_xmlChar_ptr(n_name, 1);
6245
6246 ret_val = xmlGetDocEntity(doc, name);
6247 desret_xmlEntityPtr(ret_val);
6248 call_tests++;
6249 des_xmlDocPtr(n_doc, doc, 0);
6250 des_const_xmlChar_ptr(n_name, name, 1);
6251 xmlResetLastError();
6252 if (mem_base != xmlMemBlocks()) {
6253 printf("Leak of %d blocks found in xmlGetDocEntity",
6254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006255 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00006256 printf(" %d", n_doc);
6257 printf(" %d", n_name);
6258 printf("\n");
6259 }
6260 }
6261 }
6262
6263 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006264 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006265}
6266
6267
6268static int
6269test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006270 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006271
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00006272 int mem_base;
6273 xmlEntityPtr ret_val;
6274 xmlDocPtr doc; /* the document referencing the entity */
6275 int n_doc;
6276 xmlChar * name; /* the entity name */
6277 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006278
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00006279 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6280 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
6281 mem_base = xmlMemBlocks();
6282 doc = gen_xmlDocPtr(n_doc, 0);
6283 name = gen_const_xmlChar_ptr(n_name, 1);
6284
6285 ret_val = xmlGetDtdEntity(doc, name);
6286 desret_xmlEntityPtr(ret_val);
6287 call_tests++;
6288 des_xmlDocPtr(n_doc, doc, 0);
6289 des_const_xmlChar_ptr(n_name, name, 1);
6290 xmlResetLastError();
6291 if (mem_base != xmlMemBlocks()) {
6292 printf("Leak of %d blocks found in xmlGetDtdEntity",
6293 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006294 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00006295 printf(" %d", n_doc);
6296 printf(" %d", n_name);
6297 printf("\n");
6298 }
6299 }
6300 }
6301
6302 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006303 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006304}
6305
6306
6307static int
6308test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006309 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006310
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00006311 int mem_base;
6312 xmlEntityPtr ret_val;
6313 xmlDocPtr doc; /* the document referencing the entity */
6314 int n_doc;
6315 xmlChar * name; /* the entity name */
6316 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006317
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00006318 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6319 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
6320 mem_base = xmlMemBlocks();
6321 doc = gen_xmlDocPtr(n_doc, 0);
6322 name = gen_const_xmlChar_ptr(n_name, 1);
6323
6324 ret_val = xmlGetParameterEntity(doc, name);
6325 desret_xmlEntityPtr(ret_val);
6326 call_tests++;
6327 des_xmlDocPtr(n_doc, doc, 0);
6328 des_const_xmlChar_ptr(n_name, name, 1);
6329 xmlResetLastError();
6330 if (mem_base != xmlMemBlocks()) {
6331 printf("Leak of %d blocks found in xmlGetParameterEntity",
6332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006333 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00006334 printf(" %d", n_doc);
6335 printf(" %d", n_name);
6336 printf("\n");
6337 }
6338 }
6339 }
6340
6341 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006342 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006343}
6344
6345
6346static int
6347test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006348 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006349
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00006350 int mem_base;
6351 xmlEntityPtr ret_val;
6352 xmlChar * name; /* the entity name */
6353 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006354
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00006355 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
6356 mem_base = xmlMemBlocks();
6357 name = gen_const_xmlChar_ptr(n_name, 0);
6358
6359 ret_val = xmlGetPredefinedEntity(name);
6360 desret_xmlEntityPtr(ret_val);
6361 call_tests++;
6362 des_const_xmlChar_ptr(n_name, name, 0);
6363 xmlResetLastError();
6364 if (mem_base != xmlMemBlocks()) {
6365 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
6366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006367 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00006368 printf(" %d", n_name);
6369 printf("\n");
6370 }
6371 }
6372
6373 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006375}
6376
6377
6378static int
6379test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006381
6382 int mem_base;
6383
6384 mem_base = xmlMemBlocks();
6385
6386 xmlInitializePredefinedEntities();
6387 call_tests++;
6388 xmlResetLastError();
6389 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006390 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006391 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006392 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006393 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006394 }
6395
Daniel Veillard3d97e662004-11-04 10:49:00 +00006396 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006398}
6399
6400static int
6401test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006403
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00006404 printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006405 test_ret += test_xmlAddDocEntity();
6406 test_ret += test_xmlAddDtdEntity();
6407 test_ret += test_xmlCleanupPredefinedEntities();
6408 test_ret += test_xmlCopyEntitiesTable();
6409 test_ret += test_xmlCreateEntitiesTable();
6410 test_ret += test_xmlDumpEntitiesTable();
6411 test_ret += test_xmlDumpEntityDecl();
6412 test_ret += test_xmlEncodeEntitiesReentrant();
6413 test_ret += test_xmlEncodeSpecialChars();
6414 test_ret += test_xmlGetDocEntity();
6415 test_ret += test_xmlGetDtdEntity();
6416 test_ret += test_xmlGetParameterEntity();
6417 test_ret += test_xmlGetPredefinedEntity();
6418 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006419
Daniel Veillard42595322004-11-08 10:52:06 +00006420 if (test_ret != 0)
6421 printf("Module entities: %d errors\n", test_ret);
6422 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006423}
6424
6425static int
6426test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006427 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006428
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006429 int mem_base;
6430 int ret_val;
6431 xmlHashTablePtr table; /* the hash table */
6432 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006433 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006434 int n_name;
6435 void * userdata; /* a pointer to the userdata */
6436 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006437
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006438 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
6439 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
6440 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
6441 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006442 table = gen_xmlHashTablePtr(n_table, 0);
6443 name = gen_const_xmlChar_ptr(n_name, 1);
6444 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006445
6446 ret_val = xmlHashAddEntry(table, name, userdata);
6447 desret_int(ret_val);
6448 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006449 des_xmlHashTablePtr(n_table, table, 0);
6450 des_const_xmlChar_ptr(n_name, name, 1);
6451 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006452 xmlResetLastError();
6453 if (mem_base != xmlMemBlocks()) {
6454 printf("Leak of %d blocks found in xmlHashAddEntry",
6455 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006456 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006457 printf(" %d", n_table);
6458 printf(" %d", n_name);
6459 printf(" %d", n_userdata);
6460 printf("\n");
6461 }
6462 }
6463 }
6464 }
6465
Daniel Veillard3d97e662004-11-04 10:49:00 +00006466 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006467 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006468}
6469
6470
6471static int
6472test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006473 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006474
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006475 int mem_base;
6476 int ret_val;
6477 xmlHashTablePtr table; /* the hash table */
6478 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006479 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006480 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006481 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006482 int n_name2;
6483 void * userdata; /* a pointer to the userdata */
6484 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006485
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006486 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
6487 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
6488 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
6489 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
6490 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006491 table = gen_xmlHashTablePtr(n_table, 0);
6492 name = gen_const_xmlChar_ptr(n_name, 1);
6493 name2 = gen_const_xmlChar_ptr(n_name2, 2);
6494 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006495
6496 ret_val = xmlHashAddEntry2(table, name, name2, userdata);
6497 desret_int(ret_val);
6498 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006499 des_xmlHashTablePtr(n_table, table, 0);
6500 des_const_xmlChar_ptr(n_name, name, 1);
6501 des_const_xmlChar_ptr(n_name2, name2, 2);
6502 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006503 xmlResetLastError();
6504 if (mem_base != xmlMemBlocks()) {
6505 printf("Leak of %d blocks found in xmlHashAddEntry2",
6506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006507 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006508 printf(" %d", n_table);
6509 printf(" %d", n_name);
6510 printf(" %d", n_name2);
6511 printf(" %d", n_userdata);
6512 printf("\n");
6513 }
6514 }
6515 }
6516 }
6517 }
6518
Daniel Veillard3d97e662004-11-04 10:49:00 +00006519 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006520 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006521}
6522
6523
6524static int
6525test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006526 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006527
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006528 int mem_base;
6529 int ret_val;
6530 xmlHashTablePtr table; /* the hash table */
6531 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006532 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006533 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006534 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006535 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006536 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006537 int n_name3;
6538 void * userdata; /* a pointer to the userdata */
6539 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006540
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006541 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
6542 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
6543 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
6544 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
6545 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
6546 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006547 table = gen_xmlHashTablePtr(n_table, 0);
6548 name = gen_const_xmlChar_ptr(n_name, 1);
6549 name2 = gen_const_xmlChar_ptr(n_name2, 2);
6550 name3 = gen_const_xmlChar_ptr(n_name3, 3);
6551 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006552
6553 ret_val = xmlHashAddEntry3(table, name, name2, name3, userdata);
6554 desret_int(ret_val);
6555 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006556 des_xmlHashTablePtr(n_table, table, 0);
6557 des_const_xmlChar_ptr(n_name, name, 1);
6558 des_const_xmlChar_ptr(n_name2, name2, 2);
6559 des_const_xmlChar_ptr(n_name3, name3, 3);
6560 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006561 xmlResetLastError();
6562 if (mem_base != xmlMemBlocks()) {
6563 printf("Leak of %d blocks found in xmlHashAddEntry3",
6564 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006565 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00006566 printf(" %d", n_table);
6567 printf(" %d", n_name);
6568 printf(" %d", n_name2);
6569 printf(" %d", n_name3);
6570 printf(" %d", n_userdata);
6571 printf("\n");
6572 }
6573 }
6574 }
6575 }
6576 }
6577 }
6578
Daniel Veillard3d97e662004-11-04 10:49:00 +00006579 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006580 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006581}
6582
6583
6584static int
6585test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006587
6588
6589 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006590 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006591}
6592
6593
6594static int
6595test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006596 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006597
6598
6599 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006600 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006601}
6602
6603
6604static int
6605test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006606 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006607
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006608 int mem_base;
6609 void * ret_val;
6610 xmlHashTablePtr table; /* the hash table */
6611 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006612 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006613 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006614
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006615 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
6616 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
6617 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006618 table = gen_xmlHashTablePtr(n_table, 0);
6619 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006620
6621 ret_val = xmlHashLookup(table, name);
6622 desret_void_ptr(ret_val);
6623 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006624 des_xmlHashTablePtr(n_table, table, 0);
6625 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006626 xmlResetLastError();
6627 if (mem_base != xmlMemBlocks()) {
6628 printf("Leak of %d blocks found in xmlHashLookup",
6629 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006630 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006631 printf(" %d", n_table);
6632 printf(" %d", n_name);
6633 printf("\n");
6634 }
6635 }
6636 }
6637
Daniel Veillard3d97e662004-11-04 10:49:00 +00006638 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006640}
6641
6642
6643static int
6644test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006645 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006646
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006647 int mem_base;
6648 void * ret_val;
6649 xmlHashTablePtr table; /* the hash table */
6650 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006651 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006652 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006653 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006654 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006655
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006656 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
6657 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
6658 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
6659 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006660 table = gen_xmlHashTablePtr(n_table, 0);
6661 name = gen_const_xmlChar_ptr(n_name, 1);
6662 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006663
6664 ret_val = xmlHashLookup2(table, name, name2);
6665 desret_void_ptr(ret_val);
6666 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006667 des_xmlHashTablePtr(n_table, table, 0);
6668 des_const_xmlChar_ptr(n_name, name, 1);
6669 des_const_xmlChar_ptr(n_name2, name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006670 xmlResetLastError();
6671 if (mem_base != xmlMemBlocks()) {
6672 printf("Leak of %d blocks found in xmlHashLookup2",
6673 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006674 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006675 printf(" %d", n_table);
6676 printf(" %d", n_name);
6677 printf(" %d", n_name2);
6678 printf("\n");
6679 }
6680 }
6681 }
6682 }
6683
Daniel Veillard3d97e662004-11-04 10:49:00 +00006684 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006686}
6687
6688
6689static int
6690test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006692
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006693 int mem_base;
6694 void * ret_val;
6695 xmlHashTablePtr table; /* the hash table */
6696 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006697 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006698 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006699 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006700 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006701 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006702 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006703
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006704 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
6705 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
6706 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
6707 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
6708 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006709 table = gen_xmlHashTablePtr(n_table, 0);
6710 name = gen_const_xmlChar_ptr(n_name, 1);
6711 name2 = gen_const_xmlChar_ptr(n_name2, 2);
6712 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006713
6714 ret_val = xmlHashLookup3(table, name, name2, name3);
6715 desret_void_ptr(ret_val);
6716 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006717 des_xmlHashTablePtr(n_table, table, 0);
6718 des_const_xmlChar_ptr(n_name, name, 1);
6719 des_const_xmlChar_ptr(n_name2, name2, 2);
6720 des_const_xmlChar_ptr(n_name3, name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006721 xmlResetLastError();
6722 if (mem_base != xmlMemBlocks()) {
6723 printf("Leak of %d blocks found in xmlHashLookup3",
6724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006725 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006726 printf(" %d", n_table);
6727 printf(" %d", n_name);
6728 printf(" %d", n_name2);
6729 printf(" %d", n_name3);
6730 printf("\n");
6731 }
6732 }
6733 }
6734 }
6735 }
6736
Daniel Veillard3d97e662004-11-04 10:49:00 +00006737 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006739}
6740
6741
6742static int
6743test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006745
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006746 int mem_base;
6747 void * ret_val;
6748 xmlHashTablePtr table; /* the hash table */
6749 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006750 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006751 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006752 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006753 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006754
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006755 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
6756 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
6757 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
6758 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006759 table = gen_xmlHashTablePtr(n_table, 0);
6760 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
6761 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006762
6763 ret_val = xmlHashQLookup(table, prefix, name);
6764 desret_void_ptr(ret_val);
6765 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006766 des_xmlHashTablePtr(n_table, table, 0);
6767 des_const_xmlChar_ptr(n_prefix, prefix, 1);
6768 des_const_xmlChar_ptr(n_name, name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006769 xmlResetLastError();
6770 if (mem_base != xmlMemBlocks()) {
6771 printf("Leak of %d blocks found in xmlHashQLookup",
6772 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006773 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006774 printf(" %d", n_table);
6775 printf(" %d", n_prefix);
6776 printf(" %d", n_name);
6777 printf("\n");
6778 }
6779 }
6780 }
6781 }
6782
Daniel Veillard3d97e662004-11-04 10:49:00 +00006783 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006784 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006785}
6786
6787
6788static int
6789test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006790 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006791
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006792 int mem_base;
6793 void * ret_val;
6794 xmlHashTablePtr table; /* the hash table */
6795 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006796 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006797 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006798 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006799 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006800 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006801 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006802 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006803 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006804
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006805 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
6806 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
6807 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
6808 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
6809 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
6810 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006811 table = gen_xmlHashTablePtr(n_table, 0);
6812 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
6813 name = gen_const_xmlChar_ptr(n_name, 2);
6814 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
6815 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006816
6817 ret_val = xmlHashQLookup2(table, prefix, name, prefix2, name2);
6818 desret_void_ptr(ret_val);
6819 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006820 des_xmlHashTablePtr(n_table, table, 0);
6821 des_const_xmlChar_ptr(n_prefix, prefix, 1);
6822 des_const_xmlChar_ptr(n_name, name, 2);
6823 des_const_xmlChar_ptr(n_prefix2, prefix2, 3);
6824 des_const_xmlChar_ptr(n_name2, name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006825 xmlResetLastError();
6826 if (mem_base != xmlMemBlocks()) {
6827 printf("Leak of %d blocks found in xmlHashQLookup2",
6828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006829 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006830 printf(" %d", n_table);
6831 printf(" %d", n_prefix);
6832 printf(" %d", n_name);
6833 printf(" %d", n_prefix2);
6834 printf(" %d", n_name2);
6835 printf("\n");
6836 }
6837 }
6838 }
6839 }
6840 }
6841 }
6842
Daniel Veillard3d97e662004-11-04 10:49:00 +00006843 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006844 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006845}
6846
6847
6848static int
6849test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006851
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006852 int mem_base;
6853 void * ret_val;
6854 xmlHashTablePtr table; /* the hash table */
6855 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006856 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006857 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006858 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006859 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006860 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006861 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006862 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006863 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006864 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006865 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006866 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006867 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006868
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006869 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
6870 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
6871 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
6872 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
6873 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
6874 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
6875 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
6876 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006877 table = gen_xmlHashTablePtr(n_table, 0);
6878 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
6879 name = gen_const_xmlChar_ptr(n_name, 2);
6880 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
6881 name2 = gen_const_xmlChar_ptr(n_name2, 4);
6882 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
6883 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006884
6885 ret_val = xmlHashQLookup3(table, prefix, name, prefix2, name2, prefix3, name3);
6886 desret_void_ptr(ret_val);
6887 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006888 des_xmlHashTablePtr(n_table, table, 0);
6889 des_const_xmlChar_ptr(n_prefix, prefix, 1);
6890 des_const_xmlChar_ptr(n_name, name, 2);
6891 des_const_xmlChar_ptr(n_prefix2, prefix2, 3);
6892 des_const_xmlChar_ptr(n_name2, name2, 4);
6893 des_const_xmlChar_ptr(n_prefix3, prefix3, 5);
6894 des_const_xmlChar_ptr(n_name3, name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006895 xmlResetLastError();
6896 if (mem_base != xmlMemBlocks()) {
6897 printf("Leak of %d blocks found in xmlHashQLookup3",
6898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006899 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006900 printf(" %d", n_table);
6901 printf(" %d", n_prefix);
6902 printf(" %d", n_name);
6903 printf(" %d", n_prefix2);
6904 printf(" %d", n_name2);
6905 printf(" %d", n_prefix3);
6906 printf(" %d", n_name3);
6907 printf("\n");
6908 }
6909 }
6910 }
6911 }
6912 }
6913 }
6914 }
6915 }
6916
Daniel Veillard3d97e662004-11-04 10:49:00 +00006917 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006918 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006919}
6920
6921
6922static int
6923test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006924 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006925
Daniel Veillard42595322004-11-08 10:52:06 +00006926 int mem_base;
6927 int ret_val;
6928 xmlHashTablePtr table; /* the hash table */
6929 int n_table;
6930 xmlChar * name; /* the name of the userdata */
6931 int n_name;
6932 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
6933 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006934
Daniel Veillard42595322004-11-08 10:52:06 +00006935 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
6936 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
6937 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
6938 mem_base = xmlMemBlocks();
6939 table = gen_xmlHashTablePtr(n_table, 0);
6940 name = gen_const_xmlChar_ptr(n_name, 1);
6941 f = gen_xmlHashDeallocator(n_f, 2);
6942
6943 ret_val = xmlHashRemoveEntry(table, name, f);
6944 desret_int(ret_val);
6945 call_tests++;
6946 des_xmlHashTablePtr(n_table, table, 0);
6947 des_const_xmlChar_ptr(n_name, name, 1);
6948 des_xmlHashDeallocator(n_f, f, 2);
6949 xmlResetLastError();
6950 if (mem_base != xmlMemBlocks()) {
6951 printf("Leak of %d blocks found in xmlHashRemoveEntry",
6952 xmlMemBlocks() - mem_base);
6953 test_ret++;
6954 printf(" %d", n_table);
6955 printf(" %d", n_name);
6956 printf(" %d", n_f);
6957 printf("\n");
6958 }
6959 }
6960 }
6961 }
6962
6963 function_tests++;
6964 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006965}
6966
6967
6968static int
6969test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006970 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006971
Daniel Veillard42595322004-11-08 10:52:06 +00006972 int mem_base;
6973 int ret_val;
6974 xmlHashTablePtr table; /* the hash table */
6975 int n_table;
6976 xmlChar * name; /* the name of the userdata */
6977 int n_name;
6978 xmlChar * name2; /* a second name of the userdata */
6979 int n_name2;
6980 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
6981 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006982
Daniel Veillard42595322004-11-08 10:52:06 +00006983 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
6984 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
6985 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
6986 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
6987 mem_base = xmlMemBlocks();
6988 table = gen_xmlHashTablePtr(n_table, 0);
6989 name = gen_const_xmlChar_ptr(n_name, 1);
6990 name2 = gen_const_xmlChar_ptr(n_name2, 2);
6991 f = gen_xmlHashDeallocator(n_f, 3);
6992
6993 ret_val = xmlHashRemoveEntry2(table, name, name2, f);
6994 desret_int(ret_val);
6995 call_tests++;
6996 des_xmlHashTablePtr(n_table, table, 0);
6997 des_const_xmlChar_ptr(n_name, name, 1);
6998 des_const_xmlChar_ptr(n_name2, name2, 2);
6999 des_xmlHashDeallocator(n_f, f, 3);
7000 xmlResetLastError();
7001 if (mem_base != xmlMemBlocks()) {
7002 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
7003 xmlMemBlocks() - mem_base);
7004 test_ret++;
7005 printf(" %d", n_table);
7006 printf(" %d", n_name);
7007 printf(" %d", n_name2);
7008 printf(" %d", n_f);
7009 printf("\n");
7010 }
7011 }
7012 }
7013 }
7014 }
7015
7016 function_tests++;
7017 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007018}
7019
7020
7021static int
7022test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007023 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007024
Daniel Veillard42595322004-11-08 10:52:06 +00007025 int mem_base;
7026 int ret_val;
7027 xmlHashTablePtr table; /* the hash table */
7028 int n_table;
7029 xmlChar * name; /* the name of the userdata */
7030 int n_name;
7031 xmlChar * name2; /* a second name of the userdata */
7032 int n_name2;
7033 xmlChar * name3; /* a third name of the userdata */
7034 int n_name3;
7035 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
7036 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007037
Daniel Veillard42595322004-11-08 10:52:06 +00007038 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
7039 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
7040 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
7041 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
7042 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
7043 mem_base = xmlMemBlocks();
7044 table = gen_xmlHashTablePtr(n_table, 0);
7045 name = gen_const_xmlChar_ptr(n_name, 1);
7046 name2 = gen_const_xmlChar_ptr(n_name2, 2);
7047 name3 = gen_const_xmlChar_ptr(n_name3, 3);
7048 f = gen_xmlHashDeallocator(n_f, 4);
7049
7050 ret_val = xmlHashRemoveEntry3(table, name, name2, name3, f);
7051 desret_int(ret_val);
7052 call_tests++;
7053 des_xmlHashTablePtr(n_table, table, 0);
7054 des_const_xmlChar_ptr(n_name, name, 1);
7055 des_const_xmlChar_ptr(n_name2, name2, 2);
7056 des_const_xmlChar_ptr(n_name3, name3, 3);
7057 des_xmlHashDeallocator(n_f, f, 4);
7058 xmlResetLastError();
7059 if (mem_base != xmlMemBlocks()) {
7060 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
7061 xmlMemBlocks() - mem_base);
7062 test_ret++;
7063 printf(" %d", n_table);
7064 printf(" %d", n_name);
7065 printf(" %d", n_name2);
7066 printf(" %d", n_name3);
7067 printf(" %d", n_f);
7068 printf("\n");
7069 }
7070 }
7071 }
7072 }
7073 }
7074 }
7075
7076 function_tests++;
7077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007078}
7079
7080
7081static int
7082test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007084
7085
7086 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00007087 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007088}
7089
7090
7091static int
7092test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007093 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007094
7095
7096 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00007097 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007098}
7099
7100
7101static int
7102test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007103 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007104
7105
7106 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00007107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007108}
7109
7110
7111static int
7112test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007114
7115
7116 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00007117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007118}
7119
7120
7121static int
7122test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007124
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007125 int mem_base;
7126 int ret_val;
7127 xmlHashTablePtr table; /* the hash table */
7128 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007129
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007130 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
7131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00007132 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007133
7134 ret_val = xmlHashSize(table);
7135 desret_int(ret_val);
7136 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007137 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007138 xmlResetLastError();
7139 if (mem_base != xmlMemBlocks()) {
7140 printf("Leak of %d blocks found in xmlHashSize",
7141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007142 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007143 printf(" %d", n_table);
7144 printf("\n");
7145 }
7146 }
7147
Daniel Veillard3d97e662004-11-04 10:49:00 +00007148 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007150}
7151
7152
7153static int
7154test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007156
Daniel Veillard42595322004-11-08 10:52:06 +00007157 int mem_base;
7158 int ret_val;
7159 xmlHashTablePtr table; /* the hash table */
7160 int n_table;
7161 xmlChar * name; /* the name of the userdata */
7162 int n_name;
7163 void * userdata; /* a pointer to the userdata */
7164 int n_userdata;
7165 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
7166 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007167
Daniel Veillard42595322004-11-08 10:52:06 +00007168 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
7169 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
7170 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
7171 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
7172 mem_base = xmlMemBlocks();
7173 table = gen_xmlHashTablePtr(n_table, 0);
7174 name = gen_const_xmlChar_ptr(n_name, 1);
7175 userdata = gen_userdata(n_userdata, 2);
7176 f = gen_xmlHashDeallocator(n_f, 3);
7177
7178 ret_val = xmlHashUpdateEntry(table, name, userdata, f);
7179 desret_int(ret_val);
7180 call_tests++;
7181 des_xmlHashTablePtr(n_table, table, 0);
7182 des_const_xmlChar_ptr(n_name, name, 1);
7183 des_userdata(n_userdata, userdata, 2);
7184 des_xmlHashDeallocator(n_f, f, 3);
7185 xmlResetLastError();
7186 if (mem_base != xmlMemBlocks()) {
7187 printf("Leak of %d blocks found in xmlHashUpdateEntry",
7188 xmlMemBlocks() - mem_base);
7189 test_ret++;
7190 printf(" %d", n_table);
7191 printf(" %d", n_name);
7192 printf(" %d", n_userdata);
7193 printf(" %d", n_f);
7194 printf("\n");
7195 }
7196 }
7197 }
7198 }
7199 }
7200
7201 function_tests++;
7202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007203}
7204
7205
7206static int
7207test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007209
Daniel Veillard42595322004-11-08 10:52:06 +00007210 int mem_base;
7211 int ret_val;
7212 xmlHashTablePtr table; /* the hash table */
7213 int n_table;
7214 xmlChar * name; /* the name of the userdata */
7215 int n_name;
7216 xmlChar * name2; /* a second name of the userdata */
7217 int n_name2;
7218 void * userdata; /* a pointer to the userdata */
7219 int n_userdata;
7220 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
7221 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007222
Daniel Veillard42595322004-11-08 10:52:06 +00007223 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
7224 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
7225 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
7226 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
7227 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
7228 mem_base = xmlMemBlocks();
7229 table = gen_xmlHashTablePtr(n_table, 0);
7230 name = gen_const_xmlChar_ptr(n_name, 1);
7231 name2 = gen_const_xmlChar_ptr(n_name2, 2);
7232 userdata = gen_userdata(n_userdata, 3);
7233 f = gen_xmlHashDeallocator(n_f, 4);
7234
7235 ret_val = xmlHashUpdateEntry2(table, name, name2, userdata, f);
7236 desret_int(ret_val);
7237 call_tests++;
7238 des_xmlHashTablePtr(n_table, table, 0);
7239 des_const_xmlChar_ptr(n_name, name, 1);
7240 des_const_xmlChar_ptr(n_name2, name2, 2);
7241 des_userdata(n_userdata, userdata, 3);
7242 des_xmlHashDeallocator(n_f, f, 4);
7243 xmlResetLastError();
7244 if (mem_base != xmlMemBlocks()) {
7245 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
7246 xmlMemBlocks() - mem_base);
7247 test_ret++;
7248 printf(" %d", n_table);
7249 printf(" %d", n_name);
7250 printf(" %d", n_name2);
7251 printf(" %d", n_userdata);
7252 printf(" %d", n_f);
7253 printf("\n");
7254 }
7255 }
7256 }
7257 }
7258 }
7259 }
7260
7261 function_tests++;
7262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007263}
7264
7265
7266static int
7267test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007269
Daniel Veillard42595322004-11-08 10:52:06 +00007270 int mem_base;
7271 int ret_val;
7272 xmlHashTablePtr table; /* the hash table */
7273 int n_table;
7274 xmlChar * name; /* the name of the userdata */
7275 int n_name;
7276 xmlChar * name2; /* a second name of the userdata */
7277 int n_name2;
7278 xmlChar * name3; /* a third name of the userdata */
7279 int n_name3;
7280 void * userdata; /* a pointer to the userdata */
7281 int n_userdata;
7282 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
7283 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007284
Daniel Veillard42595322004-11-08 10:52:06 +00007285 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
7286 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
7287 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
7288 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
7289 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
7290 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
7291 mem_base = xmlMemBlocks();
7292 table = gen_xmlHashTablePtr(n_table, 0);
7293 name = gen_const_xmlChar_ptr(n_name, 1);
7294 name2 = gen_const_xmlChar_ptr(n_name2, 2);
7295 name3 = gen_const_xmlChar_ptr(n_name3, 3);
7296 userdata = gen_userdata(n_userdata, 4);
7297 f = gen_xmlHashDeallocator(n_f, 5);
7298
7299 ret_val = xmlHashUpdateEntry3(table, name, name2, name3, userdata, f);
7300 desret_int(ret_val);
7301 call_tests++;
7302 des_xmlHashTablePtr(n_table, table, 0);
7303 des_const_xmlChar_ptr(n_name, name, 1);
7304 des_const_xmlChar_ptr(n_name2, name2, 2);
7305 des_const_xmlChar_ptr(n_name3, name3, 3);
7306 des_userdata(n_userdata, userdata, 4);
7307 des_xmlHashDeallocator(n_f, f, 5);
7308 xmlResetLastError();
7309 if (mem_base != xmlMemBlocks()) {
7310 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
7311 xmlMemBlocks() - mem_base);
7312 test_ret++;
7313 printf(" %d", n_table);
7314 printf(" %d", n_name);
7315 printf(" %d", n_name2);
7316 printf(" %d", n_name3);
7317 printf(" %d", n_userdata);
7318 printf(" %d", n_f);
7319 printf("\n");
7320 }
7321 }
7322 }
7323 }
7324 }
7325 }
7326 }
7327
7328 function_tests++;
7329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007330}
7331
7332static int
7333test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007334 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007335
Daniel Veillard42595322004-11-08 10:52:06 +00007336 printf("Testing hash : 16 of 23 functions ...\n");
7337 test_ret += test_xmlHashAddEntry();
7338 test_ret += test_xmlHashAddEntry2();
7339 test_ret += test_xmlHashAddEntry3();
7340 test_ret += test_xmlHashCopy();
7341 test_ret += test_xmlHashCreate();
7342 test_ret += test_xmlHashLookup();
7343 test_ret += test_xmlHashLookup2();
7344 test_ret += test_xmlHashLookup3();
7345 test_ret += test_xmlHashQLookup();
7346 test_ret += test_xmlHashQLookup2();
7347 test_ret += test_xmlHashQLookup3();
7348 test_ret += test_xmlHashRemoveEntry();
7349 test_ret += test_xmlHashRemoveEntry2();
7350 test_ret += test_xmlHashRemoveEntry3();
7351 test_ret += test_xmlHashScan();
7352 test_ret += test_xmlHashScan3();
7353 test_ret += test_xmlHashScanFull();
7354 test_ret += test_xmlHashScanFull3();
7355 test_ret += test_xmlHashSize();
7356 test_ret += test_xmlHashUpdateEntry();
7357 test_ret += test_xmlHashUpdateEntry2();
7358 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +00007359
Daniel Veillard42595322004-11-08 10:52:06 +00007360 if (test_ret != 0)
7361 printf("Module hash: %d errors\n", test_ret);
7362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007363}
7364
Daniel Veillardce682bc2004-11-05 17:22:25 +00007365#define gen_nb_xmlLinkPtr 1
7366static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7367 return(NULL);
7368}
7369static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7370}
7371
Daniel Veillardd93f6252004-11-02 15:53:51 +00007372static int
7373test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007374 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007375
Daniel Veillardce682bc2004-11-05 17:22:25 +00007376 int mem_base;
7377 void * ret_val;
7378 xmlLinkPtr lk; /* a link */
7379 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007380
Daniel Veillardce682bc2004-11-05 17:22:25 +00007381 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
7382 mem_base = xmlMemBlocks();
7383 lk = gen_xmlLinkPtr(n_lk, 0);
7384
7385 ret_val = xmlLinkGetData(lk);
7386 desret_void_ptr(ret_val);
7387 call_tests++;
7388 des_xmlLinkPtr(n_lk, lk, 0);
7389 xmlResetLastError();
7390 if (mem_base != xmlMemBlocks()) {
7391 printf("Leak of %d blocks found in xmlLinkGetData",
7392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007393 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00007394 printf(" %d", n_lk);
7395 printf("\n");
7396 }
7397 }
7398
7399 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007401}
7402
7403
7404static int
7405test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007406 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007407
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007408 int mem_base;
7409 int ret_val;
7410 xmlListPtr l; /* a list */
7411 int n_l;
7412 void * data; /* the data */
7413 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007414
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007415 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
7416 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
7417 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00007418 l = gen_xmlListPtr(n_l, 0);
7419 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007420
7421 ret_val = xmlListAppend(l, data);
7422 desret_int(ret_val);
7423 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007424 des_xmlListPtr(n_l, l, 0);
7425 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007426 xmlResetLastError();
7427 if (mem_base != xmlMemBlocks()) {
7428 printf("Leak of %d blocks found in xmlListAppend",
7429 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007430 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007431 printf(" %d", n_l);
7432 printf(" %d", n_data);
7433 printf("\n");
7434 }
7435 }
7436 }
7437
Daniel Veillard3d97e662004-11-04 10:49:00 +00007438 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007439 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007440}
7441
7442
7443static int
7444test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007446
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007447 int mem_base;
7448 xmlListPtr l; /* a list */
7449 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007450
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007451 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
7452 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00007453 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007454
7455 xmlListClear(l);
7456 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007457 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007458 xmlResetLastError();
7459 if (mem_base != xmlMemBlocks()) {
7460 printf("Leak of %d blocks found in xmlListClear",
7461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007462 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007463 printf(" %d", n_l);
7464 printf("\n");
7465 }
7466 }
7467
Daniel Veillard3d97e662004-11-04 10:49:00 +00007468 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007469 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007470}
7471
7472
Daniel Veillardce682bc2004-11-05 17:22:25 +00007473#define gen_nb_const_xmlListPtr 1
7474static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7475 return(NULL);
7476}
7477static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7478}
7479
Daniel Veillardd93f6252004-11-02 15:53:51 +00007480static int
7481test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007482 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007483
Daniel Veillardce682bc2004-11-05 17:22:25 +00007484 int mem_base;
7485 int ret_val;
7486 xmlListPtr cur; /* the new list */
7487 int n_cur;
7488 xmlListPtr old; /* the old list */
7489 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007490
Daniel Veillardce682bc2004-11-05 17:22:25 +00007491 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
7492 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
7493 mem_base = xmlMemBlocks();
7494 cur = gen_xmlListPtr(n_cur, 0);
7495 old = gen_const_xmlListPtr(n_old, 1);
7496
7497 ret_val = xmlListCopy(cur, old);
7498 desret_int(ret_val);
7499 call_tests++;
7500 des_xmlListPtr(n_cur, cur, 0);
7501 des_const_xmlListPtr(n_old, old, 1);
7502 xmlResetLastError();
7503 if (mem_base != xmlMemBlocks()) {
7504 printf("Leak of %d blocks found in xmlListCopy",
7505 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007506 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00007507 printf(" %d", n_cur);
7508 printf(" %d", n_old);
7509 printf("\n");
7510 }
7511 }
7512 }
7513
7514 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007515 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007516}
7517
7518
7519static int
7520test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007521 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007522
7523
7524 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00007525 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007526}
7527
7528
7529static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00007530test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007531 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007532
7533
7534 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00007535 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007536}
7537
7538
7539static int
7540test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007541 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007542
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007543 int mem_base;
7544 int ret_val;
7545 xmlListPtr l; /* a list */
7546 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007547
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007548 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
7549 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00007550 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007551
7552 ret_val = xmlListEmpty(l);
7553 desret_int(ret_val);
7554 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007555 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007556 xmlResetLastError();
7557 if (mem_base != xmlMemBlocks()) {
7558 printf("Leak of %d blocks found in xmlListEmpty",
7559 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007560 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007561 printf(" %d", n_l);
7562 printf("\n");
7563 }
7564 }
7565
Daniel Veillard3d97e662004-11-04 10:49:00 +00007566 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007567 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007568}
7569
7570
7571static int
7572test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007573 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007574
7575
7576 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00007577 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007578}
7579
7580
7581static int
7582test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007583 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007584
7585
7586 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00007587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007588}
7589
7590
7591static int
7592test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007594
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007595 int mem_base;
7596 int ret_val;
7597 xmlListPtr l; /* a list */
7598 int n_l;
7599 void * data; /* the data */
7600 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007601
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007602 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
7603 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
7604 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00007605 l = gen_xmlListPtr(n_l, 0);
7606 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007607
7608 ret_val = xmlListInsert(l, data);
7609 desret_int(ret_val);
7610 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007611 des_xmlListPtr(n_l, l, 0);
7612 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007613 xmlResetLastError();
7614 if (mem_base != xmlMemBlocks()) {
7615 printf("Leak of %d blocks found in xmlListInsert",
7616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007617 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007618 printf(" %d", n_l);
7619 printf(" %d", n_data);
7620 printf("\n");
7621 }
7622 }
7623 }
7624
Daniel Veillard3d97e662004-11-04 10:49:00 +00007625 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007626 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007627}
7628
7629
7630static int
7631test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007632 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007633
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007634 int mem_base;
7635 xmlListPtr l1; /* the original list */
7636 int n_l1;
7637 xmlListPtr l2; /* the new list */
7638 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007639
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007640 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
7641 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
7642 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00007643 l1 = gen_xmlListPtr(n_l1, 0);
7644 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007645
7646 xmlListMerge(l1, l2);
7647 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007648 des_xmlListPtr(n_l1, l1, 0);
7649 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007650 xmlResetLastError();
7651 if (mem_base != xmlMemBlocks()) {
7652 printf("Leak of %d blocks found in xmlListMerge",
7653 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007654 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007655 printf(" %d", n_l1);
7656 printf(" %d", n_l2);
7657 printf("\n");
7658 }
7659 }
7660 }
7661
Daniel Veillard3d97e662004-11-04 10:49:00 +00007662 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007664}
7665
7666
7667static int
7668test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007670
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007671 int mem_base;
7672 xmlListPtr l; /* a list */
7673 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007674
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007675 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
7676 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00007677 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007678
7679 xmlListPopBack(l);
7680 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007681 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007682 xmlResetLastError();
7683 if (mem_base != xmlMemBlocks()) {
7684 printf("Leak of %d blocks found in xmlListPopBack",
7685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007686 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007687 printf(" %d", n_l);
7688 printf("\n");
7689 }
7690 }
7691
Daniel Veillard3d97e662004-11-04 10:49:00 +00007692 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007693 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007694}
7695
7696
7697static int
7698test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007699 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007700
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007701 int mem_base;
7702 xmlListPtr l; /* a list */
7703 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007704
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007705 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
7706 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00007707 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007708
7709 xmlListPopFront(l);
7710 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007711 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007712 xmlResetLastError();
7713 if (mem_base != xmlMemBlocks()) {
7714 printf("Leak of %d blocks found in xmlListPopFront",
7715 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007716 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007717 printf(" %d", n_l);
7718 printf("\n");
7719 }
7720 }
7721
Daniel Veillard3d97e662004-11-04 10:49:00 +00007722 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007724}
7725
7726
7727static int
7728test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007730
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007731 int mem_base;
7732 int ret_val;
7733 xmlListPtr l; /* a list */
7734 int n_l;
7735 void * data; /* new data */
7736 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007737
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007738 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
7739 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
7740 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00007741 l = gen_xmlListPtr(n_l, 0);
7742 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007743
7744 ret_val = xmlListPushBack(l, data);
7745 desret_int(ret_val);
7746 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007747 des_xmlListPtr(n_l, l, 0);
7748 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007749 xmlResetLastError();
7750 if (mem_base != xmlMemBlocks()) {
7751 printf("Leak of %d blocks found in xmlListPushBack",
7752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007753 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007754 printf(" %d", n_l);
7755 printf(" %d", n_data);
7756 printf("\n");
7757 }
7758 }
7759 }
7760
Daniel Veillard3d97e662004-11-04 10:49:00 +00007761 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007762 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007763}
7764
7765
7766static int
7767test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007769
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007770 int mem_base;
7771 int ret_val;
7772 xmlListPtr l; /* a list */
7773 int n_l;
7774 void * data; /* new data */
7775 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007776
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007777 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
7778 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
7779 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00007780 l = gen_xmlListPtr(n_l, 0);
7781 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007782
7783 ret_val = xmlListPushFront(l, data);
7784 desret_int(ret_val);
7785 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007786 des_xmlListPtr(n_l, l, 0);
7787 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007788 xmlResetLastError();
7789 if (mem_base != xmlMemBlocks()) {
7790 printf("Leak of %d blocks found in xmlListPushFront",
7791 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007792 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007793 printf(" %d", n_l);
7794 printf(" %d", n_data);
7795 printf("\n");
7796 }
7797 }
7798 }
7799
Daniel Veillard3d97e662004-11-04 10:49:00 +00007800 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007802}
7803
7804
7805static int
7806test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007808
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007809 int mem_base;
7810 int ret_val;
7811 xmlListPtr l; /* a list */
7812 int n_l;
7813 void * data; /* list data */
7814 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007815
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007816 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
7817 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
7818 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00007819 l = gen_xmlListPtr(n_l, 0);
7820 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007821
7822 ret_val = xmlListRemoveAll(l, data);
7823 desret_int(ret_val);
7824 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007825 des_xmlListPtr(n_l, l, 0);
7826 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007827 xmlResetLastError();
7828 if (mem_base != xmlMemBlocks()) {
7829 printf("Leak of %d blocks found in xmlListRemoveAll",
7830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007831 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007832 printf(" %d", n_l);
7833 printf(" %d", n_data);
7834 printf("\n");
7835 }
7836 }
7837 }
7838
Daniel Veillard3d97e662004-11-04 10:49:00 +00007839 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007840 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007841}
7842
7843
7844static int
7845test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007846 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007847
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007848 int mem_base;
7849 int ret_val;
7850 xmlListPtr l; /* a list */
7851 int n_l;
7852 void * data; /* list data */
7853 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007854
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007855 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
7856 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
7857 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00007858 l = gen_xmlListPtr(n_l, 0);
7859 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007860
7861 ret_val = xmlListRemoveFirst(l, data);
7862 desret_int(ret_val);
7863 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007864 des_xmlListPtr(n_l, l, 0);
7865 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007866 xmlResetLastError();
7867 if (mem_base != xmlMemBlocks()) {
7868 printf("Leak of %d blocks found in xmlListRemoveFirst",
7869 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007870 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007871 printf(" %d", n_l);
7872 printf(" %d", n_data);
7873 printf("\n");
7874 }
7875 }
7876 }
7877
Daniel Veillard3d97e662004-11-04 10:49:00 +00007878 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007880}
7881
7882
7883static int
7884test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007885 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007886
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007887 int mem_base;
7888 int ret_val;
7889 xmlListPtr l; /* a list */
7890 int n_l;
7891 void * data; /* list data */
7892 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007893
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007894 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
7895 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
7896 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00007897 l = gen_xmlListPtr(n_l, 0);
7898 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007899
7900 ret_val = xmlListRemoveLast(l, data);
7901 desret_int(ret_val);
7902 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007903 des_xmlListPtr(n_l, l, 0);
7904 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007905 xmlResetLastError();
7906 if (mem_base != xmlMemBlocks()) {
7907 printf("Leak of %d blocks found in xmlListRemoveLast",
7908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007909 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007910 printf(" %d", n_l);
7911 printf(" %d", n_data);
7912 printf("\n");
7913 }
7914 }
7915 }
7916
Daniel Veillard3d97e662004-11-04 10:49:00 +00007917 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007918 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007919}
7920
7921
7922static int
7923test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007924 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007925
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007926 int mem_base;
7927 xmlListPtr l; /* a list */
7928 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007929
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007930 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
7931 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00007932 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007933
7934 xmlListReverse(l);
7935 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007936 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007937 xmlResetLastError();
7938 if (mem_base != xmlMemBlocks()) {
7939 printf("Leak of %d blocks found in xmlListReverse",
7940 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007941 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00007942 printf(" %d", n_l);
7943 printf("\n");
7944 }
7945 }
7946
Daniel Veillard3d97e662004-11-04 10:49:00 +00007947 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007949}
7950
7951
7952static int
7953test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007954 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007955
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00007956 int mem_base;
7957 void * ret_val;
7958 xmlListPtr l; /* a list */
7959 int n_l;
7960 void * data; /* a search value */
7961 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007962
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00007963 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
7964 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
7965 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00007966 l = gen_xmlListPtr(n_l, 0);
7967 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00007968
7969 ret_val = xmlListReverseSearch(l, data);
7970 desret_void_ptr(ret_val);
7971 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007972 des_xmlListPtr(n_l, l, 0);
7973 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00007974 xmlResetLastError();
7975 if (mem_base != xmlMemBlocks()) {
7976 printf("Leak of %d blocks found in xmlListReverseSearch",
7977 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007978 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00007979 printf(" %d", n_l);
7980 printf(" %d", n_data);
7981 printf("\n");
7982 }
7983 }
7984 }
7985
Daniel Veillard3d97e662004-11-04 10:49:00 +00007986 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00007987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007988}
7989
7990
7991static int
7992test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007994
7995
7996 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00007997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007998}
7999
8000
8001static int
8002test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008004
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008005 int mem_base;
8006 void * ret_val;
8007 xmlListPtr l; /* a list */
8008 int n_l;
8009 void * data; /* a search value */
8010 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008011
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008012 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
8013 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
8014 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008015 l = gen_xmlListPtr(n_l, 0);
8016 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008017
8018 ret_val = xmlListSearch(l, data);
8019 desret_void_ptr(ret_val);
8020 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008021 des_xmlListPtr(n_l, l, 0);
8022 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008023 xmlResetLastError();
8024 if (mem_base != xmlMemBlocks()) {
8025 printf("Leak of %d blocks found in xmlListSearch",
8026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008027 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008028 printf(" %d", n_l);
8029 printf(" %d", n_data);
8030 printf("\n");
8031 }
8032 }
8033 }
8034
Daniel Veillard3d97e662004-11-04 10:49:00 +00008035 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008036 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008037}
8038
8039
8040static int
8041test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008042 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008043
Daniel Veillardd005b9e2004-11-03 17:07:05 +00008044 int mem_base;
8045 int ret_val;
8046 xmlListPtr l; /* a list */
8047 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008048
Daniel Veillardd005b9e2004-11-03 17:07:05 +00008049 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
8050 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008051 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00008052
8053 ret_val = xmlListSize(l);
8054 desret_int(ret_val);
8055 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008056 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00008057 xmlResetLastError();
8058 if (mem_base != xmlMemBlocks()) {
8059 printf("Leak of %d blocks found in xmlListSize",
8060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008061 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00008062 printf(" %d", n_l);
8063 printf("\n");
8064 }
8065 }
8066
Daniel Veillard3d97e662004-11-04 10:49:00 +00008067 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008069}
8070
8071
8072static int
8073test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008075
Daniel Veillardd005b9e2004-11-03 17:07:05 +00008076 int mem_base;
8077 xmlListPtr l; /* a list */
8078 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008079
Daniel Veillardd005b9e2004-11-03 17:07:05 +00008080 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
8081 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008082 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00008083
8084 xmlListSort(l);
8085 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008086 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00008087 xmlResetLastError();
8088 if (mem_base != xmlMemBlocks()) {
8089 printf("Leak of %d blocks found in xmlListSort",
8090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008091 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00008092 printf(" %d", n_l);
8093 printf("\n");
8094 }
8095 }
8096
Daniel Veillard3d97e662004-11-04 10:49:00 +00008097 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008098 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008099}
8100
8101
8102static int
8103test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008105
8106
8107 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008109}
8110
8111static int
8112test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008114
Daniel Veillardce682bc2004-11-05 17:22:25 +00008115 printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008116 test_ret += test_xmlLinkGetData();
8117 test_ret += test_xmlListAppend();
8118 test_ret += test_xmlListClear();
8119 test_ret += test_xmlListCopy();
8120 test_ret += test_xmlListCreate();
8121 test_ret += test_xmlListDup();
8122 test_ret += test_xmlListEmpty();
8123 test_ret += test_xmlListEnd();
8124 test_ret += test_xmlListFront();
8125 test_ret += test_xmlListInsert();
8126 test_ret += test_xmlListMerge();
8127 test_ret += test_xmlListPopBack();
8128 test_ret += test_xmlListPopFront();
8129 test_ret += test_xmlListPushBack();
8130 test_ret += test_xmlListPushFront();
8131 test_ret += test_xmlListRemoveAll();
8132 test_ret += test_xmlListRemoveFirst();
8133 test_ret += test_xmlListRemoveLast();
8134 test_ret += test_xmlListReverse();
8135 test_ret += test_xmlListReverseSearch();
8136 test_ret += test_xmlListReverseWalk();
8137 test_ret += test_xmlListSearch();
8138 test_ret += test_xmlListSize();
8139 test_ret += test_xmlListSort();
8140 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008141
Daniel Veillard42595322004-11-08 10:52:06 +00008142 if (test_ret != 0)
8143 printf("Module list: %d errors\n", test_ret);
8144 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008145}
8146
8147static int
8148test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008149 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008150
Daniel Veillard27f20102004-11-05 11:50:11 +00008151#ifdef LIBXML_FTP_ENABLED
8152 int mem_base;
8153 int ret_val;
8154 void * ctx; /* an FTP context */
8155 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008156
Daniel Veillard27f20102004-11-05 11:50:11 +00008157 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
8158 mem_base = xmlMemBlocks();
8159 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
8160
8161 ret_val = xmlNanoFTPCheckResponse(ctx);
8162 desret_int(ret_val);
8163 call_tests++;
8164 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
8165 xmlResetLastError();
8166 if (mem_base != xmlMemBlocks()) {
8167 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
8168 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008169 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00008170 printf(" %d", n_ctx);
8171 printf("\n");
8172 }
8173 }
8174#endif
8175
8176 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008178}
8179
8180
8181static int
8182test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008184
8185#ifdef LIBXML_FTP_ENABLED
8186 int mem_base;
8187
8188 mem_base = xmlMemBlocks();
8189
8190 xmlNanoFTPCleanup();
8191 call_tests++;
8192 xmlResetLastError();
8193 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008194 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008195 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008196 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008197 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008198 }
8199#endif
8200
Daniel Veillard3d97e662004-11-04 10:49:00 +00008201 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008203}
8204
8205
8206static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008207test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008209
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008210#ifdef LIBXML_FTP_ENABLED
8211 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +00008212 int ret_val;
8213 void * ctx; /* an FTP context */
8214 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008215
Daniel Veillard27f20102004-11-05 11:50:11 +00008216 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008217 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +00008218 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008219
Daniel Veillard27f20102004-11-05 11:50:11 +00008220 ret_val = xmlNanoFTPCloseConnection(ctx);
8221 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008222 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +00008223 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008224 xmlResetLastError();
8225 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +00008226 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008228 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00008229 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008230 printf("\n");
8231 }
8232 }
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008233#endif
8234
Daniel Veillard3d97e662004-11-04 10:49:00 +00008235 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008236 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008237}
8238
8239
8240static int
8241test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008243
Daniel Veillard27f20102004-11-05 11:50:11 +00008244#ifdef LIBXML_FTP_ENABLED
8245 int mem_base;
8246 int ret_val;
8247 void * ctx; /* an FTP context */
8248 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008249 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +00008250 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008251
Daniel Veillard27f20102004-11-05 11:50:11 +00008252 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
8253 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
8254 mem_base = xmlMemBlocks();
8255 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
8256 directory = gen_const_char_ptr(n_directory, 1);
8257
8258 ret_val = xmlNanoFTPCwd(ctx, directory);
8259 desret_int(ret_val);
8260 call_tests++;
8261 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
8262 des_const_char_ptr(n_directory, directory, 1);
8263 xmlResetLastError();
8264 if (mem_base != xmlMemBlocks()) {
8265 printf("Leak of %d blocks found in xmlNanoFTPCwd",
8266 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008267 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00008268 printf(" %d", n_ctx);
8269 printf(" %d", n_directory);
8270 printf("\n");
8271 }
8272 }
8273 }
8274#endif
8275
8276 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008278}
8279
8280
8281static int
8282test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008284
Daniel Veillard27f20102004-11-05 11:50:11 +00008285#ifdef LIBXML_FTP_ENABLED
8286 int mem_base;
8287 int ret_val;
8288 void * ctx; /* an FTP context */
8289 int n_ctx;
8290 const char * file; /* a file or directory on the server */
8291 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008292
Daniel Veillard27f20102004-11-05 11:50:11 +00008293 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
8294 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
8295 mem_base = xmlMemBlocks();
8296 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
8297 file = gen_filepath(n_file, 1);
8298
8299 ret_val = xmlNanoFTPDele(ctx, file);
8300 desret_int(ret_val);
8301 call_tests++;
8302 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
8303 des_filepath(n_file, file, 1);
8304 xmlResetLastError();
8305 if (mem_base != xmlMemBlocks()) {
8306 printf("Leak of %d blocks found in xmlNanoFTPDele",
8307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008308 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00008309 printf(" %d", n_ctx);
8310 printf(" %d", n_file);
8311 printf("\n");
8312 }
8313 }
8314 }
8315#endif
8316
8317 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008319}
8320
8321
8322static int
8323test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008325
8326
8327 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008328 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008329}
8330
8331
8332static int
8333test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008334 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008335
Daniel Veillard27f20102004-11-05 11:50:11 +00008336#ifdef LIBXML_FTP_ENABLED
8337 int mem_base;
8338 int ret_val;
8339 void * ctx; /* an FTP context */
8340 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008341
Daniel Veillard27f20102004-11-05 11:50:11 +00008342 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
8343 mem_base = xmlMemBlocks();
8344 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
8345
8346 ret_val = xmlNanoFTPGetConnection(ctx);
8347 desret_int(ret_val);
8348 call_tests++;
8349 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
8350 xmlResetLastError();
8351 if (mem_base != xmlMemBlocks()) {
8352 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
8353 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008354 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00008355 printf(" %d", n_ctx);
8356 printf("\n");
8357 }
8358 }
8359#endif
8360
8361 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008363}
8364
8365
8366static int
8367test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008369
Daniel Veillard27f20102004-11-05 11:50:11 +00008370#ifdef LIBXML_FTP_ENABLED
8371 int mem_base;
8372 int ret_val;
8373 void * ctx; /* an FTP context */
8374 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008375
Daniel Veillard27f20102004-11-05 11:50:11 +00008376 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
8377 mem_base = xmlMemBlocks();
8378 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
8379
8380 ret_val = xmlNanoFTPGetResponse(ctx);
8381 desret_int(ret_val);
8382 call_tests++;
8383 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
8384 xmlResetLastError();
8385 if (mem_base != xmlMemBlocks()) {
8386 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
8387 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008388 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00008389 printf(" %d", n_ctx);
8390 printf("\n");
8391 }
8392 }
8393#endif
8394
8395 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008397}
8398
8399
8400static int
8401test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008403
Daniel Veillard27f20102004-11-05 11:50:11 +00008404#ifdef LIBXML_FTP_ENABLED
8405 int mem_base;
8406 int ret_val;
8407 void * ctx; /* an FTP context */
8408 int n_ctx;
8409 const char * filename; /* the file to retrieve (or NULL if path is in context). */
8410 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008411
Daniel Veillard27f20102004-11-05 11:50:11 +00008412 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
8413 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
8414 mem_base = xmlMemBlocks();
8415 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
8416 filename = gen_filepath(n_filename, 1);
8417
8418 ret_val = xmlNanoFTPGetSocket(ctx, filename);
8419 desret_int(ret_val);
8420 call_tests++;
8421 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
8422 des_filepath(n_filename, filename, 1);
8423 xmlResetLastError();
8424 if (mem_base != xmlMemBlocks()) {
8425 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
8426 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008427 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00008428 printf(" %d", n_ctx);
8429 printf(" %d", n_filename);
8430 printf("\n");
8431 }
8432 }
8433 }
8434#endif
8435
8436 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008437 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008438}
8439
8440
8441static int
8442test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008443 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008444
8445#ifdef LIBXML_FTP_ENABLED
8446 int mem_base;
8447
8448 mem_base = xmlMemBlocks();
8449
8450 xmlNanoFTPInit();
8451 call_tests++;
8452 xmlResetLastError();
8453 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008454 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008455 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008456 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008457 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008458 }
8459#endif
8460
Daniel Veillard3d97e662004-11-04 10:49:00 +00008461 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008463}
8464
8465
8466static int
8467test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008469
8470
8471 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008472 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008473}
8474
8475
8476static int
8477test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008478 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008479
8480
8481 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008483}
8484
8485
8486static int
8487test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008489
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008490#ifdef LIBXML_FTP_ENABLED
8491 int mem_base;
8492 void * ret_val;
8493 const char * URL; /* the URL to the resource */
8494 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008495
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008496 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
8497 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008498 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008499
8500 ret_val = xmlNanoFTPOpen(URL);
8501 desret_void_ptr(ret_val);
8502 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008503 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008504 xmlResetLastError();
8505 if (mem_base != xmlMemBlocks()) {
8506 printf("Leak of %d blocks found in xmlNanoFTPOpen",
8507 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008508 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00008509 printf(" %d", n_URL);
8510 printf("\n");
8511 }
8512 }
8513#endif
8514
Daniel Veillard3d97e662004-11-04 10:49:00 +00008515 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_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008522 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008523
8524#ifdef LIBXML_FTP_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008525 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008526 int n_host;
8527 int port; /* the proxy port */
8528 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008529 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008530 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008531 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008532 int n_passwd;
8533 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
8534 int n_type;
8535
8536 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
8537 for (n_port = 0;n_port < gen_nb_int;n_port++) {
8538 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
8539 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
8540 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008541 host = gen_const_char_ptr(n_host, 0);
8542 port = gen_int(n_port, 1);
8543 user = gen_const_char_ptr(n_user, 2);
8544 passwd = gen_const_char_ptr(n_passwd, 3);
8545 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008546
8547 xmlNanoFTPProxy(host, port, user, passwd, type);
8548 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008549 des_const_char_ptr(n_host, host, 0);
8550 des_int(n_port, port, 1);
8551 des_const_char_ptr(n_user, user, 2);
8552 des_const_char_ptr(n_passwd, passwd, 3);
8553 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008554 xmlResetLastError();
8555 }
8556 }
8557 }
8558 }
8559 }
8560#endif
8561
Daniel Veillard3d97e662004-11-04 10:49:00 +00008562 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008564}
8565
8566
8567static int
8568test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008570
Daniel Veillard27f20102004-11-05 11:50:11 +00008571#ifdef LIBXML_FTP_ENABLED
8572 int mem_base;
8573 int ret_val;
8574 void * ctx; /* an FTP context */
8575 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008576
Daniel Veillard27f20102004-11-05 11:50:11 +00008577 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
8578 mem_base = xmlMemBlocks();
8579 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
8580
8581 ret_val = xmlNanoFTPQuit(ctx);
8582 desret_int(ret_val);
8583 call_tests++;
8584 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
8585 xmlResetLastError();
8586 if (mem_base != xmlMemBlocks()) {
8587 printf("Leak of %d blocks found in xmlNanoFTPQuit",
8588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008589 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00008590 printf(" %d", n_ctx);
8591 printf("\n");
8592 }
8593 }
8594#endif
8595
8596 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008597 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008598}
8599
8600
8601static int
8602test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008603 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008604
Daniel Veillard27f20102004-11-05 11:50:11 +00008605#ifdef LIBXML_FTP_ENABLED
8606 int mem_base;
8607 int ret_val;
8608 void * ctx; /* the FTP context */
8609 int n_ctx;
8610 void * dest; /* a buffer */
8611 int n_dest;
8612 int len; /* the buffer length */
8613 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008614
Daniel Veillard27f20102004-11-05 11:50:11 +00008615 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
8616 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
8617 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8618 mem_base = xmlMemBlocks();
8619 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
8620 dest = gen_void_ptr(n_dest, 1);
8621 len = gen_int(n_len, 2);
8622
8623 ret_val = xmlNanoFTPRead(ctx, dest, len);
8624 desret_int(ret_val);
8625 call_tests++;
8626 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
8627 des_void_ptr(n_dest, dest, 1);
8628 des_int(n_len, len, 2);
8629 xmlResetLastError();
8630 if (mem_base != xmlMemBlocks()) {
8631 printf("Leak of %d blocks found in xmlNanoFTPRead",
8632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008633 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00008634 printf(" %d", n_ctx);
8635 printf(" %d", n_dest);
8636 printf(" %d", n_len);
8637 printf("\n");
8638 }
8639 }
8640 }
8641 }
8642#endif
8643
8644 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008646}
8647
8648
8649static int
8650test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008652
8653#ifdef LIBXML_FTP_ENABLED
8654 const char * URL; /* The proxy URL used to initialize the proxy context */
8655 int n_URL;
8656
8657 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008658 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008659
8660 xmlNanoFTPScanProxy(URL);
8661 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008662 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008663 xmlResetLastError();
8664 }
8665#endif
8666
Daniel Veillard3d97e662004-11-04 10:49:00 +00008667 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008668 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008669}
8670
8671
8672static int
8673test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008674 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008675
Daniel Veillard27f20102004-11-05 11:50:11 +00008676#ifdef LIBXML_FTP_ENABLED
8677 int mem_base;
8678 int ret_val;
8679 void * ctx; /* an FTP context */
8680 int n_ctx;
8681 const char * URL; /* The URL used to update the context */
8682 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008683
Daniel Veillard27f20102004-11-05 11:50:11 +00008684 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
8685 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
8686 mem_base = xmlMemBlocks();
8687 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
8688 URL = gen_filepath(n_URL, 1);
8689
8690 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
8691 desret_int(ret_val);
8692 call_tests++;
8693 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
8694 des_filepath(n_URL, URL, 1);
8695 xmlResetLastError();
8696 if (mem_base != xmlMemBlocks()) {
8697 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
8698 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008699 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00008700 printf(" %d", n_ctx);
8701 printf(" %d", n_URL);
8702 printf("\n");
8703 }
8704 }
8705 }
8706#endif
8707
8708 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008710}
8711
8712static int
8713test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008715
Daniel Veillard27f20102004-11-05 11:50:11 +00008716 printf("Testing nanoftp : 15 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008717 test_ret += test_xmlNanoFTPCheckResponse();
8718 test_ret += test_xmlNanoFTPCleanup();
8719 test_ret += test_xmlNanoFTPCloseConnection();
8720 test_ret += test_xmlNanoFTPCwd();
8721 test_ret += test_xmlNanoFTPDele();
8722 test_ret += test_xmlNanoFTPGet();
8723 test_ret += test_xmlNanoFTPGetConnection();
8724 test_ret += test_xmlNanoFTPGetResponse();
8725 test_ret += test_xmlNanoFTPGetSocket();
8726 test_ret += test_xmlNanoFTPInit();
8727 test_ret += test_xmlNanoFTPList();
8728 test_ret += test_xmlNanoFTPNewCtxt();
8729 test_ret += test_xmlNanoFTPOpen();
8730 test_ret += test_xmlNanoFTPProxy();
8731 test_ret += test_xmlNanoFTPQuit();
8732 test_ret += test_xmlNanoFTPRead();
8733 test_ret += test_xmlNanoFTPScanProxy();
8734 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008735
Daniel Veillard42595322004-11-08 10:52:06 +00008736 if (test_ret != 0)
8737 printf("Module nanoftp: %d errors\n", test_ret);
8738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008739}
8740
8741static int
8742test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008743 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008744
Daniel Veillard27f20102004-11-05 11:50:11 +00008745#ifdef LIBXML_HTTP_ENABLED
8746 int mem_base;
8747 const char * ret_val;
8748 void * ctx; /* the HTTP context */
8749 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008750
Daniel Veillard27f20102004-11-05 11:50:11 +00008751 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
8752 mem_base = xmlMemBlocks();
8753 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
8754
8755 ret_val = xmlNanoHTTPAuthHeader(ctx);
8756 desret_const_char_ptr(ret_val);
8757 call_tests++;
8758 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
8759 xmlResetLastError();
8760 if (mem_base != xmlMemBlocks()) {
8761 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
8762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008763 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00008764 printf(" %d", n_ctx);
8765 printf("\n");
8766 }
8767 }
8768#endif
8769
8770 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008771 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008772}
8773
8774
8775static int
8776test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008777 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008778
8779#ifdef LIBXML_HTTP_ENABLED
8780 int mem_base;
8781
8782 mem_base = xmlMemBlocks();
8783
8784 xmlNanoHTTPCleanup();
8785 call_tests++;
8786 xmlResetLastError();
8787 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008788 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008789 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008790 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008791 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008792 }
8793#endif
8794
Daniel Veillard3d97e662004-11-04 10:49:00 +00008795 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008797}
8798
8799
8800static int
8801test_xmlNanoHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008803
Daniel Veillard27f20102004-11-05 11:50:11 +00008804#ifdef LIBXML_HTTP_ENABLED
8805 int mem_base;
8806 void * ctx; /* the HTTP context */
8807 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008808
Daniel Veillard27f20102004-11-05 11:50:11 +00008809 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
8810 mem_base = xmlMemBlocks();
8811 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
8812
8813 xmlNanoHTTPClose(ctx);
8814 call_tests++;
8815 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
8816 xmlResetLastError();
8817 if (mem_base != xmlMemBlocks()) {
8818 printf("Leak of %d blocks found in xmlNanoHTTPClose",
8819 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008820 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00008821 printf(" %d", n_ctx);
8822 printf("\n");
8823 }
8824 }
8825#endif
8826
8827 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008829}
8830
8831
8832static int
8833test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008835
Daniel Veillard27f20102004-11-05 11:50:11 +00008836#ifdef LIBXML_HTTP_ENABLED
8837 int mem_base;
8838 int ret_val;
8839 void * ctx; /* the HTTP context */
8840 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008841
Daniel Veillard27f20102004-11-05 11:50:11 +00008842 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
8843 mem_base = xmlMemBlocks();
8844 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
8845
8846 ret_val = xmlNanoHTTPContentLength(ctx);
8847 desret_int(ret_val);
8848 call_tests++;
8849 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
8850 xmlResetLastError();
8851 if (mem_base != xmlMemBlocks()) {
8852 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
8853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008854 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00008855 printf(" %d", n_ctx);
8856 printf("\n");
8857 }
8858 }
8859#endif
8860
8861 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008863}
8864
8865
8866static int
8867test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008869
Daniel Veillard27f20102004-11-05 11:50:11 +00008870#ifdef LIBXML_HTTP_ENABLED
8871 int mem_base;
8872 const char * ret_val;
8873 void * ctx; /* the HTTP context */
8874 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008875
Daniel Veillard27f20102004-11-05 11:50:11 +00008876 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
8877 mem_base = xmlMemBlocks();
8878 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
8879
8880 ret_val = xmlNanoHTTPEncoding(ctx);
8881 desret_const_char_ptr(ret_val);
8882 call_tests++;
8883 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
8884 xmlResetLastError();
8885 if (mem_base != xmlMemBlocks()) {
8886 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
8887 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008888 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00008889 printf(" %d", n_ctx);
8890 printf("\n");
8891 }
8892 }
8893#endif
8894
8895 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008897}
8898
8899
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008900#define gen_nb_char_ptr_ptr 1
8901static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8902 return(NULL);
8903}
8904static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8905}
8906
Daniel Veillardd93f6252004-11-02 15:53:51 +00008907static int
8908test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008909 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008910
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008911#ifdef LIBXML_HTTP_ENABLED
8912 int mem_base;
8913 int ret_val;
8914 const char * URL; /* The URL to load */
8915 int n_URL;
8916 const char * filename; /* the filename where the content should be saved */
8917 int n_filename;
8918 char ** contentType; /* if available the Content-Type information will be returned at that location */
8919 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008920
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008921 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
8922 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
8923 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
8924 mem_base = xmlMemBlocks();
8925 URL = gen_filepath(n_URL, 0);
8926 filename = gen_filepath(n_filename, 1);
8927 contentType = gen_char_ptr_ptr(n_contentType, 2);
8928
8929 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
8930 desret_int(ret_val);
8931 call_tests++;
8932 des_filepath(n_URL, URL, 0);
8933 des_filepath(n_filename, filename, 1);
8934 des_char_ptr_ptr(n_contentType, contentType, 2);
8935 xmlResetLastError();
8936 if (mem_base != xmlMemBlocks()) {
8937 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
8938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008939 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008940 printf(" %d", n_URL);
8941 printf(" %d", n_filename);
8942 printf(" %d", n_contentType);
8943 printf("\n");
8944 }
8945 }
8946 }
8947 }
8948#endif
8949
8950 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008951 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008952}
8953
8954
8955static int
8956test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008957 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008958
8959#ifdef LIBXML_HTTP_ENABLED
8960 int mem_base;
8961
8962 mem_base = xmlMemBlocks();
8963
8964 xmlNanoHTTPInit();
8965 call_tests++;
8966 xmlResetLastError();
8967 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008968 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008969 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008970 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008971 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008972 }
8973#endif
8974
Daniel Veillard3d97e662004-11-04 10:49:00 +00008975 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008977}
8978
8979
8980static int
8981test_xmlNanoHTTPMethod(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008983
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008984#ifdef LIBXML_HTTP_ENABLED
8985 int mem_base;
8986 void * ret_val;
8987 const char * URL; /* The URL to load */
8988 int n_URL;
8989 char * method; /* the HTTP method to use */
8990 int n_method;
8991 char * input; /* the input string if any */
8992 int n_input;
8993 char ** contentType; /* the Content-Type information IN and OUT */
8994 int n_contentType;
8995 char * headers; /* the extra headers */
8996 int n_headers;
8997 int ilen; /* input length */
8998 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008999
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009000 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
9001 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
9002 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
9003 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
9004 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
9005 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
9006 mem_base = xmlMemBlocks();
9007 URL = gen_filepath(n_URL, 0);
9008 method = gen_const_char_ptr(n_method, 1);
9009 input = gen_const_char_ptr(n_input, 2);
9010 contentType = gen_char_ptr_ptr(n_contentType, 3);
9011 headers = gen_const_char_ptr(n_headers, 4);
9012 ilen = gen_int(n_ilen, 5);
9013
9014 ret_val = xmlNanoHTTPMethod(URL, method, input, contentType, headers, ilen);
9015 desret_void_ptr(ret_val);
9016 call_tests++;
9017 des_filepath(n_URL, URL, 0);
9018 des_const_char_ptr(n_method, method, 1);
9019 des_const_char_ptr(n_input, input, 2);
9020 des_char_ptr_ptr(n_contentType, contentType, 3);
9021 des_const_char_ptr(n_headers, headers, 4);
9022 des_int(n_ilen, ilen, 5);
9023 xmlResetLastError();
9024 if (mem_base != xmlMemBlocks()) {
9025 printf("Leak of %d blocks found in xmlNanoHTTPMethod",
9026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009027 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009028 printf(" %d", n_URL);
9029 printf(" %d", n_method);
9030 printf(" %d", n_input);
9031 printf(" %d", n_contentType);
9032 printf(" %d", n_headers);
9033 printf(" %d", n_ilen);
9034 printf("\n");
9035 }
9036 }
9037 }
9038 }
9039 }
9040 }
9041 }
9042#endif
9043
9044 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009046}
9047
9048
9049static int
9050test_xmlNanoHTTPMethodRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009052
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009053#ifdef LIBXML_HTTP_ENABLED
9054 int mem_base;
9055 void * ret_val;
9056 const char * URL; /* The URL to load */
9057 int n_URL;
9058 char * method; /* the HTTP method to use */
9059 int n_method;
9060 char * input; /* the input string if any */
9061 int n_input;
9062 char ** contentType; /* the Content-Type information IN and OUT */
9063 int n_contentType;
9064 char ** redir; /* the redirected URL OUT */
9065 int n_redir;
9066 char * headers; /* the extra headers */
9067 int n_headers;
9068 int ilen; /* input length */
9069 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009070
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009071 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
9072 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
9073 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
9074 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
9075 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
9076 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
9077 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
9078 mem_base = xmlMemBlocks();
9079 URL = gen_filepath(n_URL, 0);
9080 method = gen_const_char_ptr(n_method, 1);
9081 input = gen_const_char_ptr(n_input, 2);
9082 contentType = gen_char_ptr_ptr(n_contentType, 3);
9083 redir = gen_char_ptr_ptr(n_redir, 4);
9084 headers = gen_const_char_ptr(n_headers, 5);
9085 ilen = gen_int(n_ilen, 6);
9086
9087 ret_val = xmlNanoHTTPMethodRedir(URL, method, input, contentType, redir, headers, ilen);
9088 desret_void_ptr(ret_val);
9089 call_tests++;
9090 des_filepath(n_URL, URL, 0);
9091 des_const_char_ptr(n_method, method, 1);
9092 des_const_char_ptr(n_input, input, 2);
9093 des_char_ptr_ptr(n_contentType, contentType, 3);
9094 des_char_ptr_ptr(n_redir, redir, 4);
9095 des_const_char_ptr(n_headers, headers, 5);
9096 des_int(n_ilen, ilen, 6);
9097 xmlResetLastError();
9098 if (mem_base != xmlMemBlocks()) {
9099 printf("Leak of %d blocks found in xmlNanoHTTPMethodRedir",
9100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009101 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009102 printf(" %d", n_URL);
9103 printf(" %d", n_method);
9104 printf(" %d", n_input);
9105 printf(" %d", n_contentType);
9106 printf(" %d", n_redir);
9107 printf(" %d", n_headers);
9108 printf(" %d", n_ilen);
9109 printf("\n");
9110 }
9111 }
9112 }
9113 }
9114 }
9115 }
9116 }
9117 }
9118#endif
9119
9120 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009122}
9123
9124
9125static int
9126test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009128
Daniel Veillard27f20102004-11-05 11:50:11 +00009129#ifdef LIBXML_HTTP_ENABLED
9130 int mem_base;
9131 const char * ret_val;
9132 void * ctx; /* the HTTP context */
9133 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009134
Daniel Veillard27f20102004-11-05 11:50:11 +00009135 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
9136 mem_base = xmlMemBlocks();
9137 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
9138
9139 ret_val = xmlNanoHTTPMimeType(ctx);
9140 desret_const_char_ptr(ret_val);
9141 call_tests++;
9142 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
9143 xmlResetLastError();
9144 if (mem_base != xmlMemBlocks()) {
9145 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
9146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009147 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00009148 printf(" %d", n_ctx);
9149 printf("\n");
9150 }
9151 }
9152#endif
9153
9154 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009156}
9157
9158
9159static int
9160test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009162
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009163#ifdef LIBXML_HTTP_ENABLED
9164 int mem_base;
9165 void * ret_val;
9166 const char * URL; /* The URL to load */
9167 int n_URL;
9168 char ** contentType; /* if available the Content-Type information will be returned at that location */
9169 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009170
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009171 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
9172 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
9173 mem_base = xmlMemBlocks();
9174 URL = gen_filepath(n_URL, 0);
9175 contentType = gen_char_ptr_ptr(n_contentType, 1);
9176
9177 ret_val = xmlNanoHTTPOpen(URL, contentType);
9178 desret_void_ptr(ret_val);
9179 call_tests++;
9180 des_filepath(n_URL, URL, 0);
9181 des_char_ptr_ptr(n_contentType, contentType, 1);
9182 xmlResetLastError();
9183 if (mem_base != xmlMemBlocks()) {
9184 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
9185 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009186 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009187 printf(" %d", n_URL);
9188 printf(" %d", n_contentType);
9189 printf("\n");
9190 }
9191 }
9192 }
9193#endif
9194
9195 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009197}
9198
9199
9200static int
9201test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009203
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009204#ifdef LIBXML_HTTP_ENABLED
9205 int mem_base;
9206 void * ret_val;
9207 const char * URL; /* The URL to load */
9208 int n_URL;
9209 char ** contentType; /* if available the Content-Type information will be returned at that location */
9210 int n_contentType;
9211 char ** redir; /* if available the redirected URL will be returned */
9212 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009213
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009214 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
9215 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
9216 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
9217 mem_base = xmlMemBlocks();
9218 URL = gen_filepath(n_URL, 0);
9219 contentType = gen_char_ptr_ptr(n_contentType, 1);
9220 redir = gen_char_ptr_ptr(n_redir, 2);
9221
9222 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
9223 desret_void_ptr(ret_val);
9224 call_tests++;
9225 des_filepath(n_URL, URL, 0);
9226 des_char_ptr_ptr(n_contentType, contentType, 1);
9227 des_char_ptr_ptr(n_redir, redir, 2);
9228 xmlResetLastError();
9229 if (mem_base != xmlMemBlocks()) {
9230 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
9231 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009232 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009233 printf(" %d", n_URL);
9234 printf(" %d", n_contentType);
9235 printf(" %d", n_redir);
9236 printf("\n");
9237 }
9238 }
9239 }
9240 }
9241#endif
9242
9243 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009244 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009245}
9246
9247
9248static int
9249test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009250 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009251
Daniel Veillard27f20102004-11-05 11:50:11 +00009252#ifdef LIBXML_HTTP_ENABLED
9253 int mem_base;
9254 int ret_val;
9255 void * ctx; /* the HTTP context */
9256 int n_ctx;
9257 void * dest; /* a buffer */
9258 int n_dest;
9259 int len; /* the buffer length */
9260 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009261
Daniel Veillard27f20102004-11-05 11:50:11 +00009262 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
9263 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
9264 for (n_len = 0;n_len < gen_nb_int;n_len++) {
9265 mem_base = xmlMemBlocks();
9266 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
9267 dest = gen_void_ptr(n_dest, 1);
9268 len = gen_int(n_len, 2);
9269
9270 ret_val = xmlNanoHTTPRead(ctx, dest, len);
9271 desret_int(ret_val);
9272 call_tests++;
9273 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
9274 des_void_ptr(n_dest, dest, 1);
9275 des_int(n_len, len, 2);
9276 xmlResetLastError();
9277 if (mem_base != xmlMemBlocks()) {
9278 printf("Leak of %d blocks found in xmlNanoHTTPRead",
9279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009280 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00009281 printf(" %d", n_ctx);
9282 printf(" %d", n_dest);
9283 printf(" %d", n_len);
9284 printf("\n");
9285 }
9286 }
9287 }
9288 }
9289#endif
9290
9291 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009293}
9294
9295
9296static int
9297test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009299
9300
9301 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009302 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009303}
9304
9305
9306static int
9307test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009309
Daniel Veillard27f20102004-11-05 11:50:11 +00009310#ifdef LIBXML_HTTP_ENABLED
9311 int mem_base;
9312 int ret_val;
9313 void * ctx; /* the HTTP context */
9314 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009315
Daniel Veillard27f20102004-11-05 11:50:11 +00009316 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
9317 mem_base = xmlMemBlocks();
9318 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
9319
9320 ret_val = xmlNanoHTTPReturnCode(ctx);
9321 desret_int(ret_val);
9322 call_tests++;
9323 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
9324 xmlResetLastError();
9325 if (mem_base != xmlMemBlocks()) {
9326 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
9327 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009328 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +00009329 printf(" %d", n_ctx);
9330 printf("\n");
9331 }
9332 }
9333#endif
9334
9335 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009336 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009337}
9338
9339
9340static int
9341test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009342 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009343
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009344#ifdef LIBXML_HTTP_ENABLED
9345#ifdef LIBXML_OUTPUT_ENABLED
9346 int mem_base;
9347 int ret_val;
9348 void * ctxt; /* the HTTP context */
9349 int n_ctxt;
9350 const char * filename; /* the filename where the content should be saved */
9351 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009352
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009353 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
9354 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
9355 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009356 ctxt = gen_void_ptr(n_ctxt, 0);
9357 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009358
9359 ret_val = xmlNanoHTTPSave(ctxt, filename);
9360 desret_int(ret_val);
9361 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009362 des_void_ptr(n_ctxt, ctxt, 0);
9363 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009364 xmlResetLastError();
9365 if (mem_base != xmlMemBlocks()) {
9366 printf("Leak of %d blocks found in xmlNanoHTTPSave",
9367 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009368 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009369 printf(" %d", n_ctxt);
9370 printf(" %d", n_filename);
9371 printf("\n");
9372 }
9373 }
9374 }
9375#endif
9376#endif
9377
Daniel Veillard3d97e662004-11-04 10:49:00 +00009378 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009379 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009380}
9381
9382
9383static int
9384test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009385 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009386
9387#ifdef LIBXML_HTTP_ENABLED
9388 const char * URL; /* The proxy URL used to initialize the proxy context */
9389 int n_URL;
9390
9391 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00009392 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009393
9394 xmlNanoHTTPScanProxy(URL);
9395 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009396 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009397 xmlResetLastError();
9398 }
9399#endif
9400
Daniel Veillard3d97e662004-11-04 10:49:00 +00009401 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009402 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009403}
9404
9405static int
9406test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009408
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009409 printf("Testing nanohttp : 16 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009410 test_ret += test_xmlNanoHTTPAuthHeader();
9411 test_ret += test_xmlNanoHTTPCleanup();
9412 test_ret += test_xmlNanoHTTPClose();
9413 test_ret += test_xmlNanoHTTPContentLength();
9414 test_ret += test_xmlNanoHTTPEncoding();
9415 test_ret += test_xmlNanoHTTPFetch();
9416 test_ret += test_xmlNanoHTTPInit();
9417 test_ret += test_xmlNanoHTTPMethod();
9418 test_ret += test_xmlNanoHTTPMethodRedir();
9419 test_ret += test_xmlNanoHTTPMimeType();
9420 test_ret += test_xmlNanoHTTPOpen();
9421 test_ret += test_xmlNanoHTTPOpenRedir();
9422 test_ret += test_xmlNanoHTTPRead();
9423 test_ret += test_xmlNanoHTTPRedir();
9424 test_ret += test_xmlNanoHTTPReturnCode();
9425 test_ret += test_xmlNanoHTTPSave();
9426 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009427
Daniel Veillard42595322004-11-08 10:52:06 +00009428 if (test_ret != 0)
9429 printf("Module nanohttp: %d errors\n", test_ret);
9430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009431}
9432
9433static int
9434test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009436
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00009437 int mem_base;
9438 long ret_val;
9439 xmlParserCtxtPtr ctxt; /* an XML parser context */
9440 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009441
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00009442 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
9443 mem_base = xmlMemBlocks();
9444 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
9445
9446 ret_val = xmlByteConsumed(ctxt);
9447 desret_long(ret_val);
9448 call_tests++;
9449 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
9450 xmlResetLastError();
9451 if (mem_base != xmlMemBlocks()) {
9452 printf("Leak of %d blocks found in xmlByteConsumed",
9453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009454 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00009455 printf(" %d", n_ctxt);
9456 printf("\n");
9457 }
9458 }
9459
9460 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009461 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009462}
9463
9464
Daniel Veillardce682bc2004-11-05 17:22:25 +00009465#define gen_nb_xmlParserNodeInfoSeqPtr 1
9466static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9467 return(NULL);
9468}
9469static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9470}
9471
Daniel Veillardd93f6252004-11-02 15:53:51 +00009472static int
9473test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009474 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009475
Daniel Veillardce682bc2004-11-05 17:22:25 +00009476 int mem_base;
9477 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
9478 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009479
Daniel Veillardce682bc2004-11-05 17:22:25 +00009480 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
9481 mem_base = xmlMemBlocks();
9482 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
9483
9484 xmlClearNodeInfoSeq(seq);
9485 call_tests++;
9486 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
9487 xmlResetLastError();
9488 if (mem_base != xmlMemBlocks()) {
9489 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
9490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009491 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009492 printf(" %d", n_seq);
9493 printf("\n");
9494 }
9495 }
9496
9497 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009498 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009499}
9500
9501
9502static int
9503test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009504 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009505
9506 int mem_base;
9507 xmlParserCtxtPtr ctxt; /* an XML parser context */
9508 int n_ctxt;
9509
9510 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
9511 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009512 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009513
9514 xmlClearParserCtxt(ctxt);
9515 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009516 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009517 xmlResetLastError();
9518 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009519 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009520 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009521 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009522 printf(" %d", n_ctxt);
9523 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009524 }
9525 }
9526
Daniel Veillard3d97e662004-11-04 10:49:00 +00009527 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009529}
9530
9531
9532static int
9533test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009535
Daniel Veillard34099b42004-11-04 17:34:35 +00009536 int mem_base;
9537 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009538 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +00009539 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009540
Daniel Veillard34099b42004-11-04 17:34:35 +00009541 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
9542 mem_base = xmlMemBlocks();
9543 cur = gen_const_xmlChar_ptr(n_cur, 0);
9544
9545 ret_val = xmlCreateDocParserCtxt(cur);
9546 desret_xmlParserCtxtPtr(ret_val);
9547 call_tests++;
9548 des_const_xmlChar_ptr(n_cur, cur, 0);
9549 xmlResetLastError();
9550 if (mem_base != xmlMemBlocks()) {
9551 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
9552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009553 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00009554 printf(" %d", n_cur);
9555 printf("\n");
9556 }
9557 }
9558
9559 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009560 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009561}
9562
9563
9564static int
9565test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009566 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009567
Daniel Veillard34099b42004-11-04 17:34:35 +00009568#ifdef LIBXML_PUSH_ENABLED
9569 int mem_base;
9570 xmlParserCtxtPtr ret_val;
9571 xmlSAXHandlerPtr sax; /* a SAX handler */
9572 int n_sax;
9573 void * user_data; /* The user data returned on SAX callbacks */
9574 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009575 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +00009576 int n_chunk;
9577 int size; /* number of chars in the array */
9578 int n_size;
9579 const char * filename; /* an optional file name or URI */
9580 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009581
Daniel Veillard34099b42004-11-04 17:34:35 +00009582 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
9583 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
9584 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
9585 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00009586 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +00009587 mem_base = xmlMemBlocks();
9588 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
9589 user_data = gen_userdata(n_user_data, 1);
9590 chunk = gen_const_char_ptr(n_chunk, 2);
9591 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00009592 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +00009593
9594 ret_val = xmlCreatePushParserCtxt(sax, user_data, chunk, size, filename);
9595 desret_xmlParserCtxtPtr(ret_val);
9596 call_tests++;
9597 des_xmlSAXHandlerPtr(n_sax, sax, 0);
9598 des_userdata(n_user_data, user_data, 1);
9599 des_const_char_ptr(n_chunk, chunk, 2);
9600 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00009601 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +00009602 xmlResetLastError();
9603 if (mem_base != xmlMemBlocks()) {
9604 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
9605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009606 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00009607 printf(" %d", n_sax);
9608 printf(" %d", n_user_data);
9609 printf(" %d", n_chunk);
9610 printf(" %d", n_size);
9611 printf(" %d", n_filename);
9612 printf("\n");
9613 }
9614 }
9615 }
9616 }
9617 }
9618 }
9619#endif
9620
9621 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009623}
9624
9625
9626static int
9627test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009629
9630 int mem_base;
9631 xmlDocPtr ret_val;
9632 xmlParserCtxtPtr ctxt; /* an XML parser context */
9633 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009634 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +00009635 int n_cur;
9636 const char * URL; /* the base URL to use for the document */
9637 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009638 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +00009639 int n_encoding;
9640 int options; /* a combination of xmlParserOption */
9641 int n_options;
9642
9643 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
9644 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
9645 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
9646 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
9647 for (n_options = 0;n_options < gen_nb_int;n_options++) {
9648 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009649 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
9650 cur = gen_const_xmlChar_ptr(n_cur, 1);
9651 URL = gen_filepath(n_URL, 2);
9652 encoding = gen_const_char_ptr(n_encoding, 3);
9653 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009654
9655 ret_val = xmlCtxtReadDoc(ctxt, cur, URL, encoding, options);
9656 desret_xmlDocPtr(ret_val);
9657 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009658 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
9659 des_const_xmlChar_ptr(n_cur, cur, 1);
9660 des_filepath(n_URL, URL, 2);
9661 des_const_char_ptr(n_encoding, encoding, 3);
9662 des_int(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009663 xmlResetLastError();
9664 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009665 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009667 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009668 printf(" %d", n_ctxt);
9669 printf(" %d", n_cur);
9670 printf(" %d", n_URL);
9671 printf(" %d", n_encoding);
9672 printf(" %d", n_options);
9673 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009674 }
9675 }
9676 }
9677 }
9678 }
9679 }
9680
Daniel Veillard3d97e662004-11-04 10:49:00 +00009681 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009682 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009683}
9684
9685
9686static int
9687test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009688 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009689
9690 int mem_base;
9691 xmlDocPtr ret_val;
9692 xmlParserCtxtPtr ctxt; /* an XML parser context */
9693 int n_ctxt;
9694 const char * filename; /* a file or URL */
9695 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009696 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +00009697 int n_encoding;
9698 int options; /* a combination of xmlParserOption */
9699 int n_options;
9700
9701 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
9702 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
9703 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
9704 for (n_options = 0;n_options < gen_nb_int;n_options++) {
9705 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009706 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
9707 filename = gen_filepath(n_filename, 1);
9708 encoding = gen_const_char_ptr(n_encoding, 2);
9709 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009710
9711 ret_val = xmlCtxtReadFile(ctxt, filename, encoding, options);
9712 desret_xmlDocPtr(ret_val);
9713 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009714 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
9715 des_filepath(n_filename, filename, 1);
9716 des_const_char_ptr(n_encoding, encoding, 2);
9717 des_int(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009718 xmlResetLastError();
9719 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009720 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009721 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009722 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009723 printf(" %d", n_ctxt);
9724 printf(" %d", n_filename);
9725 printf(" %d", n_encoding);
9726 printf(" %d", n_options);
9727 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009728 }
9729 }
9730 }
9731 }
9732 }
9733
Daniel Veillard3d97e662004-11-04 10:49:00 +00009734 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009736}
9737
9738
9739static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009740test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009742
9743 int mem_base;
9744 xmlDocPtr ret_val;
9745 xmlParserCtxtPtr ctxt; /* an XML parser context */
9746 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009747 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +00009748 int n_buffer;
9749 int size; /* the size of the array */
9750 int n_size;
9751 const char * URL; /* the base URL to use for the document */
9752 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009753 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +00009754 int n_encoding;
9755 int options; /* a combination of xmlParserOption */
9756 int n_options;
9757
9758 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
9759 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
9760 for (n_size = 0;n_size < gen_nb_int;n_size++) {
9761 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
9762 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
9763 for (n_options = 0;n_options < gen_nb_int;n_options++) {
9764 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009765 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
9766 buffer = gen_const_char_ptr(n_buffer, 1);
9767 size = gen_int(n_size, 2);
9768 URL = gen_filepath(n_URL, 3);
9769 encoding = gen_const_char_ptr(n_encoding, 4);
9770 options = gen_int(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009771
9772 ret_val = xmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options);
9773 desret_xmlDocPtr(ret_val);
9774 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009775 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
9776 des_const_char_ptr(n_buffer, buffer, 1);
9777 des_int(n_size, size, 2);
9778 des_filepath(n_URL, URL, 3);
9779 des_const_char_ptr(n_encoding, encoding, 4);
9780 des_int(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009781 xmlResetLastError();
9782 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009783 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009785 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009786 printf(" %d", n_ctxt);
9787 printf(" %d", n_buffer);
9788 printf(" %d", n_size);
9789 printf(" %d", n_URL);
9790 printf(" %d", n_encoding);
9791 printf(" %d", n_options);
9792 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009793 }
9794 }
9795 }
9796 }
9797 }
9798 }
9799 }
9800
Daniel Veillard3d97e662004-11-04 10:49:00 +00009801 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009802 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009803}
9804
9805
9806static int
9807test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009808 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009809
9810 int mem_base;
9811 xmlParserCtxtPtr ctxt; /* an XML parser context */
9812 int n_ctxt;
9813
9814 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
9815 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009816 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009817
9818 xmlCtxtReset(ctxt);
9819 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009820 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009821 xmlResetLastError();
9822 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009823 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009825 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009826 printf(" %d", n_ctxt);
9827 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009828 }
9829 }
9830
Daniel Veillard3d97e662004-11-04 10:49:00 +00009831 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009832 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009833}
9834
9835
9836static int
9837test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009838 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009839
9840 int mem_base;
9841 int ret_val;
9842 xmlParserCtxtPtr ctxt; /* an XML parser context */
9843 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009844 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +00009845 int n_chunk;
9846 int size; /* number of chars in the array */
9847 int n_size;
9848 const char * filename; /* an optional file name or URI */
9849 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009850 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +00009851 int n_encoding;
9852
9853 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
9854 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
9855 for (n_size = 0;n_size < gen_nb_int;n_size++) {
9856 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
9857 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
9858 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009859 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
9860 chunk = gen_const_char_ptr(n_chunk, 1);
9861 size = gen_int(n_size, 2);
9862 filename = gen_filepath(n_filename, 3);
9863 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009864
9865 ret_val = xmlCtxtResetPush(ctxt, chunk, size, filename, encoding);
9866 desret_int(ret_val);
9867 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009868 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
9869 des_const_char_ptr(n_chunk, chunk, 1);
9870 des_int(n_size, size, 2);
9871 des_filepath(n_filename, filename, 3);
9872 des_const_char_ptr(n_encoding, encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009873 xmlResetLastError();
9874 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009875 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009877 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009878 printf(" %d", n_ctxt);
9879 printf(" %d", n_chunk);
9880 printf(" %d", n_size);
9881 printf(" %d", n_filename);
9882 printf(" %d", n_encoding);
9883 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009884 }
9885 }
9886 }
9887 }
9888 }
9889 }
9890
Daniel Veillard3d97e662004-11-04 10:49:00 +00009891 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009892 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009893}
9894
9895
9896static int
9897test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009898 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009899
9900 int mem_base;
9901 int ret_val;
9902 xmlParserCtxtPtr ctxt; /* an XML parser context */
9903 int n_ctxt;
9904 int options; /* a combination of xmlParserOption */
9905 int n_options;
9906
9907 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
9908 for (n_options = 0;n_options < gen_nb_int;n_options++) {
9909 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009910 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
9911 options = gen_int(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009912
9913 ret_val = xmlCtxtUseOptions(ctxt, options);
9914 desret_int(ret_val);
9915 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009916 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
9917 des_int(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009918 xmlResetLastError();
9919 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009920 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009922 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009923 printf(" %d", n_ctxt);
9924 printf(" %d", n_options);
9925 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009926 }
9927 }
9928 }
9929
Daniel Veillard3d97e662004-11-04 10:49:00 +00009930 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009932}
9933
9934
9935static int
9936test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009938
9939
9940 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009941 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009942}
9943
9944
9945static int
9946test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009947 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009948
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009949 int mem_base;
9950 int ret_val;
9951 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
9952 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009953 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009954 int n_name;
9955 void * result; /* location to store the result */
9956 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009957
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009958 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
9959 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
9960 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
9961 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009962 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
9963 name = gen_const_char_ptr(n_name, 1);
9964 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009965
9966 ret_val = xmlGetFeature(ctxt, name, result);
9967 desret_int(ret_val);
9968 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009969 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
9970 des_const_char_ptr(n_name, name, 1);
9971 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009972 xmlResetLastError();
9973 if (mem_base != xmlMemBlocks()) {
9974 printf("Leak of %d blocks found in xmlGetFeature",
9975 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009976 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009977 printf(" %d", n_ctxt);
9978 printf(" %d", n_name);
9979 printf(" %d", n_result);
9980 printf("\n");
9981 }
9982 }
9983 }
9984 }
9985
Daniel Veillard3d97e662004-11-04 10:49:00 +00009986 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009988}
9989
9990
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009991#define gen_nb_const_char_ptr_ptr 1
9992static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9993 return(NULL);
9994}
9995static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9996}
9997
Daniel Veillardd93f6252004-11-02 15:53:51 +00009998static int
9999test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010000 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010001
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000010002 int mem_base;
10003 int ret_val;
10004 int * len; /* the length of the features name array (input/output) */
10005 int n_len;
10006 char ** result; /* an array of string to be filled with the features name. */
10007 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010008
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000010009 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
10010 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
10011 mem_base = xmlMemBlocks();
10012 len = gen_int_ptr(n_len, 0);
10013 result = gen_const_char_ptr_ptr(n_result, 1);
10014
10015 ret_val = xmlGetFeaturesList(len, result);
10016 desret_int(ret_val);
10017 call_tests++;
10018 des_int_ptr(n_len, len, 0);
10019 des_const_char_ptr_ptr(n_result, result, 1);
10020 xmlResetLastError();
10021 if (mem_base != xmlMemBlocks()) {
10022 printf("Leak of %d blocks found in xmlGetFeaturesList",
10023 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010024 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000010025 printf(" %d", n_len);
10026 printf(" %d", n_result);
10027 printf("\n");
10028 }
10029 }
10030 }
10031
10032 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010033 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010034}
10035
10036
10037static int
10038test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010040
Daniel Veillard34099b42004-11-04 17:34:35 +000010041 int mem_base;
10042 xmlDtdPtr ret_val;
10043 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
10044 int n_sax;
10045 xmlParserInputBufferPtr input; /* an Input Buffer */
10046 int n_input;
10047 xmlCharEncoding enc; /* the charset encoding if known */
10048 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010049
Daniel Veillard34099b42004-11-04 17:34:35 +000010050 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
10051 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
10052 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
10053 mem_base = xmlMemBlocks();
10054 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
10055 input = gen_xmlParserInputBufferPtr(n_input, 1);
10056 enc = gen_xmlCharEncoding(n_enc, 2);
10057
10058 ret_val = xmlIOParseDTD(sax, input, enc);
10059 input = NULL;
10060 desret_xmlDtdPtr(ret_val);
10061 call_tests++;
10062 des_xmlSAXHandlerPtr(n_sax, sax, 0);
10063 des_xmlParserInputBufferPtr(n_input, input, 1);
10064 des_xmlCharEncoding(n_enc, enc, 2);
10065 xmlResetLastError();
10066 if (mem_base != xmlMemBlocks()) {
10067 printf("Leak of %d blocks found in xmlIOParseDTD",
10068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010069 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000010070 printf(" %d", n_sax);
10071 printf(" %d", n_input);
10072 printf(" %d", n_enc);
10073 printf("\n");
10074 }
10075 }
10076 }
10077 }
10078
10079 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010080 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010081}
10082
10083
10084static int
10085test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010086 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010087
Daniel Veillardce682bc2004-11-05 17:22:25 +000010088 int mem_base;
10089 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
10090 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010091
Daniel Veillardce682bc2004-11-05 17:22:25 +000010092 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
10093 mem_base = xmlMemBlocks();
10094 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
10095
10096 xmlInitNodeInfoSeq(seq);
10097 call_tests++;
10098 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
10099 xmlResetLastError();
10100 if (mem_base != xmlMemBlocks()) {
10101 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
10102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010103 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010104 printf(" %d", n_seq);
10105 printf("\n");
10106 }
10107 }
10108
10109 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010111}
10112
10113
10114static int
10115test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010117
10118 int mem_base;
10119
10120 mem_base = xmlMemBlocks();
10121
10122 xmlInitParser();
10123 call_tests++;
10124 xmlResetLastError();
10125 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000010126 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000010127 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010128 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000010129 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000010130 }
10131
Daniel Veillard3d97e662004-11-04 10:49:00 +000010132 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010134}
10135
10136
10137static int
10138test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010140
10141 int mem_base;
10142 int ret_val;
10143 xmlParserCtxtPtr ctxt; /* an XML parser context */
10144 int n_ctxt;
10145
10146 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
10147 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010148 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010149
10150 ret_val = xmlInitParserCtxt(ctxt);
10151 desret_int(ret_val);
10152 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010153 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010154 xmlResetLastError();
10155 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000010156 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000010157 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010158 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000010159 printf(" %d", n_ctxt);
10160 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000010161 }
10162 }
10163
Daniel Veillard3d97e662004-11-04 10:49:00 +000010164 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010166}
10167
10168
10169static int
10170test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010172
10173 int mem_base;
10174 int ret_val;
10175 int val; /* int 0 or 1 */
10176 int n_val;
10177
10178 for (n_val = 0;n_val < gen_nb_int;n_val++) {
10179 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010180 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010181
10182 ret_val = xmlKeepBlanksDefault(val);
10183 desret_int(ret_val);
10184 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010185 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010186 xmlResetLastError();
10187 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000010188 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000010189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010190 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000010191 printf(" %d", n_val);
10192 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000010193 }
10194 }
10195
Daniel Veillard3d97e662004-11-04 10:49:00 +000010196 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010197 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010198}
10199
10200
10201static int
10202test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010203 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010204
10205 int mem_base;
10206 int ret_val;
10207 int val; /* int 0 or 1 */
10208 int n_val;
10209
10210 for (n_val = 0;n_val < gen_nb_int;n_val++) {
10211 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010212 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010213
10214 ret_val = xmlLineNumbersDefault(val);
10215 desret_int(ret_val);
10216 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010217 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010218 xmlResetLastError();
10219 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000010220 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000010221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010222 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000010223 printf(" %d", n_val);
10224 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000010225 }
10226 }
10227
Daniel Veillard3d97e662004-11-04 10:49:00 +000010228 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010230}
10231
10232
10233static int
10234test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010236
Daniel Veillard42595322004-11-08 10:52:06 +000010237 int mem_base;
10238 xmlParserInputPtr ret_val;
10239 const char * URL; /* the URL for the entity to load */
10240 int n_URL;
10241 char * ID; /* the Public ID for the entity to load */
10242 int n_ID;
10243 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
10244 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010245
Daniel Veillard42595322004-11-08 10:52:06 +000010246 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
10247 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
10248 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
10249 mem_base = xmlMemBlocks();
10250 URL = gen_filepath(n_URL, 0);
10251 ID = gen_const_char_ptr(n_ID, 1);
10252 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
10253
10254 ret_val = xmlLoadExternalEntity(URL, ID, ctxt);
10255 desret_xmlParserInputPtr(ret_val);
10256 call_tests++;
10257 des_filepath(n_URL, URL, 0);
10258 des_const_char_ptr(n_ID, ID, 1);
10259 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
10260 xmlResetLastError();
10261 if (mem_base != xmlMemBlocks()) {
10262 printf("Leak of %d blocks found in xmlLoadExternalEntity",
10263 xmlMemBlocks() - mem_base);
10264 test_ret++;
10265 printf(" %d", n_URL);
10266 printf(" %d", n_ID);
10267 printf(" %d", n_ctxt);
10268 printf("\n");
10269 }
10270 }
10271 }
10272 }
10273
10274 function_tests++;
10275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010276}
10277
10278
10279static int
10280test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010282
Daniel Veillard42595322004-11-08 10:52:06 +000010283 int mem_base;
10284 xmlParserInputPtr ret_val;
10285 xmlParserCtxtPtr ctxt; /* an XML parser context */
10286 int n_ctxt;
10287 xmlParserInputBufferPtr input; /* an I/O Input */
10288 int n_input;
10289 xmlCharEncoding enc; /* the charset encoding if known */
10290 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010291
Daniel Veillard42595322004-11-08 10:52:06 +000010292 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
10293 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
10294 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
10295 mem_base = xmlMemBlocks();
10296 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
10297 input = gen_xmlParserInputBufferPtr(n_input, 1);
10298 enc = gen_xmlCharEncoding(n_enc, 2);
10299
10300 ret_val = xmlNewIOInputStream(ctxt, input, enc);
10301 if (ret_val != NULL) input = NULL;
10302 desret_xmlParserInputPtr(ret_val);
10303 call_tests++;
10304 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
10305 des_xmlParserInputBufferPtr(n_input, input, 1);
10306 des_xmlCharEncoding(n_enc, enc, 2);
10307 xmlResetLastError();
10308 if (mem_base != xmlMemBlocks()) {
10309 printf("Leak of %d blocks found in xmlNewIOInputStream",
10310 xmlMemBlocks() - mem_base);
10311 test_ret++;
10312 printf(" %d", n_ctxt);
10313 printf(" %d", n_input);
10314 printf(" %d", n_enc);
10315 printf("\n");
10316 }
10317 }
10318 }
10319 }
10320
10321 function_tests++;
10322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010323}
10324
10325
10326static int
10327test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010329
Daniel Veillard34099b42004-11-04 17:34:35 +000010330 int mem_base;
10331 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010332
Daniel Veillard34099b42004-11-04 17:34:35 +000010333 mem_base = xmlMemBlocks();
10334
10335 ret_val = xmlNewParserCtxt();
10336 desret_xmlParserCtxtPtr(ret_val);
10337 call_tests++;
10338 xmlResetLastError();
10339 if (mem_base != xmlMemBlocks()) {
10340 printf("Leak of %d blocks found in xmlNewParserCtxt",
10341 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010342 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000010343 printf("\n");
10344 }
10345
10346 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010348}
10349
10350
Daniel Veillardce682bc2004-11-05 17:22:25 +000010351#define gen_nb_xmlNodePtr_ptr 1
10352static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10353 return(NULL);
10354}
10355static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10356}
10357
Daniel Veillardd93f6252004-11-02 15:53:51 +000010358static int
10359test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010361
Daniel Veillardce682bc2004-11-05 17:22:25 +000010362 int mem_base;
10363 int ret_val;
10364 xmlDocPtr doc; /* the document the chunk pertains to */
10365 int n_doc;
10366 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
10367 int n_sax;
10368 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
10369 int n_user_data;
10370 int depth; /* Used for loop detection, use 0 */
10371 int n_depth;
10372 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
10373 int n_string;
10374 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
10375 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010376
Daniel Veillardce682bc2004-11-05 17:22:25 +000010377 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
10378 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
10379 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
10380 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
10381 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
10382 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
10383 mem_base = xmlMemBlocks();
10384 doc = gen_xmlDocPtr(n_doc, 0);
10385 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
10386 user_data = gen_userdata(n_user_data, 2);
10387 depth = gen_int(n_depth, 3);
10388 string = gen_const_xmlChar_ptr(n_string, 4);
10389 lst = gen_xmlNodePtr_ptr(n_lst, 5);
10390 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
10391
10392 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, string, lst);
10393 desret_int(ret_val);
10394 call_tests++;
10395 des_xmlDocPtr(n_doc, doc, 0);
10396 des_xmlSAXHandlerPtr(n_sax, sax, 1);
10397 des_userdata(n_user_data, user_data, 2);
10398 des_int(n_depth, depth, 3);
10399 des_const_xmlChar_ptr(n_string, string, 4);
10400 des_xmlNodePtr_ptr(n_lst, lst, 5);
10401 xmlResetLastError();
10402 if (mem_base != xmlMemBlocks()) {
10403 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
10404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010405 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010406 printf(" %d", n_doc);
10407 printf(" %d", n_sax);
10408 printf(" %d", n_user_data);
10409 printf(" %d", n_depth);
10410 printf(" %d", n_string);
10411 printf(" %d", n_lst);
10412 printf("\n");
10413 }
10414 }
10415 }
10416 }
10417 }
10418 }
10419 }
10420
10421 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010422 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010423}
10424
10425
10426static int
10427test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010428 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010429
Daniel Veillardce682bc2004-11-05 17:22:25 +000010430 int mem_base;
10431 int ret_val;
10432 xmlDocPtr doc; /* the document the chunk pertains to */
10433 int n_doc;
10434 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
10435 int n_sax;
10436 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
10437 int n_user_data;
10438 int depth; /* Used for loop detection, use 0 */
10439 int n_depth;
10440 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
10441 int n_string;
10442 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
10443 int n_lst;
10444 int recover; /* return nodes even if the data is broken (use 0) */
10445 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010446
Daniel Veillardce682bc2004-11-05 17:22:25 +000010447 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
10448 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
10449 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
10450 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
10451 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
10452 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
10453 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
10454 mem_base = xmlMemBlocks();
10455 doc = gen_xmlDocPtr(n_doc, 0);
10456 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
10457 user_data = gen_userdata(n_user_data, 2);
10458 depth = gen_int(n_depth, 3);
10459 string = gen_const_xmlChar_ptr(n_string, 4);
10460 lst = gen_xmlNodePtr_ptr(n_lst, 5);
10461 recover = gen_int(n_recover, 6);
10462 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
10463
10464 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, string, lst, recover);
10465 desret_int(ret_val);
10466 call_tests++;
10467 des_xmlDocPtr(n_doc, doc, 0);
10468 des_xmlSAXHandlerPtr(n_sax, sax, 1);
10469 des_userdata(n_user_data, user_data, 2);
10470 des_int(n_depth, depth, 3);
10471 des_const_xmlChar_ptr(n_string, string, 4);
10472 des_xmlNodePtr_ptr(n_lst, lst, 5);
10473 des_int(n_recover, recover, 6);
10474 xmlResetLastError();
10475 if (mem_base != xmlMemBlocks()) {
10476 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
10477 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010478 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010479 printf(" %d", n_doc);
10480 printf(" %d", n_sax);
10481 printf(" %d", n_user_data);
10482 printf(" %d", n_depth);
10483 printf(" %d", n_string);
10484 printf(" %d", n_lst);
10485 printf(" %d", n_recover);
10486 printf("\n");
10487 }
10488 }
10489 }
10490 }
10491 }
10492 }
10493 }
10494 }
10495
10496 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010498}
10499
10500
10501static int
10502test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010504
10505#ifdef LIBXML_PUSH_ENABLED
10506 int mem_base;
10507 int ret_val;
10508 xmlParserCtxtPtr ctxt; /* an XML parser context */
10509 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010510 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000010511 int n_chunk;
10512 int size; /* the size in byte of the chunk */
10513 int n_size;
10514 int terminate; /* last chunk indicator */
10515 int n_terminate;
10516
10517 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
10518 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
10519 for (n_size = 0;n_size < gen_nb_int;n_size++) {
10520 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
10521 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010522 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
10523 chunk = gen_const_char_ptr(n_chunk, 1);
10524 size = gen_int(n_size, 2);
10525 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010526
10527 ret_val = xmlParseChunk(ctxt, chunk, size, terminate);
10528 desret_int(ret_val);
10529 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010530 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
10531 des_const_char_ptr(n_chunk, chunk, 1);
10532 des_int(n_size, size, 2);
10533 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010534 xmlResetLastError();
10535 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000010536 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000010537 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010538 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000010539 printf(" %d", n_ctxt);
10540 printf(" %d", n_chunk);
10541 printf(" %d", n_size);
10542 printf(" %d", n_terminate);
10543 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000010544 }
10545 }
10546 }
10547 }
10548 }
10549#endif
10550
Daniel Veillard3d97e662004-11-04 10:49:00 +000010551 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010552 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010553}
10554
10555
10556static int
10557test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010558 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010559
Daniel Veillardce682bc2004-11-05 17:22:25 +000010560 int mem_base;
10561 int ret_val;
10562 xmlParserCtxtPtr ctx; /* the existing parsing context */
10563 int n_ctx;
10564 xmlChar * URL; /* the URL for the entity to load */
10565 int n_URL;
10566 xmlChar * ID; /* the System ID for the entity to load */
10567 int n_ID;
10568 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
10569 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010570
Daniel Veillardce682bc2004-11-05 17:22:25 +000010571 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
10572 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
10573 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
10574 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
10575 mem_base = xmlMemBlocks();
10576 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
10577 URL = gen_const_xmlChar_ptr(n_URL, 1);
10578 ID = gen_const_xmlChar_ptr(n_ID, 2);
10579 lst = gen_xmlNodePtr_ptr(n_lst, 3);
10580
10581 ret_val = xmlParseCtxtExternalEntity(ctx, URL, ID, lst);
10582 desret_int(ret_val);
10583 call_tests++;
10584 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
10585 des_const_xmlChar_ptr(n_URL, URL, 1);
10586 des_const_xmlChar_ptr(n_ID, ID, 2);
10587 des_xmlNodePtr_ptr(n_lst, lst, 3);
10588 xmlResetLastError();
10589 if (mem_base != xmlMemBlocks()) {
10590 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
10591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010592 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010593 printf(" %d", n_ctx);
10594 printf(" %d", n_URL);
10595 printf(" %d", n_ID);
10596 printf(" %d", n_lst);
10597 printf("\n");
10598 }
10599 }
10600 }
10601 }
10602 }
10603
10604 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010606}
10607
10608
10609static int
10610test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010612
Daniel Veillard34099b42004-11-04 17:34:35 +000010613 int mem_base;
10614 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010615 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000010616 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010617 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000010618 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010619
Daniel Veillard34099b42004-11-04 17:34:35 +000010620 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
10621 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
10622 mem_base = xmlMemBlocks();
10623 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
10624 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
10625
10626 ret_val = xmlParseDTD(ExternalID, SystemID);
10627 desret_xmlDtdPtr(ret_val);
10628 call_tests++;
10629 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 0);
10630 des_const_xmlChar_ptr(n_SystemID, SystemID, 1);
10631 xmlResetLastError();
10632 if (mem_base != xmlMemBlocks()) {
10633 printf("Leak of %d blocks found in xmlParseDTD",
10634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010635 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000010636 printf(" %d", n_ExternalID);
10637 printf(" %d", n_SystemID);
10638 printf("\n");
10639 }
10640 }
10641 }
10642
10643 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010645}
10646
10647
10648static int
10649test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010651
Daniel Veillard8a32fe42004-11-02 22:10:16 +000010652 int mem_base;
10653 xmlDocPtr ret_val;
10654 xmlChar * cur; /* a pointer to an array of xmlChar */
10655 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010656
Daniel Veillard8a32fe42004-11-02 22:10:16 +000010657 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
10658 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010659 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000010660
10661 ret_val = xmlParseDoc(cur);
10662 desret_xmlDocPtr(ret_val);
10663 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010664 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000010665 xmlResetLastError();
10666 if (mem_base != xmlMemBlocks()) {
10667 printf("Leak of %d blocks found in xmlParseDoc",
10668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010669 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000010670 printf(" %d", n_cur);
10671 printf("\n");
10672 }
10673 }
10674
Daniel Veillard3d97e662004-11-04 10:49:00 +000010675 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010677}
10678
10679
10680static int
10681test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010683
10684 int mem_base;
10685 int ret_val;
10686 xmlParserCtxtPtr ctxt; /* an XML parser context */
10687 int n_ctxt;
10688
10689 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
10690 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010691 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010692
10693 ret_val = xmlParseDocument(ctxt);
10694 desret_int(ret_val);
10695 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010696 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010697 xmlResetLastError();
10698 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000010699 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000010700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010701 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000010702 printf(" %d", n_ctxt);
10703 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000010704 }
10705 }
10706
Daniel Veillard3d97e662004-11-04 10:49:00 +000010707 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010709}
10710
10711
10712static int
10713test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010715
10716 int mem_base;
10717 xmlDocPtr ret_val;
10718 const char * filename; /* the filename */
10719 int n_filename;
10720
10721 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
10722 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010723 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010724
10725 ret_val = xmlParseEntity(filename);
10726 desret_xmlDocPtr(ret_val);
10727 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010728 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010729 xmlResetLastError();
10730 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000010731 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000010732 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010733 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000010734 printf(" %d", n_filename);
10735 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000010736 }
10737 }
10738
Daniel Veillard3d97e662004-11-04 10:49:00 +000010739 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010741}
10742
10743
10744static int
10745test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010747
10748 int mem_base;
10749 int ret_val;
10750 xmlParserCtxtPtr ctxt; /* an XML parser context */
10751 int n_ctxt;
10752
10753 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
10754 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010755 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010756
10757 ret_val = xmlParseExtParsedEnt(ctxt);
10758 desret_int(ret_val);
10759 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010760 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010761 xmlResetLastError();
10762 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000010763 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000010764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010765 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000010766 printf(" %d", n_ctxt);
10767 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000010768 }
10769 }
10770
Daniel Veillard3d97e662004-11-04 10:49:00 +000010771 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010772 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010773}
10774
10775
10776static int
10777test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010778 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010779
Daniel Veillardce682bc2004-11-05 17:22:25 +000010780 int mem_base;
10781 int ret_val;
10782 xmlDocPtr doc; /* the document the chunk pertains to */
10783 int n_doc;
10784 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
10785 int n_sax;
10786 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
10787 int n_user_data;
10788 int depth; /* Used for loop detection, use 0 */
10789 int n_depth;
10790 xmlChar * URL; /* the URL for the entity to load */
10791 int n_URL;
10792 xmlChar * ID; /* the System ID for the entity to load */
10793 int n_ID;
10794 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
10795 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010796
Daniel Veillardce682bc2004-11-05 17:22:25 +000010797 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
10798 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
10799 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
10800 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
10801 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
10802 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
10803 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
10804 mem_base = xmlMemBlocks();
10805 doc = gen_xmlDocPtr(n_doc, 0);
10806 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
10807 user_data = gen_userdata(n_user_data, 2);
10808 depth = gen_int(n_depth, 3);
10809 URL = gen_const_xmlChar_ptr(n_URL, 4);
10810 ID = gen_const_xmlChar_ptr(n_ID, 5);
10811 lst = gen_xmlNodePtr_ptr(n_lst, 6);
10812
10813 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, URL, ID, lst);
10814 desret_int(ret_val);
10815 call_tests++;
10816 des_xmlDocPtr(n_doc, doc, 0);
10817 des_xmlSAXHandlerPtr(n_sax, sax, 1);
10818 des_userdata(n_user_data, user_data, 2);
10819 des_int(n_depth, depth, 3);
10820 des_const_xmlChar_ptr(n_URL, URL, 4);
10821 des_const_xmlChar_ptr(n_ID, ID, 5);
10822 des_xmlNodePtr_ptr(n_lst, lst, 6);
10823 xmlResetLastError();
10824 if (mem_base != xmlMemBlocks()) {
10825 printf("Leak of %d blocks found in xmlParseExternalEntity",
10826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010827 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010828 printf(" %d", n_doc);
10829 printf(" %d", n_sax);
10830 printf(" %d", n_user_data);
10831 printf(" %d", n_depth);
10832 printf(" %d", n_URL);
10833 printf(" %d", n_ID);
10834 printf(" %d", n_lst);
10835 printf("\n");
10836 }
10837 }
10838 }
10839 }
10840 }
10841 }
10842 }
10843 }
10844
10845 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010846 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010847}
10848
10849
10850static int
10851test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010852 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010853
10854 int mem_base;
10855 xmlDocPtr ret_val;
10856 const char * filename; /* the filename */
10857 int n_filename;
10858
10859 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
10860 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010861 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010862
10863 ret_val = xmlParseFile(filename);
10864 desret_xmlDocPtr(ret_val);
10865 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010866 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010867 xmlResetLastError();
10868 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000010869 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000010870 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010871 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000010872 printf(" %d", n_filename);
10873 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000010874 }
10875 }
10876
Daniel Veillard3d97e662004-11-04 10:49:00 +000010877 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010879}
10880
10881
10882static int
10883test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010885
Daniel Veillard57b25162004-11-06 14:50:18 +000010886 int mem_base;
10887 xmlParserErrors ret_val;
10888 xmlNodePtr node; /* the context node */
10889 int n_node;
10890 char * data; /* the input string */
10891 int n_data;
10892 int datalen; /* the input string length in bytes */
10893 int n_datalen;
10894 int options; /* a combination of xmlParserOption */
10895 int n_options;
10896 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
10897 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010898
Daniel Veillard57b25162004-11-06 14:50:18 +000010899 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
10900 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
10901 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
10902 for (n_options = 0;n_options < gen_nb_int;n_options++) {
10903 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
10904 mem_base = xmlMemBlocks();
10905 node = gen_xmlNodePtr(n_node, 0);
10906 data = gen_const_char_ptr(n_data, 1);
10907 datalen = gen_int(n_datalen, 2);
10908 options = gen_int(n_options, 3);
10909 lst = gen_xmlNodePtr_ptr(n_lst, 4);
10910
10911 ret_val = xmlParseInNodeContext(node, data, datalen, options, lst);
10912 desret_xmlParserErrors(ret_val);
10913 call_tests++;
10914 des_xmlNodePtr(n_node, node, 0);
10915 des_const_char_ptr(n_data, data, 1);
10916 des_int(n_datalen, datalen, 2);
10917 des_int(n_options, options, 3);
10918 des_xmlNodePtr_ptr(n_lst, lst, 4);
10919 xmlResetLastError();
10920 if (mem_base != xmlMemBlocks()) {
10921 printf("Leak of %d blocks found in xmlParseInNodeContext",
10922 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010923 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000010924 printf(" %d", n_node);
10925 printf(" %d", n_data);
10926 printf(" %d", n_datalen);
10927 printf(" %d", n_options);
10928 printf(" %d", n_lst);
10929 printf("\n");
10930 }
10931 }
10932 }
10933 }
10934 }
10935 }
10936
10937 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010938 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010939}
10940
10941
10942static int
10943test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010945
10946 int mem_base;
10947 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010948 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000010949 int n_buffer;
10950 int size; /* the size of the array */
10951 int n_size;
10952
10953 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
10954 for (n_size = 0;n_size < gen_nb_int;n_size++) {
10955 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010956 buffer = gen_const_char_ptr(n_buffer, 0);
10957 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010958
10959 ret_val = xmlParseMemory(buffer, size);
10960 desret_xmlDocPtr(ret_val);
10961 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010962 des_const_char_ptr(n_buffer, buffer, 0);
10963 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010964 xmlResetLastError();
10965 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000010966 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000010967 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010968 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000010969 printf(" %d", n_buffer);
10970 printf(" %d", n_size);
10971 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000010972 }
10973 }
10974 }
10975
Daniel Veillard3d97e662004-11-04 10:49:00 +000010976 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010978}
10979
10980
Daniel Veillardce682bc2004-11-05 17:22:25 +000010981#define gen_nb_const_xmlParserNodeInfoPtr 1
10982static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10983 return(NULL);
10984}
10985static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10986}
10987
Daniel Veillardd93f6252004-11-02 15:53:51 +000010988static int
10989test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010991
Daniel Veillardce682bc2004-11-05 17:22:25 +000010992 int mem_base;
10993 xmlParserCtxtPtr ctxt; /* an XML parser context */
10994 int n_ctxt;
10995 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
10996 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010997
Daniel Veillardce682bc2004-11-05 17:22:25 +000010998 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
10999 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
11000 mem_base = xmlMemBlocks();
11001 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
11002 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
11003
11004 xmlParserAddNodeInfo(ctxt, info);
11005 call_tests++;
11006 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
11007 des_const_xmlParserNodeInfoPtr(n_info, info, 1);
11008 xmlResetLastError();
11009 if (mem_base != xmlMemBlocks()) {
11010 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
11011 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011012 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011013 printf(" %d", n_ctxt);
11014 printf(" %d", n_info);
11015 printf("\n");
11016 }
11017 }
11018 }
11019
11020 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011021 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011022}
11023
11024
Daniel Veillardce682bc2004-11-05 17:22:25 +000011025#define gen_nb_const_xmlParserCtxtPtr 1
11026static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11027 return(NULL);
11028}
11029static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11030}
11031
Daniel Veillardd93f6252004-11-02 15:53:51 +000011032static int
11033test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011035
11036
11037 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011039}
11040
11041
Daniel Veillardce682bc2004-11-05 17:22:25 +000011042#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
11043static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11044 return(NULL);
11045}
11046static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11047}
11048
Daniel Veillardd93f6252004-11-02 15:53:51 +000011049static int
11050test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011052
11053
11054 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011056}
11057
11058
Daniel Veillardce682bc2004-11-05 17:22:25 +000011059#define gen_nb_xmlParserInputPtr 1
11060static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11061 return(NULL);
11062}
11063static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11064}
11065
Daniel Veillardd93f6252004-11-02 15:53:51 +000011066static int
11067test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011069
Daniel Veillardce682bc2004-11-05 17:22:25 +000011070 int mem_base;
11071 int ret_val;
11072 xmlParserInputPtr in; /* an XML parser input */
11073 int n_in;
11074 int len; /* an indicative size for the lookahead */
11075 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011076
Daniel Veillardce682bc2004-11-05 17:22:25 +000011077 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
11078 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11079 mem_base = xmlMemBlocks();
11080 in = gen_xmlParserInputPtr(n_in, 0);
11081 len = gen_int(n_len, 1);
11082
11083 ret_val = xmlParserInputGrow(in, len);
11084 desret_int(ret_val);
11085 call_tests++;
11086 des_xmlParserInputPtr(n_in, in, 0);
11087 des_int(n_len, len, 1);
11088 xmlResetLastError();
11089 if (mem_base != xmlMemBlocks()) {
11090 printf("Leak of %d blocks found in xmlParserInputGrow",
11091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011092 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011093 printf(" %d", n_in);
11094 printf(" %d", n_len);
11095 printf("\n");
11096 }
11097 }
11098 }
11099
11100 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011102}
11103
11104
11105static int
11106test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011108
Daniel Veillardce682bc2004-11-05 17:22:25 +000011109 int mem_base;
11110 int ret_val;
11111 xmlParserInputPtr in; /* an XML parser input */
11112 int n_in;
11113 int len; /* an indicative size for the lookahead */
11114 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011115
Daniel Veillardce682bc2004-11-05 17:22:25 +000011116 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
11117 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11118 mem_base = xmlMemBlocks();
11119 in = gen_xmlParserInputPtr(n_in, 0);
11120 len = gen_int(n_len, 1);
11121
11122 ret_val = xmlParserInputRead(in, len);
11123 desret_int(ret_val);
11124 call_tests++;
11125 des_xmlParserInputPtr(n_in, in, 0);
11126 des_int(n_len, len, 1);
11127 xmlResetLastError();
11128 if (mem_base != xmlMemBlocks()) {
11129 printf("Leak of %d blocks found in xmlParserInputRead",
11130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011131 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011132 printf(" %d", n_in);
11133 printf(" %d", n_len);
11134 printf("\n");
11135 }
11136 }
11137 }
11138
11139 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011141}
11142
11143
11144static int
11145test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011147
11148 int mem_base;
11149 int ret_val;
11150 int val; /* int 0 or 1 */
11151 int n_val;
11152
11153 for (n_val = 0;n_val < gen_nb_int;n_val++) {
11154 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011155 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011156
11157 ret_val = xmlPedanticParserDefault(val);
11158 desret_int(ret_val);
11159 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011160 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011161 xmlResetLastError();
11162 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011163 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011165 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011166 printf(" %d", n_val);
11167 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011168 }
11169 }
11170
Daniel Veillard3d97e662004-11-04 10:49:00 +000011171 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011173}
11174
11175
11176static int
11177test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011179
11180 int mem_base;
11181 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011182 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011183 int n_cur;
11184 const char * URL; /* the base URL to use for the document */
11185 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011186 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011187 int n_encoding;
11188 int options; /* a combination of xmlParserOption */
11189 int n_options;
11190
11191 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
11192 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11193 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
11194 for (n_options = 0;n_options < gen_nb_int;n_options++) {
11195 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011196 cur = gen_const_xmlChar_ptr(n_cur, 0);
11197 URL = gen_filepath(n_URL, 1);
11198 encoding = gen_const_char_ptr(n_encoding, 2);
11199 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011200
11201 ret_val = xmlReadDoc(cur, URL, encoding, options);
11202 desret_xmlDocPtr(ret_val);
11203 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011204 des_const_xmlChar_ptr(n_cur, cur, 0);
11205 des_filepath(n_URL, URL, 1);
11206 des_const_char_ptr(n_encoding, encoding, 2);
11207 des_int(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011208 xmlResetLastError();
11209 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011210 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011212 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011213 printf(" %d", n_cur);
11214 printf(" %d", n_URL);
11215 printf(" %d", n_encoding);
11216 printf(" %d", n_options);
11217 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011218 }
11219 }
11220 }
11221 }
11222 }
11223
Daniel Veillard3d97e662004-11-04 10:49:00 +000011224 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011226}
11227
11228
11229static int
11230test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011232
11233 int mem_base;
11234 xmlDocPtr ret_val;
11235 const char * filename; /* a file or URL */
11236 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011237 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011238 int n_encoding;
11239 int options; /* a combination of xmlParserOption */
11240 int n_options;
11241
11242 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11243 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
11244 for (n_options = 0;n_options < gen_nb_int;n_options++) {
11245 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011246 filename = gen_filepath(n_filename, 0);
11247 encoding = gen_const_char_ptr(n_encoding, 1);
11248 options = gen_int(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011249
11250 ret_val = xmlReadFile(filename, encoding, options);
11251 desret_xmlDocPtr(ret_val);
11252 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011253 des_filepath(n_filename, filename, 0);
11254 des_const_char_ptr(n_encoding, encoding, 1);
11255 des_int(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011256 xmlResetLastError();
11257 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011258 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011259 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011260 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011261 printf(" %d", n_filename);
11262 printf(" %d", n_encoding);
11263 printf(" %d", n_options);
11264 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011265 }
11266 }
11267 }
11268 }
11269
Daniel Veillard3d97e662004-11-04 10:49:00 +000011270 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011272}
11273
11274
11275static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011276test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011277 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011278
11279 int mem_base;
11280 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011281 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011282 int n_buffer;
11283 int size; /* the size of the array */
11284 int n_size;
11285 const char * URL; /* the base URL to use for the document */
11286 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011287 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011288 int n_encoding;
11289 int options; /* a combination of xmlParserOption */
11290 int n_options;
11291
11292 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
11293 for (n_size = 0;n_size < gen_nb_int;n_size++) {
11294 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11295 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
11296 for (n_options = 0;n_options < gen_nb_int;n_options++) {
11297 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011298 buffer = gen_const_char_ptr(n_buffer, 0);
11299 size = gen_int(n_size, 1);
11300 URL = gen_filepath(n_URL, 2);
11301 encoding = gen_const_char_ptr(n_encoding, 3);
11302 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011303
11304 ret_val = xmlReadMemory(buffer, size, URL, encoding, options);
11305 desret_xmlDocPtr(ret_val);
11306 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011307 des_const_char_ptr(n_buffer, buffer, 0);
11308 des_int(n_size, size, 1);
11309 des_filepath(n_URL, URL, 2);
11310 des_const_char_ptr(n_encoding, encoding, 3);
11311 des_int(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011312 xmlResetLastError();
11313 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011314 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011316 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011317 printf(" %d", n_buffer);
11318 printf(" %d", n_size);
11319 printf(" %d", n_URL);
11320 printf(" %d", n_encoding);
11321 printf(" %d", n_options);
11322 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011323 }
11324 }
11325 }
11326 }
11327 }
11328 }
11329
Daniel Veillard3d97e662004-11-04 10:49:00 +000011330 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011331 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011332}
11333
11334
11335static int
11336test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011337 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011338
Daniel Veillard8a32fe42004-11-02 22:10:16 +000011339 int mem_base;
11340 xmlDocPtr ret_val;
11341 xmlChar * cur; /* a pointer to an array of xmlChar */
11342 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011343
Daniel Veillard8a32fe42004-11-02 22:10:16 +000011344 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
11345 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011346 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000011347
11348 ret_val = xmlRecoverDoc(cur);
11349 desret_xmlDocPtr(ret_val);
11350 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011351 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000011352 xmlResetLastError();
11353 if (mem_base != xmlMemBlocks()) {
11354 printf("Leak of %d blocks found in xmlRecoverDoc",
11355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011356 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000011357 printf(" %d", n_cur);
11358 printf("\n");
11359 }
11360 }
11361
Daniel Veillard3d97e662004-11-04 10:49:00 +000011362 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011364}
11365
11366
11367static int
11368test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011370
11371 int mem_base;
11372 xmlDocPtr ret_val;
11373 const char * filename; /* the filename */
11374 int n_filename;
11375
11376 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11377 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011378 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011379
11380 ret_val = xmlRecoverFile(filename);
11381 desret_xmlDocPtr(ret_val);
11382 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011383 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011384 xmlResetLastError();
11385 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011386 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011387 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011388 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011389 printf(" %d", n_filename);
11390 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011391 }
11392 }
11393
Daniel Veillard3d97e662004-11-04 10:49:00 +000011394 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011395 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011396}
11397
11398
11399static int
11400test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011401 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011402
11403 int mem_base;
11404 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011405 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011406 int n_buffer;
11407 int size; /* the size of the array */
11408 int n_size;
11409
11410 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
11411 for (n_size = 0;n_size < gen_nb_int;n_size++) {
11412 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011413 buffer = gen_const_char_ptr(n_buffer, 0);
11414 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011415
11416 ret_val = xmlRecoverMemory(buffer, size);
11417 desret_xmlDocPtr(ret_val);
11418 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011419 des_const_char_ptr(n_buffer, buffer, 0);
11420 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011421 xmlResetLastError();
11422 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011423 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011425 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011426 printf(" %d", n_buffer);
11427 printf(" %d", n_size);
11428 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011429 }
11430 }
11431 }
11432
Daniel Veillard3d97e662004-11-04 10:49:00 +000011433 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011435}
11436
11437
11438static int
11439test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011441
Daniel Veillard34099b42004-11-04 17:34:35 +000011442 int mem_base;
11443 xmlDtdPtr ret_val;
11444 xmlSAXHandlerPtr sax; /* the SAX handler block */
11445 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011446 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000011447 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011448 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000011449 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011450
Daniel Veillard34099b42004-11-04 17:34:35 +000011451 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
11452 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
11453 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
11454 mem_base = xmlMemBlocks();
11455 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
11456 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
11457 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
11458
11459 ret_val = xmlSAXParseDTD(sax, ExternalID, SystemID);
11460 desret_xmlDtdPtr(ret_val);
11461 call_tests++;
11462 des_xmlSAXHandlerPtr(n_sax, sax, 0);
11463 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
11464 des_const_xmlChar_ptr(n_SystemID, SystemID, 2);
11465 xmlResetLastError();
11466 if (mem_base != xmlMemBlocks()) {
11467 printf("Leak of %d blocks found in xmlSAXParseDTD",
11468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011469 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000011470 printf(" %d", n_sax);
11471 printf(" %d", n_ExternalID);
11472 printf(" %d", n_SystemID);
11473 printf("\n");
11474 }
11475 }
11476 }
11477 }
11478
11479 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011481}
11482
11483
11484static int
11485test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011487
Daniel Veillard34099b42004-11-04 17:34:35 +000011488 int mem_base;
11489 xmlDocPtr ret_val;
11490 xmlSAXHandlerPtr sax; /* the SAX handler block */
11491 int n_sax;
11492 xmlChar * cur; /* a pointer to an array of xmlChar */
11493 int n_cur;
11494 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
11495 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011496
Daniel Veillard34099b42004-11-04 17:34:35 +000011497 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
11498 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
11499 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
11500 mem_base = xmlMemBlocks();
11501 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
11502 cur = gen_xmlChar_ptr(n_cur, 1);
11503 recovery = gen_int(n_recovery, 2);
11504
11505 ret_val = xmlSAXParseDoc(sax, cur, recovery);
11506 desret_xmlDocPtr(ret_val);
11507 call_tests++;
11508 des_xmlSAXHandlerPtr(n_sax, sax, 0);
11509 des_xmlChar_ptr(n_cur, cur, 1);
11510 des_int(n_recovery, recovery, 2);
11511 xmlResetLastError();
11512 if (mem_base != xmlMemBlocks()) {
11513 printf("Leak of %d blocks found in xmlSAXParseDoc",
11514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011515 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000011516 printf(" %d", n_sax);
11517 printf(" %d", n_cur);
11518 printf(" %d", n_recovery);
11519 printf("\n");
11520 }
11521 }
11522 }
11523 }
11524
11525 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011527}
11528
11529
11530static int
11531test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011533
Daniel Veillard34099b42004-11-04 17:34:35 +000011534 int mem_base;
11535 xmlDocPtr ret_val;
11536 xmlSAXHandlerPtr sax; /* the SAX handler block */
11537 int n_sax;
11538 const char * filename; /* the filename */
11539 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011540
Daniel Veillard34099b42004-11-04 17:34:35 +000011541 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
11542 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11543 mem_base = xmlMemBlocks();
11544 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
11545 filename = gen_filepath(n_filename, 1);
11546
11547 ret_val = xmlSAXParseEntity(sax, filename);
11548 desret_xmlDocPtr(ret_val);
11549 call_tests++;
11550 des_xmlSAXHandlerPtr(n_sax, sax, 0);
11551 des_filepath(n_filename, filename, 1);
11552 xmlResetLastError();
11553 if (mem_base != xmlMemBlocks()) {
11554 printf("Leak of %d blocks found in xmlSAXParseEntity",
11555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011556 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000011557 printf(" %d", n_sax);
11558 printf(" %d", n_filename);
11559 printf("\n");
11560 }
11561 }
11562 }
11563
11564 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011565 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011566}
11567
11568
11569static int
11570test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011571 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011572
Daniel Veillard34099b42004-11-04 17:34:35 +000011573 int mem_base;
11574 xmlDocPtr ret_val;
11575 xmlSAXHandlerPtr sax; /* the SAX handler block */
11576 int n_sax;
11577 const char * filename; /* the filename */
11578 int n_filename;
11579 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
11580 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011581
Daniel Veillard34099b42004-11-04 17:34:35 +000011582 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
11583 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11584 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
11585 mem_base = xmlMemBlocks();
11586 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
11587 filename = gen_filepath(n_filename, 1);
11588 recovery = gen_int(n_recovery, 2);
11589
11590 ret_val = xmlSAXParseFile(sax, filename, recovery);
11591 desret_xmlDocPtr(ret_val);
11592 call_tests++;
11593 des_xmlSAXHandlerPtr(n_sax, sax, 0);
11594 des_filepath(n_filename, filename, 1);
11595 des_int(n_recovery, recovery, 2);
11596 xmlResetLastError();
11597 if (mem_base != xmlMemBlocks()) {
11598 printf("Leak of %d blocks found in xmlSAXParseFile",
11599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011600 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000011601 printf(" %d", n_sax);
11602 printf(" %d", n_filename);
11603 printf(" %d", n_recovery);
11604 printf("\n");
11605 }
11606 }
11607 }
11608 }
11609
11610 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011612}
11613
11614
11615static int
11616test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011618
Daniel Veillard34099b42004-11-04 17:34:35 +000011619 int mem_base;
11620 xmlDocPtr ret_val;
11621 xmlSAXHandlerPtr sax; /* the SAX handler block */
11622 int n_sax;
11623 const char * filename; /* the filename */
11624 int n_filename;
11625 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
11626 int n_recovery;
11627 void * data; /* the userdata */
11628 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011629
Daniel Veillard34099b42004-11-04 17:34:35 +000011630 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
11631 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11632 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
11633 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11634 mem_base = xmlMemBlocks();
11635 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
11636 filename = gen_filepath(n_filename, 1);
11637 recovery = gen_int(n_recovery, 2);
11638 data = gen_userdata(n_data, 3);
11639
11640 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
11641 desret_xmlDocPtr(ret_val);
11642 call_tests++;
11643 des_xmlSAXHandlerPtr(n_sax, sax, 0);
11644 des_filepath(n_filename, filename, 1);
11645 des_int(n_recovery, recovery, 2);
11646 des_userdata(n_data, data, 3);
11647 xmlResetLastError();
11648 if (mem_base != xmlMemBlocks()) {
11649 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
11650 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011651 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000011652 printf(" %d", n_sax);
11653 printf(" %d", n_filename);
11654 printf(" %d", n_recovery);
11655 printf(" %d", n_data);
11656 printf("\n");
11657 }
11658 }
11659 }
11660 }
11661 }
11662
11663 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011664 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011665}
11666
11667
11668static int
11669test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011670 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011671
Daniel Veillard34099b42004-11-04 17:34:35 +000011672 int mem_base;
11673 xmlDocPtr ret_val;
11674 xmlSAXHandlerPtr sax; /* the SAX handler block */
11675 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011676 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000011677 int n_buffer;
11678 int size; /* the size of the array */
11679 int n_size;
11680 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
11681 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011682
Daniel Veillard34099b42004-11-04 17:34:35 +000011683 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
11684 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
11685 for (n_size = 0;n_size < gen_nb_int;n_size++) {
11686 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
11687 mem_base = xmlMemBlocks();
11688 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
11689 buffer = gen_const_char_ptr(n_buffer, 1);
11690 size = gen_int(n_size, 2);
11691 recovery = gen_int(n_recovery, 3);
11692
11693 ret_val = xmlSAXParseMemory(sax, buffer, size, recovery);
11694 desret_xmlDocPtr(ret_val);
11695 call_tests++;
11696 des_xmlSAXHandlerPtr(n_sax, sax, 0);
11697 des_const_char_ptr(n_buffer, buffer, 1);
11698 des_int(n_size, size, 2);
11699 des_int(n_recovery, recovery, 3);
11700 xmlResetLastError();
11701 if (mem_base != xmlMemBlocks()) {
11702 printf("Leak of %d blocks found in xmlSAXParseMemory",
11703 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011704 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000011705 printf(" %d", n_sax);
11706 printf(" %d", n_buffer);
11707 printf(" %d", n_size);
11708 printf(" %d", n_recovery);
11709 printf("\n");
11710 }
11711 }
11712 }
11713 }
11714 }
11715
11716 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011717 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011718}
11719
11720
11721static int
11722test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011723 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011724
Daniel Veillard34099b42004-11-04 17:34:35 +000011725 int mem_base;
11726 xmlDocPtr ret_val;
11727 xmlSAXHandlerPtr sax; /* the SAX handler block */
11728 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011729 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000011730 int n_buffer;
11731 int size; /* the size of the array */
11732 int n_size;
11733 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
11734 int n_recovery;
11735 void * data; /* the userdata */
11736 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011737
Daniel Veillard34099b42004-11-04 17:34:35 +000011738 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
11739 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
11740 for (n_size = 0;n_size < gen_nb_int;n_size++) {
11741 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
11742 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11743 mem_base = xmlMemBlocks();
11744 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
11745 buffer = gen_const_char_ptr(n_buffer, 1);
11746 size = gen_int(n_size, 2);
11747 recovery = gen_int(n_recovery, 3);
11748 data = gen_userdata(n_data, 4);
11749
11750 ret_val = xmlSAXParseMemoryWithData(sax, buffer, size, recovery, data);
11751 desret_xmlDocPtr(ret_val);
11752 call_tests++;
11753 des_xmlSAXHandlerPtr(n_sax, sax, 0);
11754 des_const_char_ptr(n_buffer, buffer, 1);
11755 des_int(n_size, size, 2);
11756 des_int(n_recovery, recovery, 3);
11757 des_userdata(n_data, data, 4);
11758 xmlResetLastError();
11759 if (mem_base != xmlMemBlocks()) {
11760 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
11761 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011762 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000011763 printf(" %d", n_sax);
11764 printf(" %d", n_buffer);
11765 printf(" %d", n_size);
11766 printf(" %d", n_recovery);
11767 printf(" %d", n_data);
11768 printf("\n");
11769 }
11770 }
11771 }
11772 }
11773 }
11774 }
11775
11776 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011778}
11779
11780
11781static int
11782test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011784
Daniel Veillard34099b42004-11-04 17:34:35 +000011785 int mem_base;
11786 int ret_val;
11787 xmlSAXHandlerPtr sax; /* a SAX handler */
11788 int n_sax;
11789 void * user_data; /* The user data returned on SAX callbacks */
11790 int n_user_data;
11791 const char * filename; /* a file name */
11792 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011793
Daniel Veillard34099b42004-11-04 17:34:35 +000011794 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
11795 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
11796 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11797 mem_base = xmlMemBlocks();
11798 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
11799 user_data = gen_userdata(n_user_data, 1);
11800 filename = gen_filepath(n_filename, 2);
Daniel Veillardce244ad2004-11-05 10:03:46 +000011801 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillard34099b42004-11-04 17:34:35 +000011802
11803 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
11804 desret_int(ret_val);
11805 call_tests++;
11806 des_xmlSAXHandlerPtr(n_sax, sax, 0);
11807 des_userdata(n_user_data, user_data, 1);
11808 des_filepath(n_filename, filename, 2);
11809 xmlResetLastError();
11810 if (mem_base != xmlMemBlocks()) {
11811 printf("Leak of %d blocks found in xmlSAXUserParseFile",
11812 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011813 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000011814 printf(" %d", n_sax);
11815 printf(" %d", n_user_data);
11816 printf(" %d", n_filename);
11817 printf("\n");
11818 }
11819 }
11820 }
11821 }
11822
11823 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011824 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011825}
11826
11827
11828static int
11829test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011830 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011831
Daniel Veillard34099b42004-11-04 17:34:35 +000011832 int mem_base;
11833 int ret_val;
11834 xmlSAXHandlerPtr sax; /* a SAX handler */
11835 int n_sax;
11836 void * user_data; /* The user data returned on SAX callbacks */
11837 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011838 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000011839 int n_buffer;
11840 int size; /* the length of the XML document in bytes */
11841 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011842
Daniel Veillard34099b42004-11-04 17:34:35 +000011843 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
11844 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
11845 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
11846 for (n_size = 0;n_size < gen_nb_int;n_size++) {
11847 mem_base = xmlMemBlocks();
11848 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
11849 user_data = gen_userdata(n_user_data, 1);
11850 buffer = gen_const_char_ptr(n_buffer, 2);
11851 size = gen_int(n_size, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000011852 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillard34099b42004-11-04 17:34:35 +000011853
11854 ret_val = xmlSAXUserParseMemory(sax, user_data, buffer, size);
11855 desret_int(ret_val);
11856 call_tests++;
11857 des_xmlSAXHandlerPtr(n_sax, sax, 0);
11858 des_userdata(n_user_data, user_data, 1);
11859 des_const_char_ptr(n_buffer, buffer, 2);
11860 des_int(n_size, size, 3);
11861 xmlResetLastError();
11862 if (mem_base != xmlMemBlocks()) {
11863 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
11864 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011865 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000011866 printf(" %d", n_sax);
11867 printf(" %d", n_user_data);
11868 printf(" %d", n_buffer);
11869 printf(" %d", n_size);
11870 printf("\n");
11871 }
11872 }
11873 }
11874 }
11875 }
11876
11877 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011879}
11880
11881
11882static int
11883test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011885
11886
11887 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011889}
11890
11891
11892static int
11893test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011895
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011896 int mem_base;
11897 int ret_val;
11898 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
11899 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011900 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011901 int n_name;
11902 void * value; /* pointer to the location of the new value */
11903 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011904
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011905 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
11906 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
11907 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
11908 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011909 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
11910 name = gen_const_char_ptr(n_name, 1);
11911 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011912
11913 ret_val = xmlSetFeature(ctxt, name, value);
11914 desret_int(ret_val);
11915 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011916 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
11917 des_const_char_ptr(n_name, name, 1);
11918 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011919 xmlResetLastError();
11920 if (mem_base != xmlMemBlocks()) {
11921 printf("Leak of %d blocks found in xmlSetFeature",
11922 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011923 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011924 printf(" %d", n_ctxt);
11925 printf(" %d", n_name);
11926 printf(" %d", n_value);
11927 printf("\n");
11928 }
11929 }
11930 }
11931 }
11932
Daniel Veillard3d97e662004-11-04 10:49:00 +000011933 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011935}
11936
11937
11938static int
11939test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011941
11942 int mem_base;
11943 xmlParserCtxtPtr ctxt; /* an XML parser context */
11944 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011945 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011946 int n_buffer;
11947 const char * filename; /* a file name */
11948 int n_filename;
11949
11950 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
11951 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
11952 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11953 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011954 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
11955 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
11956 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011957
11958 xmlSetupParserForBuffer(ctxt, buffer, filename);
11959 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011960 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
11961 des_const_xmlChar_ptr(n_buffer, buffer, 1);
11962 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011963 xmlResetLastError();
11964 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011965 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011967 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011968 printf(" %d", n_ctxt);
11969 printf(" %d", n_buffer);
11970 printf(" %d", n_filename);
11971 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011972 }
11973 }
11974 }
11975 }
11976
Daniel Veillard3d97e662004-11-04 10:49:00 +000011977 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011979}
11980
11981
11982static int
11983test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011985
11986 int mem_base;
11987 xmlParserCtxtPtr ctxt; /* an XML parser context */
11988 int n_ctxt;
11989
11990 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
11991 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011992 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011993
11994 xmlStopParser(ctxt);
11995 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011996 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011997 xmlResetLastError();
11998 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011999 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012000 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012001 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012002 printf(" %d", n_ctxt);
12003 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012004 }
12005 }
12006
Daniel Veillard3d97e662004-11-04 10:49:00 +000012007 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012008 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012009}
12010
12011
12012static int
12013test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012015
12016 int mem_base;
12017 int ret_val;
12018 int val; /* int 0 or 1 */
12019 int n_val;
12020
12021 for (n_val = 0;n_val < gen_nb_int;n_val++) {
12022 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012023 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012024
12025 ret_val = xmlSubstituteEntitiesDefault(val);
12026 desret_int(ret_val);
12027 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012028 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012029 xmlResetLastError();
12030 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012031 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012032 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012033 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012034 printf(" %d", n_val);
12035 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012036 }
12037 }
12038
Daniel Veillard3d97e662004-11-04 10:49:00 +000012039 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012041}
12042
12043static int
12044test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012045 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012046
Daniel Veillard42595322004-11-08 10:52:06 +000012047 printf("Testing parser : 58 of 69 functions ...\n");
12048 test_ret += test_xmlByteConsumed();
12049 test_ret += test_xmlClearNodeInfoSeq();
12050 test_ret += test_xmlClearParserCtxt();
12051 test_ret += test_xmlCreateDocParserCtxt();
12052 test_ret += test_xmlCreatePushParserCtxt();
12053 test_ret += test_xmlCtxtReadDoc();
12054 test_ret += test_xmlCtxtReadFile();
12055 test_ret += test_xmlCtxtReadMemory();
12056 test_ret += test_xmlCtxtReset();
12057 test_ret += test_xmlCtxtResetPush();
12058 test_ret += test_xmlCtxtUseOptions();
12059 test_ret += test_xmlGetExternalEntityLoader();
12060 test_ret += test_xmlGetFeature();
12061 test_ret += test_xmlGetFeaturesList();
12062 test_ret += test_xmlIOParseDTD();
12063 test_ret += test_xmlInitNodeInfoSeq();
12064 test_ret += test_xmlInitParser();
12065 test_ret += test_xmlInitParserCtxt();
12066 test_ret += test_xmlKeepBlanksDefault();
12067 test_ret += test_xmlLineNumbersDefault();
12068 test_ret += test_xmlLoadExternalEntity();
12069 test_ret += test_xmlNewIOInputStream();
12070 test_ret += test_xmlNewParserCtxt();
12071 test_ret += test_xmlParseBalancedChunkMemory();
12072 test_ret += test_xmlParseBalancedChunkMemoryRecover();
12073 test_ret += test_xmlParseChunk();
12074 test_ret += test_xmlParseCtxtExternalEntity();
12075 test_ret += test_xmlParseDTD();
12076 test_ret += test_xmlParseDoc();
12077 test_ret += test_xmlParseDocument();
12078 test_ret += test_xmlParseEntity();
12079 test_ret += test_xmlParseExtParsedEnt();
12080 test_ret += test_xmlParseExternalEntity();
12081 test_ret += test_xmlParseFile();
12082 test_ret += test_xmlParseInNodeContext();
12083 test_ret += test_xmlParseMemory();
12084 test_ret += test_xmlParserAddNodeInfo();
12085 test_ret += test_xmlParserFindNodeInfo();
12086 test_ret += test_xmlParserFindNodeInfoIndex();
12087 test_ret += test_xmlParserInputGrow();
12088 test_ret += test_xmlParserInputRead();
12089 test_ret += test_xmlPedanticParserDefault();
12090 test_ret += test_xmlReadDoc();
12091 test_ret += test_xmlReadFile();
12092 test_ret += test_xmlReadMemory();
12093 test_ret += test_xmlRecoverDoc();
12094 test_ret += test_xmlRecoverFile();
12095 test_ret += test_xmlRecoverMemory();
12096 test_ret += test_xmlSAXParseDTD();
12097 test_ret += test_xmlSAXParseDoc();
12098 test_ret += test_xmlSAXParseEntity();
12099 test_ret += test_xmlSAXParseFile();
12100 test_ret += test_xmlSAXParseFileWithData();
12101 test_ret += test_xmlSAXParseMemory();
12102 test_ret += test_xmlSAXParseMemoryWithData();
12103 test_ret += test_xmlSAXUserParseFile();
12104 test_ret += test_xmlSAXUserParseMemory();
12105 test_ret += test_xmlSetExternalEntityLoader();
12106 test_ret += test_xmlSetFeature();
12107 test_ret += test_xmlSetupParserForBuffer();
12108 test_ret += test_xmlStopParser();
12109 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012110
Daniel Veillard42595322004-11-08 10:52:06 +000012111 if (test_ret != 0)
12112 printf("Module parser: %d errors\n", test_ret);
12113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012114}
12115
Daniel Veillardce682bc2004-11-05 17:22:25 +000012116#define gen_nb_xmlPatternPtr 1
12117static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12118 return(NULL);
12119}
12120static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12121}
12122
Daniel Veillardd93f6252004-11-02 15:53:51 +000012123static int
12124test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012126
Daniel Veillardce682bc2004-11-05 17:22:25 +000012127#ifdef LIBXML_PATTERN_ENABLED
12128 int mem_base;
12129 int ret_val;
12130 xmlPatternPtr comp; /* the precompiled pattern */
12131 int n_comp;
12132 xmlNodePtr node; /* a node */
12133 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012134
Daniel Veillardce682bc2004-11-05 17:22:25 +000012135 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
12136 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
12137 mem_base = xmlMemBlocks();
12138 comp = gen_xmlPatternPtr(n_comp, 0);
12139 node = gen_xmlNodePtr(n_node, 1);
12140
12141 ret_val = xmlPatternMatch(comp, node);
12142 desret_int(ret_val);
12143 call_tests++;
12144 des_xmlPatternPtr(n_comp, comp, 0);
12145 des_xmlNodePtr(n_node, node, 1);
12146 xmlResetLastError();
12147 if (mem_base != xmlMemBlocks()) {
12148 printf("Leak of %d blocks found in xmlPatternMatch",
12149 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012150 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012151 printf(" %d", n_comp);
12152 printf(" %d", n_node);
12153 printf("\n");
12154 }
12155 }
12156 }
12157#endif
12158
12159 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012160 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012161}
12162
12163
12164static int
12165test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012166 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012167
12168
12169 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012171}
12172
12173static int
12174test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012176
Daniel Veillardce682bc2004-11-05 17:22:25 +000012177 printf("Testing pattern : 1 of 4 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012178 test_ret += test_xmlPatternMatch();
12179 test_ret += test_xmlPatterncompile();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012180
Daniel Veillard42595322004-11-08 10:52:06 +000012181 if (test_ret != 0)
12182 printf("Module pattern: %d errors\n", test_ret);
12183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012184}
12185
Daniel Veillardce682bc2004-11-05 17:22:25 +000012186#define gen_nb_xmlRelaxNGPtr 1
12187static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12188 return(NULL);
12189}
12190static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12191}
12192
Daniel Veillardd93f6252004-11-02 15:53:51 +000012193static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012194test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012195 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012196
Daniel Veillardce682bc2004-11-05 17:22:25 +000012197#ifdef LIBXML_SCHEMAS_ENABLED
12198#ifdef LIBXML_OUTPUT_ENABLED
12199 int mem_base;
12200 FILE * output; /* the file output */
12201 int n_output;
12202 xmlRelaxNGPtr schema; /* a schema structure */
12203 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012204
Daniel Veillardce682bc2004-11-05 17:22:25 +000012205 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
12206 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
12207 mem_base = xmlMemBlocks();
12208 output = gen_FILE_ptr(n_output, 0);
12209 schema = gen_xmlRelaxNGPtr(n_schema, 1);
12210
12211 xmlRelaxNGDump(output, schema);
12212 call_tests++;
12213 des_FILE_ptr(n_output, output, 0);
12214 des_xmlRelaxNGPtr(n_schema, schema, 1);
12215 xmlResetLastError();
12216 if (mem_base != xmlMemBlocks()) {
12217 printf("Leak of %d blocks found in xmlRelaxNGDump",
12218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012219 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012220 printf(" %d", n_output);
12221 printf(" %d", n_schema);
12222 printf("\n");
12223 }
12224 }
12225 }
12226#endif
12227#endif
12228
12229 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012231}
12232
12233
12234static int
12235test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012237
Daniel Veillardce682bc2004-11-05 17:22:25 +000012238#ifdef LIBXML_SCHEMAS_ENABLED
12239#ifdef LIBXML_OUTPUT_ENABLED
12240 int mem_base;
12241 FILE * output; /* the file output */
12242 int n_output;
12243 xmlRelaxNGPtr schema; /* a schema structure */
12244 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012245
Daniel Veillardce682bc2004-11-05 17:22:25 +000012246 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
12247 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
12248 mem_base = xmlMemBlocks();
12249 output = gen_FILE_ptr(n_output, 0);
12250 schema = gen_xmlRelaxNGPtr(n_schema, 1);
12251
12252 xmlRelaxNGDumpTree(output, schema);
12253 call_tests++;
12254 des_FILE_ptr(n_output, output, 0);
12255 des_xmlRelaxNGPtr(n_schema, schema, 1);
12256 xmlResetLastError();
12257 if (mem_base != xmlMemBlocks()) {
12258 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
12259 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012260 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012261 printf(" %d", n_output);
12262 printf(" %d", n_schema);
12263 printf("\n");
12264 }
12265 }
12266 }
12267#endif
12268#endif
12269
12270 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012272}
12273
12274
Daniel Veillardce682bc2004-11-05 17:22:25 +000012275#define gen_nb_xmlRelaxNGParserCtxtPtr 1
12276static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12277 return(NULL);
12278}
12279static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12280}
12281
12282#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
12283static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12284 return(NULL);
12285}
12286static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12287}
12288
12289#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
12290static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12291 return(NULL);
12292}
12293static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12294}
12295
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012296#define gen_nb_void_ptr_ptr 1
12297static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12298 return(NULL);
12299}
12300static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12301}
12302
Daniel Veillardd93f6252004-11-02 15:53:51 +000012303static int
12304test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012306
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012307#ifdef LIBXML_SCHEMAS_ENABLED
12308 int mem_base;
12309 int ret_val;
12310 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
12311 int n_ctxt;
12312 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
12313 int n_err;
12314 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
12315 int n_warn;
12316 void ** ctx; /* contextual data for the callbacks result */
12317 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012318
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012319 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
12320 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
12321 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
12322 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
12323 mem_base = xmlMemBlocks();
12324 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
12325 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
12326 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
12327 ctx = gen_void_ptr_ptr(n_ctx, 3);
12328
12329 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
12330 desret_int(ret_val);
12331 call_tests++;
12332 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
12333 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
12334 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
12335 des_void_ptr_ptr(n_ctx, ctx, 3);
12336 xmlResetLastError();
12337 if (mem_base != xmlMemBlocks()) {
12338 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
12339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012340 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012341 printf(" %d", n_ctxt);
12342 printf(" %d", n_err);
12343 printf(" %d", n_warn);
12344 printf(" %d", n_ctx);
12345 printf("\n");
12346 }
12347 }
12348 }
12349 }
12350 }
12351#endif
12352
12353 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012355}
12356
12357
Daniel Veillardce682bc2004-11-05 17:22:25 +000012358#define gen_nb_xmlRelaxNGValidCtxtPtr 1
12359static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12360 return(NULL);
12361}
12362static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12363}
12364
Daniel Veillardd93f6252004-11-02 15:53:51 +000012365static int
12366test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012367 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012368
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012369#ifdef LIBXML_SCHEMAS_ENABLED
12370 int mem_base;
12371 int ret_val;
12372 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
12373 int n_ctxt;
12374 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
12375 int n_err;
12376 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
12377 int n_warn;
12378 void ** ctx; /* the functions context result */
12379 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012380
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012381 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
12382 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
12383 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
12384 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
12385 mem_base = xmlMemBlocks();
12386 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
12387 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
12388 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
12389 ctx = gen_void_ptr_ptr(n_ctx, 3);
12390
12391 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
12392 desret_int(ret_val);
12393 call_tests++;
12394 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
12395 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
12396 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
12397 des_void_ptr_ptr(n_ctx, ctx, 3);
12398 xmlResetLastError();
12399 if (mem_base != xmlMemBlocks()) {
12400 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
12401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012402 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012403 printf(" %d", n_ctxt);
12404 printf(" %d", n_err);
12405 printf(" %d", n_warn);
12406 printf(" %d", n_ctx);
12407 printf("\n");
12408 }
12409 }
12410 }
12411 }
12412 }
12413#endif
12414
12415 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012416 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012417}
12418
12419
12420static int
Daniel Veillard34099b42004-11-04 17:34:35 +000012421test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012422 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000012423
12424#ifdef LIBXML_SCHEMAS_ENABLED
12425 int mem_base;
12426 int ret_val;
12427
12428 mem_base = xmlMemBlocks();
12429
12430 ret_val = xmlRelaxNGInitTypes();
12431 desret_int(ret_val);
12432 call_tests++;
12433 xmlResetLastError();
12434 if (mem_base != xmlMemBlocks()) {
12435 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
12436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012437 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012438 printf("\n");
12439 }
12440#endif
12441
12442 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012443 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000012444}
12445
12446
12447static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012448test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012449 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012450
Daniel Veillard42595322004-11-08 10:52:06 +000012451#ifdef LIBXML_SCHEMAS_ENABLED
12452 int mem_base;
12453 xmlRelaxNGParserCtxtPtr ret_val;
12454 xmlDocPtr doc; /* a preparsed document tree */
12455 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012456
Daniel Veillard42595322004-11-08 10:52:06 +000012457 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
12458 mem_base = xmlMemBlocks();
12459 doc = gen_xmlDocPtr(n_doc, 0);
12460
12461 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
12462 desret_xmlRelaxNGParserCtxtPtr(ret_val);
12463 call_tests++;
12464 des_xmlDocPtr(n_doc, doc, 0);
12465 xmlResetLastError();
12466 if (mem_base != xmlMemBlocks()) {
12467 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
12468 xmlMemBlocks() - mem_base);
12469 test_ret++;
12470 printf(" %d", n_doc);
12471 printf("\n");
12472 }
12473 }
12474#endif
12475
12476 function_tests++;
12477 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012478}
12479
12480
12481static int
12482test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012483 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012484
Daniel Veillard42595322004-11-08 10:52:06 +000012485#ifdef LIBXML_SCHEMAS_ENABLED
12486 int mem_base;
12487 xmlRelaxNGParserCtxtPtr ret_val;
12488 char * buffer; /* a pointer to a char array containing the schemas */
12489 int n_buffer;
12490 int size; /* the size of the array */
12491 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012492
Daniel Veillard42595322004-11-08 10:52:06 +000012493 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12494 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12495 mem_base = xmlMemBlocks();
12496 buffer = gen_const_char_ptr(n_buffer, 0);
12497 size = gen_int(n_size, 1);
12498
12499 ret_val = xmlRelaxNGNewMemParserCtxt(buffer, size);
12500 desret_xmlRelaxNGParserCtxtPtr(ret_val);
12501 call_tests++;
12502 des_const_char_ptr(n_buffer, buffer, 0);
12503 des_int(n_size, size, 1);
12504 xmlResetLastError();
12505 if (mem_base != xmlMemBlocks()) {
12506 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
12507 xmlMemBlocks() - mem_base);
12508 test_ret++;
12509 printf(" %d", n_buffer);
12510 printf(" %d", n_size);
12511 printf("\n");
12512 }
12513 }
12514 }
12515#endif
12516
12517 function_tests++;
12518 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012519}
12520
12521
12522static int
12523test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012524 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012525
Daniel Veillard42595322004-11-08 10:52:06 +000012526#ifdef LIBXML_SCHEMAS_ENABLED
12527 int mem_base;
12528 xmlRelaxNGParserCtxtPtr ret_val;
12529 char * URL; /* the location of the schema */
12530 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012531
Daniel Veillard42595322004-11-08 10:52:06 +000012532 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
12533 mem_base = xmlMemBlocks();
12534 URL = gen_const_char_ptr(n_URL, 0);
12535
12536 ret_val = xmlRelaxNGNewParserCtxt(URL);
12537 desret_xmlRelaxNGParserCtxtPtr(ret_val);
12538 call_tests++;
12539 des_const_char_ptr(n_URL, URL, 0);
12540 xmlResetLastError();
12541 if (mem_base != xmlMemBlocks()) {
12542 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
12543 xmlMemBlocks() - mem_base);
12544 test_ret++;
12545 printf(" %d", n_URL);
12546 printf("\n");
12547 }
12548 }
12549#endif
12550
12551 function_tests++;
12552 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012553}
12554
12555
12556static int
12557test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012558 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012559
12560
12561 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012563}
12564
12565
12566static int
12567test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012569
12570
12571 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012573}
12574
12575
12576static int
12577test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012578 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012579
12580
12581 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012583}
12584
12585
12586static int
12587test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012589
12590
12591 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012593}
12594
12595
12596static int
12597test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012598 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012599
Daniel Veillardce682bc2004-11-05 17:22:25 +000012600#ifdef LIBXML_SCHEMAS_ENABLED
12601 int mem_base;
12602 int ret_val;
12603 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
12604 int n_ctxt;
12605 xmlDocPtr doc; /* a parsed document tree */
12606 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012607
Daniel Veillardce682bc2004-11-05 17:22:25 +000012608 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
12609 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
12610 mem_base = xmlMemBlocks();
12611 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
12612 doc = gen_xmlDocPtr(n_doc, 1);
12613
12614 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
12615 desret_int(ret_val);
12616 call_tests++;
12617 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
12618 des_xmlDocPtr(n_doc, doc, 1);
12619 xmlResetLastError();
12620 if (mem_base != xmlMemBlocks()) {
12621 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
12622 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012623 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012624 printf(" %d", n_ctxt);
12625 printf(" %d", n_doc);
12626 printf("\n");
12627 }
12628 }
12629 }
12630#endif
12631
12632 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012633 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012634}
12635
12636
12637static int
12638test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012639 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012640
Daniel Veillardce682bc2004-11-05 17:22:25 +000012641#ifdef LIBXML_SCHEMAS_ENABLED
12642 int mem_base;
12643 int ret_val;
12644 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
12645 int n_ctxt;
12646 xmlDocPtr doc; /* a document instance */
12647 int n_doc;
12648 xmlNodePtr elem; /* an element instance */
12649 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012650
Daniel Veillardce682bc2004-11-05 17:22:25 +000012651 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
12652 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
12653 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
12654 mem_base = xmlMemBlocks();
12655 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
12656 doc = gen_xmlDocPtr(n_doc, 1);
12657 elem = gen_xmlNodePtr(n_elem, 2);
12658
12659 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
12660 desret_int(ret_val);
12661 call_tests++;
12662 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
12663 des_xmlDocPtr(n_doc, doc, 1);
12664 des_xmlNodePtr(n_elem, elem, 2);
12665 xmlResetLastError();
12666 if (mem_base != xmlMemBlocks()) {
12667 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
12668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012669 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012670 printf(" %d", n_ctxt);
12671 printf(" %d", n_doc);
12672 printf(" %d", n_elem);
12673 printf("\n");
12674 }
12675 }
12676 }
12677 }
12678#endif
12679
12680 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012681 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012682}
12683
12684
12685static int
12686test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012688
Daniel Veillardce682bc2004-11-05 17:22:25 +000012689#ifdef LIBXML_SCHEMAS_ENABLED
12690 int mem_base;
12691 int ret_val;
12692 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
12693 int n_ctxt;
12694 xmlDocPtr doc; /* a document instance */
12695 int n_doc;
12696 xmlNodePtr elem; /* an element instance */
12697 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012698
Daniel Veillardce682bc2004-11-05 17:22:25 +000012699 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
12700 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
12701 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
12702 mem_base = xmlMemBlocks();
12703 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
12704 doc = gen_xmlDocPtr(n_doc, 1);
12705 elem = gen_xmlNodePtr(n_elem, 2);
12706
12707 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
12708 desret_int(ret_val);
12709 call_tests++;
12710 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
12711 des_xmlDocPtr(n_doc, doc, 1);
12712 des_xmlNodePtr(n_elem, elem, 2);
12713 xmlResetLastError();
12714 if (mem_base != xmlMemBlocks()) {
12715 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
12716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012717 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012718 printf(" %d", n_ctxt);
12719 printf(" %d", n_doc);
12720 printf(" %d", n_elem);
12721 printf("\n");
12722 }
12723 }
12724 }
12725 }
12726#endif
12727
12728 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012730}
12731
12732
12733static int
12734test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012735 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012736
Daniel Veillardce682bc2004-11-05 17:22:25 +000012737#ifdef LIBXML_SCHEMAS_ENABLED
12738 int mem_base;
12739 int ret_val;
12740 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
12741 int n_ctxt;
12742 xmlChar * data; /* some character data read */
12743 int n_data;
12744 int len; /* the lenght of the data */
12745 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012746
Daniel Veillardce682bc2004-11-05 17:22:25 +000012747 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
12748 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
12749 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12750 mem_base = xmlMemBlocks();
12751 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
12752 data = gen_const_xmlChar_ptr(n_data, 1);
12753 len = gen_int(n_len, 2);
12754
12755 ret_val = xmlRelaxNGValidatePushCData(ctxt, data, len);
12756 desret_int(ret_val);
12757 call_tests++;
12758 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
12759 des_const_xmlChar_ptr(n_data, data, 1);
12760 des_int(n_len, len, 2);
12761 xmlResetLastError();
12762 if (mem_base != xmlMemBlocks()) {
12763 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
12764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012765 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012766 printf(" %d", n_ctxt);
12767 printf(" %d", n_data);
12768 printf(" %d", n_len);
12769 printf("\n");
12770 }
12771 }
12772 }
12773 }
12774#endif
12775
12776 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012778}
12779
12780
12781static int
12782test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012784
Daniel Veillardce682bc2004-11-05 17:22:25 +000012785#ifdef LIBXML_SCHEMAS_ENABLED
12786 int mem_base;
12787 int ret_val;
12788 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
12789 int n_ctxt;
12790 xmlDocPtr doc; /* a document instance */
12791 int n_doc;
12792 xmlNodePtr elem; /* an element instance */
12793 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012794
Daniel Veillardce682bc2004-11-05 17:22:25 +000012795 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
12796 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
12797 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
12798 mem_base = xmlMemBlocks();
12799 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
12800 doc = gen_xmlDocPtr(n_doc, 1);
12801 elem = gen_xmlNodePtr(n_elem, 2);
12802
12803 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
12804 desret_int(ret_val);
12805 call_tests++;
12806 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
12807 des_xmlDocPtr(n_doc, doc, 1);
12808 des_xmlNodePtr(n_elem, elem, 2);
12809 xmlResetLastError();
12810 if (mem_base != xmlMemBlocks()) {
12811 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
12812 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012813 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012814 printf(" %d", n_ctxt);
12815 printf(" %d", n_doc);
12816 printf(" %d", n_elem);
12817 printf("\n");
12818 }
12819 }
12820 }
12821 }
12822#endif
12823
12824 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012825 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012826}
12827
12828
12829static int
12830test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012831 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012832
Daniel Veillardce682bc2004-11-05 17:22:25 +000012833#ifdef LIBXML_SCHEMAS_ENABLED
12834 int mem_base;
12835 int ret_val;
12836 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
12837 int n_ctxt;
12838 int flags; /* a set of flags values */
12839 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012840
Daniel Veillardce682bc2004-11-05 17:22:25 +000012841 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
12842 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
12843 mem_base = xmlMemBlocks();
12844 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
12845 flags = gen_int(n_flags, 1);
12846
12847 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
12848 desret_int(ret_val);
12849 call_tests++;
12850 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
12851 des_int(n_flags, flags, 1);
12852 xmlResetLastError();
12853 if (mem_base != xmlMemBlocks()) {
12854 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
12855 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012856 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012857 printf(" %d", n_ctxt);
12858 printf(" %d", n_flags);
12859 printf("\n");
12860 }
12861 }
12862 }
12863#endif
12864
12865 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012867}
12868
12869static int
12870test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012871 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012872
Daniel Veillard42595322004-11-08 10:52:06 +000012873 printf("Testing relaxng : 14 of 22 functions ...\n");
12874 test_ret += test_xmlRelaxNGDump();
12875 test_ret += test_xmlRelaxNGDumpTree();
12876 test_ret += test_xmlRelaxNGGetParserErrors();
12877 test_ret += test_xmlRelaxNGGetValidErrors();
12878 test_ret += test_xmlRelaxNGInitTypes();
12879 test_ret += test_xmlRelaxNGNewDocParserCtxt();
12880 test_ret += test_xmlRelaxNGNewMemParserCtxt();
12881 test_ret += test_xmlRelaxNGNewParserCtxt();
12882 test_ret += test_xmlRelaxNGNewValidCtxt();
12883 test_ret += test_xmlRelaxNGParse();
12884 test_ret += test_xmlRelaxNGSetParserErrors();
12885 test_ret += test_xmlRelaxNGSetValidErrors();
12886 test_ret += test_xmlRelaxNGValidateDoc();
12887 test_ret += test_xmlRelaxNGValidateFullElement();
12888 test_ret += test_xmlRelaxNGValidatePopElement();
12889 test_ret += test_xmlRelaxNGValidatePushCData();
12890 test_ret += test_xmlRelaxNGValidatePushElement();
12891 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012892
Daniel Veillard42595322004-11-08 10:52:06 +000012893 if (test_ret != 0)
12894 printf("Module relaxng: %d errors\n", test_ret);
12895 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012896}
12897static int
12898test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012900
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012901 printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012902
Daniel Veillard42595322004-11-08 10:52:06 +000012903 if (test_ret != 0)
12904 printf("Module schemasInternals: %d errors\n", test_ret);
12905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012906}
12907
12908static int
12909test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012910 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012911
12912 int mem_base;
12913 xmlNodePtr ret_val;
12914 xmlNodePtr parent; /* the parent node */
12915 int n_parent;
12916 xmlNodePtr cur; /* the child node */
12917 int n_cur;
12918
Daniel Veillarda03e3652004-11-02 18:45:30 +000012919 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012920 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
12921 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012922 parent = gen_xmlNodePtr(n_parent, 0);
12923 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012924
12925 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000012926 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000012927 desret_xmlNodePtr(ret_val);
12928 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012929 des_xmlNodePtr(n_parent, parent, 0);
12930 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012931 xmlResetLastError();
12932 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012933 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012934 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012935 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012936 printf(" %d", n_parent);
12937 printf(" %d", n_cur);
12938 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012939 }
12940 }
12941 }
12942
Daniel Veillard3d97e662004-11-04 10:49:00 +000012943 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012944 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012945}
12946
12947
12948static int
12949test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012950 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012951
12952 int mem_base;
12953 xmlNodePtr ret_val;
12954 xmlNodePtr parent; /* the parent node */
12955 int n_parent;
12956 xmlNodePtr cur; /* the first node in the list */
12957 int n_cur;
12958
Daniel Veillarda03e3652004-11-02 18:45:30 +000012959 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012960 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
12961 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012962 parent = gen_xmlNodePtr(n_parent, 0);
12963 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012964
12965 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000012966 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000012967 desret_xmlNodePtr(ret_val);
12968 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012969 des_xmlNodePtr(n_parent, parent, 0);
12970 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012971 xmlResetLastError();
12972 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012973 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012975 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012976 printf(" %d", n_parent);
12977 printf(" %d", n_cur);
12978 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012979 }
12980 }
12981 }
12982
Daniel Veillard3d97e662004-11-04 10:49:00 +000012983 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012985}
12986
12987
12988static int
12989test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012991
12992 int mem_base;
12993 xmlNodePtr ret_val;
12994 xmlNodePtr cur; /* the child node */
12995 int n_cur;
12996 xmlNodePtr elem; /* the new node */
12997 int n_elem;
12998
12999 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013000 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000013001 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013002 cur = gen_xmlNodePtr(n_cur, 0);
13003 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013004
13005 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013006 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000013007 desret_xmlNodePtr(ret_val);
13008 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013009 des_xmlNodePtr(n_cur, cur, 0);
13010 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013011 xmlResetLastError();
13012 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013013 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013015 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013016 printf(" %d", n_cur);
13017 printf(" %d", n_elem);
13018 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013019 }
13020 }
13021 }
13022
Daniel Veillard3d97e662004-11-04 10:49:00 +000013023 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013025}
13026
13027
13028static int
13029test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013031
13032#ifdef LIBXML_TREE_ENABLED
13033 int mem_base;
13034 xmlNodePtr ret_val;
13035 xmlNodePtr cur; /* the child node */
13036 int n_cur;
13037 xmlNodePtr elem; /* the new node */
13038 int n_elem;
13039
13040 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013041 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000013042 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013043 cur = gen_xmlNodePtr(n_cur, 0);
13044 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013045
13046 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013047 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000013048 desret_xmlNodePtr(ret_val);
13049 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013050 des_xmlNodePtr(n_cur, cur, 0);
13051 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013052 xmlResetLastError();
13053 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013054 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013055 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013056 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013057 printf(" %d", n_cur);
13058 printf(" %d", n_elem);
13059 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013060 }
13061 }
13062 }
13063#endif
13064
Daniel Veillard3d97e662004-11-04 10:49:00 +000013065 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013067}
13068
13069
13070static int
13071test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013073
13074 int mem_base;
13075 xmlNodePtr ret_val;
13076 xmlNodePtr cur; /* the child node */
13077 int n_cur;
13078 xmlNodePtr elem; /* the new node */
13079 int n_elem;
13080
13081 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013082 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000013083 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013084 cur = gen_xmlNodePtr(n_cur, 0);
13085 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013086
13087 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013088 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000013089 desret_xmlNodePtr(ret_val);
13090 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013091 des_xmlNodePtr(n_cur, cur, 0);
13092 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013093 xmlResetLastError();
13094 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013095 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013097 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013098 printf(" %d", n_cur);
13099 printf(" %d", n_elem);
13100 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013101 }
13102 }
13103 }
13104
Daniel Veillard3d97e662004-11-04 10:49:00 +000013105 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013106 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013107}
13108
13109
13110static int
13111test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013112 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013113
Daniel Veillardce244ad2004-11-05 10:03:46 +000013114 int mem_base;
13115 xmlBufferPtr buf; /* the XML buffer output */
13116 int n_buf;
13117 xmlDocPtr doc; /* the document */
13118 int n_doc;
13119 xmlAttrPtr attr; /* the attribute node */
13120 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013121 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000013122 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013123
Daniel Veillardce244ad2004-11-05 10:03:46 +000013124 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
13125 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13126 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
13127 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13128 mem_base = xmlMemBlocks();
13129 buf = gen_xmlBufferPtr(n_buf, 0);
13130 doc = gen_xmlDocPtr(n_doc, 1);
13131 attr = gen_xmlAttrPtr(n_attr, 2);
13132 string = gen_const_xmlChar_ptr(n_string, 3);
13133
13134 xmlAttrSerializeTxtContent(buf, doc, attr, string);
13135 call_tests++;
13136 des_xmlBufferPtr(n_buf, buf, 0);
13137 des_xmlDocPtr(n_doc, doc, 1);
13138 des_xmlAttrPtr(n_attr, attr, 2);
13139 des_const_xmlChar_ptr(n_string, string, 3);
13140 xmlResetLastError();
13141 if (mem_base != xmlMemBlocks()) {
13142 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
13143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013144 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000013145 printf(" %d", n_buf);
13146 printf(" %d", n_doc);
13147 printf(" %d", n_attr);
13148 printf(" %d", n_string);
13149 printf("\n");
13150 }
13151 }
13152 }
13153 }
13154 }
13155
13156 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013158}
13159
13160
13161static int
13162test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013164
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013165 int mem_base;
13166 int ret_val;
13167 xmlBufferPtr buf; /* the buffer to dump */
13168 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013169 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013170 int n_str;
13171 int len; /* the number of #xmlChar to add */
13172 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013173
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013174 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
13175 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
13176 for (n_len = 0;n_len < gen_nb_int;n_len++) {
13177 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013178 buf = gen_xmlBufferPtr(n_buf, 0);
13179 str = gen_const_xmlChar_ptr(n_str, 1);
13180 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013181
13182 ret_val = xmlBufferAdd(buf, str, len);
13183 desret_int(ret_val);
13184 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013185 des_xmlBufferPtr(n_buf, buf, 0);
13186 des_const_xmlChar_ptr(n_str, str, 1);
13187 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013188 xmlResetLastError();
13189 if (mem_base != xmlMemBlocks()) {
13190 printf("Leak of %d blocks found in xmlBufferAdd",
13191 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013192 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013193 printf(" %d", n_buf);
13194 printf(" %d", n_str);
13195 printf(" %d", n_len);
13196 printf("\n");
13197 }
13198 }
13199 }
13200 }
13201
Daniel Veillard3d97e662004-11-04 10:49:00 +000013202 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013204}
13205
13206
13207static int
13208test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013210
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013211 int mem_base;
13212 int ret_val;
13213 xmlBufferPtr buf; /* the buffer */
13214 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013215 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013216 int n_str;
13217 int len; /* the number of #xmlChar to add */
13218 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013219
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013220 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
13221 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
13222 for (n_len = 0;n_len < gen_nb_int;n_len++) {
13223 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013224 buf = gen_xmlBufferPtr(n_buf, 0);
13225 str = gen_const_xmlChar_ptr(n_str, 1);
13226 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013227
13228 ret_val = xmlBufferAddHead(buf, str, len);
13229 desret_int(ret_val);
13230 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013231 des_xmlBufferPtr(n_buf, buf, 0);
13232 des_const_xmlChar_ptr(n_str, str, 1);
13233 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013234 xmlResetLastError();
13235 if (mem_base != xmlMemBlocks()) {
13236 printf("Leak of %d blocks found in xmlBufferAddHead",
13237 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013238 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013239 printf(" %d", n_buf);
13240 printf(" %d", n_str);
13241 printf(" %d", n_len);
13242 printf("\n");
13243 }
13244 }
13245 }
13246 }
13247
Daniel Veillard3d97e662004-11-04 10:49:00 +000013248 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013249 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013250}
13251
13252
13253static int
13254test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013256
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013257 int mem_base;
13258 int ret_val;
13259 xmlBufferPtr buf; /* the buffer to dump */
13260 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013261 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013262 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013263
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013264 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
13265 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
13266 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013267 buf = gen_xmlBufferPtr(n_buf, 0);
13268 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013269
13270 ret_val = xmlBufferCCat(buf, str);
13271 desret_int(ret_val);
13272 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013273 des_xmlBufferPtr(n_buf, buf, 0);
13274 des_const_char_ptr(n_str, str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013275 xmlResetLastError();
13276 if (mem_base != xmlMemBlocks()) {
13277 printf("Leak of %d blocks found in xmlBufferCCat",
13278 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013279 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013280 printf(" %d", n_buf);
13281 printf(" %d", n_str);
13282 printf("\n");
13283 }
13284 }
13285 }
13286
Daniel Veillard3d97e662004-11-04 10:49:00 +000013287 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013289}
13290
13291
13292static int
13293test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013295
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013296 int mem_base;
13297 int ret_val;
13298 xmlBufferPtr buf; /* the buffer to add to */
13299 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013300 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013301 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013302
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013303 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
13304 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
13305 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013306 buf = gen_xmlBufferPtr(n_buf, 0);
13307 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013308
13309 ret_val = xmlBufferCat(buf, str);
13310 desret_int(ret_val);
13311 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013312 des_xmlBufferPtr(n_buf, buf, 0);
13313 des_const_xmlChar_ptr(n_str, str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013314 xmlResetLastError();
13315 if (mem_base != xmlMemBlocks()) {
13316 printf("Leak of %d blocks found in xmlBufferCat",
13317 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013318 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013319 printf(" %d", n_buf);
13320 printf(" %d", n_str);
13321 printf("\n");
13322 }
13323 }
13324 }
13325
Daniel Veillard3d97e662004-11-04 10:49:00 +000013326 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013328}
13329
13330
Daniel Veillardce682bc2004-11-05 17:22:25 +000013331#define gen_nb_const_xmlBufferPtr 1
13332static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13333 return(NULL);
13334}
13335static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13336}
13337
Daniel Veillardd93f6252004-11-02 15:53:51 +000013338static int
13339test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013341
Daniel Veillardce682bc2004-11-05 17:22:25 +000013342 int mem_base;
13343 const xmlChar * ret_val;
13344 xmlBufferPtr buf; /* the buffer */
13345 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013346
Daniel Veillardce682bc2004-11-05 17:22:25 +000013347 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
13348 mem_base = xmlMemBlocks();
13349 buf = gen_const_xmlBufferPtr(n_buf, 0);
13350
13351 ret_val = xmlBufferContent(buf);
13352 desret_const_xmlChar_ptr(ret_val);
13353 call_tests++;
13354 des_const_xmlBufferPtr(n_buf, buf, 0);
13355 xmlResetLastError();
13356 if (mem_base != xmlMemBlocks()) {
13357 printf("Leak of %d blocks found in xmlBufferContent",
13358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013359 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013360 printf(" %d", n_buf);
13361 printf("\n");
13362 }
13363 }
13364
13365 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013366 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013367}
13368
13369
13370static int
13371test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013373
Daniel Veillard3d95c732004-11-06 22:25:14 +000013374 int mem_base;
13375 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013376
Daniel Veillard3d95c732004-11-06 22:25:14 +000013377 mem_base = xmlMemBlocks();
13378
13379 ret_val = xmlBufferCreate();
13380 desret_xmlBufferPtr(ret_val);
13381 call_tests++;
13382 xmlResetLastError();
13383 if (mem_base != xmlMemBlocks()) {
13384 printf("Leak of %d blocks found in xmlBufferCreate",
13385 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013386 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000013387 printf("\n");
13388 }
13389
13390 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013392}
13393
13394
13395static int
13396test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013397 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013398
13399
13400 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000013401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013402}
13403
13404
13405static int
13406test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013408
13409
13410 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000013411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013412}
13413
13414
13415static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000013416test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013418
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013419 int mem_base;
13420 xmlBufferPtr buf; /* the buffer */
13421 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013422
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013423 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
13424 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013425 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013426
13427 xmlBufferEmpty(buf);
13428 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013429 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013430 xmlResetLastError();
13431 if (mem_base != xmlMemBlocks()) {
13432 printf("Leak of %d blocks found in xmlBufferEmpty",
13433 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013434 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013435 printf(" %d", n_buf);
13436 printf("\n");
13437 }
13438 }
13439
Daniel Veillard3d97e662004-11-04 10:49:00 +000013440 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013441 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013442}
13443
13444
13445static int
13446test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013447 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013448
Daniel Veillard3d97e662004-11-04 10:49:00 +000013449 int mem_base;
13450 int ret_val;
13451 xmlBufferPtr buf; /* the buffer */
13452 int n_buf;
13453 unsigned int len; /* the minimum free size to allocate */
13454 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013455
Daniel Veillard3d97e662004-11-04 10:49:00 +000013456 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
13457 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
13458 mem_base = xmlMemBlocks();
13459 buf = gen_xmlBufferPtr(n_buf, 0);
13460 len = gen_unsigned_int(n_len, 1);
13461
13462 ret_val = xmlBufferGrow(buf, len);
13463 desret_int(ret_val);
13464 call_tests++;
13465 des_xmlBufferPtr(n_buf, buf, 0);
13466 des_unsigned_int(n_len, len, 1);
13467 xmlResetLastError();
13468 if (mem_base != xmlMemBlocks()) {
13469 printf("Leak of %d blocks found in xmlBufferGrow",
13470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013471 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013472 printf(" %d", n_buf);
13473 printf(" %d", n_len);
13474 printf("\n");
13475 }
13476 }
13477 }
13478
13479 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013481}
13482
13483
13484static int
13485test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013487
Daniel Veillardce682bc2004-11-05 17:22:25 +000013488 int mem_base;
13489 int ret_val;
13490 xmlBufferPtr buf; /* the buffer */
13491 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013492
Daniel Veillardce682bc2004-11-05 17:22:25 +000013493 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
13494 mem_base = xmlMemBlocks();
13495 buf = gen_const_xmlBufferPtr(n_buf, 0);
13496
13497 ret_val = xmlBufferLength(buf);
13498 desret_int(ret_val);
13499 call_tests++;
13500 des_const_xmlBufferPtr(n_buf, buf, 0);
13501 xmlResetLastError();
13502 if (mem_base != xmlMemBlocks()) {
13503 printf("Leak of %d blocks found in xmlBufferLength",
13504 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013505 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013506 printf(" %d", n_buf);
13507 printf("\n");
13508 }
13509 }
13510
13511 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013513}
13514
13515
13516static int
13517test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013519
Daniel Veillard3d97e662004-11-04 10:49:00 +000013520 int mem_base;
13521 int ret_val;
13522 xmlBufferPtr buf; /* the buffer to resize */
13523 int n_buf;
13524 unsigned int size; /* the desired size */
13525 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013526
Daniel Veillard3d97e662004-11-04 10:49:00 +000013527 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
13528 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
13529 mem_base = xmlMemBlocks();
13530 buf = gen_xmlBufferPtr(n_buf, 0);
13531 size = gen_unsigned_int(n_size, 1);
13532
13533 ret_val = xmlBufferResize(buf, size);
13534 desret_int(ret_val);
13535 call_tests++;
13536 des_xmlBufferPtr(n_buf, buf, 0);
13537 des_unsigned_int(n_size, size, 1);
13538 xmlResetLastError();
13539 if (mem_base != xmlMemBlocks()) {
13540 printf("Leak of %d blocks found in xmlBufferResize",
13541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013542 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013543 printf(" %d", n_buf);
13544 printf(" %d", n_size);
13545 printf("\n");
13546 }
13547 }
13548 }
13549
13550 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013551 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013552}
13553
13554
13555static int
13556test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013557 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013558
Daniel Veillard57b25162004-11-06 14:50:18 +000013559 int mem_base;
13560 xmlBufferPtr buf; /* the buffer to tune */
13561 int n_buf;
13562 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
13563 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013564
Daniel Veillard57b25162004-11-06 14:50:18 +000013565 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
13566 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
13567 mem_base = xmlMemBlocks();
13568 buf = gen_xmlBufferPtr(n_buf, 0);
13569 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
13570
13571 xmlBufferSetAllocationScheme(buf, scheme);
13572 call_tests++;
13573 des_xmlBufferPtr(n_buf, buf, 0);
13574 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
13575 xmlResetLastError();
13576 if (mem_base != xmlMemBlocks()) {
13577 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
13578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013579 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000013580 printf(" %d", n_buf);
13581 printf(" %d", n_scheme);
13582 printf("\n");
13583 }
13584 }
13585 }
13586
13587 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013588 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013589}
13590
13591
13592static int
13593test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013594 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013595
Daniel Veillard3d97e662004-11-04 10:49:00 +000013596 int mem_base;
13597 int ret_val;
13598 xmlBufferPtr buf; /* the buffer to dump */
13599 int n_buf;
13600 unsigned int len; /* the number of xmlChar to remove */
13601 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013602
Daniel Veillard3d97e662004-11-04 10:49:00 +000013603 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
13604 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
13605 mem_base = xmlMemBlocks();
13606 buf = gen_xmlBufferPtr(n_buf, 0);
13607 len = gen_unsigned_int(n_len, 1);
13608
13609 ret_val = xmlBufferShrink(buf, len);
13610 desret_int(ret_val);
13611 call_tests++;
13612 des_xmlBufferPtr(n_buf, buf, 0);
13613 des_unsigned_int(n_len, len, 1);
13614 xmlResetLastError();
13615 if (mem_base != xmlMemBlocks()) {
13616 printf("Leak of %d blocks found in xmlBufferShrink",
13617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013618 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013619 printf(" %d", n_buf);
13620 printf(" %d", n_len);
13621 printf("\n");
13622 }
13623 }
13624 }
13625
13626 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013628}
13629
13630
13631static int
13632test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013633 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013634
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013635 int mem_base;
13636 xmlBufferPtr buf; /* the XML buffer */
13637 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013638 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013639 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013640
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013641 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
13642 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13643 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013644 buf = gen_xmlBufferPtr(n_buf, 0);
13645 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013646
13647 xmlBufferWriteCHAR(buf, string);
13648 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013649 des_xmlBufferPtr(n_buf, buf, 0);
13650 des_const_xmlChar_ptr(n_string, string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013651 xmlResetLastError();
13652 if (mem_base != xmlMemBlocks()) {
13653 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
13654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013655 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013656 printf(" %d", n_buf);
13657 printf(" %d", n_string);
13658 printf("\n");
13659 }
13660 }
13661 }
13662
Daniel Veillard3d97e662004-11-04 10:49:00 +000013663 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013664 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013665}
13666
13667
13668static int
13669test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013670 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013671
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013672 int mem_base;
13673 xmlBufferPtr buf; /* the XML buffer output */
13674 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013675 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013676 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013677
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013678 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
13679 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
13680 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013681 buf = gen_xmlBufferPtr(n_buf, 0);
13682 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013683
13684 xmlBufferWriteChar(buf, string);
13685 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013686 des_xmlBufferPtr(n_buf, buf, 0);
13687 des_const_char_ptr(n_string, string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013688 xmlResetLastError();
13689 if (mem_base != xmlMemBlocks()) {
13690 printf("Leak of %d blocks found in xmlBufferWriteChar",
13691 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013692 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013693 printf(" %d", n_buf);
13694 printf(" %d", n_string);
13695 printf("\n");
13696 }
13697 }
13698 }
13699
Daniel Veillard3d97e662004-11-04 10:49:00 +000013700 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013701 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013702}
13703
13704
13705static int
13706test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013707 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013708
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013709 int mem_base;
13710 xmlBufferPtr buf; /* the XML buffer output */
13711 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013712 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013713 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013714
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013715 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
13716 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13717 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013718 buf = gen_xmlBufferPtr(n_buf, 0);
13719 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013720
13721 xmlBufferWriteQuotedString(buf, string);
13722 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013723 des_xmlBufferPtr(n_buf, buf, 0);
13724 des_const_xmlChar_ptr(n_string, string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013725 xmlResetLastError();
13726 if (mem_base != xmlMemBlocks()) {
13727 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
13728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013729 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000013730 printf(" %d", n_buf);
13731 printf(" %d", n_string);
13732 printf("\n");
13733 }
13734 }
13735 }
13736
Daniel Veillard3d97e662004-11-04 10:49:00 +000013737 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013739}
13740
13741
13742static int
13743test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013745
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013746 int mem_base;
13747 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013748 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013749 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013750 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013751 int n_prefix;
13752 xmlChar * memory; /* preallocated memory */
13753 int n_memory;
13754 int len; /* preallocated memory length */
13755 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013756
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013757 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
13758 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
13759 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
13760 for (n_len = 0;n_len < gen_nb_int;n_len++) {
13761 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013762 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
13763 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
13764 memory = gen_xmlChar_ptr(n_memory, 2);
13765 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013766
13767 ret_val = xmlBuildQName(ncname, prefix, memory, len);
13768 if ((ret_val != NULL) && (ret_val != ncname) &&
13769 (ret_val != prefix) && (ret_val != memory))
13770 xmlFree(ret_val);
13771 ret_val = NULL;
13772 desret_xmlChar_ptr(ret_val);
13773 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013774 des_const_xmlChar_ptr(n_ncname, ncname, 0);
13775 des_const_xmlChar_ptr(n_prefix, prefix, 1);
13776 des_xmlChar_ptr(n_memory, memory, 2);
13777 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013778 xmlResetLastError();
13779 if (mem_base != xmlMemBlocks()) {
13780 printf("Leak of %d blocks found in xmlBuildQName",
13781 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013782 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013783 printf(" %d", n_ncname);
13784 printf(" %d", n_prefix);
13785 printf(" %d", n_memory);
13786 printf(" %d", n_len);
13787 printf("\n");
13788 }
13789 }
13790 }
13791 }
13792 }
13793
Daniel Veillard3d97e662004-11-04 10:49:00 +000013794 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013795 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013796}
13797
13798
13799static int
13800test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013801 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013802
13803#ifdef LIBXML_TREE_ENABLED
13804 int mem_base;
13805 xmlDocPtr ret_val;
13806 xmlDocPtr doc; /* the document */
13807 int n_doc;
13808 int recursive; /* if not zero do a recursive copy. */
13809 int n_recursive;
13810
13811 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13812 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
13813 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013814 doc = gen_xmlDocPtr(n_doc, 0);
13815 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013816
13817 ret_val = xmlCopyDoc(doc, recursive);
13818 desret_xmlDocPtr(ret_val);
13819 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013820 des_xmlDocPtr(n_doc, doc, 0);
13821 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013822 xmlResetLastError();
13823 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013824 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013826 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013827 printf(" %d", n_doc);
13828 printf(" %d", n_recursive);
13829 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013830 }
13831 }
13832 }
13833#endif
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_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013843
Daniel Veillard27f20102004-11-05 11:50:11 +000013844#ifdef LIBXML_TREE_ENABLED
13845 int mem_base;
13846 xmlDtdPtr ret_val;
13847 xmlDtdPtr dtd; /* the dtd */
13848 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013849
Daniel Veillard27f20102004-11-05 11:50:11 +000013850 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
13851 mem_base = xmlMemBlocks();
13852 dtd = gen_xmlDtdPtr(n_dtd, 0);
13853
13854 ret_val = xmlCopyDtd(dtd);
13855 desret_xmlDtdPtr(ret_val);
13856 call_tests++;
13857 des_xmlDtdPtr(n_dtd, dtd, 0);
13858 xmlResetLastError();
13859 if (mem_base != xmlMemBlocks()) {
13860 printf("Leak of %d blocks found in xmlCopyDtd",
13861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013862 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000013863 printf(" %d", n_dtd);
13864 printf("\n");
13865 }
13866 }
13867#endif
13868
13869 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013870 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013871}
13872
13873
13874static int
13875test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013876 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013877
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013878 int mem_base;
13879 xmlNsPtr ret_val;
13880 xmlNsPtr cur; /* the namespace */
13881 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013882
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013883 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
13884 mem_base = xmlMemBlocks();
13885 cur = gen_xmlNsPtr(n_cur, 0);
13886
13887 ret_val = xmlCopyNamespace(cur);
13888 if (ret_val != NULL) xmlFreeNs(ret_val);
13889 desret_xmlNsPtr(ret_val);
13890 call_tests++;
13891 des_xmlNsPtr(n_cur, cur, 0);
13892 xmlResetLastError();
13893 if (mem_base != xmlMemBlocks()) {
13894 printf("Leak of %d blocks found in xmlCopyNamespace",
13895 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013896 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013897 printf(" %d", n_cur);
13898 printf("\n");
13899 }
13900 }
13901
13902 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013903 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013904}
13905
13906
13907static int
13908test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013909 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013910
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013911 int mem_base;
13912 xmlNsPtr ret_val;
13913 xmlNsPtr cur; /* the first namespace */
13914 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013915
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013916 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
13917 mem_base = xmlMemBlocks();
13918 cur = gen_xmlNsPtr(n_cur, 0);
13919
13920 ret_val = xmlCopyNamespaceList(cur);
13921 if (ret_val != NULL) xmlFreeNsList(ret_val);
13922 desret_xmlNsPtr(ret_val);
13923 call_tests++;
13924 des_xmlNsPtr(n_cur, cur, 0);
13925 xmlResetLastError();
13926 if (mem_base != xmlMemBlocks()) {
13927 printf("Leak of %d blocks found in xmlCopyNamespaceList",
13928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013929 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013930 printf(" %d", n_cur);
13931 printf("\n");
13932 }
13933 }
13934
13935 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013936 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013937}
13938
13939
13940static int
13941test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013942 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013943
Daniel Veillardce682bc2004-11-05 17:22:25 +000013944 int mem_base;
13945 xmlNodePtr ret_val;
13946 xmlNodePtr node; /* the node */
13947 int n_node;
13948 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
13949 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013950
Daniel Veillardce682bc2004-11-05 17:22:25 +000013951 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
13952 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
13953 mem_base = xmlMemBlocks();
13954 node = gen_const_xmlNodePtr(n_node, 0);
13955 extended = gen_int(n_extended, 1);
13956
13957 ret_val = xmlCopyNode(node, extended);
13958 desret_xmlNodePtr(ret_val);
13959 call_tests++;
13960 des_const_xmlNodePtr(n_node, node, 0);
13961 des_int(n_extended, extended, 1);
13962 xmlResetLastError();
13963 if (mem_base != xmlMemBlocks()) {
13964 printf("Leak of %d blocks found in xmlCopyNode",
13965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013966 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013967 printf(" %d", n_node);
13968 printf(" %d", n_extended);
13969 printf("\n");
13970 }
13971 }
13972 }
13973
13974 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013976}
13977
13978
13979static int
13980test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013982
Daniel Veillardce682bc2004-11-05 17:22:25 +000013983 int mem_base;
13984 xmlNodePtr ret_val;
13985 xmlNodePtr node; /* the first node in the list. */
13986 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013987
Daniel Veillardce682bc2004-11-05 17:22:25 +000013988 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
13989 mem_base = xmlMemBlocks();
13990 node = gen_const_xmlNodePtr(n_node, 0);
13991
13992 ret_val = xmlCopyNodeList(node);
13993 desret_xmlNodePtr(ret_val);
13994 call_tests++;
13995 des_const_xmlNodePtr(n_node, node, 0);
13996 xmlResetLastError();
13997 if (mem_base != xmlMemBlocks()) {
13998 printf("Leak of %d blocks found in xmlCopyNodeList",
13999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014000 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014001 printf(" %d", n_node);
14002 printf("\n");
14003 }
14004 }
14005
14006 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014007 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014008}
14009
14010
14011static int
14012test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014013 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014014
Daniel Veillard57b25162004-11-06 14:50:18 +000014015 int mem_base;
14016 xmlAttrPtr ret_val;
14017 xmlNodePtr target; /* the element where the attribute will be grafted */
14018 int n_target;
14019 xmlAttrPtr cur; /* the attribute */
14020 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014021
Daniel Veillard57b25162004-11-06 14:50:18 +000014022 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
14023 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
14024 mem_base = xmlMemBlocks();
14025 target = gen_xmlNodePtr(n_target, 0);
14026 cur = gen_xmlAttrPtr(n_cur, 1);
14027
14028 ret_val = xmlCopyProp(target, cur);
14029 desret_xmlAttrPtr(ret_val);
14030 call_tests++;
14031 des_xmlNodePtr(n_target, target, 0);
14032 des_xmlAttrPtr(n_cur, cur, 1);
14033 xmlResetLastError();
14034 if (mem_base != xmlMemBlocks()) {
14035 printf("Leak of %d blocks found in xmlCopyProp",
14036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014037 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000014038 printf(" %d", n_target);
14039 printf(" %d", n_cur);
14040 printf("\n");
14041 }
14042 }
14043 }
14044
14045 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014046 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014047}
14048
14049
14050static int
14051test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014052 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014053
Daniel Veillard57b25162004-11-06 14:50:18 +000014054 int mem_base;
14055 xmlAttrPtr ret_val;
14056 xmlNodePtr target; /* the element where the attributes will be grafted */
14057 int n_target;
14058 xmlAttrPtr cur; /* the first attribute */
14059 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014060
Daniel Veillard57b25162004-11-06 14:50:18 +000014061 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
14062 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
14063 mem_base = xmlMemBlocks();
14064 target = gen_xmlNodePtr(n_target, 0);
14065 cur = gen_xmlAttrPtr(n_cur, 1);
14066
14067 ret_val = xmlCopyPropList(target, cur);
14068 desret_xmlAttrPtr(ret_val);
14069 call_tests++;
14070 des_xmlNodePtr(n_target, target, 0);
14071 des_xmlAttrPtr(n_cur, cur, 1);
14072 xmlResetLastError();
14073 if (mem_base != xmlMemBlocks()) {
14074 printf("Leak of %d blocks found in xmlCopyPropList",
14075 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014076 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000014077 printf(" %d", n_target);
14078 printf(" %d", n_cur);
14079 printf("\n");
14080 }
14081 }
14082 }
14083
14084 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014086}
14087
14088
14089static int
14090test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014092
Daniel Veillard34099b42004-11-04 17:34:35 +000014093 int mem_base;
14094 xmlDtdPtr ret_val;
14095 xmlDocPtr doc; /* the document pointer */
14096 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014097 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000014098 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014099 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000014100 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014101 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000014102 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014103
Daniel Veillard34099b42004-11-04 17:34:35 +000014104 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
14105 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
14106 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14107 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14108 mem_base = xmlMemBlocks();
14109 doc = gen_xmlDocPtr(n_doc, 0);
14110 name = gen_const_xmlChar_ptr(n_name, 1);
14111 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
14112 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
14113
14114 ret_val = xmlCreateIntSubset(doc, name, ExternalID, SystemID);
14115 desret_xmlDtdPtr(ret_val);
14116 call_tests++;
14117 des_xmlDocPtr(n_doc, doc, 0);
14118 des_const_xmlChar_ptr(n_name, name, 1);
14119 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
14120 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
14121 xmlResetLastError();
14122 if (mem_base != xmlMemBlocks()) {
14123 printf("Leak of %d blocks found in xmlCreateIntSubset",
14124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014125 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014126 printf(" %d", n_doc);
14127 printf(" %d", n_name);
14128 printf(" %d", n_ExternalID);
14129 printf(" %d", n_SystemID);
14130 printf("\n");
14131 }
14132 }
14133 }
14134 }
14135 }
14136
14137 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014139}
14140
14141
14142static int
14143test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014145
Daniel Veillardce682bc2004-11-05 17:22:25 +000014146 int mem_base;
14147 xmlNodePtr ret_val;
14148 xmlNodePtr node; /* the node */
14149 int n_node;
14150 xmlDocPtr doc; /* the document */
14151 int n_doc;
14152 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
14153 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014154
Daniel Veillardce682bc2004-11-05 17:22:25 +000014155 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14156 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
14157 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
14158 mem_base = xmlMemBlocks();
14159 node = gen_const_xmlNodePtr(n_node, 0);
14160 doc = gen_xmlDocPtr(n_doc, 1);
14161 extended = gen_int(n_extended, 2);
14162
14163 ret_val = xmlDocCopyNode(node, doc, extended);
14164 desret_xmlNodePtr(ret_val);
14165 call_tests++;
14166 des_const_xmlNodePtr(n_node, node, 0);
14167 des_xmlDocPtr(n_doc, doc, 1);
14168 des_int(n_extended, extended, 2);
14169 xmlResetLastError();
14170 if (mem_base != xmlMemBlocks()) {
14171 printf("Leak of %d blocks found in xmlDocCopyNode",
14172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014173 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014174 printf(" %d", n_node);
14175 printf(" %d", n_doc);
14176 printf(" %d", n_extended);
14177 printf("\n");
14178 }
14179 }
14180 }
14181 }
14182
14183 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014185}
14186
14187
14188static int
14189test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014191
Daniel Veillardce682bc2004-11-05 17:22:25 +000014192 int mem_base;
14193 xmlNodePtr ret_val;
14194 xmlDocPtr doc; /* the target document */
14195 int n_doc;
14196 xmlNodePtr node; /* the first node in the list. */
14197 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014198
Daniel Veillardce682bc2004-11-05 17:22:25 +000014199 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
14200 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14201 mem_base = xmlMemBlocks();
14202 doc = gen_xmlDocPtr(n_doc, 0);
14203 node = gen_const_xmlNodePtr(n_node, 1);
14204
14205 ret_val = xmlDocCopyNodeList(doc, node);
14206 desret_xmlNodePtr(ret_val);
14207 call_tests++;
14208 des_xmlDocPtr(n_doc, doc, 0);
14209 des_const_xmlNodePtr(n_node, node, 1);
14210 xmlResetLastError();
14211 if (mem_base != xmlMemBlocks()) {
14212 printf("Leak of %d blocks found in xmlDocCopyNodeList",
14213 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014214 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014215 printf(" %d", n_doc);
14216 printf(" %d", n_node);
14217 printf("\n");
14218 }
14219 }
14220 }
14221
14222 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014223 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014224}
14225
14226
14227static int
14228test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014229 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014230
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000014231#ifdef LIBXML_OUTPUT_ENABLED
14232 int mem_base;
14233 int ret_val;
14234 FILE * f; /* the FILE* */
14235 int n_f;
14236 xmlDocPtr cur; /* the document */
14237 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014238
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000014239 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
14240 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
14241 mem_base = xmlMemBlocks();
14242 f = gen_FILE_ptr(n_f, 0);
14243 cur = gen_xmlDocPtr(n_cur, 1);
14244
14245 ret_val = xmlDocDump(f, cur);
14246 desret_int(ret_val);
14247 call_tests++;
14248 des_FILE_ptr(n_f, f, 0);
14249 des_xmlDocPtr(n_cur, cur, 1);
14250 xmlResetLastError();
14251 if (mem_base != xmlMemBlocks()) {
14252 printf("Leak of %d blocks found in xmlDocDump",
14253 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014254 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000014255 printf(" %d", n_f);
14256 printf(" %d", n_cur);
14257 printf("\n");
14258 }
14259 }
14260 }
14261#endif
14262
14263 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014264 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014265}
14266
14267
14268static int
14269test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014270 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014271
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000014272#ifdef LIBXML_OUTPUT_ENABLED
14273 int mem_base;
14274 xmlDocPtr cur; /* the document */
14275 int n_cur;
14276 xmlChar ** mem; /* OUT: the memory pointer */
14277 int n_mem;
14278 int * size; /* OUT: the memory length */
14279 int n_size;
14280 int format; /* should formatting spaces been added */
14281 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014282
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000014283 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
14284 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
14285 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
14286 for (n_format = 0;n_format < gen_nb_int;n_format++) {
14287 mem_base = xmlMemBlocks();
14288 cur = gen_xmlDocPtr(n_cur, 0);
14289 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
14290 size = gen_int_ptr(n_size, 2);
14291 format = gen_int(n_format, 3);
14292
14293 xmlDocDumpFormatMemory(cur, mem, size, format);
14294 call_tests++;
14295 des_xmlDocPtr(n_cur, cur, 0);
14296 des_xmlChar_ptr_ptr(n_mem, mem, 1);
14297 des_int_ptr(n_size, size, 2);
14298 des_int(n_format, format, 3);
14299 xmlResetLastError();
14300 if (mem_base != xmlMemBlocks()) {
14301 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
14302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014303 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000014304 printf(" %d", n_cur);
14305 printf(" %d", n_mem);
14306 printf(" %d", n_size);
14307 printf(" %d", n_format);
14308 printf("\n");
14309 }
14310 }
14311 }
14312 }
14313 }
14314#endif
14315
14316 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014318}
14319
14320
14321static int
14322test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014324
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000014325#ifdef LIBXML_OUTPUT_ENABLED
14326 int mem_base;
14327 xmlDocPtr out_doc; /* Document to generate XML text from */
14328 int n_out_doc;
14329 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
14330 int n_doc_txt_ptr;
14331 int * doc_txt_len; /* Length of the generated XML text */
14332 int n_doc_txt_len;
14333 char * txt_encoding; /* Character encoding to use when generating XML text */
14334 int n_txt_encoding;
14335 int format; /* should formatting spaces been added */
14336 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014337
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000014338 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
14339 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
14340 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
14341 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
14342 for (n_format = 0;n_format < gen_nb_int;n_format++) {
14343 mem_base = xmlMemBlocks();
14344 out_doc = gen_xmlDocPtr(n_out_doc, 0);
14345 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
14346 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
14347 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
14348 format = gen_int(n_format, 4);
14349
14350 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, txt_encoding, format);
14351 call_tests++;
14352 des_xmlDocPtr(n_out_doc, out_doc, 0);
14353 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
14354 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
14355 des_const_char_ptr(n_txt_encoding, txt_encoding, 3);
14356 des_int(n_format, format, 4);
14357 xmlResetLastError();
14358 if (mem_base != xmlMemBlocks()) {
14359 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
14360 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014361 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000014362 printf(" %d", n_out_doc);
14363 printf(" %d", n_doc_txt_ptr);
14364 printf(" %d", n_doc_txt_len);
14365 printf(" %d", n_txt_encoding);
14366 printf(" %d", n_format);
14367 printf("\n");
14368 }
14369 }
14370 }
14371 }
14372 }
14373 }
14374#endif
14375
14376 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014378}
14379
14380
14381static int
14382test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014384
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000014385#ifdef LIBXML_OUTPUT_ENABLED
14386 int mem_base;
14387 xmlDocPtr cur; /* the document */
14388 int n_cur;
14389 xmlChar ** mem; /* OUT: the memory pointer */
14390 int n_mem;
14391 int * size; /* OUT: the memory length */
14392 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014393
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000014394 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
14395 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
14396 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
14397 mem_base = xmlMemBlocks();
14398 cur = gen_xmlDocPtr(n_cur, 0);
14399 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
14400 size = gen_int_ptr(n_size, 2);
14401
14402 xmlDocDumpMemory(cur, mem, size);
14403 call_tests++;
14404 des_xmlDocPtr(n_cur, cur, 0);
14405 des_xmlChar_ptr_ptr(n_mem, mem, 1);
14406 des_int_ptr(n_size, size, 2);
14407 xmlResetLastError();
14408 if (mem_base != xmlMemBlocks()) {
14409 printf("Leak of %d blocks found in xmlDocDumpMemory",
14410 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014411 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000014412 printf(" %d", n_cur);
14413 printf(" %d", n_mem);
14414 printf(" %d", n_size);
14415 printf("\n");
14416 }
14417 }
14418 }
14419 }
14420#endif
14421
14422 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014423 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014424}
14425
14426
14427static int
14428test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014430
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000014431#ifdef LIBXML_OUTPUT_ENABLED
14432 int mem_base;
14433 xmlDocPtr out_doc; /* Document to generate XML text from */
14434 int n_out_doc;
14435 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
14436 int n_doc_txt_ptr;
14437 int * doc_txt_len; /* Length of the generated XML text */
14438 int n_doc_txt_len;
14439 char * txt_encoding; /* Character encoding to use when generating XML text */
14440 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014441
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000014442 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
14443 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
14444 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
14445 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
14446 mem_base = xmlMemBlocks();
14447 out_doc = gen_xmlDocPtr(n_out_doc, 0);
14448 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
14449 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
14450 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
14451
14452 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, txt_encoding);
14453 call_tests++;
14454 des_xmlDocPtr(n_out_doc, out_doc, 0);
14455 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
14456 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
14457 des_const_char_ptr(n_txt_encoding, txt_encoding, 3);
14458 xmlResetLastError();
14459 if (mem_base != xmlMemBlocks()) {
14460 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
14461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014462 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000014463 printf(" %d", n_out_doc);
14464 printf(" %d", n_doc_txt_ptr);
14465 printf(" %d", n_doc_txt_len);
14466 printf(" %d", n_txt_encoding);
14467 printf("\n");
14468 }
14469 }
14470 }
14471 }
14472 }
14473#endif
14474
14475 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014476 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014477}
14478
14479
14480static int
14481test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014482 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014483
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000014484#ifdef LIBXML_OUTPUT_ENABLED
14485 int mem_base;
14486 int ret_val;
14487 FILE * f; /* the FILE* */
14488 int n_f;
14489 xmlDocPtr cur; /* the document */
14490 int n_cur;
14491 int format; /* should formatting spaces been added */
14492 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014493
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000014494 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
14495 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
14496 for (n_format = 0;n_format < gen_nb_int;n_format++) {
14497 mem_base = xmlMemBlocks();
14498 f = gen_FILE_ptr(n_f, 0);
14499 cur = gen_xmlDocPtr(n_cur, 1);
14500 format = gen_int(n_format, 2);
14501
14502 ret_val = xmlDocFormatDump(f, cur, format);
14503 desret_int(ret_val);
14504 call_tests++;
14505 des_FILE_ptr(n_f, f, 0);
14506 des_xmlDocPtr(n_cur, cur, 1);
14507 des_int(n_format, format, 2);
14508 xmlResetLastError();
14509 if (mem_base != xmlMemBlocks()) {
14510 printf("Leak of %d blocks found in xmlDocFormatDump",
14511 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014512 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000014513 printf(" %d", n_f);
14514 printf(" %d", n_cur);
14515 printf(" %d", n_format);
14516 printf("\n");
14517 }
14518 }
14519 }
14520 }
14521#endif
14522
14523 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014524 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014525}
14526
14527
14528static int
14529test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014530 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014531
14532 int mem_base;
14533 xmlNodePtr ret_val;
14534 xmlDocPtr doc; /* the document */
14535 int n_doc;
14536
14537 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
14538 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014539 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014540
14541 ret_val = xmlDocGetRootElement(doc);
14542 desret_xmlNodePtr(ret_val);
14543 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014544 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014545 xmlResetLastError();
14546 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014547 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014548 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014549 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014550 printf(" %d", n_doc);
14551 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014552 }
14553 }
14554
Daniel Veillard3d97e662004-11-04 10:49:00 +000014555 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014556 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014557}
14558
14559
14560static int
14561test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014562 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014563
14564#ifdef LIBXML_TREE_ENABLED
14565 int mem_base;
14566 xmlNodePtr ret_val;
14567 xmlDocPtr doc; /* the document */
14568 int n_doc;
14569 xmlNodePtr root; /* the new document root element */
14570 int n_root;
14571
14572 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014573 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014574 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014575 doc = gen_xmlDocPtr(n_doc, 0);
14576 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014577
14578 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014579 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000014580 desret_xmlNodePtr(ret_val);
14581 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014582 des_xmlDocPtr(n_doc, doc, 0);
14583 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014584 xmlResetLastError();
14585 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014586 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014588 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014589 printf(" %d", n_doc);
14590 printf(" %d", n_root);
14591 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014592 }
14593 }
14594 }
14595#endif
14596
Daniel Veillard3d97e662004-11-04 10:49:00 +000014597 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014598 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014599}
14600
14601
14602static int
14603test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014605
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000014606#ifdef LIBXML_OUTPUT_ENABLED
14607 int mem_base;
14608 FILE * f; /* the FILE * for the output */
14609 int n_f;
14610 xmlDocPtr doc; /* the document */
14611 int n_doc;
14612 xmlNodePtr cur; /* the current node */
14613 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014614
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000014615 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
14616 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
14617 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
14618 mem_base = xmlMemBlocks();
14619 f = gen_FILE_ptr(n_f, 0);
14620 doc = gen_xmlDocPtr(n_doc, 1);
14621 cur = gen_xmlNodePtr(n_cur, 2);
14622
14623 xmlElemDump(f, doc, cur);
14624 call_tests++;
14625 des_FILE_ptr(n_f, f, 0);
14626 des_xmlDocPtr(n_doc, doc, 1);
14627 des_xmlNodePtr(n_cur, cur, 2);
14628 xmlResetLastError();
14629 if (mem_base != xmlMemBlocks()) {
14630 printf("Leak of %d blocks found in xmlElemDump",
14631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014632 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000014633 printf(" %d", n_f);
14634 printf(" %d", n_doc);
14635 printf(" %d", n_cur);
14636 printf("\n");
14637 }
14638 }
14639 }
14640 }
14641#endif
14642
14643 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014645}
14646
14647
14648static int
14649test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014651
Daniel Veillard57b25162004-11-06 14:50:18 +000014652 int mem_base;
14653 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014654
Daniel Veillard57b25162004-11-06 14:50:18 +000014655 mem_base = xmlMemBlocks();
14656
14657 ret_val = xmlGetBufferAllocationScheme();
14658 desret_xmlBufferAllocationScheme(ret_val);
14659 call_tests++;
14660 xmlResetLastError();
14661 if (mem_base != xmlMemBlocks()) {
14662 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
14663 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014664 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000014665 printf("\n");
14666 }
14667
14668 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014669 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014670}
14671
14672
14673static int
14674test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014675 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014676
14677 int mem_base;
14678 int ret_val;
14679
14680 mem_base = xmlMemBlocks();
14681
14682 ret_val = xmlGetCompressMode();
14683 desret_int(ret_val);
14684 call_tests++;
14685 xmlResetLastError();
14686 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014687 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014689 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014690 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014691 }
14692
Daniel Veillard3d97e662004-11-04 10:49:00 +000014693 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014694 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014695}
14696
14697
14698static int
14699test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014700 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014701
14702 int mem_base;
14703 int ret_val;
14704 xmlDocPtr doc; /* the document */
14705 int n_doc;
14706
14707 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
14708 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014709 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014710
14711 ret_val = xmlGetDocCompressMode(doc);
14712 desret_int(ret_val);
14713 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014714 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014715 xmlResetLastError();
14716 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014717 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014718 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014719 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014720 printf(" %d", n_doc);
14721 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014722 }
14723 }
14724
Daniel Veillard3d97e662004-11-04 10:49:00 +000014725 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014727}
14728
14729
14730static int
14731test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014732 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014733
Daniel Veillard34099b42004-11-04 17:34:35 +000014734 int mem_base;
14735 xmlDtdPtr ret_val;
14736 xmlDocPtr doc; /* the document pointer */
14737 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014738
Daniel Veillard34099b42004-11-04 17:34:35 +000014739 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
14740 mem_base = xmlMemBlocks();
14741 doc = gen_xmlDocPtr(n_doc, 0);
14742
14743 ret_val = xmlGetIntSubset(doc);
14744 desret_xmlDtdPtr(ret_val);
14745 call_tests++;
14746 des_xmlDocPtr(n_doc, doc, 0);
14747 xmlResetLastError();
14748 if (mem_base != xmlMemBlocks()) {
14749 printf("Leak of %d blocks found in xmlGetIntSubset",
14750 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014751 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014752 printf(" %d", n_doc);
14753 printf("\n");
14754 }
14755 }
14756
14757 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014759}
14760
14761
14762static int
14763test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014765
14766 int mem_base;
14767 xmlNodePtr ret_val;
14768 xmlNodePtr parent; /* the parent node */
14769 int n_parent;
14770
14771 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
14772 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014773 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014774
14775 ret_val = xmlGetLastChild(parent);
14776 desret_xmlNodePtr(ret_val);
14777 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014778 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014779 xmlResetLastError();
14780 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014781 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014782 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014783 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014784 printf(" %d", n_parent);
14785 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014786 }
14787 }
14788
Daniel Veillard3d97e662004-11-04 10:49:00 +000014789 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014790 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014791}
14792
14793
14794static int
14795test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014796 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014797
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000014798 int mem_base;
14799 long ret_val;
14800 xmlNodePtr node; /* valid node */
14801 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014802
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000014803 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
14804 mem_base = xmlMemBlocks();
14805 node = gen_xmlNodePtr(n_node, 0);
14806
14807 ret_val = xmlGetLineNo(node);
14808 desret_long(ret_val);
14809 call_tests++;
14810 des_xmlNodePtr(n_node, node, 0);
14811 xmlResetLastError();
14812 if (mem_base != xmlMemBlocks()) {
14813 printf("Leak of %d blocks found in xmlGetLineNo",
14814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014815 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000014816 printf(" %d", n_node);
14817 printf("\n");
14818 }
14819 }
14820
14821 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014823}
14824
14825
14826static int
14827test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014829
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014830 int mem_base;
14831 xmlChar * ret_val;
14832 xmlNodePtr node; /* the node */
14833 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014834 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014835 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014836
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014837 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
14838 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
14839 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014840 node = gen_xmlNodePtr(n_node, 0);
14841 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014842
14843 ret_val = xmlGetNoNsProp(node, name);
14844 desret_xmlChar_ptr(ret_val);
14845 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014846 des_xmlNodePtr(n_node, node, 0);
14847 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014848 xmlResetLastError();
14849 if (mem_base != xmlMemBlocks()) {
14850 printf("Leak of %d blocks found in xmlGetNoNsProp",
14851 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014852 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014853 printf(" %d", n_node);
14854 printf(" %d", n_name);
14855 printf("\n");
14856 }
14857 }
14858 }
14859
Daniel Veillard3d97e662004-11-04 10:49:00 +000014860 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014862}
14863
14864
14865static int
14866test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014868
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014869#ifdef LIBXML_TREE_ENABLED
14870 int mem_base;
14871 xmlChar * ret_val;
14872 xmlNodePtr node; /* a node */
14873 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014874
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014875 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
14876 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014877 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014878
14879 ret_val = xmlGetNodePath(node);
14880 desret_xmlChar_ptr(ret_val);
14881 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014882 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014883 xmlResetLastError();
14884 if (mem_base != xmlMemBlocks()) {
14885 printf("Leak of %d blocks found in xmlGetNodePath",
14886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014887 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014888 printf(" %d", n_node);
14889 printf("\n");
14890 }
14891 }
14892#endif
14893
Daniel Veillard3d97e662004-11-04 10:49:00 +000014894 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014895 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014896}
14897
14898
14899static int
14900test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014902
14903
14904 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000014905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014906}
14907
14908
14909static int
14910test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014912
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014913 int mem_base;
14914 xmlChar * ret_val;
14915 xmlNodePtr node; /* the node */
14916 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014917 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014918 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014919 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014920 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014921
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014922 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
14923 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
14924 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
14925 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014926 node = gen_xmlNodePtr(n_node, 0);
14927 name = gen_const_xmlChar_ptr(n_name, 1);
14928 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014929
14930 ret_val = xmlGetNsProp(node, name, nameSpace);
14931 desret_xmlChar_ptr(ret_val);
14932 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014933 des_xmlNodePtr(n_node, node, 0);
14934 des_const_xmlChar_ptr(n_name, name, 1);
14935 des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014936 xmlResetLastError();
14937 if (mem_base != xmlMemBlocks()) {
14938 printf("Leak of %d blocks found in xmlGetNsProp",
14939 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014940 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014941 printf(" %d", n_node);
14942 printf(" %d", n_name);
14943 printf(" %d", n_nameSpace);
14944 printf("\n");
14945 }
14946 }
14947 }
14948 }
14949
Daniel Veillard3d97e662004-11-04 10:49:00 +000014950 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014951 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014952}
14953
14954
14955static int
14956test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014957 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014958
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014959 int mem_base;
14960 xmlChar * ret_val;
14961 xmlNodePtr node; /* the node */
14962 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014963 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014964 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014965
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014966 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
14967 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
14968 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014969 node = gen_xmlNodePtr(n_node, 0);
14970 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014971
14972 ret_val = xmlGetProp(node, name);
14973 desret_xmlChar_ptr(ret_val);
14974 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014975 des_xmlNodePtr(n_node, node, 0);
14976 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014977 xmlResetLastError();
14978 if (mem_base != xmlMemBlocks()) {
14979 printf("Leak of %d blocks found in xmlGetProp",
14980 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014981 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014982 printf(" %d", n_node);
14983 printf(" %d", n_name);
14984 printf("\n");
14985 }
14986 }
14987 }
14988
Daniel Veillard3d97e662004-11-04 10:49:00 +000014989 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014991}
14992
14993
14994static int
14995test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014997
Daniel Veillard57b25162004-11-06 14:50:18 +000014998 int mem_base;
14999 xmlAttrPtr ret_val;
15000 xmlNodePtr node; /* the node */
15001 int n_node;
15002 xmlChar * name; /* the attribute name */
15003 int n_name;
15004 xmlChar * nameSpace; /* the URI of the namespace */
15005 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015006
Daniel Veillard57b25162004-11-06 14:50:18 +000015007 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
15008 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
15009 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
15010 mem_base = xmlMemBlocks();
15011 node = gen_xmlNodePtr(n_node, 0);
15012 name = gen_const_xmlChar_ptr(n_name, 1);
15013 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
15014
15015 ret_val = xmlHasNsProp(node, name, nameSpace);
15016 desret_xmlAttrPtr(ret_val);
15017 call_tests++;
15018 des_xmlNodePtr(n_node, node, 0);
15019 des_const_xmlChar_ptr(n_name, name, 1);
15020 des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
15021 xmlResetLastError();
15022 if (mem_base != xmlMemBlocks()) {
15023 printf("Leak of %d blocks found in xmlHasNsProp",
15024 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015025 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000015026 printf(" %d", n_node);
15027 printf(" %d", n_name);
15028 printf(" %d", n_nameSpace);
15029 printf("\n");
15030 }
15031 }
15032 }
15033 }
15034
15035 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015036 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015037}
15038
15039
15040static int
15041test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015042 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015043
Daniel Veillard57b25162004-11-06 14:50:18 +000015044 int mem_base;
15045 xmlAttrPtr ret_val;
15046 xmlNodePtr node; /* the node */
15047 int n_node;
15048 xmlChar * name; /* the attribute name */
15049 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015050
Daniel Veillard57b25162004-11-06 14:50:18 +000015051 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
15052 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
15053 mem_base = xmlMemBlocks();
15054 node = gen_xmlNodePtr(n_node, 0);
15055 name = gen_const_xmlChar_ptr(n_name, 1);
15056
15057 ret_val = xmlHasProp(node, name);
15058 desret_xmlAttrPtr(ret_val);
15059 call_tests++;
15060 des_xmlNodePtr(n_node, node, 0);
15061 des_const_xmlChar_ptr(n_name, name, 1);
15062 xmlResetLastError();
15063 if (mem_base != xmlMemBlocks()) {
15064 printf("Leak of %d blocks found in xmlHasProp",
15065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015066 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000015067 printf(" %d", n_node);
15068 printf(" %d", n_name);
15069 printf("\n");
15070 }
15071 }
15072 }
15073
15074 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015075 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015076}
15077
15078
15079static int
15080test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015081 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015082
15083 int mem_base;
15084 int ret_val;
15085 xmlNodePtr node; /* the node */
15086 int n_node;
15087
15088 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
15089 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015090 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015091
15092 ret_val = xmlIsBlankNode(node);
15093 desret_int(ret_val);
15094 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015095 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015096 xmlResetLastError();
15097 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015098 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015099 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015100 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015101 printf(" %d", n_node);
15102 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015103 }
15104 }
15105
Daniel Veillard3d97e662004-11-04 10:49:00 +000015106 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015108}
15109
15110
15111static int
15112test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015114
15115 int mem_base;
15116 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015117 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015118 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015119 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015120 int n_publicID;
15121
15122 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
15123 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
15124 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015125 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
15126 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015127
15128 ret_val = xmlIsXHTML(systemID, publicID);
15129 desret_int(ret_val);
15130 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015131 des_const_xmlChar_ptr(n_systemID, systemID, 0);
15132 des_const_xmlChar_ptr(n_publicID, publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015133 xmlResetLastError();
15134 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015135 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015137 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015138 printf(" %d", n_systemID);
15139 printf(" %d", n_publicID);
15140 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015141 }
15142 }
15143 }
15144
Daniel Veillard3d97e662004-11-04 10:49:00 +000015145 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015146 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015147}
15148
15149
15150static int
15151test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015152 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015153
15154 int mem_base;
15155 xmlNodePtr ret_val;
15156 xmlDocPtr doc; /* the document */
15157 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015158 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015159 int n_content;
15160 int len; /* the length of the block */
15161 int n_len;
15162
15163 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
15164 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
15165 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15166 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015167 doc = gen_xmlDocPtr(n_doc, 0);
15168 content = gen_const_xmlChar_ptr(n_content, 1);
15169 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015170
15171 ret_val = xmlNewCDataBlock(doc, content, len);
15172 desret_xmlNodePtr(ret_val);
15173 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015174 des_xmlDocPtr(n_doc, doc, 0);
15175 des_const_xmlChar_ptr(n_content, content, 1);
15176 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015177 xmlResetLastError();
15178 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015179 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015181 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015182 printf(" %d", n_doc);
15183 printf(" %d", n_content);
15184 printf(" %d", n_len);
15185 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015186 }
15187 }
15188 }
15189 }
15190
Daniel Veillard3d97e662004-11-04 10:49:00 +000015191 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015193}
15194
15195
15196static int
15197test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015198 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015199
15200 int mem_base;
15201 xmlNodePtr ret_val;
15202 xmlDocPtr doc; /* the document */
15203 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015204 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015205 int n_name;
15206
15207 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
15208 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
15209 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015210 doc = gen_xmlDocPtr(n_doc, 0);
15211 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015212
15213 ret_val = xmlNewCharRef(doc, name);
15214 desret_xmlNodePtr(ret_val);
15215 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015216 des_xmlDocPtr(n_doc, doc, 0);
15217 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015218 xmlResetLastError();
15219 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015220 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015222 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015223 printf(" %d", n_doc);
15224 printf(" %d", n_name);
15225 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015226 }
15227 }
15228 }
15229
Daniel Veillard3d97e662004-11-04 10:49:00 +000015230 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015232}
15233
15234
15235static int
15236test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015238
Daniel Veillard27f20102004-11-05 11:50:11 +000015239 int mem_base;
15240 xmlNodePtr ret_val;
15241 xmlNodePtr parent; /* the parent node */
15242 int n_parent;
15243 xmlNsPtr ns; /* a namespace if any */
15244 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015245 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000015246 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015247 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000015248 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015249
Daniel Veillard27f20102004-11-05 11:50:11 +000015250 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
15251 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
15252 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
15253 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
15254 mem_base = xmlMemBlocks();
15255 parent = gen_xmlNodePtr(n_parent, 0);
15256 ns = gen_xmlNsPtr(n_ns, 1);
15257 name = gen_const_xmlChar_ptr(n_name, 2);
15258 content = gen_const_xmlChar_ptr(n_content, 3);
15259
15260 ret_val = xmlNewChild(parent, ns, name, content);
15261 desret_xmlNodePtr(ret_val);
15262 call_tests++;
15263 des_xmlNodePtr(n_parent, parent, 0);
15264 des_xmlNsPtr(n_ns, ns, 1);
15265 des_const_xmlChar_ptr(n_name, name, 2);
15266 des_const_xmlChar_ptr(n_content, content, 3);
15267 xmlResetLastError();
15268 if (mem_base != xmlMemBlocks()) {
15269 printf("Leak of %d blocks found in xmlNewChild",
15270 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015271 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000015272 printf(" %d", n_parent);
15273 printf(" %d", n_ns);
15274 printf(" %d", n_name);
15275 printf(" %d", n_content);
15276 printf("\n");
15277 }
15278 }
15279 }
15280 }
15281 }
15282
15283 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015284 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015285}
15286
15287
15288static int
15289test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015290 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015291
15292 int mem_base;
15293 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015294 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015295 int n_content;
15296
15297 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
15298 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015299 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015300
15301 ret_val = xmlNewComment(content);
15302 desret_xmlNodePtr(ret_val);
15303 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015304 des_const_xmlChar_ptr(n_content, content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015305 xmlResetLastError();
15306 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015307 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015309 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015310 printf(" %d", n_content);
15311 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015312 }
15313 }
15314
Daniel Veillard3d97e662004-11-04 10:49:00 +000015315 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015317}
15318
15319
15320static int
15321test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015323
15324 int mem_base;
15325 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015326 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015327 int n_version;
15328
15329 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
15330 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015331 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015332
15333 ret_val = xmlNewDoc(version);
15334 desret_xmlDocPtr(ret_val);
15335 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015336 des_const_xmlChar_ptr(n_version, version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015337 xmlResetLastError();
15338 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015339 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015341 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015342 printf(" %d", n_version);
15343 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015344 }
15345 }
15346
Daniel Veillard3d97e662004-11-04 10:49:00 +000015347 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015349}
15350
15351
15352static int
15353test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015355
15356 int mem_base;
15357 xmlNodePtr ret_val;
15358 xmlDocPtr doc; /* the document */
15359 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015360 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015361 int n_content;
15362
15363 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
15364 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
15365 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015366 doc = gen_xmlDocPtr(n_doc, 0);
15367 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015368
15369 ret_val = xmlNewDocComment(doc, content);
15370 desret_xmlNodePtr(ret_val);
15371 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015372 des_xmlDocPtr(n_doc, doc, 0);
15373 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015374 xmlResetLastError();
15375 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015376 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015377 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015378 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015379 printf(" %d", n_doc);
15380 printf(" %d", n_content);
15381 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015382 }
15383 }
15384 }
15385
Daniel Veillard3d97e662004-11-04 10:49:00 +000015386 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015388}
15389
15390
15391static int
15392test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015394
15395#ifdef LIBXML_TREE_ENABLED
15396 int mem_base;
15397 xmlNodePtr ret_val;
15398 xmlDocPtr doc; /* the document owning the fragment */
15399 int n_doc;
15400
15401 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
15402 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015403 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015404
15405 ret_val = xmlNewDocFragment(doc);
15406 desret_xmlNodePtr(ret_val);
15407 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015408 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015409 xmlResetLastError();
15410 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015411 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015413 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015414 printf(" %d", n_doc);
15415 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015416 }
15417 }
15418#endif
15419
Daniel Veillard3d97e662004-11-04 10:49:00 +000015420 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015421 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015422}
15423
15424
15425static int
15426test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015427 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015428
Daniel Veillard27f20102004-11-05 11:50:11 +000015429 int mem_base;
15430 xmlNodePtr ret_val;
15431 xmlDocPtr doc; /* the document */
15432 int n_doc;
15433 xmlNsPtr ns; /* namespace if any */
15434 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015435 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000015436 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015437 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000015438 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015439
Daniel Veillard27f20102004-11-05 11:50:11 +000015440 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
15441 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
15442 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
15443 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
15444 mem_base = xmlMemBlocks();
15445 doc = gen_xmlDocPtr(n_doc, 0);
15446 ns = gen_xmlNsPtr(n_ns, 1);
15447 name = gen_const_xmlChar_ptr(n_name, 2);
15448 content = gen_const_xmlChar_ptr(n_content, 3);
15449
15450 ret_val = xmlNewDocNode(doc, ns, name, content);
15451 desret_xmlNodePtr(ret_val);
15452 call_tests++;
15453 des_xmlDocPtr(n_doc, doc, 0);
15454 des_xmlNsPtr(n_ns, ns, 1);
15455 des_const_xmlChar_ptr(n_name, name, 2);
15456 des_const_xmlChar_ptr(n_content, content, 3);
15457 xmlResetLastError();
15458 if (mem_base != xmlMemBlocks()) {
15459 printf("Leak of %d blocks found in xmlNewDocNode",
15460 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015461 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000015462 printf(" %d", n_doc);
15463 printf(" %d", n_ns);
15464 printf(" %d", n_name);
15465 printf(" %d", n_content);
15466 printf("\n");
15467 }
15468 }
15469 }
15470 }
15471 }
15472
15473 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015475}
15476
15477
15478static int
15479test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015481
Daniel Veillard27f20102004-11-05 11:50:11 +000015482 int mem_base;
15483 xmlNodePtr ret_val;
15484 xmlDocPtr doc; /* the document */
15485 int n_doc;
15486 xmlNsPtr ns; /* namespace if any */
15487 int n_ns;
15488 xmlChar * name; /* the node name */
15489 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015490 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000015491 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015492
Daniel Veillard27f20102004-11-05 11:50:11 +000015493 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
15494 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
15495 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
15496 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
15497 mem_base = xmlMemBlocks();
15498 doc = gen_xmlDocPtr(n_doc, 0);
15499 ns = gen_xmlNsPtr(n_ns, 1);
15500 name = gen_eaten_name(n_name, 2);
15501 content = gen_const_xmlChar_ptr(n_content, 3);
15502
15503 ret_val = xmlNewDocNodeEatName(doc, ns, name, content);
15504 desret_xmlNodePtr(ret_val);
15505 call_tests++;
15506 des_xmlDocPtr(n_doc, doc, 0);
15507 des_xmlNsPtr(n_ns, ns, 1);
15508 des_eaten_name(n_name, name, 2);
15509 des_const_xmlChar_ptr(n_content, content, 3);
15510 xmlResetLastError();
15511 if (mem_base != xmlMemBlocks()) {
15512 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
15513 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015514 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000015515 printf(" %d", n_doc);
15516 printf(" %d", n_ns);
15517 printf(" %d", n_name);
15518 printf(" %d", n_content);
15519 printf("\n");
15520 }
15521 }
15522 }
15523 }
15524 }
15525
15526 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015528}
15529
15530
15531static int
15532test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015534
15535 int mem_base;
15536 xmlNodePtr ret_val;
15537 xmlDocPtr doc; /* the target document */
15538 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015539 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015540 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015541 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015542 int n_content;
15543
15544 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
15545 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
15546 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
15547 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015548 doc = gen_xmlDocPtr(n_doc, 0);
15549 name = gen_const_xmlChar_ptr(n_name, 1);
15550 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015551
15552 ret_val = xmlNewDocPI(doc, name, content);
15553 desret_xmlNodePtr(ret_val);
15554 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015555 des_xmlDocPtr(n_doc, doc, 0);
15556 des_const_xmlChar_ptr(n_name, name, 1);
15557 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015558 xmlResetLastError();
15559 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015560 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015561 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015562 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015563 printf(" %d", n_doc);
15564 printf(" %d", n_name);
15565 printf(" %d", n_content);
15566 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015567 }
15568 }
15569 }
15570 }
15571
Daniel Veillard3d97e662004-11-04 10:49:00 +000015572 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015573 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015574}
15575
15576
15577static int
15578test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015579 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015580
Daniel Veillard57b25162004-11-06 14:50:18 +000015581 int mem_base;
15582 xmlAttrPtr ret_val;
15583 xmlDocPtr doc; /* the document */
15584 int n_doc;
15585 xmlChar * name; /* the name of the attribute */
15586 int n_name;
15587 xmlChar * value; /* the value of the attribute */
15588 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015589
Daniel Veillard57b25162004-11-06 14:50:18 +000015590 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
15591 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
15592 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15593 mem_base = xmlMemBlocks();
15594 doc = gen_xmlDocPtr(n_doc, 0);
15595 name = gen_const_xmlChar_ptr(n_name, 1);
15596 value = gen_const_xmlChar_ptr(n_value, 2);
15597
15598 ret_val = xmlNewDocProp(doc, name, value);
15599 desret_xmlAttrPtr(ret_val);
15600 call_tests++;
15601 des_xmlDocPtr(n_doc, doc, 0);
15602 des_const_xmlChar_ptr(n_name, name, 1);
15603 des_const_xmlChar_ptr(n_value, value, 2);
15604 xmlResetLastError();
15605 if (mem_base != xmlMemBlocks()) {
15606 printf("Leak of %d blocks found in xmlNewDocProp",
15607 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015608 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000015609 printf(" %d", n_doc);
15610 printf(" %d", n_name);
15611 printf(" %d", n_value);
15612 printf("\n");
15613 }
15614 }
15615 }
15616 }
15617
15618 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015620}
15621
15622
15623static int
15624test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015626
Daniel Veillard27f20102004-11-05 11:50:11 +000015627 int mem_base;
15628 xmlNodePtr ret_val;
15629 xmlDocPtr doc; /* the document */
15630 int n_doc;
15631 xmlNsPtr ns; /* namespace if any */
15632 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015633 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000015634 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015635 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000015636 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015637
Daniel Veillard27f20102004-11-05 11:50:11 +000015638 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
15639 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
15640 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
15641 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
15642 mem_base = xmlMemBlocks();
15643 doc = gen_xmlDocPtr(n_doc, 0);
15644 ns = gen_xmlNsPtr(n_ns, 1);
15645 name = gen_const_xmlChar_ptr(n_name, 2);
15646 content = gen_const_xmlChar_ptr(n_content, 3);
15647
15648 ret_val = xmlNewDocRawNode(doc, ns, name, content);
15649 desret_xmlNodePtr(ret_val);
15650 call_tests++;
15651 des_xmlDocPtr(n_doc, doc, 0);
15652 des_xmlNsPtr(n_ns, ns, 1);
15653 des_const_xmlChar_ptr(n_name, name, 2);
15654 des_const_xmlChar_ptr(n_content, content, 3);
15655 xmlResetLastError();
15656 if (mem_base != xmlMemBlocks()) {
15657 printf("Leak of %d blocks found in xmlNewDocRawNode",
15658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015659 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000015660 printf(" %d", n_doc);
15661 printf(" %d", n_ns);
15662 printf(" %d", n_name);
15663 printf(" %d", n_content);
15664 printf("\n");
15665 }
15666 }
15667 }
15668 }
15669 }
15670
15671 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015672 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015673}
15674
15675
15676static int
15677test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015678 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015679
15680 int mem_base;
15681 xmlNodePtr ret_val;
15682 xmlDocPtr doc; /* the document */
15683 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015684 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015685 int n_content;
15686
15687 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
15688 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
15689 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015690 doc = gen_xmlDocPtr(n_doc, 0);
15691 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015692
15693 ret_val = xmlNewDocText(doc, content);
15694 desret_xmlNodePtr(ret_val);
15695 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015696 des_xmlDocPtr(n_doc, doc, 0);
15697 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015698 xmlResetLastError();
15699 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015700 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015702 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015703 printf(" %d", n_doc);
15704 printf(" %d", n_content);
15705 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015706 }
15707 }
15708 }
15709
Daniel Veillard3d97e662004-11-04 10:49:00 +000015710 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015711 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015712}
15713
15714
15715static int
15716test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015717 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015718
15719 int mem_base;
15720 xmlNodePtr ret_val;
15721 xmlDocPtr doc; /* the document */
15722 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015723 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015724 int n_content;
15725 int len; /* the text len. */
15726 int n_len;
15727
15728 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
15729 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
15730 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15731 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015732 doc = gen_xmlDocPtr(n_doc, 0);
15733 content = gen_const_xmlChar_ptr(n_content, 1);
15734 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015735
15736 ret_val = xmlNewDocTextLen(doc, content, len);
15737 desret_xmlNodePtr(ret_val);
15738 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015739 des_xmlDocPtr(n_doc, doc, 0);
15740 des_const_xmlChar_ptr(n_content, content, 1);
15741 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015742 xmlResetLastError();
15743 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015744 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015746 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015747 printf(" %d", n_doc);
15748 printf(" %d", n_content);
15749 printf(" %d", n_len);
15750 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015751 }
15752 }
15753 }
15754 }
15755
Daniel Veillard3d97e662004-11-04 10:49:00 +000015756 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015758}
15759
15760
15761static int
15762test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015764
Daniel Veillard34099b42004-11-04 17:34:35 +000015765 int mem_base;
15766 xmlDtdPtr ret_val;
15767 xmlDocPtr doc; /* the document pointer */
15768 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015769 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000015770 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015771 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000015772 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015773 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000015774 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015775
Daniel Veillard34099b42004-11-04 17:34:35 +000015776 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
15777 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
15778 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
15779 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
15780 mem_base = xmlMemBlocks();
15781 doc = gen_xmlDocPtr(n_doc, 0);
15782 name = gen_const_xmlChar_ptr(n_name, 1);
15783 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
15784 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
15785
15786 ret_val = xmlNewDtd(doc, name, ExternalID, SystemID);
15787 desret_xmlDtdPtr(ret_val);
15788 call_tests++;
15789 des_xmlDocPtr(n_doc, doc, 0);
15790 des_const_xmlChar_ptr(n_name, name, 1);
15791 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
15792 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
15793 xmlResetLastError();
15794 if (mem_base != xmlMemBlocks()) {
15795 printf("Leak of %d blocks found in xmlNewDtd",
15796 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015797 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015798 printf(" %d", n_doc);
15799 printf(" %d", n_name);
15800 printf(" %d", n_ExternalID);
15801 printf(" %d", n_SystemID);
15802 printf("\n");
15803 }
15804 }
15805 }
15806 }
15807 }
15808
15809 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015811}
15812
15813
15814static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000015815test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015817
Daniel Veillard27f20102004-11-05 11:50:11 +000015818 int mem_base;
15819 xmlNodePtr ret_val;
15820 xmlNsPtr ns; /* namespace if any */
15821 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015822 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000015823 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015824
Daniel Veillard27f20102004-11-05 11:50:11 +000015825 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
15826 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
15827 mem_base = xmlMemBlocks();
15828 ns = gen_xmlNsPtr(n_ns, 0);
15829 name = gen_const_xmlChar_ptr(n_name, 1);
15830
15831 ret_val = xmlNewNode(ns, name);
15832 desret_xmlNodePtr(ret_val);
15833 call_tests++;
15834 des_xmlNsPtr(n_ns, ns, 0);
15835 des_const_xmlChar_ptr(n_name, name, 1);
15836 xmlResetLastError();
15837 if (mem_base != xmlMemBlocks()) {
15838 printf("Leak of %d blocks found in xmlNewNode",
15839 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015840 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000015841 printf(" %d", n_ns);
15842 printf(" %d", n_name);
15843 printf("\n");
15844 }
15845 }
15846 }
15847
15848 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015850}
15851
15852
15853static int
15854test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015856
Daniel Veillard27f20102004-11-05 11:50:11 +000015857 int mem_base;
15858 xmlNodePtr ret_val;
15859 xmlNsPtr ns; /* namespace if any */
15860 int n_ns;
15861 xmlChar * name; /* the node name */
15862 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015863
Daniel Veillard27f20102004-11-05 11:50:11 +000015864 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
15865 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
15866 mem_base = xmlMemBlocks();
15867 ns = gen_xmlNsPtr(n_ns, 0);
15868 name = gen_eaten_name(n_name, 1);
15869
15870 ret_val = xmlNewNodeEatName(ns, name);
15871 desret_xmlNodePtr(ret_val);
15872 call_tests++;
15873 des_xmlNsPtr(n_ns, ns, 0);
15874 des_eaten_name(n_name, name, 1);
15875 xmlResetLastError();
15876 if (mem_base != xmlMemBlocks()) {
15877 printf("Leak of %d blocks found in xmlNewNodeEatName",
15878 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015879 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000015880 printf(" %d", n_ns);
15881 printf(" %d", n_name);
15882 printf("\n");
15883 }
15884 }
15885 }
15886
15887 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015889}
15890
15891
15892static int
15893test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015895
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000015896 int mem_base;
15897 xmlNsPtr ret_val;
15898 xmlNodePtr node; /* the element carrying the namespace */
15899 int n_node;
15900 xmlChar * href; /* the URI associated */
15901 int n_href;
15902 xmlChar * prefix; /* the prefix for the namespace */
15903 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015904
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000015905 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
15906 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
15907 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
15908 mem_base = xmlMemBlocks();
15909 node = gen_xmlNodePtr(n_node, 0);
15910 href = gen_const_xmlChar_ptr(n_href, 1);
15911 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
15912
15913 ret_val = xmlNewNs(node, href, prefix);
15914 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
15915 desret_xmlNsPtr(ret_val);
15916 call_tests++;
15917 des_xmlNodePtr(n_node, node, 0);
15918 des_const_xmlChar_ptr(n_href, href, 1);
15919 des_const_xmlChar_ptr(n_prefix, prefix, 2);
15920 xmlResetLastError();
15921 if (mem_base != xmlMemBlocks()) {
15922 printf("Leak of %d blocks found in xmlNewNs",
15923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015924 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000015925 printf(" %d", n_node);
15926 printf(" %d", n_href);
15927 printf(" %d", n_prefix);
15928 printf("\n");
15929 }
15930 }
15931 }
15932 }
15933
15934 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015935 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015936}
15937
15938
15939static int
15940test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015941 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015942
Daniel Veillard57b25162004-11-06 14:50:18 +000015943 int mem_base;
15944 xmlAttrPtr ret_val;
15945 xmlNodePtr node; /* the holding node */
15946 int n_node;
15947 xmlNsPtr ns; /* the namespace */
15948 int n_ns;
15949 xmlChar * name; /* the name of the attribute */
15950 int n_name;
15951 xmlChar * value; /* the value of the attribute */
15952 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015953
Daniel Veillard57b25162004-11-06 14:50:18 +000015954 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
15955 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
15956 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
15957 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15958 mem_base = xmlMemBlocks();
15959 node = gen_xmlNodePtr(n_node, 0);
15960 ns = gen_xmlNsPtr(n_ns, 1);
15961 name = gen_const_xmlChar_ptr(n_name, 2);
15962 value = gen_const_xmlChar_ptr(n_value, 3);
15963
15964 ret_val = xmlNewNsProp(node, ns, name, value);
15965 desret_xmlAttrPtr(ret_val);
15966 call_tests++;
15967 des_xmlNodePtr(n_node, node, 0);
15968 des_xmlNsPtr(n_ns, ns, 1);
15969 des_const_xmlChar_ptr(n_name, name, 2);
15970 des_const_xmlChar_ptr(n_value, value, 3);
15971 xmlResetLastError();
15972 if (mem_base != xmlMemBlocks()) {
15973 printf("Leak of %d blocks found in xmlNewNsProp",
15974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015975 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000015976 printf(" %d", n_node);
15977 printf(" %d", n_ns);
15978 printf(" %d", n_name);
15979 printf(" %d", n_value);
15980 printf("\n");
15981 }
15982 }
15983 }
15984 }
15985 }
15986
15987 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015988 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015989}
15990
15991
15992static int
15993test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015994 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015995
Daniel Veillard57b25162004-11-06 14:50:18 +000015996 int mem_base;
15997 xmlAttrPtr ret_val;
15998 xmlNodePtr node; /* the holding node */
15999 int n_node;
16000 xmlNsPtr ns; /* the namespace */
16001 int n_ns;
16002 xmlChar * name; /* the name of the attribute */
16003 int n_name;
16004 xmlChar * value; /* the value of the attribute */
16005 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016006
Daniel Veillard57b25162004-11-06 14:50:18 +000016007 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16008 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
16009 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
16010 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
16011 mem_base = xmlMemBlocks();
16012 node = gen_xmlNodePtr(n_node, 0);
16013 ns = gen_xmlNsPtr(n_ns, 1);
16014 name = gen_eaten_name(n_name, 2);
16015 value = gen_const_xmlChar_ptr(n_value, 3);
16016
16017 ret_val = xmlNewNsPropEatName(node, ns, name, value);
16018 desret_xmlAttrPtr(ret_val);
16019 call_tests++;
16020 des_xmlNodePtr(n_node, node, 0);
16021 des_xmlNsPtr(n_ns, ns, 1);
16022 des_eaten_name(n_name, name, 2);
16023 des_const_xmlChar_ptr(n_value, value, 3);
16024 xmlResetLastError();
16025 if (mem_base != xmlMemBlocks()) {
16026 printf("Leak of %d blocks found in xmlNewNsPropEatName",
16027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016028 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000016029 printf(" %d", n_node);
16030 printf(" %d", n_ns);
16031 printf(" %d", n_name);
16032 printf(" %d", n_value);
16033 printf("\n");
16034 }
16035 }
16036 }
16037 }
16038 }
16039
16040 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016041 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016042}
16043
16044
16045static int
16046test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016047 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016048
16049 int mem_base;
16050 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016051 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000016052 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016053 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000016054 int n_content;
16055
16056 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16057 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
16058 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016059 name = gen_const_xmlChar_ptr(n_name, 0);
16060 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016061
16062 ret_val = xmlNewPI(name, content);
16063 desret_xmlNodePtr(ret_val);
16064 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016065 des_const_xmlChar_ptr(n_name, name, 0);
16066 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016067 xmlResetLastError();
16068 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000016069 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000016070 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016071 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000016072 printf(" %d", n_name);
16073 printf(" %d", n_content);
16074 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000016075 }
16076 }
16077 }
16078
Daniel Veillard3d97e662004-11-04 10:49:00 +000016079 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016080 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016081}
16082
16083
16084static int
16085test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016086 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016087
Daniel Veillard57b25162004-11-06 14:50:18 +000016088 int mem_base;
16089 xmlAttrPtr ret_val;
16090 xmlNodePtr node; /* the holding node */
16091 int n_node;
16092 xmlChar * name; /* the name of the attribute */
16093 int n_name;
16094 xmlChar * value; /* the value of the attribute */
16095 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016096
Daniel Veillard57b25162004-11-06 14:50:18 +000016097 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16098 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16099 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
16100 mem_base = xmlMemBlocks();
16101 node = gen_xmlNodePtr(n_node, 0);
16102 name = gen_const_xmlChar_ptr(n_name, 1);
16103 value = gen_const_xmlChar_ptr(n_value, 2);
16104
16105 ret_val = xmlNewProp(node, name, value);
16106 desret_xmlAttrPtr(ret_val);
16107 call_tests++;
16108 des_xmlNodePtr(n_node, node, 0);
16109 des_const_xmlChar_ptr(n_name, name, 1);
16110 des_const_xmlChar_ptr(n_value, value, 2);
16111 xmlResetLastError();
16112 if (mem_base != xmlMemBlocks()) {
16113 printf("Leak of %d blocks found in xmlNewProp",
16114 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016115 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000016116 printf(" %d", n_node);
16117 printf(" %d", n_name);
16118 printf(" %d", n_value);
16119 printf("\n");
16120 }
16121 }
16122 }
16123 }
16124
16125 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016127}
16128
16129
16130static int
16131test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016133
16134 int mem_base;
16135 xmlNodePtr ret_val;
16136 xmlDocPtr doc; /* the document */
16137 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016138 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000016139 int n_name;
16140
16141 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
16142 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16143 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016144 doc = gen_xmlDocPtr(n_doc, 0);
16145 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016146
16147 ret_val = xmlNewReference(doc, name);
16148 desret_xmlNodePtr(ret_val);
16149 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016150 des_xmlDocPtr(n_doc, doc, 0);
16151 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016152 xmlResetLastError();
16153 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000016154 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000016155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016156 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000016157 printf(" %d", n_doc);
16158 printf(" %d", n_name);
16159 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000016160 }
16161 }
16162 }
16163
Daniel Veillard3d97e662004-11-04 10:49:00 +000016164 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016166}
16167
16168
16169static int
16170test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016172
16173 int mem_base;
16174 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016175 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000016176 int n_content;
16177
16178 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
16179 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016180 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016181
16182 ret_val = xmlNewText(content);
16183 desret_xmlNodePtr(ret_val);
16184 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016185 des_const_xmlChar_ptr(n_content, content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016186 xmlResetLastError();
16187 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000016188 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000016189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016190 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000016191 printf(" %d", n_content);
16192 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000016193 }
16194 }
16195
Daniel Veillard3d97e662004-11-04 10:49:00 +000016196 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016197 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016198}
16199
16200
16201static int
16202test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016203 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016204
Daniel Veillard27f20102004-11-05 11:50:11 +000016205 int mem_base;
16206 xmlNodePtr ret_val;
16207 xmlNodePtr parent; /* the parent node */
16208 int n_parent;
16209 xmlNsPtr ns; /* a namespace if any */
16210 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016211 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000016212 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016213 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000016214 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016215
Daniel Veillard27f20102004-11-05 11:50:11 +000016216 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
16217 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
16218 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16219 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
16220 mem_base = xmlMemBlocks();
16221 parent = gen_xmlNodePtr(n_parent, 0);
16222 ns = gen_xmlNsPtr(n_ns, 1);
16223 name = gen_const_xmlChar_ptr(n_name, 2);
16224 content = gen_const_xmlChar_ptr(n_content, 3);
16225
16226 ret_val = xmlNewTextChild(parent, ns, name, content);
16227 desret_xmlNodePtr(ret_val);
16228 call_tests++;
16229 des_xmlNodePtr(n_parent, parent, 0);
16230 des_xmlNsPtr(n_ns, ns, 1);
16231 des_const_xmlChar_ptr(n_name, name, 2);
16232 des_const_xmlChar_ptr(n_content, content, 3);
16233 xmlResetLastError();
16234 if (mem_base != xmlMemBlocks()) {
16235 printf("Leak of %d blocks found in xmlNewTextChild",
16236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016237 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000016238 printf(" %d", n_parent);
16239 printf(" %d", n_ns);
16240 printf(" %d", n_name);
16241 printf(" %d", n_content);
16242 printf("\n");
16243 }
16244 }
16245 }
16246 }
16247 }
16248
16249 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016251}
16252
16253
16254static int
16255test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016257
16258 int mem_base;
16259 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016260 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000016261 int n_content;
16262 int len; /* the text len. */
16263 int n_len;
16264
16265 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
16266 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16267 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016268 content = gen_const_xmlChar_ptr(n_content, 0);
16269 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016270
16271 ret_val = xmlNewTextLen(content, len);
16272 desret_xmlNodePtr(ret_val);
16273 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016274 des_const_xmlChar_ptr(n_content, content, 0);
16275 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016276 xmlResetLastError();
16277 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000016278 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000016279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016280 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000016281 printf(" %d", n_content);
16282 printf(" %d", n_len);
16283 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000016284 }
16285 }
16286 }
16287
Daniel Veillard3d97e662004-11-04 10:49:00 +000016288 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016290}
16291
16292
16293static int
16294test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016296
16297 int mem_base;
16298 xmlNodePtr cur; /* the node being modified */
16299 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016300 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000016301 int n_content;
16302
16303 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
16304 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
16305 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016306 cur = gen_xmlNodePtr(n_cur, 0);
16307 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016308
16309 xmlNodeAddContent(cur, content);
16310 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016311 des_xmlNodePtr(n_cur, cur, 0);
16312 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016313 xmlResetLastError();
16314 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000016315 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000016316 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016317 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000016318 printf(" %d", n_cur);
16319 printf(" %d", n_content);
16320 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000016321 }
16322 }
16323 }
16324
Daniel Veillard3d97e662004-11-04 10:49:00 +000016325 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016327}
16328
16329
16330static int
16331test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016333
16334 int mem_base;
16335 xmlNodePtr cur; /* the node being modified */
16336 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016337 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000016338 int n_content;
16339 int len; /* the size of @content */
16340 int n_len;
16341
16342 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
16343 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
16344 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16345 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016346 cur = gen_xmlNodePtr(n_cur, 0);
16347 content = gen_const_xmlChar_ptr(n_content, 1);
16348 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016349
16350 xmlNodeAddContentLen(cur, content, len);
16351 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016352 des_xmlNodePtr(n_cur, cur, 0);
16353 des_const_xmlChar_ptr(n_content, content, 1);
16354 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016355 xmlResetLastError();
16356 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000016357 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000016358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016359 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000016360 printf(" %d", n_cur);
16361 printf(" %d", n_content);
16362 printf(" %d", n_len);
16363 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000016364 }
16365 }
16366 }
16367 }
16368
Daniel Veillard3d97e662004-11-04 10:49:00 +000016369 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016371}
16372
16373
16374static int
16375test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016377
Daniel Veillardd005b9e2004-11-03 17:07:05 +000016378 int mem_base;
16379 int ret_val;
16380 xmlBufferPtr buffer; /* a buffer */
16381 int n_buffer;
16382 xmlNodePtr cur; /* the node being read */
16383 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016384
Daniel Veillardd005b9e2004-11-03 17:07:05 +000016385 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
16386 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
16387 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016388 buffer = gen_xmlBufferPtr(n_buffer, 0);
16389 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000016390
16391 ret_val = xmlNodeBufGetContent(buffer, cur);
16392 desret_int(ret_val);
16393 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016394 des_xmlBufferPtr(n_buffer, buffer, 0);
16395 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000016396 xmlResetLastError();
16397 if (mem_base != xmlMemBlocks()) {
16398 printf("Leak of %d blocks found in xmlNodeBufGetContent",
16399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016400 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000016401 printf(" %d", n_buffer);
16402 printf(" %d", n_cur);
16403 printf("\n");
16404 }
16405 }
16406 }
16407
Daniel Veillard3d97e662004-11-04 10:49:00 +000016408 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016409 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016410}
16411
16412
16413static int
16414test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016415 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016416
Daniel Veillardd005b9e2004-11-03 17:07:05 +000016417#ifdef LIBXML_OUTPUT_ENABLED
16418 int mem_base;
16419 int ret_val;
16420 xmlBufferPtr buf; /* the XML buffer output */
16421 int n_buf;
16422 xmlDocPtr doc; /* the document */
16423 int n_doc;
16424 xmlNodePtr cur; /* the current node */
16425 int n_cur;
16426 int level; /* the imbrication level for indenting */
16427 int n_level;
16428 int format; /* is formatting allowed */
16429 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016430
Daniel Veillardd005b9e2004-11-03 17:07:05 +000016431 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
16432 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
16433 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
16434 for (n_level = 0;n_level < gen_nb_int;n_level++) {
16435 for (n_format = 0;n_format < gen_nb_int;n_format++) {
16436 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016437 buf = gen_xmlBufferPtr(n_buf, 0);
16438 doc = gen_xmlDocPtr(n_doc, 1);
16439 cur = gen_xmlNodePtr(n_cur, 2);
16440 level = gen_int(n_level, 3);
16441 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000016442
16443 ret_val = xmlNodeDump(buf, doc, cur, level, format);
16444 desret_int(ret_val);
16445 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016446 des_xmlBufferPtr(n_buf, buf, 0);
16447 des_xmlDocPtr(n_doc, doc, 1);
16448 des_xmlNodePtr(n_cur, cur, 2);
16449 des_int(n_level, level, 3);
16450 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000016451 xmlResetLastError();
16452 if (mem_base != xmlMemBlocks()) {
16453 printf("Leak of %d blocks found in xmlNodeDump",
16454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016455 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000016456 printf(" %d", n_buf);
16457 printf(" %d", n_doc);
16458 printf(" %d", n_cur);
16459 printf(" %d", n_level);
16460 printf(" %d", n_format);
16461 printf("\n");
16462 }
16463 }
16464 }
16465 }
16466 }
16467 }
16468#endif
16469
Daniel Veillard3d97e662004-11-04 10:49:00 +000016470 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016471 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016472}
16473
16474
16475static int
16476test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016477 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016478
Daniel Veillard3d97e662004-11-04 10:49:00 +000016479#ifdef LIBXML_OUTPUT_ENABLED
16480 int mem_base;
16481 xmlOutputBufferPtr buf; /* the XML buffer output */
16482 int n_buf;
16483 xmlDocPtr doc; /* the document */
16484 int n_doc;
16485 xmlNodePtr cur; /* the current node */
16486 int n_cur;
16487 int level; /* the imbrication level for indenting */
16488 int n_level;
16489 int format; /* is formatting allowed */
16490 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016491 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000016492 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016493
Daniel Veillard3d97e662004-11-04 10:49:00 +000016494 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
16495 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
16496 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
16497 for (n_level = 0;n_level < gen_nb_int;n_level++) {
16498 for (n_format = 0;n_format < gen_nb_int;n_format++) {
16499 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
16500 mem_base = xmlMemBlocks();
16501 buf = gen_xmlOutputBufferPtr(n_buf, 0);
16502 doc = gen_xmlDocPtr(n_doc, 1);
16503 cur = gen_xmlNodePtr(n_cur, 2);
16504 level = gen_int(n_level, 3);
16505 format = gen_int(n_format, 4);
16506 encoding = gen_const_char_ptr(n_encoding, 5);
16507
16508 xmlNodeDumpOutput(buf, doc, cur, level, format, encoding);
16509 call_tests++;
16510 des_xmlOutputBufferPtr(n_buf, buf, 0);
16511 des_xmlDocPtr(n_doc, doc, 1);
16512 des_xmlNodePtr(n_cur, cur, 2);
16513 des_int(n_level, level, 3);
16514 des_int(n_format, format, 4);
16515 des_const_char_ptr(n_encoding, encoding, 5);
16516 xmlResetLastError();
16517 if (mem_base != xmlMemBlocks()) {
16518 printf("Leak of %d blocks found in xmlNodeDumpOutput",
16519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016520 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016521 printf(" %d", n_buf);
16522 printf(" %d", n_doc);
16523 printf(" %d", n_cur);
16524 printf(" %d", n_level);
16525 printf(" %d", n_format);
16526 printf(" %d", n_encoding);
16527 printf("\n");
16528 }
16529 }
16530 }
16531 }
16532 }
16533 }
16534 }
16535#endif
16536
16537 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016539}
16540
16541
16542static int
16543test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016545
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016546 int mem_base;
16547 xmlChar * ret_val;
16548 xmlDocPtr doc; /* the document the node pertains to */
16549 int n_doc;
16550 xmlNodePtr cur; /* the node being checked */
16551 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016552
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016553 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
16554 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
16555 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016556 doc = gen_xmlDocPtr(n_doc, 0);
16557 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016558
16559 ret_val = xmlNodeGetBase(doc, cur);
16560 desret_xmlChar_ptr(ret_val);
16561 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016562 des_xmlDocPtr(n_doc, doc, 0);
16563 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016564 xmlResetLastError();
16565 if (mem_base != xmlMemBlocks()) {
16566 printf("Leak of %d blocks found in xmlNodeGetBase",
16567 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016568 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016569 printf(" %d", n_doc);
16570 printf(" %d", n_cur);
16571 printf("\n");
16572 }
16573 }
16574 }
16575
Daniel Veillard3d97e662004-11-04 10:49:00 +000016576 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016577 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016578}
16579
16580
16581static int
16582test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016583 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016584
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016585 int mem_base;
16586 xmlChar * ret_val;
16587 xmlNodePtr cur; /* the node being read */
16588 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016589
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016590 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
16591 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016592 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016593
16594 ret_val = xmlNodeGetContent(cur);
16595 desret_xmlChar_ptr(ret_val);
16596 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016597 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016598 xmlResetLastError();
16599 if (mem_base != xmlMemBlocks()) {
16600 printf("Leak of %d blocks found in xmlNodeGetContent",
16601 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016602 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016603 printf(" %d", n_cur);
16604 printf("\n");
16605 }
16606 }
16607
Daniel Veillard3d97e662004-11-04 10:49:00 +000016608 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016610}
16611
16612
16613static int
16614test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016616
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016617 int mem_base;
16618 xmlChar * ret_val;
16619 xmlNodePtr cur; /* the node being checked */
16620 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016621
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016622 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
16623 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016624 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016625
16626 ret_val = xmlNodeGetLang(cur);
16627 desret_xmlChar_ptr(ret_val);
16628 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016629 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016630 xmlResetLastError();
16631 if (mem_base != xmlMemBlocks()) {
16632 printf("Leak of %d blocks found in xmlNodeGetLang",
16633 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016634 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016635 printf(" %d", n_cur);
16636 printf("\n");
16637 }
16638 }
16639
Daniel Veillard3d97e662004-11-04 10:49:00 +000016640 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016641 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016642}
16643
16644
16645static int
16646test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016647 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016648
16649 int mem_base;
16650 int ret_val;
16651 xmlNodePtr cur; /* the node being checked */
16652 int n_cur;
16653
16654 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
16655 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016656 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016657
16658 ret_val = xmlNodeGetSpacePreserve(cur);
16659 desret_int(ret_val);
16660 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016661 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016662 xmlResetLastError();
16663 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000016664 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000016665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016666 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000016667 printf(" %d", n_cur);
16668 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000016669 }
16670 }
16671
Daniel Veillard3d97e662004-11-04 10:49:00 +000016672 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016673 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016674}
16675
16676
16677static int
16678test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016679 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016680
16681 int mem_base;
16682 int ret_val;
16683 xmlNodePtr node; /* the node */
16684 int n_node;
16685
16686 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16687 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016688 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016689
16690 ret_val = xmlNodeIsText(node);
16691 desret_int(ret_val);
16692 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016693 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016694 xmlResetLastError();
16695 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000016696 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000016697 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016698 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000016699 printf(" %d", n_node);
16700 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000016701 }
16702 }
16703
Daniel Veillard3d97e662004-11-04 10:49:00 +000016704 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016705 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016706}
16707
16708
16709static int
16710test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016712
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016713#ifdef LIBXML_TREE_ENABLED
16714 int mem_base;
16715 xmlChar * ret_val;
16716 xmlDocPtr doc; /* the document */
16717 int n_doc;
16718 xmlNodePtr list; /* a Node list */
16719 int n_list;
16720 int inLine; /* should we replace entity contents or show their external form */
16721 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016722
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016723 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
16724 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
16725 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
16726 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016727 doc = gen_xmlDocPtr(n_doc, 0);
16728 list = gen_xmlNodePtr(n_list, 1);
16729 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016730
16731 ret_val = xmlNodeListGetRawString(doc, list, inLine);
16732 desret_xmlChar_ptr(ret_val);
16733 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016734 des_xmlDocPtr(n_doc, doc, 0);
16735 des_xmlNodePtr(n_list, list, 1);
16736 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016737 xmlResetLastError();
16738 if (mem_base != xmlMemBlocks()) {
16739 printf("Leak of %d blocks found in xmlNodeListGetRawString",
16740 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016741 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016742 printf(" %d", n_doc);
16743 printf(" %d", n_list);
16744 printf(" %d", n_inLine);
16745 printf("\n");
16746 }
16747 }
16748 }
16749 }
16750#endif
16751
Daniel Veillard3d97e662004-11-04 10:49:00 +000016752 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016754}
16755
16756
16757static int
16758test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016760
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016761 int mem_base;
16762 xmlChar * ret_val;
16763 xmlDocPtr doc; /* the document */
16764 int n_doc;
16765 xmlNodePtr list; /* a Node list */
16766 int n_list;
16767 int inLine; /* should we replace entity contents or show their external form */
16768 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016769
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016770 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
16771 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
16772 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
16773 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016774 doc = gen_xmlDocPtr(n_doc, 0);
16775 list = gen_xmlNodePtr(n_list, 1);
16776 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016777
16778 ret_val = xmlNodeListGetString(doc, list, inLine);
16779 desret_xmlChar_ptr(ret_val);
16780 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016781 des_xmlDocPtr(n_doc, doc, 0);
16782 des_xmlNodePtr(n_list, list, 1);
16783 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016784 xmlResetLastError();
16785 if (mem_base != xmlMemBlocks()) {
16786 printf("Leak of %d blocks found in xmlNodeListGetString",
16787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016788 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000016789 printf(" %d", n_doc);
16790 printf(" %d", n_list);
16791 printf(" %d", n_inLine);
16792 printf("\n");
16793 }
16794 }
16795 }
16796 }
16797
Daniel Veillard3d97e662004-11-04 10:49:00 +000016798 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016800}
16801
16802
16803static int
16804test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016806
16807#ifdef LIBXML_TREE_ENABLED
16808 int mem_base;
16809 xmlNodePtr cur; /* the node being changed */
16810 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016811 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000016812 int n_uri;
16813
16814 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
16815 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
16816 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016817 cur = gen_xmlNodePtr(n_cur, 0);
16818 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016819
16820 xmlNodeSetBase(cur, uri);
16821 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016822 des_xmlNodePtr(n_cur, cur, 0);
16823 des_const_xmlChar_ptr(n_uri, uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016824 xmlResetLastError();
16825 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000016826 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000016827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016828 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000016829 printf(" %d", n_cur);
16830 printf(" %d", n_uri);
16831 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000016832 }
16833 }
16834 }
16835#endif
16836
Daniel Veillard3d97e662004-11-04 10:49:00 +000016837 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016838 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016839}
16840
16841
16842static int
16843test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016844 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016845
16846 int mem_base;
16847 xmlNodePtr cur; /* the node being modified */
16848 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016849 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000016850 int n_content;
16851
16852 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
16853 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
16854 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016855 cur = gen_xmlNodePtr(n_cur, 0);
16856 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016857
16858 xmlNodeSetContent(cur, content);
16859 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016860 des_xmlNodePtr(n_cur, cur, 0);
16861 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016862 xmlResetLastError();
16863 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000016864 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000016865 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016866 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000016867 printf(" %d", n_cur);
16868 printf(" %d", n_content);
16869 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000016870 }
16871 }
16872 }
16873
Daniel Veillard3d97e662004-11-04 10:49:00 +000016874 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016875 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016876}
16877
16878
16879static int
16880test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016881 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016882
16883#ifdef LIBXML_TREE_ENABLED
16884 int mem_base;
16885 xmlNodePtr cur; /* the node being modified */
16886 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016887 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000016888 int n_content;
16889 int len; /* the size of @content */
16890 int n_len;
16891
16892 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
16893 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
16894 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16895 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016896 cur = gen_xmlNodePtr(n_cur, 0);
16897 content = gen_const_xmlChar_ptr(n_content, 1);
16898 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016899
16900 xmlNodeSetContentLen(cur, content, len);
16901 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016902 des_xmlNodePtr(n_cur, cur, 0);
16903 des_const_xmlChar_ptr(n_content, content, 1);
16904 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016905 xmlResetLastError();
16906 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000016907 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000016908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016909 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000016910 printf(" %d", n_cur);
16911 printf(" %d", n_content);
16912 printf(" %d", n_len);
16913 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000016914 }
16915 }
16916 }
16917 }
16918#endif
16919
Daniel Veillard3d97e662004-11-04 10:49:00 +000016920 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016921 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016922}
16923
16924
16925static int
16926test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016927 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016928
16929#ifdef LIBXML_TREE_ENABLED
16930 int mem_base;
16931 xmlNodePtr cur; /* the node being changed */
16932 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016933 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000016934 int n_lang;
16935
16936 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
16937 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
16938 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016939 cur = gen_xmlNodePtr(n_cur, 0);
16940 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016941
16942 xmlNodeSetLang(cur, lang);
16943 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016944 des_xmlNodePtr(n_cur, cur, 0);
16945 des_const_xmlChar_ptr(n_lang, lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016946 xmlResetLastError();
16947 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000016948 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000016949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016950 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000016951 printf(" %d", n_cur);
16952 printf(" %d", n_lang);
16953 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000016954 }
16955 }
16956 }
16957#endif
16958
Daniel Veillard3d97e662004-11-04 10:49:00 +000016959 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016961}
16962
16963
16964static int
16965test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016967
16968#ifdef LIBXML_TREE_ENABLED
16969 int mem_base;
16970 xmlNodePtr cur; /* the node being changed */
16971 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016972 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000016973 int n_name;
16974
16975 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
16976 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16977 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000016978 cur = gen_xmlNodePtr(n_cur, 0);
16979 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016980
16981 xmlNodeSetName(cur, name);
16982 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000016983 des_xmlNodePtr(n_cur, cur, 0);
16984 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016985 xmlResetLastError();
16986 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000016987 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000016988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016989 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000016990 printf(" %d", n_cur);
16991 printf(" %d", n_name);
16992 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000016993 }
16994 }
16995 }
16996#endif
16997
Daniel Veillard3d97e662004-11-04 10:49:00 +000016998 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_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017006
17007#ifdef LIBXML_TREE_ENABLED
17008 int mem_base;
17009 xmlNodePtr cur; /* the node being changed */
17010 int n_cur;
17011 int val; /* the xml:space value ("0": default, 1: "preserve") */
17012 int n_val;
17013
17014 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
17015 for (n_val = 0;n_val < gen_nb_int;n_val++) {
17016 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017017 cur = gen_xmlNodePtr(n_cur, 0);
17018 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017019
17020 xmlNodeSetSpacePreserve(cur, val);
17021 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017022 des_xmlNodePtr(n_cur, cur, 0);
17023 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017024 xmlResetLastError();
17025 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017026 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017028 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017029 printf(" %d", n_cur);
17030 printf(" %d", n_val);
17031 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017032 }
17033 }
17034 }
17035#endif
17036
Daniel Veillard3d97e662004-11-04 10:49:00 +000017037 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017039}
17040
17041
17042static int
17043test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017045
17046 int mem_base;
17047 int ret_val;
17048 xmlDocPtr doc; /* the document */
17049 int n_doc;
17050 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
17051 int n_tree;
17052
17053 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17054 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
17055 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017056 doc = gen_xmlDocPtr(n_doc, 0);
17057 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017058
17059 ret_val = xmlReconciliateNs(doc, tree);
17060 desret_int(ret_val);
17061 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017062 des_xmlDocPtr(n_doc, doc, 0);
17063 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017064 xmlResetLastError();
17065 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017066 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017068 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017069 printf(" %d", n_doc);
17070 printf(" %d", n_tree);
17071 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017072 }
17073 }
17074 }
17075
Daniel Veillard3d97e662004-11-04 10:49:00 +000017076 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017078}
17079
17080
17081static int
17082test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017084
Daniel Veillardce244ad2004-11-05 10:03:46 +000017085#ifdef LIBXML_TREE_ENABLED
17086 int mem_base;
17087 int ret_val;
17088 xmlAttrPtr cur; /* an attribute */
17089 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017090
Daniel Veillardce244ad2004-11-05 10:03:46 +000017091 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
17092 mem_base = xmlMemBlocks();
17093 cur = gen_xmlAttrPtr(n_cur, 0);
17094
17095 ret_val = xmlRemoveProp(cur);
17096 cur = NULL;
17097 desret_int(ret_val);
17098 call_tests++;
17099 des_xmlAttrPtr(n_cur, cur, 0);
17100 xmlResetLastError();
17101 if (mem_base != xmlMemBlocks()) {
17102 printf("Leak of %d blocks found in xmlRemoveProp",
17103 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017104 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017105 printf(" %d", n_cur);
17106 printf("\n");
17107 }
17108 }
17109#endif
17110
17111 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017113}
17114
17115
17116static int
17117test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017119
17120#ifdef LIBXML_TREE_ENABLED
17121 int mem_base;
17122 xmlNodePtr ret_val;
17123 xmlNodePtr old; /* the old node */
17124 int n_old;
17125 xmlNodePtr cur; /* the node */
17126 int n_cur;
17127
17128 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017129 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017130 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017131 old = gen_xmlNodePtr(n_old, 0);
17132 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017133
17134 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017135 if (cur != NULL) {
17136 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000017137 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000017138 if (old != NULL) {
17139 xmlUnlinkNode(old);
17140 xmlFreeNode(old) ; old = NULL ; }
17141 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017142 desret_xmlNodePtr(ret_val);
17143 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017144 des_xmlNodePtr(n_old, old, 0);
17145 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017146 xmlResetLastError();
17147 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017148 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017149 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017150 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017151 printf(" %d", n_old);
17152 printf(" %d", n_cur);
17153 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017154 }
17155 }
17156 }
17157#endif
17158
Daniel Veillard3d97e662004-11-04 10:49:00 +000017159 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017160 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017161}
17162
17163
17164static int
17165test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017166 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017167
17168#ifdef LIBXML_OUTPUT_ENABLED
17169 int mem_base;
17170 int ret_val;
17171 const char * filename; /* the filename (or URL) */
17172 int n_filename;
17173 xmlDocPtr cur; /* the document */
17174 int n_cur;
17175
17176 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
17177 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
17178 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017179 filename = gen_fileoutput(n_filename, 0);
17180 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017181
17182 ret_val = xmlSaveFile(filename, cur);
17183 desret_int(ret_val);
17184 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017185 des_fileoutput(n_filename, filename, 0);
17186 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017187 xmlResetLastError();
17188 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017189 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017191 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017192 printf(" %d", n_filename);
17193 printf(" %d", n_cur);
17194 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017195 }
17196 }
17197 }
17198#endif
17199
Daniel Veillard3d97e662004-11-04 10:49:00 +000017200 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017201 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017202}
17203
17204
17205static int
17206test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017208
17209#ifdef LIBXML_OUTPUT_ENABLED
17210 int mem_base;
17211 int ret_val;
17212 const char * filename; /* the filename (or URL) */
17213 int n_filename;
17214 xmlDocPtr cur; /* the document */
17215 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017216 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000017217 int n_encoding;
17218
17219 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
17220 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
17221 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
17222 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017223 filename = gen_fileoutput(n_filename, 0);
17224 cur = gen_xmlDocPtr(n_cur, 1);
17225 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017226
17227 ret_val = xmlSaveFileEnc(filename, cur, encoding);
17228 desret_int(ret_val);
17229 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017230 des_fileoutput(n_filename, filename, 0);
17231 des_xmlDocPtr(n_cur, cur, 1);
17232 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017233 xmlResetLastError();
17234 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017235 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017237 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017238 printf(" %d", n_filename);
17239 printf(" %d", n_cur);
17240 printf(" %d", n_encoding);
17241 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017242 }
17243 }
17244 }
17245 }
17246#endif
17247
Daniel Veillard3d97e662004-11-04 10:49:00 +000017248 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017249 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017250}
17251
17252
17253static int
17254test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017256
Daniel Veillard3d97e662004-11-04 10:49:00 +000017257#ifdef LIBXML_OUTPUT_ENABLED
17258 int mem_base;
17259 int ret_val;
17260 xmlOutputBufferPtr buf; /* an output I/O buffer */
17261 int n_buf;
17262 xmlDocPtr cur; /* the document */
17263 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017264 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000017265 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017266
Daniel Veillard3d97e662004-11-04 10:49:00 +000017267 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
17268 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
17269 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
17270 mem_base = xmlMemBlocks();
17271 buf = gen_xmlOutputBufferPtr(n_buf, 0);
17272 cur = gen_xmlDocPtr(n_cur, 1);
17273 encoding = gen_const_char_ptr(n_encoding, 2);
17274
17275 ret_val = xmlSaveFileTo(buf, cur, encoding);
17276 buf = NULL;
17277 desret_int(ret_val);
17278 call_tests++;
17279 des_xmlOutputBufferPtr(n_buf, buf, 0);
17280 des_xmlDocPtr(n_cur, cur, 1);
17281 des_const_char_ptr(n_encoding, encoding, 2);
17282 xmlResetLastError();
17283 if (mem_base != xmlMemBlocks()) {
17284 printf("Leak of %d blocks found in xmlSaveFileTo",
17285 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017286 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017287 printf(" %d", n_buf);
17288 printf(" %d", n_cur);
17289 printf(" %d", n_encoding);
17290 printf("\n");
17291 }
17292 }
17293 }
17294 }
17295#endif
17296
17297 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017298 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017299}
17300
17301
17302static int
17303test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017304 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017305
17306#ifdef LIBXML_OUTPUT_ENABLED
17307 int mem_base;
17308 int ret_val;
17309 const char * filename; /* the filename (or URL) */
17310 int n_filename;
17311 xmlDocPtr cur; /* the document */
17312 int n_cur;
17313 int format; /* should formatting spaces been added */
17314 int n_format;
17315
17316 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
17317 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
17318 for (n_format = 0;n_format < gen_nb_int;n_format++) {
17319 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017320 filename = gen_fileoutput(n_filename, 0);
17321 cur = gen_xmlDocPtr(n_cur, 1);
17322 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017323
17324 ret_val = xmlSaveFormatFile(filename, cur, format);
17325 desret_int(ret_val);
17326 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017327 des_fileoutput(n_filename, filename, 0);
17328 des_xmlDocPtr(n_cur, cur, 1);
17329 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017330 xmlResetLastError();
17331 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017332 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017334 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017335 printf(" %d", n_filename);
17336 printf(" %d", n_cur);
17337 printf(" %d", n_format);
17338 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017339 }
17340 }
17341 }
17342 }
17343#endif
17344
Daniel Veillard3d97e662004-11-04 10:49:00 +000017345 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017346 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017347}
17348
17349
17350static int
17351test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017352 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017353
17354#ifdef LIBXML_OUTPUT_ENABLED
17355 int mem_base;
17356 int ret_val;
17357 const char * filename; /* the filename or URL to output */
17358 int n_filename;
17359 xmlDocPtr cur; /* the document being saved */
17360 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017361 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000017362 int n_encoding;
17363 int format; /* should formatting spaces be added. */
17364 int n_format;
17365
17366 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
17367 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
17368 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
17369 for (n_format = 0;n_format < gen_nb_int;n_format++) {
17370 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017371 filename = gen_fileoutput(n_filename, 0);
17372 cur = gen_xmlDocPtr(n_cur, 1);
17373 encoding = gen_const_char_ptr(n_encoding, 2);
17374 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017375
17376 ret_val = xmlSaveFormatFileEnc(filename, cur, encoding, format);
17377 desret_int(ret_val);
17378 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017379 des_fileoutput(n_filename, filename, 0);
17380 des_xmlDocPtr(n_cur, cur, 1);
17381 des_const_char_ptr(n_encoding, encoding, 2);
17382 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017383 xmlResetLastError();
17384 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017385 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017387 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017388 printf(" %d", n_filename);
17389 printf(" %d", n_cur);
17390 printf(" %d", n_encoding);
17391 printf(" %d", n_format);
17392 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017393 }
17394 }
17395 }
17396 }
17397 }
17398#endif
17399
Daniel Veillard3d97e662004-11-04 10:49:00 +000017400 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017402}
17403
17404
17405static int
17406test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017408
Daniel Veillard3d97e662004-11-04 10:49:00 +000017409#ifdef LIBXML_OUTPUT_ENABLED
17410 int mem_base;
17411 int ret_val;
17412 xmlOutputBufferPtr buf; /* an output I/O buffer */
17413 int n_buf;
17414 xmlDocPtr cur; /* the document */
17415 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017416 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000017417 int n_encoding;
17418 int format; /* should formatting spaces been added */
17419 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017420
Daniel Veillard3d97e662004-11-04 10:49:00 +000017421 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
17422 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
17423 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
17424 for (n_format = 0;n_format < gen_nb_int;n_format++) {
17425 mem_base = xmlMemBlocks();
17426 buf = gen_xmlOutputBufferPtr(n_buf, 0);
17427 cur = gen_xmlDocPtr(n_cur, 1);
17428 encoding = gen_const_char_ptr(n_encoding, 2);
17429 format = gen_int(n_format, 3);
17430
17431 ret_val = xmlSaveFormatFileTo(buf, cur, encoding, format);
17432 buf = NULL;
17433 desret_int(ret_val);
17434 call_tests++;
17435 des_xmlOutputBufferPtr(n_buf, buf, 0);
17436 des_xmlDocPtr(n_cur, cur, 1);
17437 des_const_char_ptr(n_encoding, encoding, 2);
17438 des_int(n_format, format, 3);
17439 xmlResetLastError();
17440 if (mem_base != xmlMemBlocks()) {
17441 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
17442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017443 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017444 printf(" %d", n_buf);
17445 printf(" %d", n_cur);
17446 printf(" %d", n_encoding);
17447 printf(" %d", n_format);
17448 printf("\n");
17449 }
17450 }
17451 }
17452 }
17453 }
17454#endif
17455
17456 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017458}
17459
17460
17461static int
17462test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017463 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017464
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017465 int mem_base;
17466 xmlNsPtr ret_val;
17467 xmlDocPtr doc; /* the document */
17468 int n_doc;
17469 xmlNodePtr node; /* the current node */
17470 int n_node;
17471 xmlChar * nameSpace; /* the namespace prefix */
17472 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017473
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017474 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17475 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
17476 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
17477 mem_base = xmlMemBlocks();
17478 doc = gen_xmlDocPtr(n_doc, 0);
17479 node = gen_xmlNodePtr(n_node, 1);
17480 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
17481
17482 ret_val = xmlSearchNs(doc, node, nameSpace);
17483 desret_xmlNsPtr(ret_val);
17484 call_tests++;
17485 des_xmlDocPtr(n_doc, doc, 0);
17486 des_xmlNodePtr(n_node, node, 1);
17487 des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
17488 xmlResetLastError();
17489 if (mem_base != xmlMemBlocks()) {
17490 printf("Leak of %d blocks found in xmlSearchNs",
17491 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017492 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017493 printf(" %d", n_doc);
17494 printf(" %d", n_node);
17495 printf(" %d", n_nameSpace);
17496 printf("\n");
17497 }
17498 }
17499 }
17500 }
17501
17502 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017503 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017504}
17505
17506
17507static int
17508test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017509 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017510
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017511 int mem_base;
17512 xmlNsPtr ret_val;
17513 xmlDocPtr doc; /* the document */
17514 int n_doc;
17515 xmlNodePtr node; /* the current node */
17516 int n_node;
17517 xmlChar * href; /* the namespace value */
17518 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017519
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017520 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17521 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
17522 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
17523 mem_base = xmlMemBlocks();
17524 doc = gen_xmlDocPtr(n_doc, 0);
17525 node = gen_xmlNodePtr(n_node, 1);
17526 href = gen_const_xmlChar_ptr(n_href, 2);
17527
17528 ret_val = xmlSearchNsByHref(doc, node, href);
17529 desret_xmlNsPtr(ret_val);
17530 call_tests++;
17531 des_xmlDocPtr(n_doc, doc, 0);
17532 des_xmlNodePtr(n_node, node, 1);
17533 des_const_xmlChar_ptr(n_href, href, 2);
17534 xmlResetLastError();
17535 if (mem_base != xmlMemBlocks()) {
17536 printf("Leak of %d blocks found in xmlSearchNsByHref",
17537 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017538 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017539 printf(" %d", n_doc);
17540 printf(" %d", n_node);
17541 printf(" %d", n_href);
17542 printf("\n");
17543 }
17544 }
17545 }
17546 }
17547
17548 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017549 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017550}
17551
17552
17553static int
17554test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017555 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017556
Daniel Veillard57b25162004-11-06 14:50:18 +000017557 int mem_base;
17558 xmlBufferAllocationScheme scheme; /* allocation method to use */
17559 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017560
Daniel Veillard57b25162004-11-06 14:50:18 +000017561 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
17562 mem_base = xmlMemBlocks();
17563 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
17564
17565 xmlSetBufferAllocationScheme(scheme);
17566 call_tests++;
17567 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
17568 xmlResetLastError();
17569 if (mem_base != xmlMemBlocks()) {
17570 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
17571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017572 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000017573 printf(" %d", n_scheme);
17574 printf("\n");
17575 }
17576 }
17577
17578 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017579 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017580}
17581
17582
17583static int
17584test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017585 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017586
17587 int mem_base;
17588 int mode; /* the compression ratio */
17589 int n_mode;
17590
17591 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
17592 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017593 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017594
17595 xmlSetCompressMode(mode);
17596 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017597 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017598 xmlResetLastError();
17599 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017600 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017601 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017602 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017603 printf(" %d", n_mode);
17604 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017605 }
17606 }
17607
Daniel Veillard3d97e662004-11-04 10:49:00 +000017608 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017610}
17611
17612
17613static int
17614test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017616
17617 int mem_base;
17618 xmlDocPtr doc; /* the document */
17619 int n_doc;
17620 int mode; /* the compression ratio */
17621 int n_mode;
17622
17623 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17624 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
17625 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017626 doc = gen_xmlDocPtr(n_doc, 0);
17627 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017628
17629 xmlSetDocCompressMode(doc, mode);
17630 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017631 des_xmlDocPtr(n_doc, doc, 0);
17632 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017633 xmlResetLastError();
17634 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017635 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017636 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017637 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017638 printf(" %d", n_doc);
17639 printf(" %d", n_mode);
17640 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017641 }
17642 }
17643 }
17644
Daniel Veillard3d97e662004-11-04 10:49:00 +000017645 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017646 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017647}
17648
17649
17650static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017651test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017652 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017653
Daniel Veillard27f20102004-11-05 11:50:11 +000017654 int mem_base;
17655 xmlNodePtr node; /* a node in the document */
17656 int n_node;
17657 xmlNsPtr ns; /* a namespace pointer */
17658 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017659
Daniel Veillard27f20102004-11-05 11:50:11 +000017660 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
17661 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
17662 mem_base = xmlMemBlocks();
17663 node = gen_xmlNodePtr(n_node, 0);
17664 ns = gen_xmlNsPtr(n_ns, 1);
17665
17666 xmlSetNs(node, ns);
17667 call_tests++;
17668 des_xmlNodePtr(n_node, node, 0);
17669 des_xmlNsPtr(n_ns, ns, 1);
17670 xmlResetLastError();
17671 if (mem_base != xmlMemBlocks()) {
17672 printf("Leak of %d blocks found in xmlSetNs",
17673 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017674 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000017675 printf(" %d", n_node);
17676 printf(" %d", n_ns);
17677 printf("\n");
17678 }
17679 }
17680 }
17681
17682 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017683 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017684}
17685
17686
17687static int
17688test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017689 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017690
Daniel Veillard57b25162004-11-06 14:50:18 +000017691#ifdef LIBXML_TREE_ENABLED
17692 int mem_base;
17693 xmlAttrPtr ret_val;
17694 xmlNodePtr node; /* the node */
17695 int n_node;
17696 xmlNsPtr ns; /* the namespace definition */
17697 int n_ns;
17698 xmlChar * name; /* the attribute name */
17699 int n_name;
17700 xmlChar * value; /* the attribute value */
17701 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017702
Daniel Veillard57b25162004-11-06 14:50:18 +000017703 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
17704 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
17705 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
17706 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
17707 mem_base = xmlMemBlocks();
17708 node = gen_xmlNodePtr(n_node, 0);
17709 ns = gen_xmlNsPtr(n_ns, 1);
17710 name = gen_const_xmlChar_ptr(n_name, 2);
17711 value = gen_const_xmlChar_ptr(n_value, 3);
17712
17713 ret_val = xmlSetNsProp(node, ns, name, value);
17714 desret_xmlAttrPtr(ret_val);
17715 call_tests++;
17716 des_xmlNodePtr(n_node, node, 0);
17717 des_xmlNsPtr(n_ns, ns, 1);
17718 des_const_xmlChar_ptr(n_name, name, 2);
17719 des_const_xmlChar_ptr(n_value, value, 3);
17720 xmlResetLastError();
17721 if (mem_base != xmlMemBlocks()) {
17722 printf("Leak of %d blocks found in xmlSetNsProp",
17723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017724 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000017725 printf(" %d", n_node);
17726 printf(" %d", n_ns);
17727 printf(" %d", n_name);
17728 printf(" %d", n_value);
17729 printf("\n");
17730 }
17731 }
17732 }
17733 }
17734 }
17735#endif
17736
17737 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017739}
17740
17741
17742static int
17743test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017745
Daniel Veillard57b25162004-11-06 14:50:18 +000017746#ifdef LIBXML_TREE_ENABLED
17747 int mem_base;
17748 xmlAttrPtr ret_val;
17749 xmlNodePtr node; /* the node */
17750 int n_node;
17751 xmlChar * name; /* the attribute name */
17752 int n_name;
17753 xmlChar * value; /* the attribute value */
17754 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017755
Daniel Veillard57b25162004-11-06 14:50:18 +000017756 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
17757 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
17758 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
17759 mem_base = xmlMemBlocks();
17760 node = gen_xmlNodePtr(n_node, 0);
17761 name = gen_const_xmlChar_ptr(n_name, 1);
17762 value = gen_const_xmlChar_ptr(n_value, 2);
17763
17764 ret_val = xmlSetProp(node, name, value);
17765 desret_xmlAttrPtr(ret_val);
17766 call_tests++;
17767 des_xmlNodePtr(n_node, node, 0);
17768 des_const_xmlChar_ptr(n_name, name, 1);
17769 des_const_xmlChar_ptr(n_value, value, 2);
17770 xmlResetLastError();
17771 if (mem_base != xmlMemBlocks()) {
17772 printf("Leak of %d blocks found in xmlSetProp",
17773 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017774 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000017775 printf(" %d", n_node);
17776 printf(" %d", n_name);
17777 printf(" %d", n_value);
17778 printf("\n");
17779 }
17780 }
17781 }
17782 }
17783#endif
17784
17785 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017786 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017787}
17788
17789
17790static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017791test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017792 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017793
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017794 int mem_base;
17795 xmlChar * ret_val;
17796 xmlChar * name; /* the full QName */
17797 int n_name;
17798 xmlChar ** prefix; /* a xmlChar ** */
17799 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017800
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017801 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
17802 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
17803 mem_base = xmlMemBlocks();
17804 name = gen_const_xmlChar_ptr(n_name, 0);
17805 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
17806
17807 ret_val = xmlSplitQName2(name, prefix);
17808 desret_xmlChar_ptr(ret_val);
17809 call_tests++;
17810 des_const_xmlChar_ptr(n_name, name, 0);
17811 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
17812 xmlResetLastError();
17813 if (mem_base != xmlMemBlocks()) {
17814 printf("Leak of %d blocks found in xmlSplitQName2",
17815 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017816 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017817 printf(" %d", n_name);
17818 printf(" %d", n_prefix);
17819 printf("\n");
17820 }
17821 }
17822 }
17823
17824 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017825 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017826}
17827
17828
17829static int
17830test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017831 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017832
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000017833 int mem_base;
17834 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017835 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000017836 int n_name;
17837 int * len; /* an int * */
17838 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017839
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000017840 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
17841 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
17842 mem_base = xmlMemBlocks();
17843 name = gen_const_xmlChar_ptr(n_name, 0);
17844 len = gen_int_ptr(n_len, 1);
17845
17846 ret_val = xmlSplitQName3(name, len);
17847 desret_const_xmlChar_ptr(ret_val);
17848 call_tests++;
17849 des_const_xmlChar_ptr(n_name, name, 0);
17850 des_int_ptr(n_len, len, 1);
17851 xmlResetLastError();
17852 if (mem_base != xmlMemBlocks()) {
17853 printf("Leak of %d blocks found in xmlSplitQName3",
17854 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017855 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000017856 printf(" %d", n_name);
17857 printf(" %d", n_len);
17858 printf("\n");
17859 }
17860 }
17861 }
17862
17863 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017864 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017865}
17866
17867
17868static int
17869test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017870 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017871
17872 int mem_base;
17873 xmlNodePtr ret_val;
17874 xmlDocPtr doc; /* the document */
17875 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017876 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000017877 int n_value;
17878
17879 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17880 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
17881 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017882 doc = gen_xmlDocPtr(n_doc, 0);
17883 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017884
17885 ret_val = xmlStringGetNodeList(doc, value);
17886 desret_xmlNodePtr(ret_val);
17887 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017888 des_xmlDocPtr(n_doc, doc, 0);
17889 des_const_xmlChar_ptr(n_value, value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017890 xmlResetLastError();
17891 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017892 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017893 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017894 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017895 printf(" %d", n_doc);
17896 printf(" %d", n_value);
17897 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017898 }
17899 }
17900 }
17901
Daniel Veillard3d97e662004-11-04 10:49:00 +000017902 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017903 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017904}
17905
17906
17907static int
17908test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017909 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017910
17911 int mem_base;
17912 xmlNodePtr ret_val;
17913 xmlDocPtr doc; /* the document */
17914 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017915 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000017916 int n_value;
17917 int len; /* the length of the string value */
17918 int n_len;
17919
17920 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17921 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
17922 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17923 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017924 doc = gen_xmlDocPtr(n_doc, 0);
17925 value = gen_const_xmlChar_ptr(n_value, 1);
17926 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017927
17928 ret_val = xmlStringLenGetNodeList(doc, value, len);
17929 desret_xmlNodePtr(ret_val);
17930 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017931 des_xmlDocPtr(n_doc, doc, 0);
17932 des_const_xmlChar_ptr(n_value, value, 1);
17933 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017934 xmlResetLastError();
17935 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017936 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017938 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017939 printf(" %d", n_doc);
17940 printf(" %d", n_value);
17941 printf(" %d", n_len);
17942 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017943 }
17944 }
17945 }
17946 }
17947
Daniel Veillard3d97e662004-11-04 10:49:00 +000017948 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017949 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017950}
17951
17952
17953static int
17954test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017955 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017956
17957 int mem_base;
17958 int ret_val;
17959 xmlNodePtr node; /* the node */
17960 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017961 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000017962 int n_content;
17963 int len; /* @content length */
17964 int n_len;
17965
17966 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
17967 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
17968 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17969 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017970 node = gen_xmlNodePtr(n_node, 0);
17971 content = gen_const_xmlChar_ptr(n_content, 1);
17972 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017973
17974 ret_val = xmlTextConcat(node, content, len);
17975 desret_int(ret_val);
17976 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017977 des_xmlNodePtr(n_node, node, 0);
17978 des_const_xmlChar_ptr(n_content, content, 1);
17979 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017980 xmlResetLastError();
17981 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017982 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017984 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017985 printf(" %d", n_node);
17986 printf(" %d", n_content);
17987 printf(" %d", n_len);
17988 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017989 }
17990 }
17991 }
17992 }
17993
Daniel Veillard3d97e662004-11-04 10:49:00 +000017994 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017996}
17997
17998
17999static int
18000test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018002
18003 int mem_base;
18004 xmlNodePtr ret_val;
18005 xmlNodePtr first; /* the first text node */
18006 int n_first;
18007 xmlNodePtr second; /* the second text node being merged */
18008 int n_second;
18009
Daniel Veillarda03e3652004-11-02 18:45:30 +000018010 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
18011 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000018012 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018013 first = gen_xmlNodePtr_in(n_first, 0);
18014 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018015
18016 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000018017 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000018018 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000018019 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018020 desret_xmlNodePtr(ret_val);
18021 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018022 des_xmlNodePtr_in(n_first, first, 0);
18023 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018024 xmlResetLastError();
18025 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018026 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018028 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018029 printf(" %d", n_first);
18030 printf(" %d", n_second);
18031 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018032 }
18033 }
18034 }
18035
Daniel Veillard3d97e662004-11-04 10:49:00 +000018036 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018038}
18039
18040
18041static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000018042test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018043 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018044
Daniel Veillard27f20102004-11-05 11:50:11 +000018045#ifdef LIBXML_TREE_ENABLED
18046 int mem_base;
18047 int ret_val;
18048 xmlNodePtr node; /* the node */
18049 int n_node;
18050 xmlNsPtr ns; /* the namespace definition */
18051 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018052 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000018053 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018054
Daniel Veillard27f20102004-11-05 11:50:11 +000018055 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
18056 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
18057 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18058 mem_base = xmlMemBlocks();
18059 node = gen_xmlNodePtr(n_node, 0);
18060 ns = gen_xmlNsPtr(n_ns, 1);
18061 name = gen_const_xmlChar_ptr(n_name, 2);
18062
18063 ret_val = xmlUnsetNsProp(node, ns, name);
18064 desret_int(ret_val);
18065 call_tests++;
18066 des_xmlNodePtr(n_node, node, 0);
18067 des_xmlNsPtr(n_ns, ns, 1);
18068 des_const_xmlChar_ptr(n_name, name, 2);
18069 xmlResetLastError();
18070 if (mem_base != xmlMemBlocks()) {
18071 printf("Leak of %d blocks found in xmlUnsetNsProp",
18072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018073 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018074 printf(" %d", n_node);
18075 printf(" %d", n_ns);
18076 printf(" %d", n_name);
18077 printf("\n");
18078 }
18079 }
18080 }
18081 }
18082#endif
18083
18084 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018086}
18087
18088
18089static int
18090test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018092
18093#ifdef LIBXML_TREE_ENABLED
18094 int mem_base;
18095 int ret_val;
18096 xmlNodePtr node; /* the node */
18097 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018098 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000018099 int n_name;
18100
18101 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
18102 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18103 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018104 node = gen_xmlNodePtr(n_node, 0);
18105 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018106
18107 ret_val = xmlUnsetProp(node, name);
18108 desret_int(ret_val);
18109 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018110 des_xmlNodePtr(n_node, node, 0);
18111 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018112 xmlResetLastError();
18113 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018114 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018115 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018116 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018117 printf(" %d", n_node);
18118 printf(" %d", n_name);
18119 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018120 }
18121 }
18122 }
18123#endif
18124
Daniel Veillard3d97e662004-11-04 10:49:00 +000018125 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018127}
18128
18129
18130static int
18131test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018133
18134 int mem_base;
18135 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018136 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000018137 int n_value;
18138 int space; /* allow spaces in front and end of the string */
18139 int n_space;
18140
18141 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
18142 for (n_space = 0;n_space < gen_nb_int;n_space++) {
18143 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018144 value = gen_const_xmlChar_ptr(n_value, 0);
18145 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018146
18147 ret_val = xmlValidateNCName(value, space);
18148 desret_int(ret_val);
18149 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018150 des_const_xmlChar_ptr(n_value, value, 0);
18151 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018152 xmlResetLastError();
18153 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018154 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018156 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018157 printf(" %d", n_value);
18158 printf(" %d", n_space);
18159 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018160 }
18161 }
18162 }
18163
Daniel Veillard3d97e662004-11-04 10:49:00 +000018164 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018166}
18167
18168
18169static int
18170test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018172
18173 int mem_base;
18174 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018175 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000018176 int n_value;
18177 int space; /* allow spaces in front and end of the string */
18178 int n_space;
18179
18180 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
18181 for (n_space = 0;n_space < gen_nb_int;n_space++) {
18182 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018183 value = gen_const_xmlChar_ptr(n_value, 0);
18184 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018185
18186 ret_val = xmlValidateNMToken(value, space);
18187 desret_int(ret_val);
18188 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018189 des_const_xmlChar_ptr(n_value, value, 0);
18190 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018191 xmlResetLastError();
18192 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018193 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018195 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018196 printf(" %d", n_value);
18197 printf(" %d", n_space);
18198 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018199 }
18200 }
18201 }
18202
Daniel Veillard3d97e662004-11-04 10:49:00 +000018203 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018204 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018205}
18206
18207
18208static int
18209test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018210 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018211
18212 int mem_base;
18213 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018214 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000018215 int n_value;
18216 int space; /* allow spaces in front and end of the string */
18217 int n_space;
18218
18219 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
18220 for (n_space = 0;n_space < gen_nb_int;n_space++) {
18221 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018222 value = gen_const_xmlChar_ptr(n_value, 0);
18223 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018224
18225 ret_val = xmlValidateName(value, space);
18226 desret_int(ret_val);
18227 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018228 des_const_xmlChar_ptr(n_value, value, 0);
18229 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018230 xmlResetLastError();
18231 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018232 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018233 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018234 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018235 printf(" %d", n_value);
18236 printf(" %d", n_space);
18237 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018238 }
18239 }
18240 }
18241
Daniel Veillard3d97e662004-11-04 10:49:00 +000018242 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018243 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018244}
18245
18246
18247static int
18248test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018249 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018250
18251 int mem_base;
18252 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018253 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000018254 int n_value;
18255 int space; /* allow spaces in front and end of the string */
18256 int n_space;
18257
18258 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
18259 for (n_space = 0;n_space < gen_nb_int;n_space++) {
18260 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018261 value = gen_const_xmlChar_ptr(n_value, 0);
18262 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018263
18264 ret_val = xmlValidateQName(value, space);
18265 desret_int(ret_val);
18266 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018267 des_const_xmlChar_ptr(n_value, value, 0);
18268 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018269 xmlResetLastError();
18270 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018271 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018273 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018274 printf(" %d", n_value);
18275 printf(" %d", n_space);
18276 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018277 }
18278 }
18279 }
18280
Daniel Veillard3d97e662004-11-04 10:49:00 +000018281 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018282 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018283}
18284
18285static int
18286test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018288
Daniel Veillard3d95c732004-11-06 22:25:14 +000018289 printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000018290 test_ret += test_xmlAddChild();
18291 test_ret += test_xmlAddChildList();
18292 test_ret += test_xmlAddNextSibling();
18293 test_ret += test_xmlAddPrevSibling();
18294 test_ret += test_xmlAddSibling();
18295 test_ret += test_xmlAttrSerializeTxtContent();
18296 test_ret += test_xmlBufferAdd();
18297 test_ret += test_xmlBufferAddHead();
18298 test_ret += test_xmlBufferCCat();
18299 test_ret += test_xmlBufferCat();
18300 test_ret += test_xmlBufferContent();
18301 test_ret += test_xmlBufferCreate();
18302 test_ret += test_xmlBufferCreateSize();
18303 test_ret += test_xmlBufferCreateStatic();
18304 test_ret += test_xmlBufferEmpty();
18305 test_ret += test_xmlBufferGrow();
18306 test_ret += test_xmlBufferLength();
18307 test_ret += test_xmlBufferResize();
18308 test_ret += test_xmlBufferSetAllocationScheme();
18309 test_ret += test_xmlBufferShrink();
18310 test_ret += test_xmlBufferWriteCHAR();
18311 test_ret += test_xmlBufferWriteChar();
18312 test_ret += test_xmlBufferWriteQuotedString();
18313 test_ret += test_xmlBuildQName();
18314 test_ret += test_xmlCopyDoc();
18315 test_ret += test_xmlCopyDtd();
18316 test_ret += test_xmlCopyNamespace();
18317 test_ret += test_xmlCopyNamespaceList();
18318 test_ret += test_xmlCopyNode();
18319 test_ret += test_xmlCopyNodeList();
18320 test_ret += test_xmlCopyProp();
18321 test_ret += test_xmlCopyPropList();
18322 test_ret += test_xmlCreateIntSubset();
18323 test_ret += test_xmlDocCopyNode();
18324 test_ret += test_xmlDocCopyNodeList();
18325 test_ret += test_xmlDocDump();
18326 test_ret += test_xmlDocDumpFormatMemory();
18327 test_ret += test_xmlDocDumpFormatMemoryEnc();
18328 test_ret += test_xmlDocDumpMemory();
18329 test_ret += test_xmlDocDumpMemoryEnc();
18330 test_ret += test_xmlDocFormatDump();
18331 test_ret += test_xmlDocGetRootElement();
18332 test_ret += test_xmlDocSetRootElement();
18333 test_ret += test_xmlElemDump();
18334 test_ret += test_xmlGetBufferAllocationScheme();
18335 test_ret += test_xmlGetCompressMode();
18336 test_ret += test_xmlGetDocCompressMode();
18337 test_ret += test_xmlGetIntSubset();
18338 test_ret += test_xmlGetLastChild();
18339 test_ret += test_xmlGetLineNo();
18340 test_ret += test_xmlGetNoNsProp();
18341 test_ret += test_xmlGetNodePath();
18342 test_ret += test_xmlGetNsList();
18343 test_ret += test_xmlGetNsProp();
18344 test_ret += test_xmlGetProp();
18345 test_ret += test_xmlHasNsProp();
18346 test_ret += test_xmlHasProp();
18347 test_ret += test_xmlIsBlankNode();
18348 test_ret += test_xmlIsXHTML();
18349 test_ret += test_xmlNewCDataBlock();
18350 test_ret += test_xmlNewCharRef();
18351 test_ret += test_xmlNewChild();
18352 test_ret += test_xmlNewComment();
18353 test_ret += test_xmlNewDoc();
18354 test_ret += test_xmlNewDocComment();
18355 test_ret += test_xmlNewDocFragment();
18356 test_ret += test_xmlNewDocNode();
18357 test_ret += test_xmlNewDocNodeEatName();
18358 test_ret += test_xmlNewDocPI();
18359 test_ret += test_xmlNewDocProp();
18360 test_ret += test_xmlNewDocRawNode();
18361 test_ret += test_xmlNewDocText();
18362 test_ret += test_xmlNewDocTextLen();
18363 test_ret += test_xmlNewDtd();
18364 test_ret += test_xmlNewNode();
18365 test_ret += test_xmlNewNodeEatName();
18366 test_ret += test_xmlNewNs();
18367 test_ret += test_xmlNewNsProp();
18368 test_ret += test_xmlNewNsPropEatName();
18369 test_ret += test_xmlNewPI();
18370 test_ret += test_xmlNewProp();
18371 test_ret += test_xmlNewReference();
18372 test_ret += test_xmlNewText();
18373 test_ret += test_xmlNewTextChild();
18374 test_ret += test_xmlNewTextLen();
18375 test_ret += test_xmlNodeAddContent();
18376 test_ret += test_xmlNodeAddContentLen();
18377 test_ret += test_xmlNodeBufGetContent();
18378 test_ret += test_xmlNodeDump();
18379 test_ret += test_xmlNodeDumpOutput();
18380 test_ret += test_xmlNodeGetBase();
18381 test_ret += test_xmlNodeGetContent();
18382 test_ret += test_xmlNodeGetLang();
18383 test_ret += test_xmlNodeGetSpacePreserve();
18384 test_ret += test_xmlNodeIsText();
18385 test_ret += test_xmlNodeListGetRawString();
18386 test_ret += test_xmlNodeListGetString();
18387 test_ret += test_xmlNodeSetBase();
18388 test_ret += test_xmlNodeSetContent();
18389 test_ret += test_xmlNodeSetContentLen();
18390 test_ret += test_xmlNodeSetLang();
18391 test_ret += test_xmlNodeSetName();
18392 test_ret += test_xmlNodeSetSpacePreserve();
18393 test_ret += test_xmlReconciliateNs();
18394 test_ret += test_xmlRemoveProp();
18395 test_ret += test_xmlReplaceNode();
18396 test_ret += test_xmlSaveFile();
18397 test_ret += test_xmlSaveFileEnc();
18398 test_ret += test_xmlSaveFileTo();
18399 test_ret += test_xmlSaveFormatFile();
18400 test_ret += test_xmlSaveFormatFileEnc();
18401 test_ret += test_xmlSaveFormatFileTo();
18402 test_ret += test_xmlSearchNs();
18403 test_ret += test_xmlSearchNsByHref();
18404 test_ret += test_xmlSetBufferAllocationScheme();
18405 test_ret += test_xmlSetCompressMode();
18406 test_ret += test_xmlSetDocCompressMode();
18407 test_ret += test_xmlSetNs();
18408 test_ret += test_xmlSetNsProp();
18409 test_ret += test_xmlSetProp();
18410 test_ret += test_xmlSplitQName2();
18411 test_ret += test_xmlSplitQName3();
18412 test_ret += test_xmlStringGetNodeList();
18413 test_ret += test_xmlStringLenGetNodeList();
18414 test_ret += test_xmlTextConcat();
18415 test_ret += test_xmlTextMerge();
18416 test_ret += test_xmlUnsetNsProp();
18417 test_ret += test_xmlUnsetProp();
18418 test_ret += test_xmlValidateNCName();
18419 test_ret += test_xmlValidateNMToken();
18420 test_ret += test_xmlValidateName();
18421 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000018422
Daniel Veillard42595322004-11-08 10:52:06 +000018423 if (test_ret != 0)
18424 printf("Module tree: %d errors\n", test_ret);
18425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018426}
18427
18428static int
18429test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018430 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018431
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018432 int mem_base;
18433 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018434 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018435 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018436 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018437 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018438
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018439 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
18440 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
18441 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018442 URI = gen_const_xmlChar_ptr(n_URI, 0);
18443 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018444
18445 ret_val = xmlBuildRelativeURI(URI, base);
18446 desret_xmlChar_ptr(ret_val);
18447 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018448 des_const_xmlChar_ptr(n_URI, URI, 0);
18449 des_const_xmlChar_ptr(n_base, base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018450 xmlResetLastError();
18451 if (mem_base != xmlMemBlocks()) {
18452 printf("Leak of %d blocks found in xmlBuildRelativeURI",
18453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018454 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018455 printf(" %d", n_URI);
18456 printf(" %d", n_base);
18457 printf("\n");
18458 }
18459 }
18460 }
18461
Daniel Veillard3d97e662004-11-04 10:49:00 +000018462 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018463 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018464}
18465
18466
18467static int
18468test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018469 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018470
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018471 int mem_base;
18472 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018473 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018474 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018475 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018476 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018477
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018478 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
18479 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
18480 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018481 URI = gen_const_xmlChar_ptr(n_URI, 0);
18482 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018483
18484 ret_val = xmlBuildURI(URI, base);
18485 desret_xmlChar_ptr(ret_val);
18486 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018487 des_const_xmlChar_ptr(n_URI, URI, 0);
18488 des_const_xmlChar_ptr(n_base, base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018489 xmlResetLastError();
18490 if (mem_base != xmlMemBlocks()) {
18491 printf("Leak of %d blocks found in xmlBuildURI",
18492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018493 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018494 printf(" %d", n_URI);
18495 printf(" %d", n_base);
18496 printf("\n");
18497 }
18498 }
18499 }
18500
Daniel Veillard3d97e662004-11-04 10:49:00 +000018501 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018502 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018503}
18504
18505
18506static int
18507test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018508 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018509
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018510 int mem_base;
18511 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018512 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018513 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018514
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018515 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
18516 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018517 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018518
18519 ret_val = xmlCanonicPath(path);
18520 desret_xmlChar_ptr(ret_val);
18521 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018522 des_const_xmlChar_ptr(n_path, path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018523 xmlResetLastError();
18524 if (mem_base != xmlMemBlocks()) {
18525 printf("Leak of %d blocks found in xmlCanonicPath",
18526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018527 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018528 printf(" %d", n_path);
18529 printf("\n");
18530 }
18531 }
18532
Daniel Veillard3d97e662004-11-04 10:49:00 +000018533 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018534 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018535}
18536
18537
18538static int
18539test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018540 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018541
18542
18543 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018545}
18546
18547
Daniel Veillardce682bc2004-11-05 17:22:25 +000018548#define gen_nb_char_ptr 1
18549static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18550 return(NULL);
18551}
18552static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18553}
18554
Daniel Veillardd93f6252004-11-02 15:53:51 +000018555static int
18556test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018557 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018558
Daniel Veillardce682bc2004-11-05 17:22:25 +000018559 int mem_base;
18560 int ret_val;
18561 char * path; /* pointer to the path string */
18562 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018563
Daniel Veillardce682bc2004-11-05 17:22:25 +000018564 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
18565 mem_base = xmlMemBlocks();
18566 path = gen_char_ptr(n_path, 0);
18567
18568 ret_val = xmlNormalizeURIPath(path);
18569 desret_int(ret_val);
18570 call_tests++;
18571 des_char_ptr(n_path, path, 0);
18572 xmlResetLastError();
18573 if (mem_base != xmlMemBlocks()) {
18574 printf("Leak of %d blocks found in xmlNormalizeURIPath",
18575 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018576 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018577 printf(" %d", n_path);
18578 printf("\n");
18579 }
18580 }
18581
18582 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018583 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018584}
18585
18586
18587static int
18588test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018589 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018590
18591
18592 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018593 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018594}
18595
18596
Daniel Veillardce682bc2004-11-05 17:22:25 +000018597#define gen_nb_xmlURIPtr 1
18598static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18599 return(NULL);
18600}
18601static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18602}
18603
Daniel Veillardd93f6252004-11-02 15:53:51 +000018604static int
18605test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018606 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018607
Daniel Veillardce682bc2004-11-05 17:22:25 +000018608 int mem_base;
18609 int ret_val;
18610 xmlURIPtr uri; /* pointer to an URI structure */
18611 int n_uri;
18612 char * str; /* the string to analyze */
18613 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018614
Daniel Veillardce682bc2004-11-05 17:22:25 +000018615 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
18616 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
18617 mem_base = xmlMemBlocks();
18618 uri = gen_xmlURIPtr(n_uri, 0);
18619 str = gen_const_char_ptr(n_str, 1);
18620
18621 ret_val = xmlParseURIReference(uri, str);
18622 desret_int(ret_val);
18623 call_tests++;
18624 des_xmlURIPtr(n_uri, uri, 0);
18625 des_const_char_ptr(n_str, str, 1);
18626 xmlResetLastError();
18627 if (mem_base != xmlMemBlocks()) {
18628 printf("Leak of %d blocks found in xmlParseURIReference",
18629 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018630 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018631 printf(" %d", n_uri);
18632 printf(" %d", n_str);
18633 printf("\n");
18634 }
18635 }
18636 }
18637
18638 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018640}
18641
18642
18643static int
18644test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018645 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018646
Daniel Veillardce682bc2004-11-05 17:22:25 +000018647 int mem_base;
18648 FILE * stream; /* a FILE* for the output */
18649 int n_stream;
18650 xmlURIPtr uri; /* pointer to an xmlURI */
18651 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018652
Daniel Veillardce682bc2004-11-05 17:22:25 +000018653 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
18654 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
18655 mem_base = xmlMemBlocks();
18656 stream = gen_FILE_ptr(n_stream, 0);
18657 uri = gen_xmlURIPtr(n_uri, 1);
18658
18659 xmlPrintURI(stream, uri);
18660 call_tests++;
18661 des_FILE_ptr(n_stream, stream, 0);
18662 des_xmlURIPtr(n_uri, uri, 1);
18663 xmlResetLastError();
18664 if (mem_base != xmlMemBlocks()) {
18665 printf("Leak of %d blocks found in xmlPrintURI",
18666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018667 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018668 printf(" %d", n_stream);
18669 printf(" %d", n_uri);
18670 printf("\n");
18671 }
18672 }
18673 }
18674
18675 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018677}
18678
18679
18680static int
18681test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018683
Daniel Veillardce682bc2004-11-05 17:22:25 +000018684 int mem_base;
18685 xmlChar * ret_val;
18686 xmlURIPtr uri; /* pointer to an xmlURI */
18687 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018688
Daniel Veillardce682bc2004-11-05 17:22:25 +000018689 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
18690 mem_base = xmlMemBlocks();
18691 uri = gen_xmlURIPtr(n_uri, 0);
18692
18693 ret_val = xmlSaveUri(uri);
18694 desret_xmlChar_ptr(ret_val);
18695 call_tests++;
18696 des_xmlURIPtr(n_uri, uri, 0);
18697 xmlResetLastError();
18698 if (mem_base != xmlMemBlocks()) {
18699 printf("Leak of %d blocks found in xmlSaveUri",
18700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018701 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018702 printf(" %d", n_uri);
18703 printf("\n");
18704 }
18705 }
18706
18707 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018709}
18710
18711
18712static int
18713test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018715
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018716 int mem_base;
18717 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018718 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018719 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018720
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018721 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
18722 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018723 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018724
18725 ret_val = xmlURIEscape(str);
18726 desret_xmlChar_ptr(ret_val);
18727 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018728 des_const_xmlChar_ptr(n_str, str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018729 xmlResetLastError();
18730 if (mem_base != xmlMemBlocks()) {
18731 printf("Leak of %d blocks found in xmlURIEscape",
18732 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018733 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018734 printf(" %d", n_str);
18735 printf("\n");
18736 }
18737 }
18738
Daniel Veillard3d97e662004-11-04 10:49:00 +000018739 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018741}
18742
18743
18744static int
18745test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018747
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018748 int mem_base;
18749 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018750 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018751 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018752 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018753 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018754
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018755 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
18756 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
18757 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018758 str = gen_const_xmlChar_ptr(n_str, 0);
18759 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018760
18761 ret_val = xmlURIEscapeStr(str, list);
18762 desret_xmlChar_ptr(ret_val);
18763 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018764 des_const_xmlChar_ptr(n_str, str, 0);
18765 des_const_xmlChar_ptr(n_list, list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018766 xmlResetLastError();
18767 if (mem_base != xmlMemBlocks()) {
18768 printf("Leak of %d blocks found in xmlURIEscapeStr",
18769 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018770 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018771 printf(" %d", n_str);
18772 printf(" %d", n_list);
18773 printf("\n");
18774 }
18775 }
18776 }
18777
Daniel Veillard3d97e662004-11-04 10:49:00 +000018778 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018780}
18781
18782
18783static int
18784test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018786
18787
18788 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018789 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018790}
18791
18792static int
18793test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018795
Daniel Veillardce682bc2004-11-05 17:22:25 +000018796 printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000018797 test_ret += test_xmlBuildRelativeURI();
18798 test_ret += test_xmlBuildURI();
18799 test_ret += test_xmlCanonicPath();
18800 test_ret += test_xmlCreateURI();
18801 test_ret += test_xmlNormalizeURIPath();
18802 test_ret += test_xmlParseURI();
18803 test_ret += test_xmlParseURIReference();
18804 test_ret += test_xmlPrintURI();
18805 test_ret += test_xmlSaveUri();
18806 test_ret += test_xmlURIEscape();
18807 test_ret += test_xmlURIEscapeStr();
18808 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000018809
Daniel Veillard42595322004-11-08 10:52:06 +000018810 if (test_ret != 0)
18811 printf("Module uri: %d errors\n", test_ret);
18812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018813}
18814
Daniel Veillardce682bc2004-11-05 17:22:25 +000018815#define gen_nb_xmlEnumerationPtr 1
18816static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18817 return(NULL);
18818}
18819static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18820}
18821
Daniel Veillardd93f6252004-11-02 15:53:51 +000018822static int
18823test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018825
Daniel Veillard42595322004-11-08 10:52:06 +000018826 int mem_base;
18827 xmlAttributePtr ret_val;
18828 xmlValidCtxtPtr ctxt; /* the validation context */
18829 int n_ctxt;
18830 xmlDtdPtr dtd; /* pointer to the DTD */
18831 int n_dtd;
18832 xmlChar * elem; /* the element name */
18833 int n_elem;
18834 xmlChar * name; /* the attribute name */
18835 int n_name;
18836 xmlChar * ns; /* the attribute namespace prefix */
18837 int n_ns;
18838 xmlAttributeType type; /* the attribute type */
18839 int n_type;
18840 xmlAttributeDefault def; /* the attribute default type */
18841 int n_def;
18842 xmlChar * defaultValue; /* the attribute default value */
18843 int n_defaultValue;
18844 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
18845 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018846
Daniel Veillard42595322004-11-08 10:52:06 +000018847 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
18848 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18849 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
18850 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18851 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
18852 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
18853 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
18854 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
18855 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
18856 mem_base = xmlMemBlocks();
18857 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
18858 dtd = gen_xmlDtdPtr(n_dtd, 1);
18859 elem = gen_const_xmlChar_ptr(n_elem, 2);
18860 name = gen_const_xmlChar_ptr(n_name, 3);
18861 ns = gen_const_xmlChar_ptr(n_ns, 4);
18862 type = gen_xmlAttributeType(n_type, 5);
18863 def = gen_xmlAttributeDefault(n_def, 6);
18864 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
18865 tree = gen_xmlEnumerationPtr(n_tree, 8);
18866
18867 ret_val = xmlAddAttributeDecl(ctxt, dtd, elem, name, ns, type, def, defaultValue, tree);
18868 desret_xmlAttributePtr(ret_val);
18869 call_tests++;
18870 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
18871 des_xmlDtdPtr(n_dtd, dtd, 1);
18872 des_const_xmlChar_ptr(n_elem, elem, 2);
18873 des_const_xmlChar_ptr(n_name, name, 3);
18874 des_const_xmlChar_ptr(n_ns, ns, 4);
18875 des_xmlAttributeType(n_type, type, 5);
18876 des_xmlAttributeDefault(n_def, def, 6);
18877 des_const_xmlChar_ptr(n_defaultValue, defaultValue, 7);
18878 des_xmlEnumerationPtr(n_tree, tree, 8);
18879 xmlResetLastError();
18880 if (mem_base != xmlMemBlocks()) {
18881 printf("Leak of %d blocks found in xmlAddAttributeDecl",
18882 xmlMemBlocks() - mem_base);
18883 test_ret++;
18884 printf(" %d", n_ctxt);
18885 printf(" %d", n_dtd);
18886 printf(" %d", n_elem);
18887 printf(" %d", n_name);
18888 printf(" %d", n_ns);
18889 printf(" %d", n_type);
18890 printf(" %d", n_def);
18891 printf(" %d", n_defaultValue);
18892 printf(" %d", n_tree);
18893 printf("\n");
18894 }
18895 }
18896 }
18897 }
18898 }
18899 }
18900 }
18901 }
18902 }
18903 }
18904
18905 function_tests++;
18906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018907}
18908
18909
Daniel Veillardce682bc2004-11-05 17:22:25 +000018910#define gen_nb_xmlElementContentPtr 1
18911static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18912 return(NULL);
18913}
18914static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18915}
18916
Daniel Veillardd93f6252004-11-02 15:53:51 +000018917static int
18918test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018919 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018920
Daniel Veillard42595322004-11-08 10:52:06 +000018921 int mem_base;
18922 xmlElementPtr ret_val;
18923 xmlValidCtxtPtr ctxt; /* the validation context */
18924 int n_ctxt;
18925 xmlDtdPtr dtd; /* pointer to the DTD */
18926 int n_dtd;
18927 xmlChar * name; /* the entity name */
18928 int n_name;
18929 xmlElementTypeVal type; /* the element type */
18930 int n_type;
18931 xmlElementContentPtr content; /* the element content tree or NULL */
18932 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018933
Daniel Veillard42595322004-11-08 10:52:06 +000018934 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
18935 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18936 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18937 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
18938 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
18939 mem_base = xmlMemBlocks();
18940 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
18941 dtd = gen_xmlDtdPtr(n_dtd, 1);
18942 name = gen_const_xmlChar_ptr(n_name, 2);
18943 type = gen_xmlElementTypeVal(n_type, 3);
18944 content = gen_xmlElementContentPtr(n_content, 4);
18945
18946 ret_val = xmlAddElementDecl(ctxt, dtd, name, type, content);
18947 desret_xmlElementPtr(ret_val);
18948 call_tests++;
18949 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
18950 des_xmlDtdPtr(n_dtd, dtd, 1);
18951 des_const_xmlChar_ptr(n_name, name, 2);
18952 des_xmlElementTypeVal(n_type, type, 3);
18953 des_xmlElementContentPtr(n_content, content, 4);
18954 xmlResetLastError();
18955 if (mem_base != xmlMemBlocks()) {
18956 printf("Leak of %d blocks found in xmlAddElementDecl",
18957 xmlMemBlocks() - mem_base);
18958 test_ret++;
18959 printf(" %d", n_ctxt);
18960 printf(" %d", n_dtd);
18961 printf(" %d", n_name);
18962 printf(" %d", n_type);
18963 printf(" %d", n_content);
18964 printf("\n");
18965 }
18966 }
18967 }
18968 }
18969 }
18970 }
18971
18972 function_tests++;
18973 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018974}
18975
18976
18977static int
18978test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018979 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018980
18981
18982 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018983 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018984}
18985
18986
18987static int
18988test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018989 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018990
18991
18992 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018993 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018994}
18995
18996
18997static int
18998test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018999 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019000
19001
19002 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019003 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019004}
19005
19006
Daniel Veillardce682bc2004-11-05 17:22:25 +000019007#define gen_nb_xmlAttributeTablePtr 1
19008static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
19009 return(NULL);
19010}
19011static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
19012}
19013
Daniel Veillardd93f6252004-11-02 15:53:51 +000019014static int
19015test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019016 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019017
19018
19019 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019020 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019021}
19022
19023
19024static int
19025test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019026 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019027
19028
19029 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019031}
19032
19033
Daniel Veillardce682bc2004-11-05 17:22:25 +000019034#define gen_nb_xmlElementTablePtr 1
19035static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
19036 return(NULL);
19037}
19038static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
19039}
19040
Daniel Veillardd93f6252004-11-02 15:53:51 +000019041static int
19042test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019043 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019044
19045
19046 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019047 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019048}
19049
19050
19051static int
19052test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019053 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019054
19055
19056 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019057 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019058}
19059
19060
Daniel Veillardce682bc2004-11-05 17:22:25 +000019061#define gen_nb_xmlNotationTablePtr 1
19062static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
19063 return(NULL);
19064}
19065static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
19066}
19067
Daniel Veillardd93f6252004-11-02 15:53:51 +000019068static int
19069test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019070 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019071
19072
19073 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019074 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019075}
19076
19077
19078static int
19079test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019080 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019081
19082
19083 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019084 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019085}
19086
19087
Daniel Veillardce682bc2004-11-05 17:22:25 +000019088#define gen_nb_xmlAttributePtr 1
19089static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
19090 return(NULL);
19091}
19092static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
19093}
19094
Daniel Veillardd93f6252004-11-02 15:53:51 +000019095static int
19096test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019098
Daniel Veillardce682bc2004-11-05 17:22:25 +000019099#ifdef LIBXML_OUTPUT_ENABLED
19100 int mem_base;
19101 xmlBufferPtr buf; /* the XML buffer output */
19102 int n_buf;
19103 xmlAttributePtr attr; /* An attribute declaration */
19104 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019105
Daniel Veillardce682bc2004-11-05 17:22:25 +000019106 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
19107 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
19108 mem_base = xmlMemBlocks();
19109 buf = gen_xmlBufferPtr(n_buf, 0);
19110 attr = gen_xmlAttributePtr(n_attr, 1);
19111
19112 xmlDumpAttributeDecl(buf, attr);
19113 call_tests++;
19114 des_xmlBufferPtr(n_buf, buf, 0);
19115 des_xmlAttributePtr(n_attr, attr, 1);
19116 xmlResetLastError();
19117 if (mem_base != xmlMemBlocks()) {
19118 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
19119 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019120 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019121 printf(" %d", n_buf);
19122 printf(" %d", n_attr);
19123 printf("\n");
19124 }
19125 }
19126 }
19127#endif
19128
19129 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019131}
19132
19133
19134static int
19135test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019137
Daniel Veillardce682bc2004-11-05 17:22:25 +000019138#ifdef LIBXML_OUTPUT_ENABLED
19139 int mem_base;
19140 xmlBufferPtr buf; /* the XML buffer output */
19141 int n_buf;
19142 xmlAttributeTablePtr table; /* An attribute table */
19143 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019144
Daniel Veillardce682bc2004-11-05 17:22:25 +000019145 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
19146 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
19147 mem_base = xmlMemBlocks();
19148 buf = gen_xmlBufferPtr(n_buf, 0);
19149 table = gen_xmlAttributeTablePtr(n_table, 1);
19150
19151 xmlDumpAttributeTable(buf, table);
19152 call_tests++;
19153 des_xmlBufferPtr(n_buf, buf, 0);
19154 des_xmlAttributeTablePtr(n_table, table, 1);
19155 xmlResetLastError();
19156 if (mem_base != xmlMemBlocks()) {
19157 printf("Leak of %d blocks found in xmlDumpAttributeTable",
19158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019159 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019160 printf(" %d", n_buf);
19161 printf(" %d", n_table);
19162 printf("\n");
19163 }
19164 }
19165 }
19166#endif
19167
19168 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019170}
19171
19172
Daniel Veillardce682bc2004-11-05 17:22:25 +000019173#define gen_nb_xmlElementPtr 1
19174static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
19175 return(NULL);
19176}
19177static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
19178}
19179
Daniel Veillardd93f6252004-11-02 15:53:51 +000019180static int
19181test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019182 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019183
Daniel Veillardce682bc2004-11-05 17:22:25 +000019184#ifdef LIBXML_OUTPUT_ENABLED
19185 int mem_base;
19186 xmlBufferPtr buf; /* the XML buffer output */
19187 int n_buf;
19188 xmlElementPtr elem; /* An element table */
19189 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019190
Daniel Veillardce682bc2004-11-05 17:22:25 +000019191 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
19192 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
19193 mem_base = xmlMemBlocks();
19194 buf = gen_xmlBufferPtr(n_buf, 0);
19195 elem = gen_xmlElementPtr(n_elem, 1);
19196
19197 xmlDumpElementDecl(buf, elem);
19198 call_tests++;
19199 des_xmlBufferPtr(n_buf, buf, 0);
19200 des_xmlElementPtr(n_elem, elem, 1);
19201 xmlResetLastError();
19202 if (mem_base != xmlMemBlocks()) {
19203 printf("Leak of %d blocks found in xmlDumpElementDecl",
19204 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019205 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019206 printf(" %d", n_buf);
19207 printf(" %d", n_elem);
19208 printf("\n");
19209 }
19210 }
19211 }
19212#endif
19213
19214 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019216}
19217
19218
19219static int
19220test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019222
Daniel Veillardce682bc2004-11-05 17:22:25 +000019223#ifdef LIBXML_OUTPUT_ENABLED
19224 int mem_base;
19225 xmlBufferPtr buf; /* the XML buffer output */
19226 int n_buf;
19227 xmlElementTablePtr table; /* An element table */
19228 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019229
Daniel Veillardce682bc2004-11-05 17:22:25 +000019230 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
19231 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
19232 mem_base = xmlMemBlocks();
19233 buf = gen_xmlBufferPtr(n_buf, 0);
19234 table = gen_xmlElementTablePtr(n_table, 1);
19235
19236 xmlDumpElementTable(buf, table);
19237 call_tests++;
19238 des_xmlBufferPtr(n_buf, buf, 0);
19239 des_xmlElementTablePtr(n_table, table, 1);
19240 xmlResetLastError();
19241 if (mem_base != xmlMemBlocks()) {
19242 printf("Leak of %d blocks found in xmlDumpElementTable",
19243 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019244 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019245 printf(" %d", n_buf);
19246 printf(" %d", n_table);
19247 printf("\n");
19248 }
19249 }
19250 }
19251#endif
19252
19253 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019254 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019255}
19256
19257
Daniel Veillardce682bc2004-11-05 17:22:25 +000019258#define gen_nb_xmlNotationPtr 1
19259static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
19260 return(NULL);
19261}
19262static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
19263}
19264
Daniel Veillardd93f6252004-11-02 15:53:51 +000019265static int
19266test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019267 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019268
Daniel Veillardce682bc2004-11-05 17:22:25 +000019269#ifdef LIBXML_OUTPUT_ENABLED
19270 int mem_base;
19271 xmlBufferPtr buf; /* the XML buffer output */
19272 int n_buf;
19273 xmlNotationPtr nota; /* A notation declaration */
19274 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019275
Daniel Veillardce682bc2004-11-05 17:22:25 +000019276 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
19277 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
19278 mem_base = xmlMemBlocks();
19279 buf = gen_xmlBufferPtr(n_buf, 0);
19280 nota = gen_xmlNotationPtr(n_nota, 1);
19281
19282 xmlDumpNotationDecl(buf, nota);
19283 call_tests++;
19284 des_xmlBufferPtr(n_buf, buf, 0);
19285 des_xmlNotationPtr(n_nota, nota, 1);
19286 xmlResetLastError();
19287 if (mem_base != xmlMemBlocks()) {
19288 printf("Leak of %d blocks found in xmlDumpNotationDecl",
19289 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019290 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019291 printf(" %d", n_buf);
19292 printf(" %d", n_nota);
19293 printf("\n");
19294 }
19295 }
19296 }
19297#endif
19298
19299 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019300 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019301}
19302
19303
19304static int
19305test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019307
Daniel Veillardce682bc2004-11-05 17:22:25 +000019308#ifdef LIBXML_OUTPUT_ENABLED
19309 int mem_base;
19310 xmlBufferPtr buf; /* the XML buffer output */
19311 int n_buf;
19312 xmlNotationTablePtr table; /* A notation table */
19313 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019314
Daniel Veillardce682bc2004-11-05 17:22:25 +000019315 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
19316 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
19317 mem_base = xmlMemBlocks();
19318 buf = gen_xmlBufferPtr(n_buf, 0);
19319 table = gen_xmlNotationTablePtr(n_table, 1);
19320
19321 xmlDumpNotationTable(buf, table);
19322 call_tests++;
19323 des_xmlBufferPtr(n_buf, buf, 0);
19324 des_xmlNotationTablePtr(n_table, table, 1);
19325 xmlResetLastError();
19326 if (mem_base != xmlMemBlocks()) {
19327 printf("Leak of %d blocks found in xmlDumpNotationTable",
19328 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019329 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019330 printf(" %d", n_buf);
19331 printf(" %d", n_table);
19332 printf("\n");
19333 }
19334 }
19335 }
19336#endif
19337
19338 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019339 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019340}
19341
19342
19343static int
19344test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019345 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019346
Daniel Veillard42595322004-11-08 10:52:06 +000019347 int mem_base;
19348 xmlAttributePtr ret_val;
19349 xmlDtdPtr dtd; /* a pointer to the DtD to search */
19350 int n_dtd;
19351 xmlChar * elem; /* the element name */
19352 int n_elem;
19353 xmlChar * name; /* the attribute name */
19354 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019355
Daniel Veillard42595322004-11-08 10:52:06 +000019356 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
19357 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
19358 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19359 mem_base = xmlMemBlocks();
19360 dtd = gen_xmlDtdPtr(n_dtd, 0);
19361 elem = gen_const_xmlChar_ptr(n_elem, 1);
19362 name = gen_const_xmlChar_ptr(n_name, 2);
19363
19364 ret_val = xmlGetDtdAttrDesc(dtd, elem, name);
19365 desret_xmlAttributePtr(ret_val);
19366 call_tests++;
19367 des_xmlDtdPtr(n_dtd, dtd, 0);
19368 des_const_xmlChar_ptr(n_elem, elem, 1);
19369 des_const_xmlChar_ptr(n_name, name, 2);
19370 xmlResetLastError();
19371 if (mem_base != xmlMemBlocks()) {
19372 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
19373 xmlMemBlocks() - mem_base);
19374 test_ret++;
19375 printf(" %d", n_dtd);
19376 printf(" %d", n_elem);
19377 printf(" %d", n_name);
19378 printf("\n");
19379 }
19380 }
19381 }
19382 }
19383
19384 function_tests++;
19385 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019386}
19387
19388
19389static int
19390test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019391 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019392
Daniel Veillard42595322004-11-08 10:52:06 +000019393 int mem_base;
19394 xmlElementPtr ret_val;
19395 xmlDtdPtr dtd; /* a pointer to the DtD to search */
19396 int n_dtd;
19397 xmlChar * name; /* the element name */
19398 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019399
Daniel Veillard42595322004-11-08 10:52:06 +000019400 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
19401 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19402 mem_base = xmlMemBlocks();
19403 dtd = gen_xmlDtdPtr(n_dtd, 0);
19404 name = gen_const_xmlChar_ptr(n_name, 1);
19405
19406 ret_val = xmlGetDtdElementDesc(dtd, name);
19407 desret_xmlElementPtr(ret_val);
19408 call_tests++;
19409 des_xmlDtdPtr(n_dtd, dtd, 0);
19410 des_const_xmlChar_ptr(n_name, name, 1);
19411 xmlResetLastError();
19412 if (mem_base != xmlMemBlocks()) {
19413 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
19414 xmlMemBlocks() - mem_base);
19415 test_ret++;
19416 printf(" %d", n_dtd);
19417 printf(" %d", n_name);
19418 printf("\n");
19419 }
19420 }
19421 }
19422
19423 function_tests++;
19424 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019425}
19426
19427
19428static int
19429test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019430 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019431
19432
19433 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019435}
19436
19437
19438static int
19439test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019441
Daniel Veillard42595322004-11-08 10:52:06 +000019442 int mem_base;
19443 xmlAttributePtr ret_val;
19444 xmlDtdPtr dtd; /* a pointer to the DtD to search */
19445 int n_dtd;
19446 xmlChar * elem; /* the element name */
19447 int n_elem;
19448 xmlChar * name; /* the attribute name */
19449 int n_name;
19450 xmlChar * prefix; /* the attribute namespace prefix */
19451 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019452
Daniel Veillard42595322004-11-08 10:52:06 +000019453 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
19454 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
19455 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19456 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
19457 mem_base = xmlMemBlocks();
19458 dtd = gen_xmlDtdPtr(n_dtd, 0);
19459 elem = gen_const_xmlChar_ptr(n_elem, 1);
19460 name = gen_const_xmlChar_ptr(n_name, 2);
19461 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
19462
19463 ret_val = xmlGetDtdQAttrDesc(dtd, elem, name, prefix);
19464 desret_xmlAttributePtr(ret_val);
19465 call_tests++;
19466 des_xmlDtdPtr(n_dtd, dtd, 0);
19467 des_const_xmlChar_ptr(n_elem, elem, 1);
19468 des_const_xmlChar_ptr(n_name, name, 2);
19469 des_const_xmlChar_ptr(n_prefix, prefix, 3);
19470 xmlResetLastError();
19471 if (mem_base != xmlMemBlocks()) {
19472 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
19473 xmlMemBlocks() - mem_base);
19474 test_ret++;
19475 printf(" %d", n_dtd);
19476 printf(" %d", n_elem);
19477 printf(" %d", n_name);
19478 printf(" %d", n_prefix);
19479 printf("\n");
19480 }
19481 }
19482 }
19483 }
19484 }
19485
19486 function_tests++;
19487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019488}
19489
19490
19491static int
19492test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019494
Daniel Veillard42595322004-11-08 10:52:06 +000019495 int mem_base;
19496 xmlElementPtr ret_val;
19497 xmlDtdPtr dtd; /* a pointer to the DtD to search */
19498 int n_dtd;
19499 xmlChar * name; /* the element name */
19500 int n_name;
19501 xmlChar * prefix; /* the element namespace prefix */
19502 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019503
Daniel Veillard42595322004-11-08 10:52:06 +000019504 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
19505 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19506 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
19507 mem_base = xmlMemBlocks();
19508 dtd = gen_xmlDtdPtr(n_dtd, 0);
19509 name = gen_const_xmlChar_ptr(n_name, 1);
19510 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
19511
19512 ret_val = xmlGetDtdQElementDesc(dtd, name, prefix);
19513 desret_xmlElementPtr(ret_val);
19514 call_tests++;
19515 des_xmlDtdPtr(n_dtd, dtd, 0);
19516 des_const_xmlChar_ptr(n_name, name, 1);
19517 des_const_xmlChar_ptr(n_prefix, prefix, 2);
19518 xmlResetLastError();
19519 if (mem_base != xmlMemBlocks()) {
19520 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
19521 xmlMemBlocks() - mem_base);
19522 test_ret++;
19523 printf(" %d", n_dtd);
19524 printf(" %d", n_name);
19525 printf(" %d", n_prefix);
19526 printf("\n");
19527 }
19528 }
19529 }
19530 }
19531
19532 function_tests++;
19533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019534}
19535
19536
19537static int
19538test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019539 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019540
Daniel Veillard57b25162004-11-06 14:50:18 +000019541 int mem_base;
19542 xmlAttrPtr ret_val;
19543 xmlDocPtr doc; /* pointer to the document */
19544 int n_doc;
19545 xmlChar * ID; /* the ID value */
19546 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019547
Daniel Veillard57b25162004-11-06 14:50:18 +000019548 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19549 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
19550 mem_base = xmlMemBlocks();
19551 doc = gen_xmlDocPtr(n_doc, 0);
19552 ID = gen_const_xmlChar_ptr(n_ID, 1);
19553
19554 ret_val = xmlGetID(doc, ID);
19555 desret_xmlAttrPtr(ret_val);
19556 call_tests++;
19557 des_xmlDocPtr(n_doc, doc, 0);
19558 des_const_xmlChar_ptr(n_ID, ID, 1);
19559 xmlResetLastError();
19560 if (mem_base != xmlMemBlocks()) {
19561 printf("Leak of %d blocks found in xmlGetID",
19562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019563 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019564 printf(" %d", n_doc);
19565 printf(" %d", n_ID);
19566 printf("\n");
19567 }
19568 }
19569 }
19570
19571 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019573}
19574
19575
19576static int
19577test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019578 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019579
19580
19581 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019583}
19584
19585
19586static int
19587test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019589
Daniel Veillardce244ad2004-11-05 10:03:46 +000019590 int mem_base;
19591 int ret_val;
19592 xmlDocPtr doc; /* the document */
19593 int n_doc;
19594 xmlNodePtr elem; /* the element carrying the attribute */
19595 int n_elem;
19596 xmlAttrPtr attr; /* the attribute */
19597 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019598
Daniel Veillardce244ad2004-11-05 10:03:46 +000019599 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19600 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
19601 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
19602 mem_base = xmlMemBlocks();
19603 doc = gen_xmlDocPtr(n_doc, 0);
19604 elem = gen_xmlNodePtr(n_elem, 1);
19605 attr = gen_xmlAttrPtr(n_attr, 2);
19606
19607 ret_val = xmlIsID(doc, elem, attr);
19608 desret_int(ret_val);
19609 call_tests++;
19610 des_xmlDocPtr(n_doc, doc, 0);
19611 des_xmlNodePtr(n_elem, elem, 1);
19612 des_xmlAttrPtr(n_attr, attr, 2);
19613 xmlResetLastError();
19614 if (mem_base != xmlMemBlocks()) {
19615 printf("Leak of %d blocks found in xmlIsID",
19616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019617 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000019618 printf(" %d", n_doc);
19619 printf(" %d", n_elem);
19620 printf(" %d", n_attr);
19621 printf("\n");
19622 }
19623 }
19624 }
19625 }
19626
19627 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019628 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019629}
19630
19631
19632static int
19633test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019634 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019635
19636 int mem_base;
19637 int ret_val;
19638 xmlDocPtr doc; /* the document */
19639 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019640 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019641 int n_name;
19642
19643 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19644 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19645 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019646 doc = gen_xmlDocPtr(n_doc, 0);
19647 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019648
19649 ret_val = xmlIsMixedElement(doc, name);
19650 desret_int(ret_val);
19651 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019652 des_xmlDocPtr(n_doc, doc, 0);
19653 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019654 xmlResetLastError();
19655 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019656 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019658 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019659 printf(" %d", n_doc);
19660 printf(" %d", n_name);
19661 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019662 }
19663 }
19664 }
19665
Daniel Veillard3d97e662004-11-04 10:49:00 +000019666 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019667 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019668}
19669
19670
19671static int
19672test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019673 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019674
Daniel Veillardce244ad2004-11-05 10:03:46 +000019675 int mem_base;
19676 int ret_val;
19677 xmlDocPtr doc; /* the document */
19678 int n_doc;
19679 xmlNodePtr elem; /* the element carrying the attribute */
19680 int n_elem;
19681 xmlAttrPtr attr; /* the attribute */
19682 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019683
Daniel Veillardce244ad2004-11-05 10:03:46 +000019684 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19685 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
19686 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
19687 mem_base = xmlMemBlocks();
19688 doc = gen_xmlDocPtr(n_doc, 0);
19689 elem = gen_xmlNodePtr(n_elem, 1);
19690 attr = gen_xmlAttrPtr(n_attr, 2);
19691
19692 ret_val = xmlIsRef(doc, elem, attr);
19693 desret_int(ret_val);
19694 call_tests++;
19695 des_xmlDocPtr(n_doc, doc, 0);
19696 des_xmlNodePtr(n_elem, elem, 1);
19697 des_xmlAttrPtr(n_attr, attr, 2);
19698 xmlResetLastError();
19699 if (mem_base != xmlMemBlocks()) {
19700 printf("Leak of %d blocks found in xmlIsRef",
19701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019702 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000019703 printf(" %d", n_doc);
19704 printf(" %d", n_elem);
19705 printf(" %d", n_attr);
19706 printf("\n");
19707 }
19708 }
19709 }
19710 }
19711
19712 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019714}
19715
19716
19717static int
19718test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019719 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019720
19721
19722 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019724}
19725
19726
19727static int
19728test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019730
19731
19732 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019734}
19735
19736
19737static int
19738test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019740
Daniel Veillardce244ad2004-11-05 10:03:46 +000019741 int mem_base;
19742 int ret_val;
19743 xmlDocPtr doc; /* the document */
19744 int n_doc;
19745 xmlAttrPtr attr; /* the attribute */
19746 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019747
Daniel Veillardce244ad2004-11-05 10:03:46 +000019748 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19749 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
19750 mem_base = xmlMemBlocks();
19751 doc = gen_xmlDocPtr(n_doc, 0);
19752 attr = gen_xmlAttrPtr(n_attr, 1);
19753
19754 ret_val = xmlRemoveID(doc, attr);
19755 desret_int(ret_val);
19756 call_tests++;
19757 des_xmlDocPtr(n_doc, doc, 0);
19758 des_xmlAttrPtr(n_attr, attr, 1);
19759 xmlResetLastError();
19760 if (mem_base != xmlMemBlocks()) {
19761 printf("Leak of %d blocks found in xmlRemoveID",
19762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019763 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000019764 printf(" %d", n_doc);
19765 printf(" %d", n_attr);
19766 printf("\n");
19767 }
19768 }
19769 }
19770
19771 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019772 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019773}
19774
19775
19776static int
19777test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019778 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019779
Daniel Veillardce244ad2004-11-05 10:03:46 +000019780 int mem_base;
19781 int ret_val;
19782 xmlDocPtr doc; /* the document */
19783 int n_doc;
19784 xmlAttrPtr attr; /* the attribute */
19785 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019786
Daniel Veillardce244ad2004-11-05 10:03:46 +000019787 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19788 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
19789 mem_base = xmlMemBlocks();
19790 doc = gen_xmlDocPtr(n_doc, 0);
19791 attr = gen_xmlAttrPtr(n_attr, 1);
19792
19793 ret_val = xmlRemoveRef(doc, attr);
19794 desret_int(ret_val);
19795 call_tests++;
19796 des_xmlDocPtr(n_doc, doc, 0);
19797 des_xmlAttrPtr(n_attr, attr, 1);
19798 xmlResetLastError();
19799 if (mem_base != xmlMemBlocks()) {
19800 printf("Leak of %d blocks found in xmlRemoveRef",
19801 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019802 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000019803 printf(" %d", n_doc);
19804 printf(" %d", n_attr);
19805 printf("\n");
19806 }
19807 }
19808 }
19809
19810 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019812}
19813
19814
19815static int
19816test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019818
Daniel Veillardce682bc2004-11-05 17:22:25 +000019819 int mem_base;
19820 char * buf; /* an output buffer */
19821 int n_buf;
19822 int size; /* the buffer size */
19823 int n_size;
19824 xmlElementContentPtr content; /* An element table */
19825 int n_content;
19826 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
19827 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019828
Daniel Veillardce682bc2004-11-05 17:22:25 +000019829 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
19830 for (n_size = 0;n_size < gen_nb_int;n_size++) {
19831 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
19832 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
19833 mem_base = xmlMemBlocks();
19834 buf = gen_char_ptr(n_buf, 0);
19835 size = gen_int(n_size, 1);
19836 content = gen_xmlElementContentPtr(n_content, 2);
19837 glob = gen_int(n_glob, 3);
19838
19839 xmlSnprintfElementContent(buf, size, content, glob);
19840 call_tests++;
19841 des_char_ptr(n_buf, buf, 0);
19842 des_int(n_size, size, 1);
19843 des_xmlElementContentPtr(n_content, content, 2);
19844 des_int(n_glob, glob, 3);
19845 xmlResetLastError();
19846 if (mem_base != xmlMemBlocks()) {
19847 printf("Leak of %d blocks found in xmlSnprintfElementContent",
19848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019849 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019850 printf(" %d", n_buf);
19851 printf(" %d", n_size);
19852 printf(" %d", n_content);
19853 printf(" %d", n_glob);
19854 printf("\n");
19855 }
19856 }
19857 }
19858 }
19859 }
19860
19861 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019863}
19864
19865
19866static int
19867test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019869
Daniel Veillardce682bc2004-11-05 17:22:25 +000019870 int mem_base;
19871 char * buf; /* an output buffer */
19872 int n_buf;
19873 xmlElementContentPtr content; /* An element table */
19874 int n_content;
19875 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
19876 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019877
Daniel Veillardce682bc2004-11-05 17:22:25 +000019878 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
19879 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
19880 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
19881 mem_base = xmlMemBlocks();
19882 buf = gen_char_ptr(n_buf, 0);
19883 content = gen_xmlElementContentPtr(n_content, 1);
19884 glob = gen_int(n_glob, 2);
19885
19886 xmlSprintfElementContent(buf, content, glob);
19887 call_tests++;
19888 des_char_ptr(n_buf, buf, 0);
19889 des_xmlElementContentPtr(n_content, content, 1);
19890 des_int(n_glob, glob, 2);
19891 xmlResetLastError();
19892 if (mem_base != xmlMemBlocks()) {
19893 printf("Leak of %d blocks found in xmlSprintfElementContent",
19894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019895 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019896 printf(" %d", n_buf);
19897 printf(" %d", n_content);
19898 printf(" %d", n_glob);
19899 printf("\n");
19900 }
19901 }
19902 }
19903 }
19904
19905 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019907}
19908
19909
19910static int
19911test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019913
Daniel Veillardce682bc2004-11-05 17:22:25 +000019914#ifdef LIBXML_REGEXP_ENABLED
19915 int mem_base;
19916 int ret_val;
19917 xmlValidCtxtPtr ctxt; /* a validation context */
19918 int n_ctxt;
19919 xmlElementPtr elem; /* an element declaration node */
19920 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019921
Daniel Veillardce682bc2004-11-05 17:22:25 +000019922 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
19923 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
19924 mem_base = xmlMemBlocks();
19925 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
19926 elem = gen_xmlElementPtr(n_elem, 1);
19927
19928 ret_val = xmlValidBuildContentModel(ctxt, elem);
19929 desret_int(ret_val);
19930 call_tests++;
19931 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
19932 des_xmlElementPtr(n_elem, elem, 1);
19933 xmlResetLastError();
19934 if (mem_base != xmlMemBlocks()) {
19935 printf("Leak of %d blocks found in xmlValidBuildContentModel",
19936 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019937 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019938 printf(" %d", n_ctxt);
19939 printf(" %d", n_elem);
19940 printf("\n");
19941 }
19942 }
19943 }
19944#endif
19945
19946 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019948}
19949
19950
19951static int
19952test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019954
Daniel Veillardc0be74b2004-11-03 19:16:55 +000019955#ifdef LIBXML_VALID_ENABLED
19956 int mem_base;
19957 xmlChar * ret_val;
19958 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
19959 int n_ctxt;
19960 xmlDocPtr doc; /* the document */
19961 int n_doc;
19962 xmlNodePtr elem; /* the parent */
19963 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019964 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000019965 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019966 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000019967 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019968
Daniel Veillardc0be74b2004-11-03 19:16:55 +000019969 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
19970 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19971 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
19972 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19973 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
19974 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019975 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
19976 doc = gen_xmlDocPtr(n_doc, 1);
19977 elem = gen_xmlNodePtr(n_elem, 2);
19978 name = gen_const_xmlChar_ptr(n_name, 3);
19979 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000019980
19981 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, name, value);
19982 desret_xmlChar_ptr(ret_val);
19983 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019984 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
19985 des_xmlDocPtr(n_doc, doc, 1);
19986 des_xmlNodePtr(n_elem, elem, 2);
19987 des_const_xmlChar_ptr(n_name, name, 3);
19988 des_const_xmlChar_ptr(n_value, value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000019989 xmlResetLastError();
19990 if (mem_base != xmlMemBlocks()) {
19991 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
19992 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019993 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000019994 printf(" %d", n_ctxt);
19995 printf(" %d", n_doc);
19996 printf(" %d", n_elem);
19997 printf(" %d", n_name);
19998 printf(" %d", n_value);
19999 printf("\n");
20000 }
20001 }
20002 }
20003 }
20004 }
20005 }
20006#endif
20007
Daniel Veillard3d97e662004-11-04 10:49:00 +000020008 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020009 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020010}
20011
20012
Daniel Veillardce682bc2004-11-05 17:22:25 +000020013#define gen_nb_xmlElementContent_ptr 1
20014static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
20015 return(NULL);
20016}
20017static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
20018}
20019
Daniel Veillardd93f6252004-11-02 15:53:51 +000020020static int
20021test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020022 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020023
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020024 int mem_base;
20025 int ret_val;
20026 xmlElementContent * ctree; /* an element content tree */
20027 int n_ctree;
20028 xmlChar ** list; /* an array to store the list of child names */
20029 int n_list;
20030 int * len; /* a pointer to the number of element in the list */
20031 int n_len;
20032 int max; /* the size of the array */
20033 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020034
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020035 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
20036 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
20037 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
20038 for (n_max = 0;n_max < gen_nb_int;n_max++) {
20039 mem_base = xmlMemBlocks();
20040 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
20041 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
20042 len = gen_int_ptr(n_len, 2);
20043 max = gen_int(n_max, 3);
20044
20045 ret_val = xmlValidGetPotentialChildren(ctree, list, len, max);
20046 desret_int(ret_val);
20047 call_tests++;
20048 des_xmlElementContent_ptr(n_ctree, ctree, 0);
20049 des_const_xmlChar_ptr_ptr(n_list, list, 1);
20050 des_int_ptr(n_len, len, 2);
20051 des_int(n_max, max, 3);
20052 xmlResetLastError();
20053 if (mem_base != xmlMemBlocks()) {
20054 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
20055 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020056 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020057 printf(" %d", n_ctree);
20058 printf(" %d", n_list);
20059 printf(" %d", n_len);
20060 printf(" %d", n_max);
20061 printf("\n");
20062 }
20063 }
20064 }
20065 }
20066 }
20067
20068 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020069 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020070}
20071
20072
20073static int
20074test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020075 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020076
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020077 int mem_base;
20078 int ret_val;
20079 xmlNode * prev; /* an element to insert after */
20080 int n_prev;
20081 xmlNode * next; /* an element to insert next */
20082 int n_next;
20083 xmlChar ** names; /* an array to store the list of child names */
20084 int n_names;
20085 int max; /* the size of the array */
20086 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020087
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020088 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
20089 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
20090 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
20091 for (n_max = 0;n_max < gen_nb_int;n_max++) {
20092 mem_base = xmlMemBlocks();
20093 prev = gen_xmlNodePtr(n_prev, 0);
20094 next = gen_xmlNodePtr(n_next, 1);
20095 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
20096 max = gen_int(n_max, 3);
20097
20098 ret_val = xmlValidGetValidElements(prev, next, names, max);
20099 desret_int(ret_val);
20100 call_tests++;
20101 des_xmlNodePtr(n_prev, prev, 0);
20102 des_xmlNodePtr(n_next, next, 1);
20103 des_const_xmlChar_ptr_ptr(n_names, names, 2);
20104 des_int(n_max, max, 3);
20105 xmlResetLastError();
20106 if (mem_base != xmlMemBlocks()) {
20107 printf("Leak of %d blocks found in xmlValidGetValidElements",
20108 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020109 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020110 printf(" %d", n_prev);
20111 printf(" %d", n_next);
20112 printf(" %d", n_names);
20113 printf(" %d", n_max);
20114 printf("\n");
20115 }
20116 }
20117 }
20118 }
20119 }
20120
20121 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020123}
20124
20125
20126static int
20127test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020129
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020130#ifdef LIBXML_VALID_ENABLED
20131 int mem_base;
20132 xmlChar * ret_val;
20133 xmlDocPtr doc; /* the document */
20134 int n_doc;
20135 xmlNodePtr elem; /* the parent */
20136 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020137 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020138 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020139 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020140 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020141
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020142 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20143 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
20144 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20145 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20146 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020147 doc = gen_xmlDocPtr(n_doc, 0);
20148 elem = gen_xmlNodePtr(n_elem, 1);
20149 name = gen_const_xmlChar_ptr(n_name, 2);
20150 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020151
20152 ret_val = xmlValidNormalizeAttributeValue(doc, elem, name, value);
20153 desret_xmlChar_ptr(ret_val);
20154 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020155 des_xmlDocPtr(n_doc, doc, 0);
20156 des_xmlNodePtr(n_elem, elem, 1);
20157 des_const_xmlChar_ptr(n_name, name, 2);
20158 des_const_xmlChar_ptr(n_value, value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020159 xmlResetLastError();
20160 if (mem_base != xmlMemBlocks()) {
20161 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
20162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020163 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000020164 printf(" %d", n_doc);
20165 printf(" %d", n_elem);
20166 printf(" %d", n_name);
20167 printf(" %d", n_value);
20168 printf("\n");
20169 }
20170 }
20171 }
20172 }
20173 }
20174#endif
20175
Daniel Veillard3d97e662004-11-04 10:49:00 +000020176 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020178}
20179
20180
20181static int
20182test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020184
Daniel Veillardce682bc2004-11-05 17:22:25 +000020185#ifdef LIBXML_VALID_ENABLED
20186 int mem_base;
20187 int ret_val;
20188 xmlValidCtxtPtr ctxt; /* the validation context */
20189 int n_ctxt;
20190 xmlDocPtr doc; /* a document instance */
20191 int n_doc;
20192 xmlAttributePtr attr; /* an attribute definition */
20193 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020194
Daniel Veillardce682bc2004-11-05 17:22:25 +000020195 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
20196 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20197 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
20198 mem_base = xmlMemBlocks();
20199 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
20200 doc = gen_xmlDocPtr(n_doc, 1);
20201 attr = gen_xmlAttributePtr(n_attr, 2);
20202
20203 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
20204 desret_int(ret_val);
20205 call_tests++;
20206 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
20207 des_xmlDocPtr(n_doc, doc, 1);
20208 des_xmlAttributePtr(n_attr, attr, 2);
20209 xmlResetLastError();
20210 if (mem_base != xmlMemBlocks()) {
20211 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
20212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020213 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020214 printf(" %d", n_ctxt);
20215 printf(" %d", n_doc);
20216 printf(" %d", n_attr);
20217 printf("\n");
20218 }
20219 }
20220 }
20221 }
20222#endif
20223
20224 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020226}
20227
20228
20229static int
20230test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020232
Daniel Veillard57b25162004-11-06 14:50:18 +000020233#ifdef LIBXML_VALID_ENABLED
20234 int mem_base;
20235 int ret_val;
20236 xmlAttributeType type; /* an attribute type */
20237 int n_type;
20238 xmlChar * value; /* an attribute value */
20239 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020240
Daniel Veillard57b25162004-11-06 14:50:18 +000020241 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
20242 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20243 mem_base = xmlMemBlocks();
20244 type = gen_xmlAttributeType(n_type, 0);
20245 value = gen_const_xmlChar_ptr(n_value, 1);
20246
20247 ret_val = xmlValidateAttributeValue(type, value);
20248 desret_int(ret_val);
20249 call_tests++;
20250 des_xmlAttributeType(n_type, type, 0);
20251 des_const_xmlChar_ptr(n_value, value, 1);
20252 xmlResetLastError();
20253 if (mem_base != xmlMemBlocks()) {
20254 printf("Leak of %d blocks found in xmlValidateAttributeValue",
20255 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020256 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020257 printf(" %d", n_type);
20258 printf(" %d", n_value);
20259 printf("\n");
20260 }
20261 }
20262 }
20263#endif
20264
20265 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020267}
20268
20269
20270static int
20271test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020273
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020274#ifdef LIBXML_VALID_ENABLED
20275 int mem_base;
20276 int ret_val;
20277 xmlValidCtxtPtr ctxt; /* the validation context */
20278 int n_ctxt;
20279 xmlDocPtr doc; /* a document instance */
20280 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020281
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020282 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
20283 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20284 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020285 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
20286 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020287
20288 ret_val = xmlValidateDocument(ctxt, doc);
20289 desret_int(ret_val);
20290 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020291 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
20292 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020293 xmlResetLastError();
20294 if (mem_base != xmlMemBlocks()) {
20295 printf("Leak of %d blocks found in xmlValidateDocument",
20296 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020297 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020298 printf(" %d", n_ctxt);
20299 printf(" %d", n_doc);
20300 printf("\n");
20301 }
20302 }
20303 }
20304#endif
20305
Daniel Veillard3d97e662004-11-04 10:49:00 +000020306 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020308}
20309
20310
20311static int
20312test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020314
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020315#ifdef LIBXML_VALID_ENABLED
20316 int mem_base;
20317 int ret_val;
20318 xmlValidCtxtPtr ctxt; /* the validation context */
20319 int n_ctxt;
20320 xmlDocPtr doc; /* a document instance */
20321 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020322
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020323 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
20324 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20325 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020326 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
20327 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020328
20329 ret_val = xmlValidateDocumentFinal(ctxt, doc);
20330 desret_int(ret_val);
20331 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020332 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
20333 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020334 xmlResetLastError();
20335 if (mem_base != xmlMemBlocks()) {
20336 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
20337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020338 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020339 printf(" %d", n_ctxt);
20340 printf(" %d", n_doc);
20341 printf("\n");
20342 }
20343 }
20344 }
20345#endif
20346
Daniel Veillard3d97e662004-11-04 10:49:00 +000020347 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020349}
20350
20351
20352static int
20353test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020355
Daniel Veillard27f20102004-11-05 11:50:11 +000020356#ifdef LIBXML_VALID_ENABLED
20357 int mem_base;
20358 int ret_val;
20359 xmlValidCtxtPtr ctxt; /* the validation context */
20360 int n_ctxt;
20361 xmlDocPtr doc; /* a document instance */
20362 int n_doc;
20363 xmlDtdPtr dtd; /* a dtd instance */
20364 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020365
Daniel Veillard27f20102004-11-05 11:50:11 +000020366 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
20367 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20368 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
20369 mem_base = xmlMemBlocks();
20370 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
20371 doc = gen_xmlDocPtr(n_doc, 1);
20372 dtd = gen_xmlDtdPtr(n_dtd, 2);
20373
20374 ret_val = xmlValidateDtd(ctxt, doc, dtd);
20375 desret_int(ret_val);
20376 call_tests++;
20377 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
20378 des_xmlDocPtr(n_doc, doc, 1);
20379 des_xmlDtdPtr(n_dtd, dtd, 2);
20380 xmlResetLastError();
20381 if (mem_base != xmlMemBlocks()) {
20382 printf("Leak of %d blocks found in xmlValidateDtd",
20383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020384 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020385 printf(" %d", n_ctxt);
20386 printf(" %d", n_doc);
20387 printf(" %d", n_dtd);
20388 printf("\n");
20389 }
20390 }
20391 }
20392 }
20393#endif
20394
20395 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020397}
20398
20399
20400static int
20401test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020403
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020404#ifdef LIBXML_VALID_ENABLED
20405 int mem_base;
20406 int ret_val;
20407 xmlValidCtxtPtr ctxt; /* the validation context */
20408 int n_ctxt;
20409 xmlDocPtr doc; /* a document instance */
20410 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020411
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020412 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
20413 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20414 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020415 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
20416 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020417
20418 ret_val = xmlValidateDtdFinal(ctxt, doc);
20419 desret_int(ret_val);
20420 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020421 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
20422 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020423 xmlResetLastError();
20424 if (mem_base != xmlMemBlocks()) {
20425 printf("Leak of %d blocks found in xmlValidateDtdFinal",
20426 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020427 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020428 printf(" %d", n_ctxt);
20429 printf(" %d", n_doc);
20430 printf("\n");
20431 }
20432 }
20433 }
20434#endif
20435
Daniel Veillard3d97e662004-11-04 10:49:00 +000020436 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020437 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020438}
20439
20440
20441static int
20442test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020443 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020444
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020445#ifdef LIBXML_VALID_ENABLED
20446 int mem_base;
20447 int ret_val;
20448 xmlValidCtxtPtr ctxt; /* the validation context */
20449 int n_ctxt;
20450 xmlDocPtr doc; /* a document instance */
20451 int n_doc;
20452 xmlNodePtr elem; /* an element instance */
20453 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020454
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020455 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
20456 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20457 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
20458 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020459 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
20460 doc = gen_xmlDocPtr(n_doc, 1);
20461 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020462
20463 ret_val = xmlValidateElement(ctxt, doc, elem);
20464 desret_int(ret_val);
20465 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020466 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
20467 des_xmlDocPtr(n_doc, doc, 1);
20468 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020469 xmlResetLastError();
20470 if (mem_base != xmlMemBlocks()) {
20471 printf("Leak of %d blocks found in xmlValidateElement",
20472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020473 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020474 printf(" %d", n_ctxt);
20475 printf(" %d", n_doc);
20476 printf(" %d", n_elem);
20477 printf("\n");
20478 }
20479 }
20480 }
20481 }
20482#endif
20483
Daniel Veillard3d97e662004-11-04 10:49:00 +000020484 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020486}
20487
20488
20489static int
20490test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020491 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020492
Daniel Veillardce682bc2004-11-05 17:22:25 +000020493#ifdef LIBXML_VALID_ENABLED
20494 int mem_base;
20495 int ret_val;
20496 xmlValidCtxtPtr ctxt; /* the validation context */
20497 int n_ctxt;
20498 xmlDocPtr doc; /* a document instance */
20499 int n_doc;
20500 xmlElementPtr elem; /* an element definition */
20501 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020502
Daniel Veillardce682bc2004-11-05 17:22:25 +000020503 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
20504 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20505 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
20506 mem_base = xmlMemBlocks();
20507 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
20508 doc = gen_xmlDocPtr(n_doc, 1);
20509 elem = gen_xmlElementPtr(n_elem, 2);
20510
20511 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
20512 desret_int(ret_val);
20513 call_tests++;
20514 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
20515 des_xmlDocPtr(n_doc, doc, 1);
20516 des_xmlElementPtr(n_elem, elem, 2);
20517 xmlResetLastError();
20518 if (mem_base != xmlMemBlocks()) {
20519 printf("Leak of %d blocks found in xmlValidateElementDecl",
20520 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020521 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020522 printf(" %d", n_ctxt);
20523 printf(" %d", n_doc);
20524 printf(" %d", n_elem);
20525 printf("\n");
20526 }
20527 }
20528 }
20529 }
20530#endif
20531
20532 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020534}
20535
20536
20537static int
20538test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020539 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020540
20541#ifdef LIBXML_VALID_ENABLED
20542 int mem_base;
20543 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020544 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020545 int n_value;
20546
20547 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20548 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020549 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020550
20551 ret_val = xmlValidateNameValue(value);
20552 desret_int(ret_val);
20553 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020554 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020555 xmlResetLastError();
20556 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020557 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020559 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020560 printf(" %d", n_value);
20561 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020562 }
20563 }
20564#endif
20565
Daniel Veillard3d97e662004-11-04 10:49:00 +000020566 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020567 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020568}
20569
20570
20571static int
20572test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020573 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020574
20575#ifdef LIBXML_VALID_ENABLED
20576 int mem_base;
20577 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020578 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020579 int n_value;
20580
20581 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20582 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020583 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020584
20585 ret_val = xmlValidateNamesValue(value);
20586 desret_int(ret_val);
20587 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020588 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020589 xmlResetLastError();
20590 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020591 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020593 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020594 printf(" %d", n_value);
20595 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020596 }
20597 }
20598#endif
20599
Daniel Veillard3d97e662004-11-04 10:49:00 +000020600 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020602}
20603
20604
20605static int
20606test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020607 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020608
20609#ifdef LIBXML_VALID_ENABLED
20610 int mem_base;
20611 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020612 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020613 int n_value;
20614
20615 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20616 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020617 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020618
20619 ret_val = xmlValidateNmtokenValue(value);
20620 desret_int(ret_val);
20621 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020622 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020623 xmlResetLastError();
20624 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020625 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020627 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020628 printf(" %d", n_value);
20629 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020630 }
20631 }
20632#endif
20633
Daniel Veillard3d97e662004-11-04 10:49:00 +000020634 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020636}
20637
20638
20639static int
20640test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020642
20643#ifdef LIBXML_VALID_ENABLED
20644 int mem_base;
20645 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020646 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020647 int n_value;
20648
20649 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20650 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020651 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020652
20653 ret_val = xmlValidateNmtokensValue(value);
20654 desret_int(ret_val);
20655 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020656 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020657 xmlResetLastError();
20658 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020659 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020660 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020661 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020662 printf(" %d", n_value);
20663 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020664 }
20665 }
20666#endif
20667
Daniel Veillard3d97e662004-11-04 10:49:00 +000020668 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020669 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020670}
20671
20672
20673static int
20674test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020675 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020676
Daniel Veillardce682bc2004-11-05 17:22:25 +000020677#ifdef LIBXML_VALID_ENABLED
20678 int mem_base;
20679 int ret_val;
20680 xmlValidCtxtPtr ctxt; /* the validation context */
20681 int n_ctxt;
20682 xmlDocPtr doc; /* a document instance */
20683 int n_doc;
20684 xmlNotationPtr nota; /* a notation definition */
20685 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020686
Daniel Veillardce682bc2004-11-05 17:22:25 +000020687 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
20688 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20689 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
20690 mem_base = xmlMemBlocks();
20691 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
20692 doc = gen_xmlDocPtr(n_doc, 1);
20693 nota = gen_xmlNotationPtr(n_nota, 2);
20694
20695 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
20696 desret_int(ret_val);
20697 call_tests++;
20698 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
20699 des_xmlDocPtr(n_doc, doc, 1);
20700 des_xmlNotationPtr(n_nota, nota, 2);
20701 xmlResetLastError();
20702 if (mem_base != xmlMemBlocks()) {
20703 printf("Leak of %d blocks found in xmlValidateNotationDecl",
20704 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020705 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020706 printf(" %d", n_ctxt);
20707 printf(" %d", n_doc);
20708 printf(" %d", n_nota);
20709 printf("\n");
20710 }
20711 }
20712 }
20713 }
20714#endif
20715
20716 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020717 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020718}
20719
20720
20721static int
20722test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020723 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020724
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020725#ifdef LIBXML_VALID_ENABLED
20726 int mem_base;
20727 int ret_val;
20728 xmlValidCtxtPtr ctxt; /* the validation context */
20729 int n_ctxt;
20730 xmlDocPtr doc; /* the document */
20731 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020732 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020733 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020734
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020735 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
20736 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20737 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
20738 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020739 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
20740 doc = gen_xmlDocPtr(n_doc, 1);
20741 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020742
20743 ret_val = xmlValidateNotationUse(ctxt, doc, notationName);
20744 desret_int(ret_val);
20745 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020746 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
20747 des_xmlDocPtr(n_doc, doc, 1);
20748 des_const_xmlChar_ptr(n_notationName, notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020749 xmlResetLastError();
20750 if (mem_base != xmlMemBlocks()) {
20751 printf("Leak of %d blocks found in xmlValidateNotationUse",
20752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020753 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020754 printf(" %d", n_ctxt);
20755 printf(" %d", n_doc);
20756 printf(" %d", n_notationName);
20757 printf("\n");
20758 }
20759 }
20760 }
20761 }
20762#endif
20763
Daniel Veillard3d97e662004-11-04 10:49:00 +000020764 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020766}
20767
20768
20769static int
20770test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020772
Daniel Veillardce244ad2004-11-05 10:03:46 +000020773#ifdef LIBXML_VALID_ENABLED
20774 int mem_base;
20775 int ret_val;
20776 xmlValidCtxtPtr ctxt; /* the validation context */
20777 int n_ctxt;
20778 xmlDocPtr doc; /* a document instance */
20779 int n_doc;
20780 xmlNodePtr elem; /* an element instance */
20781 int n_elem;
20782 xmlAttrPtr attr; /* an attribute instance */
20783 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020784 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000020785 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020786
Daniel Veillardce244ad2004-11-05 10:03:46 +000020787 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
20788 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20789 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
20790 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
20791 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20792 mem_base = xmlMemBlocks();
20793 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
20794 doc = gen_xmlDocPtr(n_doc, 1);
20795 elem = gen_xmlNodePtr(n_elem, 2);
20796 attr = gen_xmlAttrPtr(n_attr, 3);
20797 value = gen_const_xmlChar_ptr(n_value, 4);
20798
20799 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
20800 desret_int(ret_val);
20801 call_tests++;
20802 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
20803 des_xmlDocPtr(n_doc, doc, 1);
20804 des_xmlNodePtr(n_elem, elem, 2);
20805 des_xmlAttrPtr(n_attr, attr, 3);
20806 des_const_xmlChar_ptr(n_value, value, 4);
20807 xmlResetLastError();
20808 if (mem_base != xmlMemBlocks()) {
20809 printf("Leak of %d blocks found in xmlValidateOneAttribute",
20810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020811 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000020812 printf(" %d", n_ctxt);
20813 printf(" %d", n_doc);
20814 printf(" %d", n_elem);
20815 printf(" %d", n_attr);
20816 printf(" %d", n_value);
20817 printf("\n");
20818 }
20819 }
20820 }
20821 }
20822 }
20823 }
20824#endif
20825
20826 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020827 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020828}
20829
20830
20831static int
20832test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020833 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020834
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020835#ifdef LIBXML_VALID_ENABLED
20836 int mem_base;
20837 int ret_val;
20838 xmlValidCtxtPtr ctxt; /* the validation context */
20839 int n_ctxt;
20840 xmlDocPtr doc; /* a document instance */
20841 int n_doc;
20842 xmlNodePtr elem; /* an element instance */
20843 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020844
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020845 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
20846 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20847 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
20848 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020849 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
20850 doc = gen_xmlDocPtr(n_doc, 1);
20851 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020852
20853 ret_val = xmlValidateOneElement(ctxt, doc, elem);
20854 desret_int(ret_val);
20855 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020856 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
20857 des_xmlDocPtr(n_doc, doc, 1);
20858 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020859 xmlResetLastError();
20860 if (mem_base != xmlMemBlocks()) {
20861 printf("Leak of %d blocks found in xmlValidateOneElement",
20862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020863 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020864 printf(" %d", n_ctxt);
20865 printf(" %d", n_doc);
20866 printf(" %d", n_elem);
20867 printf("\n");
20868 }
20869 }
20870 }
20871 }
20872#endif
20873
Daniel Veillard3d97e662004-11-04 10:49:00 +000020874 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020875 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020876}
20877
20878
20879static int
20880test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020881 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020882
Daniel Veillard27f20102004-11-05 11:50:11 +000020883#ifdef LIBXML_VALID_ENABLED
20884 int mem_base;
20885 int ret_val;
20886 xmlValidCtxtPtr ctxt; /* the validation context */
20887 int n_ctxt;
20888 xmlDocPtr doc; /* a document instance */
20889 int n_doc;
20890 xmlNodePtr elem; /* an element instance */
20891 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020892 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000020893 int n_prefix;
20894 xmlNsPtr ns; /* an namespace declaration instance */
20895 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020896 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000020897 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020898
Daniel Veillard27f20102004-11-05 11:50:11 +000020899 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
20900 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20901 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
20902 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20903 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20904 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20905 mem_base = xmlMemBlocks();
20906 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
20907 doc = gen_xmlDocPtr(n_doc, 1);
20908 elem = gen_xmlNodePtr(n_elem, 2);
20909 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
20910 ns = gen_xmlNsPtr(n_ns, 4);
20911 value = gen_const_xmlChar_ptr(n_value, 5);
20912
20913 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, prefix, ns, value);
20914 desret_int(ret_val);
20915 call_tests++;
20916 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
20917 des_xmlDocPtr(n_doc, doc, 1);
20918 des_xmlNodePtr(n_elem, elem, 2);
20919 des_const_xmlChar_ptr(n_prefix, prefix, 3);
20920 des_xmlNsPtr(n_ns, ns, 4);
20921 des_const_xmlChar_ptr(n_value, value, 5);
20922 xmlResetLastError();
20923 if (mem_base != xmlMemBlocks()) {
20924 printf("Leak of %d blocks found in xmlValidateOneNamespace",
20925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020926 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020927 printf(" %d", n_ctxt);
20928 printf(" %d", n_doc);
20929 printf(" %d", n_elem);
20930 printf(" %d", n_prefix);
20931 printf(" %d", n_ns);
20932 printf(" %d", n_value);
20933 printf("\n");
20934 }
20935 }
20936 }
20937 }
20938 }
20939 }
20940 }
20941#endif
20942
20943 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020944 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020945}
20946
20947
20948static int
20949test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020950 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020951
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020952#ifdef LIBXML_REGEXP_ENABLED
20953 int mem_base;
20954 int ret_val;
20955 xmlValidCtxtPtr ctxt; /* the validation context */
20956 int n_ctxt;
20957 xmlDocPtr doc; /* a document instance */
20958 int n_doc;
20959 xmlNodePtr elem; /* an element instance */
20960 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020961 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020962 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020963
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020964 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
20965 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20966 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
20967 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
20968 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020969 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
20970 doc = gen_xmlDocPtr(n_doc, 1);
20971 elem = gen_xmlNodePtr(n_elem, 2);
20972 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020973
20974 ret_val = xmlValidatePopElement(ctxt, doc, elem, qname);
20975 desret_int(ret_val);
20976 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020977 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
20978 des_xmlDocPtr(n_doc, doc, 1);
20979 des_xmlNodePtr(n_elem, elem, 2);
20980 des_const_xmlChar_ptr(n_qname, qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020981 xmlResetLastError();
20982 if (mem_base != xmlMemBlocks()) {
20983 printf("Leak of %d blocks found in xmlValidatePopElement",
20984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020985 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000020986 printf(" %d", n_ctxt);
20987 printf(" %d", n_doc);
20988 printf(" %d", n_elem);
20989 printf(" %d", n_qname);
20990 printf("\n");
20991 }
20992 }
20993 }
20994 }
20995 }
20996#endif
20997
Daniel Veillard3d97e662004-11-04 10:49:00 +000020998 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021000}
21001
21002
21003static int
21004test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021006
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021007#ifdef LIBXML_REGEXP_ENABLED
21008 int mem_base;
21009 int ret_val;
21010 xmlValidCtxtPtr ctxt; /* the validation context */
21011 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021012 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021013 int n_data;
21014 int len; /* the lenght of the data */
21015 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021016
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021017 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
21018 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
21019 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21020 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021021 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
21022 data = gen_const_xmlChar_ptr(n_data, 1);
21023 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021024
21025 ret_val = xmlValidatePushCData(ctxt, data, len);
21026 desret_int(ret_val);
21027 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021028 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
21029 des_const_xmlChar_ptr(n_data, data, 1);
21030 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021031 xmlResetLastError();
21032 if (mem_base != xmlMemBlocks()) {
21033 printf("Leak of %d blocks found in xmlValidatePushCData",
21034 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021035 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021036 printf(" %d", n_ctxt);
21037 printf(" %d", n_data);
21038 printf(" %d", n_len);
21039 printf("\n");
21040 }
21041 }
21042 }
21043 }
21044#endif
21045
Daniel Veillard3d97e662004-11-04 10:49:00 +000021046 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021047 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021048}
21049
21050
21051static int
21052test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021053 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021054
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021055#ifdef LIBXML_REGEXP_ENABLED
21056 int mem_base;
21057 int ret_val;
21058 xmlValidCtxtPtr ctxt; /* the validation context */
21059 int n_ctxt;
21060 xmlDocPtr doc; /* a document instance */
21061 int n_doc;
21062 xmlNodePtr elem; /* an element instance */
21063 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021064 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021065 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021066
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021067 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
21068 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21069 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
21070 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
21071 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021072 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
21073 doc = gen_xmlDocPtr(n_doc, 1);
21074 elem = gen_xmlNodePtr(n_elem, 2);
21075 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021076
21077 ret_val = xmlValidatePushElement(ctxt, doc, elem, qname);
21078 desret_int(ret_val);
21079 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021080 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
21081 des_xmlDocPtr(n_doc, doc, 1);
21082 des_xmlNodePtr(n_elem, elem, 2);
21083 des_const_xmlChar_ptr(n_qname, qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021084 xmlResetLastError();
21085 if (mem_base != xmlMemBlocks()) {
21086 printf("Leak of %d blocks found in xmlValidatePushElement",
21087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021088 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021089 printf(" %d", n_ctxt);
21090 printf(" %d", n_doc);
21091 printf(" %d", n_elem);
21092 printf(" %d", n_qname);
21093 printf("\n");
21094 }
21095 }
21096 }
21097 }
21098 }
21099#endif
21100
Daniel Veillard3d97e662004-11-04 10:49:00 +000021101 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021103}
21104
21105
21106static int
21107test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021109
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021110#ifdef LIBXML_VALID_ENABLED
21111 int mem_base;
21112 int ret_val;
21113 xmlValidCtxtPtr ctxt; /* the validation context */
21114 int n_ctxt;
21115 xmlDocPtr doc; /* a document instance */
21116 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021117
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021118 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
21119 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21120 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021121 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
21122 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021123
21124 ret_val = xmlValidateRoot(ctxt, doc);
21125 desret_int(ret_val);
21126 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021127 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
21128 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021129 xmlResetLastError();
21130 if (mem_base != xmlMemBlocks()) {
21131 printf("Leak of %d blocks found in xmlValidateRoot",
21132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021133 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000021134 printf(" %d", n_ctxt);
21135 printf(" %d", n_doc);
21136 printf("\n");
21137 }
21138 }
21139 }
21140#endif
21141
Daniel Veillard3d97e662004-11-04 10:49:00 +000021142 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021143 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021144}
21145
21146static int
21147test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021149
Daniel Veillard42595322004-11-08 10:52:06 +000021150 printf("Testing valid : 46 of 67 functions ...\n");
21151 test_ret += test_xmlAddAttributeDecl();
21152 test_ret += test_xmlAddElementDecl();
21153 test_ret += test_xmlAddID();
21154 test_ret += test_xmlAddNotationDecl();
21155 test_ret += test_xmlAddRef();
21156 test_ret += test_xmlCopyAttributeTable();
21157 test_ret += test_xmlCopyElementContent();
21158 test_ret += test_xmlCopyElementTable();
21159 test_ret += test_xmlCopyEnumeration();
21160 test_ret += test_xmlCopyNotationTable();
21161 test_ret += test_xmlCreateEnumeration();
21162 test_ret += test_xmlDumpAttributeDecl();
21163 test_ret += test_xmlDumpAttributeTable();
21164 test_ret += test_xmlDumpElementDecl();
21165 test_ret += test_xmlDumpElementTable();
21166 test_ret += test_xmlDumpNotationDecl();
21167 test_ret += test_xmlDumpNotationTable();
21168 test_ret += test_xmlGetDtdAttrDesc();
21169 test_ret += test_xmlGetDtdElementDesc();
21170 test_ret += test_xmlGetDtdNotationDesc();
21171 test_ret += test_xmlGetDtdQAttrDesc();
21172 test_ret += test_xmlGetDtdQElementDesc();
21173 test_ret += test_xmlGetID();
21174 test_ret += test_xmlGetRefs();
21175 test_ret += test_xmlIsID();
21176 test_ret += test_xmlIsMixedElement();
21177 test_ret += test_xmlIsRef();
21178 test_ret += test_xmlNewElementContent();
21179 test_ret += test_xmlNewValidCtxt();
21180 test_ret += test_xmlRemoveID();
21181 test_ret += test_xmlRemoveRef();
21182 test_ret += test_xmlSnprintfElementContent();
21183 test_ret += test_xmlSprintfElementContent();
21184 test_ret += test_xmlValidBuildContentModel();
21185 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
21186 test_ret += test_xmlValidGetPotentialChildren();
21187 test_ret += test_xmlValidGetValidElements();
21188 test_ret += test_xmlValidNormalizeAttributeValue();
21189 test_ret += test_xmlValidateAttributeDecl();
21190 test_ret += test_xmlValidateAttributeValue();
21191 test_ret += test_xmlValidateDocument();
21192 test_ret += test_xmlValidateDocumentFinal();
21193 test_ret += test_xmlValidateDtd();
21194 test_ret += test_xmlValidateDtdFinal();
21195 test_ret += test_xmlValidateElement();
21196 test_ret += test_xmlValidateElementDecl();
21197 test_ret += test_xmlValidateNameValue();
21198 test_ret += test_xmlValidateNamesValue();
21199 test_ret += test_xmlValidateNmtokenValue();
21200 test_ret += test_xmlValidateNmtokensValue();
21201 test_ret += test_xmlValidateNotationDecl();
21202 test_ret += test_xmlValidateNotationUse();
21203 test_ret += test_xmlValidateOneAttribute();
21204 test_ret += test_xmlValidateOneElement();
21205 test_ret += test_xmlValidateOneNamespace();
21206 test_ret += test_xmlValidatePopElement();
21207 test_ret += test_xmlValidatePushCData();
21208 test_ret += test_xmlValidatePushElement();
21209 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000021210
Daniel Veillard42595322004-11-08 10:52:06 +000021211 if (test_ret != 0)
21212 printf("Module valid: %d errors\n", test_ret);
21213 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021214}
21215
21216static int
21217test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021218 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021219
21220
21221 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000021222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021223}
21224
21225
21226static int
21227test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021229
21230#ifdef LIBXML_XINCLUDE_ENABLED
21231 int mem_base;
21232 int ret_val;
21233 xmlDocPtr doc; /* an XML document */
21234 int n_doc;
21235
21236 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21237 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021238 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021239
21240 ret_val = xmlXIncludeProcess(doc);
21241 desret_int(ret_val);
21242 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021243 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021244 xmlResetLastError();
21245 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021246 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021247 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021248 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021249 printf(" %d", n_doc);
21250 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021251 }
21252 }
21253#endif
21254
Daniel Veillard3d97e662004-11-04 10:49:00 +000021255 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021256 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021257}
21258
21259
21260static int
21261test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021262 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021263
21264#ifdef LIBXML_XINCLUDE_ENABLED
21265 int mem_base;
21266 int ret_val;
21267 xmlDocPtr doc; /* an XML document */
21268 int n_doc;
21269 int flags; /* a set of xmlParserOption used for parsing XML includes */
21270 int n_flags;
21271
21272 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21273 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
21274 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021275 doc = gen_xmlDocPtr(n_doc, 0);
21276 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021277
21278 ret_val = xmlXIncludeProcessFlags(doc, flags);
21279 desret_int(ret_val);
21280 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021281 des_xmlDocPtr(n_doc, doc, 0);
21282 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021283 xmlResetLastError();
21284 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021285 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021287 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021288 printf(" %d", n_doc);
21289 printf(" %d", n_flags);
21290 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021291 }
21292 }
21293 }
21294#endif
21295
Daniel Veillard3d97e662004-11-04 10:49:00 +000021296 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021298}
21299
21300
Daniel Veillardce682bc2004-11-05 17:22:25 +000021301#define gen_nb_xmlXIncludeCtxtPtr 1
21302static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
21303 return(NULL);
21304}
21305static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
21306}
21307
Daniel Veillardd93f6252004-11-02 15:53:51 +000021308static int
21309test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021310 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021311
Daniel Veillardce682bc2004-11-05 17:22:25 +000021312#ifdef LIBXML_XINCLUDE_ENABLED
21313 int mem_base;
21314 int ret_val;
21315 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
21316 int n_ctxt;
21317 xmlNodePtr node; /* a node in an XML document */
21318 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021319
Daniel Veillardce682bc2004-11-05 17:22:25 +000021320 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
21321 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21322 mem_base = xmlMemBlocks();
21323 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
21324 node = gen_xmlNodePtr(n_node, 1);
21325
21326 ret_val = xmlXIncludeProcessNode(ctxt, node);
21327 desret_int(ret_val);
21328 call_tests++;
21329 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
21330 des_xmlNodePtr(n_node, node, 1);
21331 xmlResetLastError();
21332 if (mem_base != xmlMemBlocks()) {
21333 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
21334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021335 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021336 printf(" %d", n_ctxt);
21337 printf(" %d", n_node);
21338 printf("\n");
21339 }
21340 }
21341 }
21342#endif
21343
21344 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021346}
21347
21348
21349static int
21350test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021351 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021352
21353#ifdef LIBXML_XINCLUDE_ENABLED
21354 int mem_base;
21355 int ret_val;
21356 xmlNodePtr tree; /* a node in an XML document */
21357 int n_tree;
21358
21359 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21360 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021361 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021362
21363 ret_val = xmlXIncludeProcessTree(tree);
21364 desret_int(ret_val);
21365 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021366 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021367 xmlResetLastError();
21368 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021369 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021370 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021371 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021372 printf(" %d", n_tree);
21373 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021374 }
21375 }
21376#endif
21377
Daniel Veillard3d97e662004-11-04 10:49:00 +000021378 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021379 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021380}
21381
21382
21383static int
21384test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021385 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021386
21387#ifdef LIBXML_XINCLUDE_ENABLED
21388 int mem_base;
21389 int ret_val;
21390 xmlNodePtr tree; /* a node in an XML document */
21391 int n_tree;
21392 int flags; /* a set of xmlParserOption used for parsing XML includes */
21393 int n_flags;
21394
21395 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21396 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
21397 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021398 tree = gen_xmlNodePtr(n_tree, 0);
21399 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021400
21401 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
21402 desret_int(ret_val);
21403 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021404 des_xmlNodePtr(n_tree, tree, 0);
21405 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021406 xmlResetLastError();
21407 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021408 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021410 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021411 printf(" %d", n_tree);
21412 printf(" %d", n_flags);
21413 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021414 }
21415 }
21416 }
21417#endif
21418
Daniel Veillard3d97e662004-11-04 10:49:00 +000021419 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021420 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021421}
21422
21423
21424static int
21425test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021426 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021427
Daniel Veillardce682bc2004-11-05 17:22:25 +000021428#ifdef LIBXML_XINCLUDE_ENABLED
21429 int mem_base;
21430 int ret_val;
21431 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
21432 int n_ctxt;
21433 int flags; /* a set of xmlParserOption used for parsing XML includes */
21434 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021435
Daniel Veillardce682bc2004-11-05 17:22:25 +000021436 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
21437 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
21438 mem_base = xmlMemBlocks();
21439 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
21440 flags = gen_int(n_flags, 1);
21441
21442 ret_val = xmlXIncludeSetFlags(ctxt, flags);
21443 desret_int(ret_val);
21444 call_tests++;
21445 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
21446 des_int(n_flags, flags, 1);
21447 xmlResetLastError();
21448 if (mem_base != xmlMemBlocks()) {
21449 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
21450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021451 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021452 printf(" %d", n_ctxt);
21453 printf(" %d", n_flags);
21454 printf("\n");
21455 }
21456 }
21457 }
21458#endif
21459
21460 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021461 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021462}
21463
21464static int
21465test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021467
Daniel Veillardce682bc2004-11-05 17:22:25 +000021468 printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000021469 test_ret += test_xmlXIncludeNewContext();
21470 test_ret += test_xmlXIncludeProcess();
21471 test_ret += test_xmlXIncludeProcessFlags();
21472 test_ret += test_xmlXIncludeProcessNode();
21473 test_ret += test_xmlXIncludeProcessTree();
21474 test_ret += test_xmlXIncludeProcessTreeFlags();
21475 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000021476
Daniel Veillard42595322004-11-08 10:52:06 +000021477 if (test_ret != 0)
21478 printf("Module xinclude: %d errors\n", test_ret);
21479 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021480}
21481
21482static int
21483test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021484 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021485
Daniel Veillard3d95c732004-11-06 22:25:14 +000021486#ifdef LIBXML_OUTPUT_ENABLED
21487 int mem_base;
21488 xmlOutputBufferPtr ret_val;
21489 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
21490 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021491
Daniel Veillard3d95c732004-11-06 22:25:14 +000021492 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
21493 mem_base = xmlMemBlocks();
21494 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
21495
21496 ret_val = xmlAllocOutputBuffer(encoder);
21497 desret_xmlOutputBufferPtr(ret_val);
21498 call_tests++;
21499 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
21500 xmlResetLastError();
21501 if (mem_base != xmlMemBlocks()) {
21502 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
21503 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021504 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000021505 printf(" %d", n_encoder);
21506 printf("\n");
21507 }
21508 }
21509#endif
21510
21511 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021513}
21514
21515
21516static int
21517test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021519
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000021520 int mem_base;
21521 xmlParserInputBufferPtr ret_val;
21522 xmlCharEncoding enc; /* the charset encoding if known */
21523 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021524
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000021525 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
21526 mem_base = xmlMemBlocks();
21527 enc = gen_xmlCharEncoding(n_enc, 0);
21528
21529 ret_val = xmlAllocParserInputBuffer(enc);
21530 desret_xmlParserInputBufferPtr(ret_val);
21531 call_tests++;
21532 des_xmlCharEncoding(n_enc, enc, 0);
21533 xmlResetLastError();
21534 if (mem_base != xmlMemBlocks()) {
21535 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
21536 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021537 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000021538 printf(" %d", n_enc);
21539 printf("\n");
21540 }
21541 }
21542
21543 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021545}
21546
21547
21548static int
21549test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021551
21552 int mem_base;
21553 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021554 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021555 int n_path;
21556
21557 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
21558 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021559 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021560
21561 ret_val = xmlCheckFilename(path);
21562 desret_int(ret_val);
21563 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021564 des_const_char_ptr(n_path, path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021565 xmlResetLastError();
21566 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021567 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021568 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021569 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021570 printf(" %d", n_path);
21571 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021572 }
21573 }
21574
Daniel Veillard3d97e662004-11-04 10:49:00 +000021575 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021576 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021577}
21578
21579
21580static int
21581test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021583
Daniel Veillard42595322004-11-08 10:52:06 +000021584 int mem_base;
21585 xmlParserInputPtr ret_val;
21586 xmlParserCtxtPtr ctxt; /* an XML parser context */
21587 int n_ctxt;
21588 xmlParserInputPtr ret; /* an XML parser input */
21589 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021590
Daniel Veillard42595322004-11-08 10:52:06 +000021591 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
21592 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
21593 mem_base = xmlMemBlocks();
21594 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
21595 ret = gen_xmlParserInputPtr(n_ret, 1);
21596
21597 ret_val = xmlCheckHTTPInput(ctxt, ret);
21598 desret_xmlParserInputPtr(ret_val);
21599 call_tests++;
21600 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
21601 des_xmlParserInputPtr(n_ret, ret, 1);
21602 xmlResetLastError();
21603 if (mem_base != xmlMemBlocks()) {
21604 printf("Leak of %d blocks found in xmlCheckHTTPInput",
21605 xmlMemBlocks() - mem_base);
21606 test_ret++;
21607 printf(" %d", n_ctxt);
21608 printf(" %d", n_ret);
21609 printf("\n");
21610 }
21611 }
21612 }
21613
21614 function_tests++;
21615 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021616}
21617
21618
21619static int
21620test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021621 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021622
21623 int mem_base;
21624
21625 mem_base = xmlMemBlocks();
21626
21627 xmlCleanupInputCallbacks();
21628 call_tests++;
21629 xmlResetLastError();
21630 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021631 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021633 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021634 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021635 }
21636
Daniel Veillard3d97e662004-11-04 10:49:00 +000021637 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021638 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021639}
21640
21641
21642static int
21643test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021644 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021645
21646#ifdef LIBXML_OUTPUT_ENABLED
21647 int mem_base;
21648
21649 mem_base = xmlMemBlocks();
21650
21651 xmlCleanupOutputCallbacks();
21652 call_tests++;
21653 xmlResetLastError();
21654 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021655 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021656 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021657 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021658 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021659 }
21660#endif
21661
Daniel Veillard3d97e662004-11-04 10:49:00 +000021662 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021664}
21665
21666
21667static int
21668test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021670
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021671 int mem_base;
21672 int ret_val;
21673 void * context; /* the I/O context */
21674 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021675
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021676 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
21677 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021678 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021679
21680 ret_val = xmlFileClose(context);
21681 desret_int(ret_val);
21682 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021683 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021684 xmlResetLastError();
21685 if (mem_base != xmlMemBlocks()) {
21686 printf("Leak of %d blocks found in xmlFileClose",
21687 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021688 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021689 printf(" %d", n_context);
21690 printf("\n");
21691 }
21692 }
21693
Daniel Veillard3d97e662004-11-04 10:49:00 +000021694 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021696}
21697
21698
21699static int
21700test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021701 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021702
21703 int mem_base;
21704 int ret_val;
21705 const char * filename; /* the URI for matching */
21706 int n_filename;
21707
21708 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
21709 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021710 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021711
21712 ret_val = xmlFileMatch(filename);
21713 desret_int(ret_val);
21714 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021715 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021716 xmlResetLastError();
21717 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021718 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021719 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021720 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021721 printf(" %d", n_filename);
21722 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021723 }
21724 }
21725
Daniel Veillard3d97e662004-11-04 10:49:00 +000021726 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021728}
21729
21730
21731static int
21732test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021734
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021735 int mem_base;
21736 void * ret_val;
21737 const char * filename; /* the URI for matching */
21738 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021739
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021740 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
21741 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021742 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021743
21744 ret_val = xmlFileOpen(filename);
21745 desret_void_ptr(ret_val);
21746 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021747 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021748 xmlResetLastError();
21749 if (mem_base != xmlMemBlocks()) {
21750 printf("Leak of %d blocks found in xmlFileOpen",
21751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021752 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021753 printf(" %d", n_filename);
21754 printf("\n");
21755 }
21756 }
21757
Daniel Veillard3d97e662004-11-04 10:49:00 +000021758 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021759 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021760}
21761
21762
21763static int
21764test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021765 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021766
Daniel Veillardce682bc2004-11-05 17:22:25 +000021767 int mem_base;
21768 int ret_val;
21769 void * context; /* the I/O context */
21770 int n_context;
21771 char * buffer; /* where to drop data */
21772 int n_buffer;
21773 int len; /* number of bytes to write */
21774 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021775
Daniel Veillardce682bc2004-11-05 17:22:25 +000021776 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
21777 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
21778 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21779 mem_base = xmlMemBlocks();
21780 context = gen_void_ptr(n_context, 0);
21781 buffer = gen_char_ptr(n_buffer, 1);
21782 len = gen_int(n_len, 2);
21783
21784 ret_val = xmlFileRead(context, buffer, len);
21785 desret_int(ret_val);
21786 call_tests++;
21787 des_void_ptr(n_context, context, 0);
21788 des_char_ptr(n_buffer, buffer, 1);
21789 des_int(n_len, len, 2);
21790 xmlResetLastError();
21791 if (mem_base != xmlMemBlocks()) {
21792 printf("Leak of %d blocks found in xmlFileRead",
21793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021794 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021795 printf(" %d", n_context);
21796 printf(" %d", n_buffer);
21797 printf(" %d", n_len);
21798 printf("\n");
21799 }
21800 }
21801 }
21802 }
21803
21804 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021806}
21807
21808
21809static int
21810test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021811 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021812
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021813#ifdef LIBXML_FTP_ENABLED
21814 int mem_base;
21815 int ret_val;
21816 void * context; /* the I/O context */
21817 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021818
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021819 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
21820 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021821 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021822
21823 ret_val = xmlIOFTPClose(context);
21824 desret_int(ret_val);
21825 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021826 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021827 xmlResetLastError();
21828 if (mem_base != xmlMemBlocks()) {
21829 printf("Leak of %d blocks found in xmlIOFTPClose",
21830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021831 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021832 printf(" %d", n_context);
21833 printf("\n");
21834 }
21835 }
21836#endif
21837
Daniel Veillard3d97e662004-11-04 10:49:00 +000021838 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021840}
21841
21842
21843static int
21844test_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021846
21847#ifdef LIBXML_FTP_ENABLED
21848 int mem_base;
21849 int ret_val;
21850 const char * filename; /* the URI for matching */
21851 int n_filename;
21852
21853 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
21854 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021855 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021856
21857 ret_val = xmlIOFTPMatch(filename);
21858 desret_int(ret_val);
21859 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021860 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021861 xmlResetLastError();
21862 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021863 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021864 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021865 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021866 printf(" %d", n_filename);
21867 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021868 }
21869 }
21870#endif
21871
Daniel Veillard3d97e662004-11-04 10:49:00 +000021872 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021873 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021874}
21875
21876
21877static int
21878test_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021879 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021880
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021881#ifdef LIBXML_FTP_ENABLED
21882 int mem_base;
21883 void * ret_val;
21884 const char * filename; /* the URI for matching */
21885 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021886
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021887 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
21888 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021889 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021890
21891 ret_val = xmlIOFTPOpen(filename);
21892 desret_void_ptr(ret_val);
21893 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021894 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021895 xmlResetLastError();
21896 if (mem_base != xmlMemBlocks()) {
21897 printf("Leak of %d blocks found in xmlIOFTPOpen",
21898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021899 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021900 printf(" %d", n_filename);
21901 printf("\n");
21902 }
21903 }
21904#endif
21905
Daniel Veillard3d97e662004-11-04 10:49:00 +000021906 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021907 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021908}
21909
21910
21911static int
21912test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021913 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021914
Daniel Veillardce682bc2004-11-05 17:22:25 +000021915#ifdef LIBXML_FTP_ENABLED
21916 int mem_base;
21917 int ret_val;
21918 void * context; /* the I/O context */
21919 int n_context;
21920 char * buffer; /* where to drop data */
21921 int n_buffer;
21922 int len; /* number of bytes to write */
21923 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021924
Daniel Veillardce682bc2004-11-05 17:22:25 +000021925 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
21926 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
21927 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21928 mem_base = xmlMemBlocks();
21929 context = gen_void_ptr(n_context, 0);
21930 buffer = gen_char_ptr(n_buffer, 1);
21931 len = gen_int(n_len, 2);
21932
21933 ret_val = xmlIOFTPRead(context, buffer, len);
21934 desret_int(ret_val);
21935 call_tests++;
21936 des_void_ptr(n_context, context, 0);
21937 des_char_ptr(n_buffer, buffer, 1);
21938 des_int(n_len, len, 2);
21939 xmlResetLastError();
21940 if (mem_base != xmlMemBlocks()) {
21941 printf("Leak of %d blocks found in xmlIOFTPRead",
21942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021943 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021944 printf(" %d", n_context);
21945 printf(" %d", n_buffer);
21946 printf(" %d", n_len);
21947 printf("\n");
21948 }
21949 }
21950 }
21951 }
21952#endif
21953
21954 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021956}
21957
21958
21959static int
21960test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021961 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021962
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021963#ifdef LIBXML_HTTP_ENABLED
21964 int mem_base;
21965 int ret_val;
21966 void * context; /* the I/O context */
21967 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021968
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021969 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
21970 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021971 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021972
21973 ret_val = xmlIOHTTPClose(context);
21974 desret_int(ret_val);
21975 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021976 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021977 xmlResetLastError();
21978 if (mem_base != xmlMemBlocks()) {
21979 printf("Leak of %d blocks found in xmlIOHTTPClose",
21980 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021981 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000021982 printf(" %d", n_context);
21983 printf("\n");
21984 }
21985 }
21986#endif
21987
Daniel Veillard3d97e662004-11-04 10:49:00 +000021988 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021989 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021990}
21991
21992
21993static int
21994test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021995 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021996
21997#ifdef LIBXML_HTTP_ENABLED
21998 int mem_base;
21999 int ret_val;
22000 const char * filename; /* the URI for matching */
22001 int n_filename;
22002
22003 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
22004 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022005 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022006
22007 ret_val = xmlIOHTTPMatch(filename);
22008 desret_int(ret_val);
22009 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022010 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022011 xmlResetLastError();
22012 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022013 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022015 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022016 printf(" %d", n_filename);
22017 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022018 }
22019 }
22020#endif
22021
Daniel Veillard3d97e662004-11-04 10:49:00 +000022022 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022023 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022024}
22025
22026
22027static int
22028test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022029 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022030
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000022031#ifdef LIBXML_HTTP_ENABLED
22032 int mem_base;
22033 void * ret_val;
22034 const char * filename; /* the URI for matching */
22035 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022036
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000022037 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
22038 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022039 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000022040
22041 ret_val = xmlIOHTTPOpen(filename);
22042 desret_void_ptr(ret_val);
22043 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022044 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000022045 xmlResetLastError();
22046 if (mem_base != xmlMemBlocks()) {
22047 printf("Leak of %d blocks found in xmlIOHTTPOpen",
22048 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022049 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000022050 printf(" %d", n_filename);
22051 printf("\n");
22052 }
22053 }
22054#endif
22055
Daniel Veillard3d97e662004-11-04 10:49:00 +000022056 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022057 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022058}
22059
22060
22061static int
22062test_xmlIOHTTPOpenW(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022064
22065
22066 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000022067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022068}
22069
22070
22071static int
22072test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022074
Daniel Veillardce682bc2004-11-05 17:22:25 +000022075#ifdef LIBXML_HTTP_ENABLED
22076 int mem_base;
22077 int ret_val;
22078 void * context; /* the I/O context */
22079 int n_context;
22080 char * buffer; /* where to drop data */
22081 int n_buffer;
22082 int len; /* number of bytes to write */
22083 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022084
Daniel Veillardce682bc2004-11-05 17:22:25 +000022085 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
22086 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
22087 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22088 mem_base = xmlMemBlocks();
22089 context = gen_void_ptr(n_context, 0);
22090 buffer = gen_char_ptr(n_buffer, 1);
22091 len = gen_int(n_len, 2);
22092
22093 ret_val = xmlIOHTTPRead(context, buffer, len);
22094 desret_int(ret_val);
22095 call_tests++;
22096 des_void_ptr(n_context, context, 0);
22097 des_char_ptr(n_buffer, buffer, 1);
22098 des_int(n_len, len, 2);
22099 xmlResetLastError();
22100 if (mem_base != xmlMemBlocks()) {
22101 printf("Leak of %d blocks found in xmlIOHTTPRead",
22102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022103 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022104 printf(" %d", n_context);
22105 printf(" %d", n_buffer);
22106 printf(" %d", n_len);
22107 printf("\n");
22108 }
22109 }
22110 }
22111 }
22112#endif
22113
22114 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022116}
22117
22118
22119static int
22120test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022122
Daniel Veillard42595322004-11-08 10:52:06 +000022123 int mem_base;
22124 xmlParserInputPtr ret_val;
22125 const char * URL; /* the URL for the entity to load */
22126 int n_URL;
22127 char * ID; /* the System ID for the entity to load */
22128 int n_ID;
22129 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
22130 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022131
Daniel Veillard42595322004-11-08 10:52:06 +000022132 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
22133 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
22134 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
22135 mem_base = xmlMemBlocks();
22136 URL = gen_filepath(n_URL, 0);
22137 ID = gen_const_char_ptr(n_ID, 1);
22138 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
22139
22140 ret_val = xmlNoNetExternalEntityLoader(URL, ID, ctxt);
22141 desret_xmlParserInputPtr(ret_val);
22142 call_tests++;
22143 des_filepath(n_URL, URL, 0);
22144 des_const_char_ptr(n_ID, ID, 1);
22145 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
22146 xmlResetLastError();
22147 if (mem_base != xmlMemBlocks()) {
22148 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
22149 xmlMemBlocks() - mem_base);
22150 test_ret++;
22151 printf(" %d", n_URL);
22152 printf(" %d", n_ID);
22153 printf(" %d", n_ctxt);
22154 printf("\n");
22155 }
22156 }
22157 }
22158 }
22159
22160 function_tests++;
22161 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022162}
22163
22164
22165static int
22166test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022167 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022168
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022169 int mem_base;
22170 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022171 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022172 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022173
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022174 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
22175 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022176 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022177
22178 ret_val = xmlNormalizeWindowsPath(path);
22179 desret_xmlChar_ptr(ret_val);
22180 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022181 des_const_xmlChar_ptr(n_path, path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022182 xmlResetLastError();
22183 if (mem_base != xmlMemBlocks()) {
22184 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
22185 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022186 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022187 printf(" %d", n_path);
22188 printf("\n");
22189 }
22190 }
22191
Daniel Veillard3d97e662004-11-04 10:49:00 +000022192 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022194}
22195
22196
22197static int
22198test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022200
Daniel Veillard3d95c732004-11-06 22:25:14 +000022201#ifdef LIBXML_OUTPUT_ENABLED
22202 int mem_base;
22203 xmlOutputBufferPtr ret_val;
22204 int fd; /* a file descriptor number */
22205 int n_fd;
22206 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
22207 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022208
Daniel Veillard3d95c732004-11-06 22:25:14 +000022209 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
22210 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
22211 mem_base = xmlMemBlocks();
22212 fd = gen_int(n_fd, 0);
22213 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
22214
22215 ret_val = xmlOutputBufferCreateFd(fd, encoder);
22216 desret_xmlOutputBufferPtr(ret_val);
22217 call_tests++;
22218 des_int(n_fd, fd, 0);
22219 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
22220 xmlResetLastError();
22221 if (mem_base != xmlMemBlocks()) {
22222 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
22223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022224 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000022225 printf(" %d", n_fd);
22226 printf(" %d", n_encoder);
22227 printf("\n");
22228 }
22229 }
22230 }
22231#endif
22232
22233 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022235}
22236
22237
22238static int
22239test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022240 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022241
Daniel Veillard3d95c732004-11-06 22:25:14 +000022242#ifdef LIBXML_OUTPUT_ENABLED
22243 int mem_base;
22244 xmlOutputBufferPtr ret_val;
22245 FILE * file; /* a FILE* */
22246 int n_file;
22247 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
22248 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022249
Daniel Veillard3d95c732004-11-06 22:25:14 +000022250 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
22251 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
22252 mem_base = xmlMemBlocks();
22253 file = gen_FILE_ptr(n_file, 0);
22254 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
22255
22256 ret_val = xmlOutputBufferCreateFile(file, encoder);
22257 desret_xmlOutputBufferPtr(ret_val);
22258 call_tests++;
22259 des_FILE_ptr(n_file, file, 0);
22260 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
22261 xmlResetLastError();
22262 if (mem_base != xmlMemBlocks()) {
22263 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
22264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022265 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000022266 printf(" %d", n_file);
22267 printf(" %d", n_encoder);
22268 printf("\n");
22269 }
22270 }
22271 }
22272#endif
22273
22274 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022276}
22277
22278
22279static int
22280test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022282
Daniel Veillard3d95c732004-11-06 22:25:14 +000022283#ifdef LIBXML_OUTPUT_ENABLED
22284 int mem_base;
22285 xmlOutputBufferPtr ret_val;
22286 const char * URI; /* a C string containing the URI or filename */
22287 int n_URI;
22288 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
22289 int n_encoder;
22290 int compression; /* the compression ration (0 none, 9 max). */
22291 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022292
Daniel Veillard42595322004-11-08 10:52:06 +000022293 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000022294 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
22295 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
22296 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000022297 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000022298 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
22299 compression = gen_int(n_compression, 2);
22300
22301 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
22302 desret_xmlOutputBufferPtr(ret_val);
22303 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022304 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000022305 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
22306 des_int(n_compression, compression, 2);
22307 xmlResetLastError();
22308 if (mem_base != xmlMemBlocks()) {
22309 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
22310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022311 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000022312 printf(" %d", n_URI);
22313 printf(" %d", n_encoder);
22314 printf(" %d", n_compression);
22315 printf("\n");
22316 }
22317 }
22318 }
22319 }
22320#endif
22321
22322 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022324}
22325
22326
22327static int
22328test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022330
Daniel Veillard3d97e662004-11-04 10:49:00 +000022331#ifdef LIBXML_OUTPUT_ENABLED
22332 int mem_base;
22333 int ret_val;
22334 xmlOutputBufferPtr out; /* a buffered output */
22335 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022336
Daniel Veillard3d97e662004-11-04 10:49:00 +000022337 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
22338 mem_base = xmlMemBlocks();
22339 out = gen_xmlOutputBufferPtr(n_out, 0);
22340
22341 ret_val = xmlOutputBufferFlush(out);
22342 desret_int(ret_val);
22343 call_tests++;
22344 des_xmlOutputBufferPtr(n_out, out, 0);
22345 xmlResetLastError();
22346 if (mem_base != xmlMemBlocks()) {
22347 printf("Leak of %d blocks found in xmlOutputBufferFlush",
22348 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022349 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022350 printf(" %d", n_out);
22351 printf("\n");
22352 }
22353 }
22354#endif
22355
22356 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022358}
22359
22360
22361static int
22362test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022364
Daniel Veillard3d97e662004-11-04 10:49:00 +000022365#ifdef LIBXML_OUTPUT_ENABLED
22366 int mem_base;
22367 int ret_val;
22368 xmlOutputBufferPtr out; /* a buffered parser output */
22369 int n_out;
22370 int len; /* the size in bytes of the array. */
22371 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022372 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022373 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022374
Daniel Veillard3d97e662004-11-04 10:49:00 +000022375 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
22376 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22377 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
22378 mem_base = xmlMemBlocks();
22379 out = gen_xmlOutputBufferPtr(n_out, 0);
22380 len = gen_int(n_len, 1);
22381 buf = gen_const_char_ptr(n_buf, 2);
22382
22383 ret_val = xmlOutputBufferWrite(out, len, buf);
22384 desret_int(ret_val);
22385 call_tests++;
22386 des_xmlOutputBufferPtr(n_out, out, 0);
22387 des_int(n_len, len, 1);
22388 des_const_char_ptr(n_buf, buf, 2);
22389 xmlResetLastError();
22390 if (mem_base != xmlMemBlocks()) {
22391 printf("Leak of %d blocks found in xmlOutputBufferWrite",
22392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022393 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022394 printf(" %d", n_out);
22395 printf(" %d", n_len);
22396 printf(" %d", n_buf);
22397 printf("\n");
22398 }
22399 }
22400 }
22401 }
22402#endif
22403
22404 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022406}
22407
22408
22409static int
22410test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022412
22413
22414 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000022415 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022416}
22417
22418
22419static int
22420test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022421 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022422
Daniel Veillard3d97e662004-11-04 10:49:00 +000022423#ifdef LIBXML_OUTPUT_ENABLED
22424 int mem_base;
22425 int ret_val;
22426 xmlOutputBufferPtr out; /* a buffered parser output */
22427 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022428 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022429 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022430
Daniel Veillard3d97e662004-11-04 10:49:00 +000022431 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
22432 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
22433 mem_base = xmlMemBlocks();
22434 out = gen_xmlOutputBufferPtr(n_out, 0);
22435 str = gen_const_char_ptr(n_str, 1);
22436
22437 ret_val = xmlOutputBufferWriteString(out, str);
22438 desret_int(ret_val);
22439 call_tests++;
22440 des_xmlOutputBufferPtr(n_out, out, 0);
22441 des_const_char_ptr(n_str, str, 1);
22442 xmlResetLastError();
22443 if (mem_base != xmlMemBlocks()) {
22444 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
22445 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022446 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022447 printf(" %d", n_out);
22448 printf(" %d", n_str);
22449 printf("\n");
22450 }
22451 }
22452 }
22453#endif
22454
22455 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022457}
22458
22459
22460static int
22461test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022463
22464
22465 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000022466 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022467}
22468
22469
22470static int
22471test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022472 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022473
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022474 int mem_base;
22475 xmlParserInputBufferPtr ret_val;
22476 int fd; /* a file descriptor number */
22477 int n_fd;
22478 xmlCharEncoding enc; /* the charset encoding if known */
22479 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022480
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022481 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
22482 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
22483 mem_base = xmlMemBlocks();
22484 fd = gen_int(n_fd, 0);
22485 enc = gen_xmlCharEncoding(n_enc, 1);
22486 if (fd >= 0) fd = -1;
22487
22488 ret_val = xmlParserInputBufferCreateFd(fd, enc);
22489 desret_xmlParserInputBufferPtr(ret_val);
22490 call_tests++;
22491 des_int(n_fd, fd, 0);
22492 des_xmlCharEncoding(n_enc, enc, 1);
22493 xmlResetLastError();
22494 if (mem_base != xmlMemBlocks()) {
22495 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
22496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022497 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022498 printf(" %d", n_fd);
22499 printf(" %d", n_enc);
22500 printf("\n");
22501 }
22502 }
22503 }
22504
22505 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022507}
22508
22509
22510static int
22511test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022513
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022514 int mem_base;
22515 xmlParserInputBufferPtr ret_val;
22516 FILE * file; /* a FILE* */
22517 int n_file;
22518 xmlCharEncoding enc; /* the charset encoding if known */
22519 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022520
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022521 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
22522 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
22523 mem_base = xmlMemBlocks();
22524 file = gen_FILE_ptr(n_file, 0);
22525 enc = gen_xmlCharEncoding(n_enc, 1);
22526
22527 ret_val = xmlParserInputBufferCreateFile(file, enc);
22528 desret_xmlParserInputBufferPtr(ret_val);
22529 call_tests++;
22530 des_FILE_ptr(n_file, file, 0);
22531 des_xmlCharEncoding(n_enc, enc, 1);
22532 xmlResetLastError();
22533 if (mem_base != xmlMemBlocks()) {
22534 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
22535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022536 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022537 printf(" %d", n_file);
22538 printf(" %d", n_enc);
22539 printf("\n");
22540 }
22541 }
22542 }
22543
22544 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022545 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022546}
22547
22548
22549static int
22550test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022551 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022552
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022553 int mem_base;
22554 xmlParserInputBufferPtr ret_val;
22555 const char * URI; /* a C string containing the URI or filename */
22556 int n_URI;
22557 xmlCharEncoding enc; /* the charset encoding if known */
22558 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022559
Daniel Veillard42595322004-11-08 10:52:06 +000022560 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022561 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
22562 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000022563 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022564 enc = gen_xmlCharEncoding(n_enc, 1);
22565
22566 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
22567 desret_xmlParserInputBufferPtr(ret_val);
22568 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022569 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022570 des_xmlCharEncoding(n_enc, enc, 1);
22571 xmlResetLastError();
22572 if (mem_base != xmlMemBlocks()) {
22573 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
22574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022575 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022576 printf(" %d", n_URI);
22577 printf(" %d", n_enc);
22578 printf("\n");
22579 }
22580 }
22581 }
22582
22583 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022584 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022585}
22586
22587
22588static int
22589test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022591
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022592 int mem_base;
22593 xmlParserInputBufferPtr ret_val;
22594 char * mem; /* the memory input */
22595 int n_mem;
22596 int size; /* the length of the memory block */
22597 int n_size;
22598 xmlCharEncoding enc; /* the charset encoding if known */
22599 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022600
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022601 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
22602 for (n_size = 0;n_size < gen_nb_int;n_size++) {
22603 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
22604 mem_base = xmlMemBlocks();
22605 mem = gen_const_char_ptr(n_mem, 0);
22606 size = gen_int(n_size, 1);
22607 enc = gen_xmlCharEncoding(n_enc, 2);
22608
22609 ret_val = xmlParserInputBufferCreateMem(mem, size, enc);
22610 desret_xmlParserInputBufferPtr(ret_val);
22611 call_tests++;
22612 des_const_char_ptr(n_mem, mem, 0);
22613 des_int(n_size, size, 1);
22614 des_xmlCharEncoding(n_enc, enc, 2);
22615 xmlResetLastError();
22616 if (mem_base != xmlMemBlocks()) {
22617 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
22618 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022619 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022620 printf(" %d", n_mem);
22621 printf(" %d", n_size);
22622 printf(" %d", n_enc);
22623 printf("\n");
22624 }
22625 }
22626 }
22627 }
22628
22629 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022631}
22632
22633
22634static int
22635test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022637
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022638 int mem_base;
22639 xmlParserInputBufferPtr ret_val;
22640 char * mem; /* the memory input */
22641 int n_mem;
22642 int size; /* the length of the memory block */
22643 int n_size;
22644 xmlCharEncoding enc; /* the charset encoding if known */
22645 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022646
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022647 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
22648 for (n_size = 0;n_size < gen_nb_int;n_size++) {
22649 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
22650 mem_base = xmlMemBlocks();
22651 mem = gen_const_char_ptr(n_mem, 0);
22652 size = gen_int(n_size, 1);
22653 enc = gen_xmlCharEncoding(n_enc, 2);
22654
22655 ret_val = xmlParserInputBufferCreateStatic(mem, size, enc);
22656 desret_xmlParserInputBufferPtr(ret_val);
22657 call_tests++;
22658 des_const_char_ptr(n_mem, mem, 0);
22659 des_int(n_size, size, 1);
22660 des_xmlCharEncoding(n_enc, enc, 2);
22661 xmlResetLastError();
22662 if (mem_base != xmlMemBlocks()) {
22663 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
22664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022665 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022666 printf(" %d", n_mem);
22667 printf(" %d", n_size);
22668 printf(" %d", n_enc);
22669 printf("\n");
22670 }
22671 }
22672 }
22673 }
22674
22675 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022677}
22678
22679
22680static int
22681test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022683
Daniel Veillard34099b42004-11-04 17:34:35 +000022684 int mem_base;
22685 int ret_val;
22686 xmlParserInputBufferPtr in; /* a buffered parser input */
22687 int n_in;
22688 int len; /* indicative value of the amount of chars to read */
22689 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022690
Daniel Veillard34099b42004-11-04 17:34:35 +000022691 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
22692 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22693 mem_base = xmlMemBlocks();
22694 in = gen_xmlParserInputBufferPtr(n_in, 0);
22695 len = gen_int(n_len, 1);
22696
22697 ret_val = xmlParserInputBufferGrow(in, len);
22698 desret_int(ret_val);
22699 call_tests++;
22700 des_xmlParserInputBufferPtr(n_in, in, 0);
22701 des_int(n_len, len, 1);
22702 xmlResetLastError();
22703 if (mem_base != xmlMemBlocks()) {
22704 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
22705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022706 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000022707 printf(" %d", n_in);
22708 printf(" %d", n_len);
22709 printf("\n");
22710 }
22711 }
22712 }
22713
22714 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022715 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022716}
22717
22718
22719static int
22720test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022721 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022722
Daniel Veillard34099b42004-11-04 17:34:35 +000022723 int mem_base;
22724 int ret_val;
22725 xmlParserInputBufferPtr in; /* a buffered parser input */
22726 int n_in;
22727 int len; /* the size in bytes of the array. */
22728 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022729 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000022730 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022731
Daniel Veillard34099b42004-11-04 17:34:35 +000022732 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
22733 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22734 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
22735 mem_base = xmlMemBlocks();
22736 in = gen_xmlParserInputBufferPtr(n_in, 0);
22737 len = gen_int(n_len, 1);
22738 buf = gen_const_char_ptr(n_buf, 2);
22739
22740 ret_val = xmlParserInputBufferPush(in, len, buf);
22741 desret_int(ret_val);
22742 call_tests++;
22743 des_xmlParserInputBufferPtr(n_in, in, 0);
22744 des_int(n_len, len, 1);
22745 des_const_char_ptr(n_buf, buf, 2);
22746 xmlResetLastError();
22747 if (mem_base != xmlMemBlocks()) {
22748 printf("Leak of %d blocks found in xmlParserInputBufferPush",
22749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022750 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000022751 printf(" %d", n_in);
22752 printf(" %d", n_len);
22753 printf(" %d", n_buf);
22754 printf("\n");
22755 }
22756 }
22757 }
22758 }
22759
22760 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022761 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022762}
22763
22764
22765static int
22766test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022767 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022768
Daniel Veillard34099b42004-11-04 17:34:35 +000022769 int mem_base;
22770 int ret_val;
22771 xmlParserInputBufferPtr in; /* a buffered parser input */
22772 int n_in;
22773 int len; /* indicative value of the amount of chars to read */
22774 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022775
Daniel Veillard34099b42004-11-04 17:34:35 +000022776 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
22777 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22778 mem_base = xmlMemBlocks();
22779 in = gen_xmlParserInputBufferPtr(n_in, 0);
22780 len = gen_int(n_len, 1);
22781
22782 ret_val = xmlParserInputBufferRead(in, len);
22783 desret_int(ret_val);
22784 call_tests++;
22785 des_xmlParserInputBufferPtr(n_in, in, 0);
22786 des_int(n_len, len, 1);
22787 xmlResetLastError();
22788 if (mem_base != xmlMemBlocks()) {
22789 printf("Leak of %d blocks found in xmlParserInputBufferRead",
22790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022791 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000022792 printf(" %d", n_in);
22793 printf(" %d", n_len);
22794 printf("\n");
22795 }
22796 }
22797 }
22798
22799 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022801}
22802
22803
22804static int
22805test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022807
22808 int mem_base;
22809 int ret_val;
22810
22811 mem_base = xmlMemBlocks();
22812
22813 ret_val = xmlPopInputCallbacks();
22814 desret_int(ret_val);
22815 call_tests++;
22816 xmlResetLastError();
22817 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022818 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022819 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022820 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022821 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022822 }
22823
Daniel Veillard3d97e662004-11-04 10:49:00 +000022824 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022825 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022826}
22827
22828
22829static int
22830test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022831 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022832
22833 int mem_base;
22834
22835 mem_base = xmlMemBlocks();
22836
22837 xmlRegisterDefaultInputCallbacks();
22838 call_tests++;
22839 xmlResetLastError();
22840 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022841 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022843 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022844 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022845 }
22846
Daniel Veillard3d97e662004-11-04 10:49:00 +000022847 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022849}
22850
22851
22852static int
22853test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022855
22856#ifdef LIBXML_OUTPUT_ENABLED
22857 int mem_base;
22858
22859 mem_base = xmlMemBlocks();
22860
22861 xmlRegisterDefaultOutputCallbacks();
22862 call_tests++;
22863 xmlResetLastError();
22864 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022865 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022866 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022867 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022868 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022869 }
22870#endif
22871
Daniel Veillard3d97e662004-11-04 10:49:00 +000022872 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022873 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022874}
22875
22876
22877static int
22878test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022879 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022880
22881#ifdef LIBXML_HTTP_ENABLED
22882 int mem_base;
22883
22884 mem_base = xmlMemBlocks();
22885
22886 xmlRegisterHTTPPostCallbacks();
22887 call_tests++;
22888 xmlResetLastError();
22889 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022890 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022891 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022892 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022893 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022894 }
22895#endif
22896
Daniel Veillard3d97e662004-11-04 10:49:00 +000022897 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022899}
22900
22901static int
22902test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022904
Daniel Veillard42595322004-11-08 10:52:06 +000022905 printf("Testing xmlIO : 38 of 47 functions ...\n");
22906 test_ret += test_xmlAllocOutputBuffer();
22907 test_ret += test_xmlAllocParserInputBuffer();
22908 test_ret += test_xmlCheckFilename();
22909 test_ret += test_xmlCheckHTTPInput();
22910 test_ret += test_xmlCleanupInputCallbacks();
22911 test_ret += test_xmlCleanupOutputCallbacks();
22912 test_ret += test_xmlFileClose();
22913 test_ret += test_xmlFileMatch();
22914 test_ret += test_xmlFileOpen();
22915 test_ret += test_xmlFileRead();
22916 test_ret += test_xmlIOFTPClose();
22917 test_ret += test_xmlIOFTPMatch();
22918 test_ret += test_xmlIOFTPOpen();
22919 test_ret += test_xmlIOFTPRead();
22920 test_ret += test_xmlIOHTTPClose();
22921 test_ret += test_xmlIOHTTPMatch();
22922 test_ret += test_xmlIOHTTPOpen();
22923 test_ret += test_xmlIOHTTPOpenW();
22924 test_ret += test_xmlIOHTTPRead();
22925 test_ret += test_xmlNoNetExternalEntityLoader();
22926 test_ret += test_xmlNormalizeWindowsPath();
22927 test_ret += test_xmlOutputBufferCreateFd();
22928 test_ret += test_xmlOutputBufferCreateFile();
22929 test_ret += test_xmlOutputBufferCreateFilename();
22930 test_ret += test_xmlOutputBufferFlush();
22931 test_ret += test_xmlOutputBufferWrite();
22932 test_ret += test_xmlOutputBufferWriteEscape();
22933 test_ret += test_xmlOutputBufferWriteString();
22934 test_ret += test_xmlParserGetDirectory();
22935 test_ret += test_xmlParserInputBufferCreateFd();
22936 test_ret += test_xmlParserInputBufferCreateFile();
22937 test_ret += test_xmlParserInputBufferCreateFilename();
22938 test_ret += test_xmlParserInputBufferCreateMem();
22939 test_ret += test_xmlParserInputBufferCreateStatic();
22940 test_ret += test_xmlParserInputBufferGrow();
22941 test_ret += test_xmlParserInputBufferPush();
22942 test_ret += test_xmlParserInputBufferRead();
22943 test_ret += test_xmlPopInputCallbacks();
22944 test_ret += test_xmlRegisterDefaultInputCallbacks();
22945 test_ret += test_xmlRegisterDefaultOutputCallbacks();
22946 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000022947
Daniel Veillard42595322004-11-08 10:52:06 +000022948 if (test_ret != 0)
22949 printf("Module xmlIO: %d errors\n", test_ret);
22950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022951}
22952
Daniel Veillardce682bc2004-11-05 17:22:25 +000022953#define gen_nb_xmlGenericErrorFunc_ptr 1
22954static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
22955 return(NULL);
22956}
22957static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
22958}
22959
Daniel Veillardd93f6252004-11-02 15:53:51 +000022960static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022961test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022962 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022963
Daniel Veillardce682bc2004-11-05 17:22:25 +000022964 int mem_base;
22965 xmlGenericErrorFunc * handler; /* the handler */
22966 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022967
Daniel Veillardce682bc2004-11-05 17:22:25 +000022968 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
22969 mem_base = xmlMemBlocks();
22970 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
22971
22972 initGenericErrorDefaultFunc(handler);
22973 call_tests++;
22974 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
22975 xmlResetLastError();
22976 if (mem_base != xmlMemBlocks()) {
22977 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
22978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022979 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022980 printf(" %d", n_handler);
22981 printf("\n");
22982 }
22983 }
22984
22985 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022986 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022987}
22988
22989
Daniel Veillardce682bc2004-11-05 17:22:25 +000022990#define gen_nb_xmlErrorPtr 1
22991static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
22992 return(NULL);
22993}
22994static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
22995}
22996
Daniel Veillardd93f6252004-11-02 15:53:51 +000022997static int
22998test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022999 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023000
Daniel Veillardce682bc2004-11-05 17:22:25 +000023001 int mem_base;
23002 int ret_val;
23003 xmlErrorPtr from; /* a source error */
23004 int n_from;
23005 xmlErrorPtr to; /* a target error */
23006 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023007
Daniel Veillardce682bc2004-11-05 17:22:25 +000023008 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
23009 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
23010 mem_base = xmlMemBlocks();
23011 from = gen_xmlErrorPtr(n_from, 0);
23012 to = gen_xmlErrorPtr(n_to, 1);
23013
23014 ret_val = xmlCopyError(from, to);
23015 desret_int(ret_val);
23016 call_tests++;
23017 des_xmlErrorPtr(n_from, from, 0);
23018 des_xmlErrorPtr(n_to, to, 1);
23019 xmlResetLastError();
23020 if (mem_base != xmlMemBlocks()) {
23021 printf("Leak of %d blocks found in xmlCopyError",
23022 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023023 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023024 printf(" %d", n_from);
23025 printf(" %d", n_to);
23026 printf("\n");
23027 }
23028 }
23029 }
23030
23031 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023033}
23034
23035
23036static int
23037test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023039
23040
23041 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023043}
23044
23045
23046static int
23047test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023049
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000023050 int mem_base;
23051 void * ctx; /* an XML parser context */
23052 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023053
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000023054 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
23055 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023056 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000023057
23058 xmlCtxtResetLastError(ctx);
23059 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023060 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000023061 xmlResetLastError();
23062 if (mem_base != xmlMemBlocks()) {
23063 printf("Leak of %d blocks found in xmlCtxtResetLastError",
23064 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023065 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000023066 printf(" %d", n_ctx);
23067 printf("\n");
23068 }
23069 }
23070
Daniel Veillard3d97e662004-11-04 10:49:00 +000023071 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023073}
23074
23075
23076static int
23077test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023078 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023079
23080
23081 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023083}
23084
23085
23086static int
23087test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023089
23090
23091 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023093}
23094
23095
23096static int
23097test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023099
Daniel Veillardce682bc2004-11-05 17:22:25 +000023100 int mem_base;
23101 xmlParserInputPtr input; /* an xmlParserInputPtr input */
23102 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023103
Daniel Veillardce682bc2004-11-05 17:22:25 +000023104 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
23105 mem_base = xmlMemBlocks();
23106 input = gen_xmlParserInputPtr(n_input, 0);
23107
23108 xmlParserPrintFileContext(input);
23109 call_tests++;
23110 des_xmlParserInputPtr(n_input, input, 0);
23111 xmlResetLastError();
23112 if (mem_base != xmlMemBlocks()) {
23113 printf("Leak of %d blocks found in xmlParserPrintFileContext",
23114 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023115 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023116 printf(" %d", n_input);
23117 printf("\n");
23118 }
23119 }
23120
23121 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023123}
23124
23125
23126static int
23127test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023129
Daniel Veillardce682bc2004-11-05 17:22:25 +000023130 int mem_base;
23131 xmlParserInputPtr input; /* an xmlParserInputPtr input */
23132 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023133
Daniel Veillardce682bc2004-11-05 17:22:25 +000023134 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
23135 mem_base = xmlMemBlocks();
23136 input = gen_xmlParserInputPtr(n_input, 0);
23137
23138 xmlParserPrintFileInfo(input);
23139 call_tests++;
23140 des_xmlParserInputPtr(n_input, input, 0);
23141 xmlResetLastError();
23142 if (mem_base != xmlMemBlocks()) {
23143 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
23144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023145 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023146 printf(" %d", n_input);
23147 printf("\n");
23148 }
23149 }
23150
23151 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023153}
23154
23155
23156static int
23157test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023159
23160
23161 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023163}
23164
23165
23166static int
23167test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023169
23170
23171 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023173}
23174
23175
23176static int
23177test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023179
23180
23181 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023183}
23184
23185
23186static int
23187test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023189
Daniel Veillardce682bc2004-11-05 17:22:25 +000023190 int mem_base;
23191 xmlErrorPtr err; /* pointer to the error. */
23192 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023193
Daniel Veillardce682bc2004-11-05 17:22:25 +000023194 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
23195 mem_base = xmlMemBlocks();
23196 err = gen_xmlErrorPtr(n_err, 0);
23197
23198 xmlResetError(err);
23199 call_tests++;
23200 des_xmlErrorPtr(n_err, err, 0);
23201 xmlResetLastError();
23202 if (mem_base != xmlMemBlocks()) {
23203 printf("Leak of %d blocks found in xmlResetError",
23204 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023205 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023206 printf(" %d", n_err);
23207 printf("\n");
23208 }
23209 }
23210
23211 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023212 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023213}
23214
23215
23216static int
23217test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023218 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023219
23220
23221
23222 xmlResetLastError();
23223 call_tests++;
23224 xmlResetLastError();
23225
Daniel Veillard3d97e662004-11-04 10:49:00 +000023226 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023227 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023228}
23229
23230
23231static int
23232test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023234
23235
23236 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023238}
23239
23240
23241static int
23242test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023244
23245
23246 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023248}
23249
23250static int
23251test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023252 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023253
Daniel Veillardce682bc2004-11-05 17:22:25 +000023254 printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023255 test_ret += test_initGenericErrorDefaultFunc();
23256 test_ret += test_xmlCopyError();
23257 test_ret += test_xmlCtxtGetLastError();
23258 test_ret += test_xmlCtxtResetLastError();
23259 test_ret += test_xmlGetLastError();
23260 test_ret += test_xmlParserError();
23261 test_ret += test_xmlParserPrintFileContext();
23262 test_ret += test_xmlParserPrintFileInfo();
23263 test_ret += test_xmlParserValidityError();
23264 test_ret += test_xmlParserValidityWarning();
23265 test_ret += test_xmlParserWarning();
23266 test_ret += test_xmlResetError();
23267 test_ret += test_xmlResetLastError();
23268 test_ret += test_xmlSetGenericErrorFunc();
23269 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023270
Daniel Veillard42595322004-11-08 10:52:06 +000023271 if (test_ret != 0)
23272 printf("Module xmlerror: %d errors\n", test_ret);
23273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023274}
Daniel Veillardd93f6252004-11-02 15:53:51 +000023275
23276static int
23277test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023278 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023279
Daniel Veillard34099b42004-11-04 17:34:35 +000023280#ifdef LIBXML_READER_ENABLED
23281 int mem_base;
23282 xmlTextReaderPtr ret_val;
23283 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
23284 int n_input;
23285 const char * URI; /* the URI information for the source if available */
23286 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023287
Daniel Veillard34099b42004-11-04 17:34:35 +000023288 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
23289 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
23290 mem_base = xmlMemBlocks();
23291 input = gen_xmlParserInputBufferPtr(n_input, 0);
23292 URI = gen_filepath(n_URI, 1);
23293
23294 ret_val = xmlNewTextReader(input, URI);
23295 desret_xmlTextReaderPtr(ret_val);
23296 call_tests++;
23297 des_xmlParserInputBufferPtr(n_input, input, 0);
23298 des_filepath(n_URI, URI, 1);
23299 xmlResetLastError();
23300 if (mem_base != xmlMemBlocks()) {
23301 printf("Leak of %d blocks found in xmlNewTextReader",
23302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023303 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000023304 printf(" %d", n_input);
23305 printf(" %d", n_URI);
23306 printf("\n");
23307 }
23308 }
23309 }
23310#endif
23311
23312 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023314}
23315
23316
23317static int
23318test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023320
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023321#ifdef LIBXML_READER_ENABLED
23322 int mem_base;
23323 xmlTextReaderPtr ret_val;
23324 const char * URI; /* the URI of the resource to process */
23325 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023326
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023327 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
23328 mem_base = xmlMemBlocks();
23329 URI = gen_filepath(n_URI, 0);
23330
23331 ret_val = xmlNewTextReaderFilename(URI);
23332 desret_xmlTextReaderPtr(ret_val);
23333 call_tests++;
23334 des_filepath(n_URI, URI, 0);
23335 xmlResetLastError();
23336 if (mem_base != xmlMemBlocks()) {
23337 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
23338 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023339 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023340 printf(" %d", n_URI);
23341 printf("\n");
23342 }
23343 }
23344#endif
23345
23346 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023348}
23349
23350
23351static int
23352test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023354
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023355#ifdef LIBXML_READER_ENABLED
23356 int mem_base;
23357 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023358 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023359 int n_cur;
23360 const char * URL; /* the base URL to use for the document */
23361 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023362 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023363 int n_encoding;
23364 int options; /* a combination of xmlParserOption */
23365 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023366
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023367 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
23368 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
23369 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
23370 for (n_options = 0;n_options < gen_nb_int;n_options++) {
23371 mem_base = xmlMemBlocks();
23372 cur = gen_const_xmlChar_ptr(n_cur, 0);
23373 URL = gen_filepath(n_URL, 1);
23374 encoding = gen_const_char_ptr(n_encoding, 2);
23375 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023376
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023377 ret_val = xmlReaderForDoc(cur, URL, encoding, options);
23378 desret_xmlTextReaderPtr(ret_val);
23379 call_tests++;
23380 des_const_xmlChar_ptr(n_cur, cur, 0);
23381 des_filepath(n_URL, URL, 1);
23382 des_const_char_ptr(n_encoding, encoding, 2);
23383 des_int(n_options, options, 3);
23384 xmlResetLastError();
23385 if (mem_base != xmlMemBlocks()) {
23386 printf("Leak of %d blocks found in xmlReaderForDoc",
23387 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023388 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023389 printf(" %d", n_cur);
23390 printf(" %d", n_URL);
23391 printf(" %d", n_encoding);
23392 printf(" %d", n_options);
23393 printf("\n");
23394 }
23395 }
23396 }
23397 }
23398 }
23399#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023400
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023401 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023402 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023403}
23404
23405
23406static int
23407test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023408 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023409
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023410#ifdef LIBXML_READER_ENABLED
23411 int mem_base;
23412 xmlTextReaderPtr ret_val;
23413 const char * filename; /* a file or URL */
23414 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023415 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023416 int n_encoding;
23417 int options; /* a combination of xmlParserOption */
23418 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023419
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023420 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
23421 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
23422 for (n_options = 0;n_options < gen_nb_int;n_options++) {
23423 mem_base = xmlMemBlocks();
23424 filename = gen_filepath(n_filename, 0);
23425 encoding = gen_const_char_ptr(n_encoding, 1);
23426 options = gen_int(n_options, 2);
23427
23428 ret_val = xmlReaderForFile(filename, encoding, options);
23429 desret_xmlTextReaderPtr(ret_val);
23430 call_tests++;
23431 des_filepath(n_filename, filename, 0);
23432 des_const_char_ptr(n_encoding, encoding, 1);
23433 des_int(n_options, options, 2);
23434 xmlResetLastError();
23435 if (mem_base != xmlMemBlocks()) {
23436 printf("Leak of %d blocks found in xmlReaderForFile",
23437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023438 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023439 printf(" %d", n_filename);
23440 printf(" %d", n_encoding);
23441 printf(" %d", n_options);
23442 printf("\n");
23443 }
23444 }
23445 }
23446 }
23447#endif
23448
23449 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023451}
23452
23453
23454static int
23455test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023457
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023458#ifdef LIBXML_READER_ENABLED
23459 int mem_base;
23460 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023461 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023462 int n_buffer;
23463 int size; /* the size of the array */
23464 int n_size;
23465 const char * URL; /* the base URL to use for the document */
23466 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023467 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023468 int n_encoding;
23469 int options; /* a combination of xmlParserOption */
23470 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023471
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023472 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
23473 for (n_size = 0;n_size < gen_nb_int;n_size++) {
23474 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
23475 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
23476 for (n_options = 0;n_options < gen_nb_int;n_options++) {
23477 mem_base = xmlMemBlocks();
23478 buffer = gen_const_char_ptr(n_buffer, 0);
23479 size = gen_int(n_size, 1);
23480 URL = gen_filepath(n_URL, 2);
23481 encoding = gen_const_char_ptr(n_encoding, 3);
23482 options = gen_int(n_options, 4);
23483
23484 ret_val = xmlReaderForMemory(buffer, size, URL, encoding, options);
23485 desret_xmlTextReaderPtr(ret_val);
23486 call_tests++;
23487 des_const_char_ptr(n_buffer, buffer, 0);
23488 des_int(n_size, size, 1);
23489 des_filepath(n_URL, URL, 2);
23490 des_const_char_ptr(n_encoding, encoding, 3);
23491 des_int(n_options, options, 4);
23492 xmlResetLastError();
23493 if (mem_base != xmlMemBlocks()) {
23494 printf("Leak of %d blocks found in xmlReaderForMemory",
23495 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023496 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023497 printf(" %d", n_buffer);
23498 printf(" %d", n_size);
23499 printf(" %d", n_URL);
23500 printf(" %d", n_encoding);
23501 printf(" %d", n_options);
23502 printf("\n");
23503 }
23504 }
23505 }
23506 }
23507 }
23508 }
23509#endif
23510
23511 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023513}
23514
23515
23516static int
23517test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023519
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023520#ifdef LIBXML_READER_ENABLED
23521 int mem_base;
23522 int ret_val;
23523 xmlTextReaderPtr reader; /* an XML reader */
23524 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023525 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023526 int n_cur;
23527 const char * URL; /* the base URL to use for the document */
23528 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023529 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023530 int n_encoding;
23531 int options; /* a combination of xmlParserOption */
23532 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023533
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023534 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
23535 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
23536 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
23537 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
23538 for (n_options = 0;n_options < gen_nb_int;n_options++) {
23539 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023540 reader = gen_xmlTextReaderPtr(n_reader, 0);
23541 cur = gen_const_xmlChar_ptr(n_cur, 1);
23542 URL = gen_filepath(n_URL, 2);
23543 encoding = gen_const_char_ptr(n_encoding, 3);
23544 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023545
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023546 ret_val = xmlReaderNewDoc(reader, cur, URL, encoding, options);
23547 desret_int(ret_val);
23548 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023549 des_xmlTextReaderPtr(n_reader, reader, 0);
23550 des_const_xmlChar_ptr(n_cur, cur, 1);
23551 des_filepath(n_URL, URL, 2);
23552 des_const_char_ptr(n_encoding, encoding, 3);
23553 des_int(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023554 xmlResetLastError();
23555 if (mem_base != xmlMemBlocks()) {
23556 printf("Leak of %d blocks found in xmlReaderNewDoc",
23557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023558 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023559 printf(" %d", n_reader);
23560 printf(" %d", n_cur);
23561 printf(" %d", n_URL);
23562 printf(" %d", n_encoding);
23563 printf(" %d", n_options);
23564 printf("\n");
23565 }
23566 }
23567 }
23568 }
23569 }
23570 }
23571#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023572
Daniel Veillard3d97e662004-11-04 10:49:00 +000023573 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023575}
23576
23577
23578static int
23579test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023580 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023581
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023582#ifdef LIBXML_READER_ENABLED
23583 int mem_base;
23584 int ret_val;
23585 xmlTextReaderPtr reader; /* an XML reader */
23586 int n_reader;
23587 const char * filename; /* a file or URL */
23588 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023589 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023590 int n_encoding;
23591 int options; /* a combination of xmlParserOption */
23592 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023593
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023594 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
23595 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
23596 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
23597 for (n_options = 0;n_options < gen_nb_int;n_options++) {
23598 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023599 reader = gen_xmlTextReaderPtr(n_reader, 0);
23600 filename = gen_filepath(n_filename, 1);
23601 encoding = gen_const_char_ptr(n_encoding, 2);
23602 options = gen_int(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023603
23604 ret_val = xmlReaderNewFile(reader, filename, encoding, options);
23605 desret_int(ret_val);
23606 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023607 des_xmlTextReaderPtr(n_reader, reader, 0);
23608 des_filepath(n_filename, filename, 1);
23609 des_const_char_ptr(n_encoding, encoding, 2);
23610 des_int(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023611 xmlResetLastError();
23612 if (mem_base != xmlMemBlocks()) {
23613 printf("Leak of %d blocks found in xmlReaderNewFile",
23614 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023615 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023616 printf(" %d", n_reader);
23617 printf(" %d", n_filename);
23618 printf(" %d", n_encoding);
23619 printf(" %d", n_options);
23620 printf("\n");
23621 }
23622 }
23623 }
23624 }
23625 }
23626#endif
23627
Daniel Veillard3d97e662004-11-04 10:49:00 +000023628 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023630}
23631
23632
23633static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000023634test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023636
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023637#ifdef LIBXML_READER_ENABLED
23638 int mem_base;
23639 int ret_val;
23640 xmlTextReaderPtr reader; /* an XML reader */
23641 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023642 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023643 int n_buffer;
23644 int size; /* the size of the array */
23645 int n_size;
23646 const char * URL; /* the base URL to use for the document */
23647 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023648 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023649 int n_encoding;
23650 int options; /* a combination of xmlParserOption */
23651 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023652
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023653 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
23654 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
23655 for (n_size = 0;n_size < gen_nb_int;n_size++) {
23656 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
23657 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
23658 for (n_options = 0;n_options < gen_nb_int;n_options++) {
23659 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023660 reader = gen_xmlTextReaderPtr(n_reader, 0);
23661 buffer = gen_const_char_ptr(n_buffer, 1);
23662 size = gen_int(n_size, 2);
23663 URL = gen_filepath(n_URL, 3);
23664 encoding = gen_const_char_ptr(n_encoding, 4);
23665 options = gen_int(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023666
23667 ret_val = xmlReaderNewMemory(reader, buffer, size, URL, encoding, options);
23668 desret_int(ret_val);
23669 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023670 des_xmlTextReaderPtr(n_reader, reader, 0);
23671 des_const_char_ptr(n_buffer, buffer, 1);
23672 des_int(n_size, size, 2);
23673 des_filepath(n_URL, URL, 3);
23674 des_const_char_ptr(n_encoding, encoding, 4);
23675 des_int(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023676 xmlResetLastError();
23677 if (mem_base != xmlMemBlocks()) {
23678 printf("Leak of %d blocks found in xmlReaderNewMemory",
23679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023680 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023681 printf(" %d", n_reader);
23682 printf(" %d", n_buffer);
23683 printf(" %d", n_size);
23684 printf(" %d", n_URL);
23685 printf(" %d", n_encoding);
23686 printf(" %d", n_options);
23687 printf("\n");
23688 }
23689 }
23690 }
23691 }
23692 }
23693 }
23694 }
23695#endif
23696
Daniel Veillard3d97e662004-11-04 10:49:00 +000023697 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023698 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023699}
23700
23701
23702static int
23703test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023704 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023705
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023706#ifdef LIBXML_READER_ENABLED
23707 int mem_base;
23708 int ret_val;
23709 xmlTextReaderPtr reader; /* an XML reader */
23710 int n_reader;
23711 xmlDocPtr doc; /* a preparsed document */
23712 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023713
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023714 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
23715 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23716 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023717 reader = gen_xmlTextReaderPtr(n_reader, 0);
23718 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023719
23720 ret_val = xmlReaderNewWalker(reader, doc);
23721 desret_int(ret_val);
23722 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023723 des_xmlTextReaderPtr(n_reader, reader, 0);
23724 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023725 xmlResetLastError();
23726 if (mem_base != xmlMemBlocks()) {
23727 printf("Leak of %d blocks found in xmlReaderNewWalker",
23728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023729 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023730 printf(" %d", n_reader);
23731 printf(" %d", n_doc);
23732 printf("\n");
23733 }
23734 }
23735 }
23736#endif
23737
Daniel Veillard3d97e662004-11-04 10:49:00 +000023738 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023739 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023740}
23741
23742
23743static int
23744test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023745 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023746
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023747#ifdef LIBXML_READER_ENABLED
23748 int mem_base;
23749 xmlTextReaderPtr ret_val;
23750 xmlDocPtr doc; /* a preparsed document */
23751 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023752
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023753 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23754 mem_base = xmlMemBlocks();
23755 doc = gen_xmlDocPtr(n_doc, 0);
23756
23757 ret_val = xmlReaderWalker(doc);
23758 desret_xmlTextReaderPtr(ret_val);
23759 call_tests++;
23760 des_xmlDocPtr(n_doc, doc, 0);
23761 xmlResetLastError();
23762 if (mem_base != xmlMemBlocks()) {
23763 printf("Leak of %d blocks found in xmlReaderWalker",
23764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023765 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000023766 printf(" %d", n_doc);
23767 printf("\n");
23768 }
23769 }
23770#endif
23771
23772 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023773 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023774}
23775
23776
23777static int
23778test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023779 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023780
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023781#ifdef LIBXML_READER_ENABLED
23782 int mem_base;
23783 int ret_val;
23784 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
23785 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023786
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023787 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
23788 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023789 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023790
23791 ret_val = xmlTextReaderAttributeCount(reader);
23792 desret_int(ret_val);
23793 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023794 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023795 xmlResetLastError();
23796 if (mem_base != xmlMemBlocks()) {
23797 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
23798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023799 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023800 printf(" %d", n_reader);
23801 printf("\n");
23802 }
23803 }
23804#endif
23805
Daniel Veillard3d97e662004-11-04 10:49:00 +000023806 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023807 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023808}
23809
23810
23811static int
23812test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023813 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023814
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023815#ifdef LIBXML_READER_ENABLED
23816 int mem_base;
23817 xmlChar * ret_val;
23818 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
23819 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023820
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023821 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
23822 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023823 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023824
23825 ret_val = xmlTextReaderBaseUri(reader);
23826 desret_xmlChar_ptr(ret_val);
23827 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023828 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023829 xmlResetLastError();
23830 if (mem_base != xmlMemBlocks()) {
23831 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
23832 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023833 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023834 printf(" %d", n_reader);
23835 printf("\n");
23836 }
23837 }
23838#endif
23839
Daniel Veillard3d97e662004-11-04 10:49:00 +000023840 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023841 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023842}
23843
23844
23845static int
23846test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023847 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023848
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023849#ifdef LIBXML_READER_ENABLED
23850 int mem_base;
23851 int ret_val;
23852 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
23853 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023854
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023855 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
23856 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023857 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023858
23859 ret_val = xmlTextReaderClose(reader);
23860 desret_int(ret_val);
23861 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023862 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023863 xmlResetLastError();
23864 if (mem_base != xmlMemBlocks()) {
23865 printf("Leak of %d blocks found in xmlTextReaderClose",
23866 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023867 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000023868 printf(" %d", n_reader);
23869 printf("\n");
23870 }
23871 }
23872#endif
23873
Daniel Veillard3d97e662004-11-04 10:49:00 +000023874 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023875 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023876}
23877
23878
23879static int
23880test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023881 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023882
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023883#ifdef LIBXML_READER_ENABLED
23884 int mem_base;
23885 const xmlChar * ret_val;
23886 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
23887 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023888
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023889 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
23890 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023891 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023892
23893 ret_val = xmlTextReaderConstBaseUri(reader);
23894 desret_const_xmlChar_ptr(ret_val);
23895 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023896 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023897 xmlResetLastError();
23898 if (mem_base != xmlMemBlocks()) {
23899 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
23900 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023901 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023902 printf(" %d", n_reader);
23903 printf("\n");
23904 }
23905 }
23906#endif
23907
Daniel Veillard3d97e662004-11-04 10:49:00 +000023908 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023910}
23911
23912
23913static int
23914test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023916
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023917#ifdef LIBXML_READER_ENABLED
23918 int mem_base;
23919 const xmlChar * ret_val;
23920 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
23921 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023922
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023923 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
23924 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023925 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023926
23927 ret_val = xmlTextReaderConstEncoding(reader);
23928 desret_const_xmlChar_ptr(ret_val);
23929 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023930 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023931 xmlResetLastError();
23932 if (mem_base != xmlMemBlocks()) {
23933 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
23934 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023935 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023936 printf(" %d", n_reader);
23937 printf("\n");
23938 }
23939 }
23940#endif
23941
Daniel Veillard3d97e662004-11-04 10:49:00 +000023942 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023943 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023944}
23945
23946
23947static int
23948test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023950
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023951#ifdef LIBXML_READER_ENABLED
23952 int mem_base;
23953 const xmlChar * ret_val;
23954 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
23955 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023956
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023957 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
23958 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023959 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023960
23961 ret_val = xmlTextReaderConstLocalName(reader);
23962 desret_const_xmlChar_ptr(ret_val);
23963 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023964 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023965 xmlResetLastError();
23966 if (mem_base != xmlMemBlocks()) {
23967 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
23968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023969 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023970 printf(" %d", n_reader);
23971 printf("\n");
23972 }
23973 }
23974#endif
23975
Daniel Veillard3d97e662004-11-04 10:49:00 +000023976 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023978}
23979
23980
23981static int
23982test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023984
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023985#ifdef LIBXML_READER_ENABLED
23986 int mem_base;
23987 const xmlChar * ret_val;
23988 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
23989 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023990
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023991 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
23992 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023993 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023994
23995 ret_val = xmlTextReaderConstName(reader);
23996 desret_const_xmlChar_ptr(ret_val);
23997 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023998 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000023999 xmlResetLastError();
24000 if (mem_base != xmlMemBlocks()) {
24001 printf("Leak of %d blocks found in xmlTextReaderConstName",
24002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024003 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024004 printf(" %d", n_reader);
24005 printf("\n");
24006 }
24007 }
24008#endif
24009
Daniel Veillard3d97e662004-11-04 10:49:00 +000024010 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024011 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024012}
24013
24014
24015static int
24016test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024018
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024019#ifdef LIBXML_READER_ENABLED
24020 int mem_base;
24021 const xmlChar * ret_val;
24022 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24023 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024024
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024025 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24026 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024027 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024028
24029 ret_val = xmlTextReaderConstNamespaceUri(reader);
24030 desret_const_xmlChar_ptr(ret_val);
24031 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024032 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024033 xmlResetLastError();
24034 if (mem_base != xmlMemBlocks()) {
24035 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
24036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024037 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024038 printf(" %d", n_reader);
24039 printf("\n");
24040 }
24041 }
24042#endif
24043
Daniel Veillard3d97e662004-11-04 10:49:00 +000024044 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024046}
24047
24048
24049static int
24050test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024052
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024053#ifdef LIBXML_READER_ENABLED
24054 int mem_base;
24055 const xmlChar * ret_val;
24056 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24057 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024058
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024059 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24060 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024061 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024062
24063 ret_val = xmlTextReaderConstPrefix(reader);
24064 desret_const_xmlChar_ptr(ret_val);
24065 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024066 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024067 xmlResetLastError();
24068 if (mem_base != xmlMemBlocks()) {
24069 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
24070 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024071 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024072 printf(" %d", n_reader);
24073 printf("\n");
24074 }
24075 }
24076#endif
24077
Daniel Veillard3d97e662004-11-04 10:49:00 +000024078 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024080}
24081
24082
24083static int
24084test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024086
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024087#ifdef LIBXML_READER_ENABLED
24088 int mem_base;
24089 const xmlChar * ret_val;
24090 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24091 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024092 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024093 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024094
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024095 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24096 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
24097 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024098 reader = gen_xmlTextReaderPtr(n_reader, 0);
24099 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024100
24101 ret_val = xmlTextReaderConstString(reader, str);
24102 desret_const_xmlChar_ptr(ret_val);
24103 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024104 des_xmlTextReaderPtr(n_reader, reader, 0);
24105 des_const_xmlChar_ptr(n_str, str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024106 xmlResetLastError();
24107 if (mem_base != xmlMemBlocks()) {
24108 printf("Leak of %d blocks found in xmlTextReaderConstString",
24109 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024110 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024111 printf(" %d", n_reader);
24112 printf(" %d", n_str);
24113 printf("\n");
24114 }
24115 }
24116 }
24117#endif
24118
Daniel Veillard3d97e662004-11-04 10:49:00 +000024119 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024121}
24122
24123
24124static int
24125test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024127
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024128#ifdef LIBXML_READER_ENABLED
24129 int mem_base;
24130 const xmlChar * ret_val;
24131 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24132 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024133
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024134 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24135 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024136 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024137
24138 ret_val = xmlTextReaderConstValue(reader);
24139 desret_const_xmlChar_ptr(ret_val);
24140 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024141 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024142 xmlResetLastError();
24143 if (mem_base != xmlMemBlocks()) {
24144 printf("Leak of %d blocks found in xmlTextReaderConstValue",
24145 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024146 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024147 printf(" %d", n_reader);
24148 printf("\n");
24149 }
24150 }
24151#endif
24152
Daniel Veillard3d97e662004-11-04 10:49:00 +000024153 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024155}
24156
24157
24158static int
24159test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024161
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024162#ifdef LIBXML_READER_ENABLED
24163 int mem_base;
24164 const xmlChar * ret_val;
24165 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24166 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024167
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024168 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24169 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024170 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024171
24172 ret_val = xmlTextReaderConstXmlLang(reader);
24173 desret_const_xmlChar_ptr(ret_val);
24174 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024175 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024176 xmlResetLastError();
24177 if (mem_base != xmlMemBlocks()) {
24178 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
24179 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024180 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024181 printf(" %d", n_reader);
24182 printf("\n");
24183 }
24184 }
24185#endif
24186
Daniel Veillard3d97e662004-11-04 10:49:00 +000024187 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024188 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024189}
24190
24191
24192static int
24193test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024195
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024196#ifdef LIBXML_READER_ENABLED
24197 int mem_base;
24198 const xmlChar * ret_val;
24199 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24200 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024201
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024202 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24203 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024204 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024205
24206 ret_val = xmlTextReaderConstXmlVersion(reader);
24207 desret_const_xmlChar_ptr(ret_val);
24208 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024209 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024210 xmlResetLastError();
24211 if (mem_base != xmlMemBlocks()) {
24212 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
24213 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024214 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000024215 printf(" %d", n_reader);
24216 printf("\n");
24217 }
24218 }
24219#endif
24220
Daniel Veillard3d97e662004-11-04 10:49:00 +000024221 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024223}
24224
24225
24226static int
24227test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024229
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024230#ifdef LIBXML_READER_ENABLED
24231 int mem_base;
24232 xmlDocPtr ret_val;
24233 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24234 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024235
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024236 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24237 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024238 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024239
24240 ret_val = xmlTextReaderCurrentDoc(reader);
24241 desret_xmlDocPtr(ret_val);
24242 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024243 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024244 xmlResetLastError();
24245 if (mem_base != xmlMemBlocks()) {
24246 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
24247 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024248 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024249 printf(" %d", n_reader);
24250 printf("\n");
24251 }
24252 }
24253#endif
24254
Daniel Veillard3d97e662004-11-04 10:49:00 +000024255 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024256 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024257}
24258
24259
24260static int
24261test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024262 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024263
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024264#ifdef LIBXML_READER_ENABLED
24265 int mem_base;
24266 xmlNodePtr ret_val;
24267 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24268 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024269
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024270 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24271 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024272 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024273
24274 ret_val = xmlTextReaderCurrentNode(reader);
24275 desret_xmlNodePtr(ret_val);
24276 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024277 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024278 xmlResetLastError();
24279 if (mem_base != xmlMemBlocks()) {
24280 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
24281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024282 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024283 printf(" %d", n_reader);
24284 printf("\n");
24285 }
24286 }
24287#endif
24288
Daniel Veillard3d97e662004-11-04 10:49:00 +000024289 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024291}
24292
24293
24294static int
24295test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024296 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024297
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024298#ifdef LIBXML_READER_ENABLED
24299 int mem_base;
24300 int ret_val;
24301 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24302 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024303
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024304 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24305 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024306 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024307
24308 ret_val = xmlTextReaderDepth(reader);
24309 desret_int(ret_val);
24310 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024311 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024312 xmlResetLastError();
24313 if (mem_base != xmlMemBlocks()) {
24314 printf("Leak of %d blocks found in xmlTextReaderDepth",
24315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024316 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024317 printf(" %d", n_reader);
24318 printf("\n");
24319 }
24320 }
24321#endif
24322
Daniel Veillard3d97e662004-11-04 10:49:00 +000024323 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024324 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024325}
24326
24327
24328static int
24329test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024330 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024331
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024332#ifdef LIBXML_READER_ENABLED
24333 int mem_base;
24334 xmlNodePtr ret_val;
24335 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24336 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024337
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024338 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24339 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024340 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024341
24342 ret_val = xmlTextReaderExpand(reader);
24343 desret_xmlNodePtr(ret_val);
24344 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024345 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024346 xmlResetLastError();
24347 if (mem_base != xmlMemBlocks()) {
24348 printf("Leak of %d blocks found in xmlTextReaderExpand",
24349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024350 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024351 printf(" %d", n_reader);
24352 printf("\n");
24353 }
24354 }
24355#endif
24356
Daniel Veillard3d97e662004-11-04 10:49:00 +000024357 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024359}
24360
24361
24362static int
24363test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024365
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024366#ifdef LIBXML_READER_ENABLED
24367 int mem_base;
24368 xmlChar * ret_val;
24369 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24370 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024371 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024372 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024373
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024374 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24375 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24376 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024377 reader = gen_xmlTextReaderPtr(n_reader, 0);
24378 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024379
24380 ret_val = xmlTextReaderGetAttribute(reader, name);
24381 desret_xmlChar_ptr(ret_val);
24382 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024383 des_xmlTextReaderPtr(n_reader, reader, 0);
24384 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024385 xmlResetLastError();
24386 if (mem_base != xmlMemBlocks()) {
24387 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
24388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024389 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024390 printf(" %d", n_reader);
24391 printf(" %d", n_name);
24392 printf("\n");
24393 }
24394 }
24395 }
24396#endif
24397
Daniel Veillard3d97e662004-11-04 10:49:00 +000024398 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024399 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024400}
24401
24402
24403static int
24404test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024405 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024406
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024407#ifdef LIBXML_READER_ENABLED
24408 int mem_base;
24409 xmlChar * ret_val;
24410 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24411 int n_reader;
24412 int no; /* the zero-based index of the attribute relative to the containing element */
24413 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024414
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024415 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24416 for (n_no = 0;n_no < gen_nb_int;n_no++) {
24417 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024418 reader = gen_xmlTextReaderPtr(n_reader, 0);
24419 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024420
24421 ret_val = xmlTextReaderGetAttributeNo(reader, no);
24422 desret_xmlChar_ptr(ret_val);
24423 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024424 des_xmlTextReaderPtr(n_reader, reader, 0);
24425 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024426 xmlResetLastError();
24427 if (mem_base != xmlMemBlocks()) {
24428 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
24429 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024430 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024431 printf(" %d", n_reader);
24432 printf(" %d", n_no);
24433 printf("\n");
24434 }
24435 }
24436 }
24437#endif
24438
Daniel Veillard3d97e662004-11-04 10:49:00 +000024439 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024441}
24442
24443
24444static int
24445test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024447
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024448#ifdef LIBXML_READER_ENABLED
24449 int mem_base;
24450 xmlChar * ret_val;
24451 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24452 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024453 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024454 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024455 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024456 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024457
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024458 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24459 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
24460 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
24461 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024462 reader = gen_xmlTextReaderPtr(n_reader, 0);
24463 localName = gen_const_xmlChar_ptr(n_localName, 1);
24464 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024465
24466 ret_val = xmlTextReaderGetAttributeNs(reader, localName, namespaceURI);
24467 desret_xmlChar_ptr(ret_val);
24468 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024469 des_xmlTextReaderPtr(n_reader, reader, 0);
24470 des_const_xmlChar_ptr(n_localName, localName, 1);
24471 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024472 xmlResetLastError();
24473 if (mem_base != xmlMemBlocks()) {
24474 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
24475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024476 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024477 printf(" %d", n_reader);
24478 printf(" %d", n_localName);
24479 printf(" %d", n_namespaceURI);
24480 printf("\n");
24481 }
24482 }
24483 }
24484 }
24485#endif
24486
Daniel Veillard3d97e662004-11-04 10:49:00 +000024487 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024489}
24490
24491
Daniel Veillardce682bc2004-11-05 17:22:25 +000024492#define gen_nb_xmlTextReaderErrorFunc_ptr 1
24493static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24494 return(NULL);
24495}
24496static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24497}
24498
Daniel Veillardd93f6252004-11-02 15:53:51 +000024499static int
24500test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024501 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024502
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024503#ifdef LIBXML_READER_ENABLED
24504 int mem_base;
24505 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24506 int n_reader;
24507 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
24508 int n_f;
24509 void ** arg; /* a user argument */
24510 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024511
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024512 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24513 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
24514 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
24515 mem_base = xmlMemBlocks();
24516 reader = gen_xmlTextReaderPtr(n_reader, 0);
24517 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
24518 arg = gen_void_ptr_ptr(n_arg, 2);
24519
24520 xmlTextReaderGetErrorHandler(reader, f, arg);
24521 call_tests++;
24522 des_xmlTextReaderPtr(n_reader, reader, 0);
24523 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
24524 des_void_ptr_ptr(n_arg, arg, 2);
24525 xmlResetLastError();
24526 if (mem_base != xmlMemBlocks()) {
24527 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
24528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024529 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024530 printf(" %d", n_reader);
24531 printf(" %d", n_f);
24532 printf(" %d", n_arg);
24533 printf("\n");
24534 }
24535 }
24536 }
24537 }
24538#endif
24539
24540 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024542}
24543
24544
24545static int
24546test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024548
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024549#ifdef LIBXML_READER_ENABLED
24550 int mem_base;
24551 int ret_val;
24552 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24553 int n_reader;
24554 int prop; /* the xmlParserProperties to get */
24555 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024556
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024557 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24558 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
24559 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024560 reader = gen_xmlTextReaderPtr(n_reader, 0);
24561 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024562
24563 ret_val = xmlTextReaderGetParserProp(reader, prop);
24564 desret_int(ret_val);
24565 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024566 des_xmlTextReaderPtr(n_reader, reader, 0);
24567 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024568 xmlResetLastError();
24569 if (mem_base != xmlMemBlocks()) {
24570 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
24571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024572 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024573 printf(" %d", n_reader);
24574 printf(" %d", n_prop);
24575 printf("\n");
24576 }
24577 }
24578 }
24579#endif
24580
Daniel Veillard3d97e662004-11-04 10:49:00 +000024581 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024583}
24584
24585
24586static int
24587test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024589
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024590#ifdef LIBXML_READER_ENABLED
24591 int mem_base;
24592 xmlParserInputBufferPtr ret_val;
24593 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24594 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024595
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024596 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24597 mem_base = xmlMemBlocks();
24598 reader = gen_xmlTextReaderPtr(n_reader, 0);
24599
24600 ret_val = xmlTextReaderGetRemainder(reader);
24601 desret_xmlParserInputBufferPtr(ret_val);
24602 call_tests++;
24603 des_xmlTextReaderPtr(n_reader, reader, 0);
24604 xmlResetLastError();
24605 if (mem_base != xmlMemBlocks()) {
24606 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
24607 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024608 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024609 printf(" %d", n_reader);
24610 printf("\n");
24611 }
24612 }
24613#endif
24614
24615 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024616 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024617}
24618
24619
24620static int
24621test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024622 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024623
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024624#ifdef LIBXML_READER_ENABLED
24625 int mem_base;
24626 int ret_val;
24627 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24628 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024629
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024630 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24631 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024632 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024633
24634 ret_val = xmlTextReaderHasAttributes(reader);
24635 desret_int(ret_val);
24636 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024637 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024638 xmlResetLastError();
24639 if (mem_base != xmlMemBlocks()) {
24640 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
24641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024642 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024643 printf(" %d", n_reader);
24644 printf("\n");
24645 }
24646 }
24647#endif
24648
Daniel Veillard3d97e662004-11-04 10:49:00 +000024649 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024651}
24652
24653
24654static int
24655test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024657
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024658#ifdef LIBXML_READER_ENABLED
24659 int mem_base;
24660 int ret_val;
24661 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24662 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024663
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024664 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24665 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024666 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024667
24668 ret_val = xmlTextReaderHasValue(reader);
24669 desret_int(ret_val);
24670 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024671 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024672 xmlResetLastError();
24673 if (mem_base != xmlMemBlocks()) {
24674 printf("Leak of %d blocks found in xmlTextReaderHasValue",
24675 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024676 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024677 printf(" %d", n_reader);
24678 printf("\n");
24679 }
24680 }
24681#endif
24682
Daniel Veillard3d97e662004-11-04 10:49:00 +000024683 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024684 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024685}
24686
24687
24688static int
24689test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024690 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024691
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024692#ifdef LIBXML_READER_ENABLED
24693 int mem_base;
24694 int ret_val;
24695 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24696 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024697
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024698 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24699 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024700 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024701
24702 ret_val = xmlTextReaderIsDefault(reader);
24703 desret_int(ret_val);
24704 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024705 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024706 xmlResetLastError();
24707 if (mem_base != xmlMemBlocks()) {
24708 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
24709 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024710 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024711 printf(" %d", n_reader);
24712 printf("\n");
24713 }
24714 }
24715#endif
24716
Daniel Veillard3d97e662004-11-04 10:49:00 +000024717 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024718 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024719}
24720
24721
24722static int
24723test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024725
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024726#ifdef LIBXML_READER_ENABLED
24727 int mem_base;
24728 int ret_val;
24729 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24730 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024731
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024732 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24733 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024734 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024735
24736 ret_val = xmlTextReaderIsEmptyElement(reader);
24737 desret_int(ret_val);
24738 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024739 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024740 xmlResetLastError();
24741 if (mem_base != xmlMemBlocks()) {
24742 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
24743 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024744 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024745 printf(" %d", n_reader);
24746 printf("\n");
24747 }
24748 }
24749#endif
24750
Daniel Veillard3d97e662004-11-04 10:49:00 +000024751 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024752 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024753}
24754
24755
24756static int
24757test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024759
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024760#ifdef LIBXML_READER_ENABLED
24761 int mem_base;
24762 int ret_val;
24763 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24764 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024765
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024766 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24767 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024768 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024769
24770 ret_val = xmlTextReaderIsNamespaceDecl(reader);
24771 desret_int(ret_val);
24772 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024773 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024774 xmlResetLastError();
24775 if (mem_base != xmlMemBlocks()) {
24776 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
24777 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024778 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024779 printf(" %d", n_reader);
24780 printf("\n");
24781 }
24782 }
24783#endif
24784
Daniel Veillard3d97e662004-11-04 10:49:00 +000024785 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024786 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024787}
24788
24789
24790static int
24791test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024792 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024793
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024794#ifdef LIBXML_READER_ENABLED
24795 int mem_base;
24796 int ret_val;
24797 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24798 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024799
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024800 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24801 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024802 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024803
24804 ret_val = xmlTextReaderIsValid(reader);
24805 desret_int(ret_val);
24806 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024807 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024808 xmlResetLastError();
24809 if (mem_base != xmlMemBlocks()) {
24810 printf("Leak of %d blocks found in xmlTextReaderIsValid",
24811 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024812 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024813 printf(" %d", n_reader);
24814 printf("\n");
24815 }
24816 }
24817#endif
24818
Daniel Veillard3d97e662004-11-04 10:49:00 +000024819 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024821}
24822
24823
24824static int
24825test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024827
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024828#ifdef LIBXML_READER_ENABLED
24829 int mem_base;
24830 xmlChar * ret_val;
24831 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24832 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024833
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024834 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24835 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024836 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024837
24838 ret_val = xmlTextReaderLocalName(reader);
24839 desret_xmlChar_ptr(ret_val);
24840 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024841 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024842 xmlResetLastError();
24843 if (mem_base != xmlMemBlocks()) {
24844 printf("Leak of %d blocks found in xmlTextReaderLocalName",
24845 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024846 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024847 printf(" %d", n_reader);
24848 printf("\n");
24849 }
24850 }
24851#endif
24852
Daniel Veillard3d97e662004-11-04 10:49:00 +000024853 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024854 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024855}
24856
24857
Daniel Veillardce682bc2004-11-05 17:22:25 +000024858#define gen_nb_xmlTextReaderLocatorPtr 1
24859static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24860 return(NULL);
24861}
24862static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24863}
24864
Daniel Veillardd93f6252004-11-02 15:53:51 +000024865static int
24866test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024868
Daniel Veillardce682bc2004-11-05 17:22:25 +000024869#ifdef LIBXML_READER_ENABLED
24870 int mem_base;
24871 xmlChar * ret_val;
24872 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
24873 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024874
Daniel Veillardce682bc2004-11-05 17:22:25 +000024875 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
24876 mem_base = xmlMemBlocks();
24877 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
24878
24879 ret_val = xmlTextReaderLocatorBaseURI(locator);
24880 desret_xmlChar_ptr(ret_val);
24881 call_tests++;
24882 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
24883 xmlResetLastError();
24884 if (mem_base != xmlMemBlocks()) {
24885 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
24886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024887 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024888 printf(" %d", n_locator);
24889 printf("\n");
24890 }
24891 }
24892#endif
24893
24894 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024895 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024896}
24897
24898
24899static int
24900test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024902
Daniel Veillardce682bc2004-11-05 17:22:25 +000024903#ifdef LIBXML_READER_ENABLED
24904 int mem_base;
24905 int ret_val;
24906 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
24907 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024908
Daniel Veillardce682bc2004-11-05 17:22:25 +000024909 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
24910 mem_base = xmlMemBlocks();
24911 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
24912
24913 ret_val = xmlTextReaderLocatorLineNumber(locator);
24914 desret_int(ret_val);
24915 call_tests++;
24916 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
24917 xmlResetLastError();
24918 if (mem_base != xmlMemBlocks()) {
24919 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
24920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024921 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024922 printf(" %d", n_locator);
24923 printf("\n");
24924 }
24925 }
24926#endif
24927
24928 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024930}
24931
24932
24933static int
24934test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024936
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024937#ifdef LIBXML_READER_ENABLED
24938 int mem_base;
24939 xmlChar * ret_val;
24940 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24941 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024942 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 +000024943 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024944
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024945 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24946 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24947 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024948 reader = gen_xmlTextReaderPtr(n_reader, 0);
24949 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024950
24951 ret_val = xmlTextReaderLookupNamespace(reader, prefix);
24952 desret_xmlChar_ptr(ret_val);
24953 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024954 des_xmlTextReaderPtr(n_reader, reader, 0);
24955 des_const_xmlChar_ptr(n_prefix, prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024956 xmlResetLastError();
24957 if (mem_base != xmlMemBlocks()) {
24958 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
24959 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024960 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024961 printf(" %d", n_reader);
24962 printf(" %d", n_prefix);
24963 printf("\n");
24964 }
24965 }
24966 }
24967#endif
24968
Daniel Veillard3d97e662004-11-04 10:49:00 +000024969 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024971}
24972
24973
24974static int
24975test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024976 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024977
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024978#ifdef LIBXML_READER_ENABLED
24979 int mem_base;
24980 int ret_val;
24981 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
24982 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024983 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024984 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024985
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024986 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
24987 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24988 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024989 reader = gen_xmlTextReaderPtr(n_reader, 0);
24990 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024991
24992 ret_val = xmlTextReaderMoveToAttribute(reader, name);
24993 desret_int(ret_val);
24994 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024995 des_xmlTextReaderPtr(n_reader, reader, 0);
24996 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000024997 xmlResetLastError();
24998 if (mem_base != xmlMemBlocks()) {
24999 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
25000 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025001 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025002 printf(" %d", n_reader);
25003 printf(" %d", n_name);
25004 printf("\n");
25005 }
25006 }
25007 }
25008#endif
25009
Daniel Veillard3d97e662004-11-04 10:49:00 +000025010 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025011 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025012}
25013
25014
25015static int
25016test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025018
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025019#ifdef LIBXML_READER_ENABLED
25020 int mem_base;
25021 int ret_val;
25022 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25023 int n_reader;
25024 int no; /* the zero-based index of the attribute relative to the containing element. */
25025 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025026
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025027 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25028 for (n_no = 0;n_no < gen_nb_int;n_no++) {
25029 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025030 reader = gen_xmlTextReaderPtr(n_reader, 0);
25031 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025032
25033 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
25034 desret_int(ret_val);
25035 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025036 des_xmlTextReaderPtr(n_reader, reader, 0);
25037 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025038 xmlResetLastError();
25039 if (mem_base != xmlMemBlocks()) {
25040 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
25041 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025042 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025043 printf(" %d", n_reader);
25044 printf(" %d", n_no);
25045 printf("\n");
25046 }
25047 }
25048 }
25049#endif
25050
Daniel Veillard3d97e662004-11-04 10:49:00 +000025051 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025053}
25054
25055
25056static int
25057test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025058 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025059
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025060#ifdef LIBXML_READER_ENABLED
25061 int mem_base;
25062 int ret_val;
25063 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25064 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025065 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025066 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025067 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025068 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025069
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025070 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25071 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
25072 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
25073 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025074 reader = gen_xmlTextReaderPtr(n_reader, 0);
25075 localName = gen_const_xmlChar_ptr(n_localName, 1);
25076 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025077
25078 ret_val = xmlTextReaderMoveToAttributeNs(reader, localName, namespaceURI);
25079 desret_int(ret_val);
25080 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025081 des_xmlTextReaderPtr(n_reader, reader, 0);
25082 des_const_xmlChar_ptr(n_localName, localName, 1);
25083 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025084 xmlResetLastError();
25085 if (mem_base != xmlMemBlocks()) {
25086 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
25087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025088 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025089 printf(" %d", n_reader);
25090 printf(" %d", n_localName);
25091 printf(" %d", n_namespaceURI);
25092 printf("\n");
25093 }
25094 }
25095 }
25096 }
25097#endif
25098
Daniel Veillard3d97e662004-11-04 10:49:00 +000025099 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025100 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025101}
25102
25103
25104static int
25105test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025106 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025107
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025108#ifdef LIBXML_READER_ENABLED
25109 int mem_base;
25110 int ret_val;
25111 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25112 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025113
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025114 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25115 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025116 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025117
25118 ret_val = xmlTextReaderMoveToElement(reader);
25119 desret_int(ret_val);
25120 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025121 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025122 xmlResetLastError();
25123 if (mem_base != xmlMemBlocks()) {
25124 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
25125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025126 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025127 printf(" %d", n_reader);
25128 printf("\n");
25129 }
25130 }
25131#endif
25132
Daniel Veillard3d97e662004-11-04 10:49:00 +000025133 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025134 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025135}
25136
25137
25138static int
25139test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025140 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025141
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025142#ifdef LIBXML_READER_ENABLED
25143 int mem_base;
25144 int ret_val;
25145 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25146 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025147
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025148 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25149 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025150 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025151
25152 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
25153 desret_int(ret_val);
25154 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025155 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025156 xmlResetLastError();
25157 if (mem_base != xmlMemBlocks()) {
25158 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
25159 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025160 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025161 printf(" %d", n_reader);
25162 printf("\n");
25163 }
25164 }
25165#endif
25166
Daniel Veillard3d97e662004-11-04 10:49:00 +000025167 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025169}
25170
25171
25172static int
25173test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025175
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025176#ifdef LIBXML_READER_ENABLED
25177 int mem_base;
25178 int ret_val;
25179 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25180 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025181
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025182 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25183 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025184 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025185
25186 ret_val = xmlTextReaderMoveToNextAttribute(reader);
25187 desret_int(ret_val);
25188 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025189 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025190 xmlResetLastError();
25191 if (mem_base != xmlMemBlocks()) {
25192 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
25193 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025194 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025195 printf(" %d", n_reader);
25196 printf("\n");
25197 }
25198 }
25199#endif
25200
Daniel Veillard3d97e662004-11-04 10:49:00 +000025201 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025203}
25204
25205
25206static int
25207test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025209
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025210#ifdef LIBXML_READER_ENABLED
25211 int mem_base;
25212 xmlChar * ret_val;
25213 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25214 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025215
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025216 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25217 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025218 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025219
25220 ret_val = xmlTextReaderName(reader);
25221 desret_xmlChar_ptr(ret_val);
25222 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025223 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025224 xmlResetLastError();
25225 if (mem_base != xmlMemBlocks()) {
25226 printf("Leak of %d blocks found in xmlTextReaderName",
25227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025228 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025229 printf(" %d", n_reader);
25230 printf("\n");
25231 }
25232 }
25233#endif
25234
Daniel Veillard3d97e662004-11-04 10:49:00 +000025235 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025236 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025237}
25238
25239
25240static int
25241test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025243
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025244#ifdef LIBXML_READER_ENABLED
25245 int mem_base;
25246 xmlChar * ret_val;
25247 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25248 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025249
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025250 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25251 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025252 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025253
25254 ret_val = xmlTextReaderNamespaceUri(reader);
25255 desret_xmlChar_ptr(ret_val);
25256 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025257 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025258 xmlResetLastError();
25259 if (mem_base != xmlMemBlocks()) {
25260 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
25261 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025262 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025263 printf(" %d", n_reader);
25264 printf("\n");
25265 }
25266 }
25267#endif
25268
Daniel Veillard3d97e662004-11-04 10:49:00 +000025269 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025271}
25272
25273
25274static int
25275test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025277
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025278#ifdef LIBXML_READER_ENABLED
25279 int mem_base;
25280 int ret_val;
25281 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25282 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025283
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025284 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25285 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025286 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025287
25288 ret_val = xmlTextReaderNext(reader);
25289 desret_int(ret_val);
25290 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025291 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025292 xmlResetLastError();
25293 if (mem_base != xmlMemBlocks()) {
25294 printf("Leak of %d blocks found in xmlTextReaderNext",
25295 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025296 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025297 printf(" %d", n_reader);
25298 printf("\n");
25299 }
25300 }
25301#endif
25302
Daniel Veillard3d97e662004-11-04 10:49:00 +000025303 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025304 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025305}
25306
25307
25308static int
25309test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025310 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025311
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025312#ifdef LIBXML_READER_ENABLED
25313 int mem_base;
25314 int ret_val;
25315 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25316 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025317
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025318 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25319 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025320 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025321
25322 ret_val = xmlTextReaderNextSibling(reader);
25323 desret_int(ret_val);
25324 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025325 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025326 xmlResetLastError();
25327 if (mem_base != xmlMemBlocks()) {
25328 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
25329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025330 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025331 printf(" %d", n_reader);
25332 printf("\n");
25333 }
25334 }
25335#endif
25336
Daniel Veillard3d97e662004-11-04 10:49:00 +000025337 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025338 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025339}
25340
25341
25342static int
25343test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025344 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025345
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025346#ifdef LIBXML_READER_ENABLED
25347 int mem_base;
25348 int ret_val;
25349 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25350 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025351
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025352 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25353 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025354 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025355
25356 ret_val = xmlTextReaderNodeType(reader);
25357 desret_int(ret_val);
25358 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025359 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025360 xmlResetLastError();
25361 if (mem_base != xmlMemBlocks()) {
25362 printf("Leak of %d blocks found in xmlTextReaderNodeType",
25363 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025364 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025365 printf(" %d", n_reader);
25366 printf("\n");
25367 }
25368 }
25369#endif
25370
Daniel Veillard3d97e662004-11-04 10:49:00 +000025371 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025373}
25374
25375
25376static int
25377test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025379
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025380#ifdef LIBXML_READER_ENABLED
25381 int mem_base;
25382 int ret_val;
25383 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25384 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025385
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025386 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25387 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025388 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025389
25390 ret_val = xmlTextReaderNormalization(reader);
25391 desret_int(ret_val);
25392 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025393 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025394 xmlResetLastError();
25395 if (mem_base != xmlMemBlocks()) {
25396 printf("Leak of %d blocks found in xmlTextReaderNormalization",
25397 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025398 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025399 printf(" %d", n_reader);
25400 printf("\n");
25401 }
25402 }
25403#endif
25404
Daniel Veillard3d97e662004-11-04 10:49:00 +000025405 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025406 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025407}
25408
25409
25410static int
25411test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025412 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025413
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025414#ifdef LIBXML_READER_ENABLED
25415 int mem_base;
25416 xmlChar * ret_val;
25417 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25418 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025419
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025420 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25421 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025422 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025423
25424 ret_val = xmlTextReaderPrefix(reader);
25425 desret_xmlChar_ptr(ret_val);
25426 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025427 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025428 xmlResetLastError();
25429 if (mem_base != xmlMemBlocks()) {
25430 printf("Leak of %d blocks found in xmlTextReaderPrefix",
25431 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025432 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025433 printf(" %d", n_reader);
25434 printf("\n");
25435 }
25436 }
25437#endif
25438
Daniel Veillard3d97e662004-11-04 10:49:00 +000025439 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025441}
25442
25443
25444static int
25445test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025447
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025448#ifdef LIBXML_READER_ENABLED
25449 int mem_base;
25450 xmlNodePtr ret_val;
25451 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25452 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025453
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025454 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25455 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025456 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025457
25458 ret_val = xmlTextReaderPreserve(reader);
25459 desret_xmlNodePtr(ret_val);
25460 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025461 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025462 xmlResetLastError();
25463 if (mem_base != xmlMemBlocks()) {
25464 printf("Leak of %d blocks found in xmlTextReaderPreserve",
25465 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025466 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025467 printf(" %d", n_reader);
25468 printf("\n");
25469 }
25470 }
25471#endif
25472
Daniel Veillard3d97e662004-11-04 10:49:00 +000025473 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025475}
25476
25477
25478static int
25479test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025481
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025482#ifdef LIBXML_READER_ENABLED
25483 int mem_base;
25484 int ret_val;
25485 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25486 int n_reader;
25487 xmlChar * pattern; /* an XPath subset pattern */
25488 int n_pattern;
25489 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
25490 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025491
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025492 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25493 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
25494 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
25495 mem_base = xmlMemBlocks();
25496 reader = gen_xmlTextReaderPtr(n_reader, 0);
25497 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
25498 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
25499
25500 ret_val = xmlTextReaderPreservePattern(reader, pattern, namespaces);
25501 desret_int(ret_val);
25502 call_tests++;
25503 des_xmlTextReaderPtr(n_reader, reader, 0);
25504 des_const_xmlChar_ptr(n_pattern, pattern, 1);
25505 des_const_xmlChar_ptr_ptr(n_namespaces, namespaces, 2);
25506 xmlResetLastError();
25507 if (mem_base != xmlMemBlocks()) {
25508 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
25509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025510 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025511 printf(" %d", n_reader);
25512 printf(" %d", n_pattern);
25513 printf(" %d", n_namespaces);
25514 printf("\n");
25515 }
25516 }
25517 }
25518 }
25519#endif
25520
25521 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025523}
25524
25525
25526static int
25527test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025529
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025530#ifdef LIBXML_READER_ENABLED
25531 int mem_base;
25532 int ret_val;
25533 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25534 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025535
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025536 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25537 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025538 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025539
25540 ret_val = xmlTextReaderQuoteChar(reader);
25541 desret_int(ret_val);
25542 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025543 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025544 xmlResetLastError();
25545 if (mem_base != xmlMemBlocks()) {
25546 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
25547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025548 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025549 printf(" %d", n_reader);
25550 printf("\n");
25551 }
25552 }
25553#endif
25554
Daniel Veillard3d97e662004-11-04 10:49:00 +000025555 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025556 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025557}
25558
25559
25560static int
25561test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025562 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025563
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025564#ifdef LIBXML_READER_ENABLED
25565 int mem_base;
25566 int ret_val;
25567 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25568 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025569
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025570 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25571 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025572 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025573
25574 ret_val = xmlTextReaderRead(reader);
25575 desret_int(ret_val);
25576 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025577 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025578 xmlResetLastError();
25579 if (mem_base != xmlMemBlocks()) {
25580 printf("Leak of %d blocks found in xmlTextReaderRead",
25581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025582 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025583 printf(" %d", n_reader);
25584 printf("\n");
25585 }
25586 }
25587#endif
25588
Daniel Veillard3d97e662004-11-04 10:49:00 +000025589 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025590 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025591}
25592
25593
25594static int
25595test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025596 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025597
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025598#ifdef LIBXML_READER_ENABLED
25599 int mem_base;
25600 int ret_val;
25601 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25602 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025603
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025604 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25605 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025606 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025607
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025608 ret_val = xmlTextReaderReadAttributeValue(reader);
25609 desret_int(ret_val);
25610 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025611 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025612 xmlResetLastError();
25613 if (mem_base != xmlMemBlocks()) {
25614 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
25615 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025616 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025617 printf(" %d", n_reader);
25618 printf("\n");
25619 }
25620 }
25621#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000025622
Daniel Veillard3d97e662004-11-04 10:49:00 +000025623 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025625}
25626
25627
25628static int
25629test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025631
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025632#ifdef LIBXML_READER_ENABLED
25633 int mem_base;
25634 int ret_val;
25635 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25636 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025637
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025638 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25639 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025640 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025641
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025642 ret_val = xmlTextReaderReadState(reader);
25643 desret_int(ret_val);
25644 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025645 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025646 xmlResetLastError();
25647 if (mem_base != xmlMemBlocks()) {
25648 printf("Leak of %d blocks found in xmlTextReaderReadState",
25649 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025650 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025651 printf(" %d", n_reader);
25652 printf("\n");
25653 }
25654 }
25655#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000025656
Daniel Veillard3d97e662004-11-04 10:49:00 +000025657 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025659}
25660
25661
25662static int
25663test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025665
Daniel Veillardce682bc2004-11-05 17:22:25 +000025666#ifdef LIBXML_READER_ENABLED
25667#ifdef LIBXML_SCHEMAS_ENABLED
25668 int mem_base;
25669 int ret_val;
25670 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25671 int n_reader;
25672 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
25673 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025674
Daniel Veillardce682bc2004-11-05 17:22:25 +000025675 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25676 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
25677 mem_base = xmlMemBlocks();
25678 reader = gen_xmlTextReaderPtr(n_reader, 0);
25679 schema = gen_xmlRelaxNGPtr(n_schema, 1);
25680
25681 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
25682 desret_int(ret_val);
25683 call_tests++;
25684 des_xmlTextReaderPtr(n_reader, reader, 0);
25685 des_xmlRelaxNGPtr(n_schema, schema, 1);
25686 xmlResetLastError();
25687 if (mem_base != xmlMemBlocks()) {
25688 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
25689 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025690 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025691 printf(" %d", n_reader);
25692 printf(" %d", n_schema);
25693 printf("\n");
25694 }
25695 }
25696 }
25697#endif
25698#endif
25699
25700 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025701 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025702}
25703
25704
25705static int
25706test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025707 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025708
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025709#ifdef LIBXML_READER_ENABLED
25710#ifdef LIBXML_SCHEMAS_ENABLED
25711 int mem_base;
25712 int ret_val;
25713 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25714 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025715 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025716 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025717
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025718 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25719 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
25720 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025721 reader = gen_xmlTextReaderPtr(n_reader, 0);
25722 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025723
25724 ret_val = xmlTextReaderRelaxNGValidate(reader, rng);
25725 desret_int(ret_val);
25726 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025727 des_xmlTextReaderPtr(n_reader, reader, 0);
25728 des_const_char_ptr(n_rng, rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025729 xmlResetLastError();
25730 if (mem_base != xmlMemBlocks()) {
25731 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
25732 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025733 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025734 printf(" %d", n_reader);
25735 printf(" %d", n_rng);
25736 printf("\n");
25737 }
25738 }
25739 }
25740#endif
25741#endif
25742
Daniel Veillard3d97e662004-11-04 10:49:00 +000025743 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025745}
25746
25747
25748static int
25749test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025751
25752
25753 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000025754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025755}
25756
25757
25758static int
25759test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025761
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025762#ifdef LIBXML_READER_ENABLED
25763 int mem_base;
25764 int ret_val;
25765 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25766 int n_reader;
25767 int prop; /* the xmlParserProperties to set */
25768 int n_prop;
25769 int value; /* usually 0 or 1 to (de)activate it */
25770 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025771
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025772 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25773 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
25774 for (n_value = 0;n_value < gen_nb_int;n_value++) {
25775 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025776 reader = gen_xmlTextReaderPtr(n_reader, 0);
25777 prop = gen_int(n_prop, 1);
25778 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025779
25780 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
25781 desret_int(ret_val);
25782 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025783 des_xmlTextReaderPtr(n_reader, reader, 0);
25784 des_int(n_prop, prop, 1);
25785 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025786 xmlResetLastError();
25787 if (mem_base != xmlMemBlocks()) {
25788 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
25789 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025790 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025791 printf(" %d", n_reader);
25792 printf(" %d", n_prop);
25793 printf(" %d", n_value);
25794 printf("\n");
25795 }
25796 }
25797 }
25798 }
25799#endif
25800
Daniel Veillard3d97e662004-11-04 10:49:00 +000025801 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025802 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025803}
25804
25805
25806static int
25807test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025808 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025809
25810
25811 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000025812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025813}
25814
25815
25816static int
25817test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025819
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025820#ifdef LIBXML_READER_ENABLED
25821 int mem_base;
25822 int ret_val;
25823 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25824 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025825
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025826 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25827 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025828 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025829
25830 ret_val = xmlTextReaderStandalone(reader);
25831 desret_int(ret_val);
25832 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025833 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025834 xmlResetLastError();
25835 if (mem_base != xmlMemBlocks()) {
25836 printf("Leak of %d blocks found in xmlTextReaderStandalone",
25837 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025838 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025839 printf(" %d", n_reader);
25840 printf("\n");
25841 }
25842 }
25843#endif
25844
Daniel Veillard3d97e662004-11-04 10:49:00 +000025845 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025846 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025847}
25848
25849
25850static int
25851test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025852 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025853
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025854#ifdef LIBXML_READER_ENABLED
25855 int mem_base;
25856 xmlChar * ret_val;
25857 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25858 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025859
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025860 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25861 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025862 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025863
25864 ret_val = xmlTextReaderValue(reader);
25865 desret_xmlChar_ptr(ret_val);
25866 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025867 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025868 xmlResetLastError();
25869 if (mem_base != xmlMemBlocks()) {
25870 printf("Leak of %d blocks found in xmlTextReaderValue",
25871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025872 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025873 printf(" %d", n_reader);
25874 printf("\n");
25875 }
25876 }
25877#endif
25878
Daniel Veillard3d97e662004-11-04 10:49:00 +000025879 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025880 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025881}
25882
25883
25884static int
25885test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025886 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025887
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025888#ifdef LIBXML_READER_ENABLED
25889 int mem_base;
25890 xmlChar * ret_val;
25891 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
25892 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025893
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025894 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
25895 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025896 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025897
25898 ret_val = xmlTextReaderXmlLang(reader);
25899 desret_xmlChar_ptr(ret_val);
25900 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025901 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025902 xmlResetLastError();
25903 if (mem_base != xmlMemBlocks()) {
25904 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
25905 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025906 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000025907 printf(" %d", n_reader);
25908 printf("\n");
25909 }
25910 }
25911#endif
25912
Daniel Veillard3d97e662004-11-04 10:49:00 +000025913 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025914 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025915}
25916
25917static int
25918test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025919 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025920
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025921 printf("Testing xmlreader : 68 of 78 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000025922 test_ret += test_xmlNewTextReader();
25923 test_ret += test_xmlNewTextReaderFilename();
25924 test_ret += test_xmlReaderForDoc();
25925 test_ret += test_xmlReaderForFile();
25926 test_ret += test_xmlReaderForMemory();
25927 test_ret += test_xmlReaderNewDoc();
25928 test_ret += test_xmlReaderNewFile();
25929 test_ret += test_xmlReaderNewMemory();
25930 test_ret += test_xmlReaderNewWalker();
25931 test_ret += test_xmlReaderWalker();
25932 test_ret += test_xmlTextReaderAttributeCount();
25933 test_ret += test_xmlTextReaderBaseUri();
25934 test_ret += test_xmlTextReaderClose();
25935 test_ret += test_xmlTextReaderConstBaseUri();
25936 test_ret += test_xmlTextReaderConstEncoding();
25937 test_ret += test_xmlTextReaderConstLocalName();
25938 test_ret += test_xmlTextReaderConstName();
25939 test_ret += test_xmlTextReaderConstNamespaceUri();
25940 test_ret += test_xmlTextReaderConstPrefix();
25941 test_ret += test_xmlTextReaderConstString();
25942 test_ret += test_xmlTextReaderConstValue();
25943 test_ret += test_xmlTextReaderConstXmlLang();
25944 test_ret += test_xmlTextReaderConstXmlVersion();
25945 test_ret += test_xmlTextReaderCurrentDoc();
25946 test_ret += test_xmlTextReaderCurrentNode();
25947 test_ret += test_xmlTextReaderDepth();
25948 test_ret += test_xmlTextReaderExpand();
25949 test_ret += test_xmlTextReaderGetAttribute();
25950 test_ret += test_xmlTextReaderGetAttributeNo();
25951 test_ret += test_xmlTextReaderGetAttributeNs();
25952 test_ret += test_xmlTextReaderGetErrorHandler();
25953 test_ret += test_xmlTextReaderGetParserProp();
25954 test_ret += test_xmlTextReaderGetRemainder();
25955 test_ret += test_xmlTextReaderHasAttributes();
25956 test_ret += test_xmlTextReaderHasValue();
25957 test_ret += test_xmlTextReaderIsDefault();
25958 test_ret += test_xmlTextReaderIsEmptyElement();
25959 test_ret += test_xmlTextReaderIsNamespaceDecl();
25960 test_ret += test_xmlTextReaderIsValid();
25961 test_ret += test_xmlTextReaderLocalName();
25962 test_ret += test_xmlTextReaderLocatorBaseURI();
25963 test_ret += test_xmlTextReaderLocatorLineNumber();
25964 test_ret += test_xmlTextReaderLookupNamespace();
25965 test_ret += test_xmlTextReaderMoveToAttribute();
25966 test_ret += test_xmlTextReaderMoveToAttributeNo();
25967 test_ret += test_xmlTextReaderMoveToAttributeNs();
25968 test_ret += test_xmlTextReaderMoveToElement();
25969 test_ret += test_xmlTextReaderMoveToFirstAttribute();
25970 test_ret += test_xmlTextReaderMoveToNextAttribute();
25971 test_ret += test_xmlTextReaderName();
25972 test_ret += test_xmlTextReaderNamespaceUri();
25973 test_ret += test_xmlTextReaderNext();
25974 test_ret += test_xmlTextReaderNextSibling();
25975 test_ret += test_xmlTextReaderNodeType();
25976 test_ret += test_xmlTextReaderNormalization();
25977 test_ret += test_xmlTextReaderPrefix();
25978 test_ret += test_xmlTextReaderPreserve();
25979 test_ret += test_xmlTextReaderPreservePattern();
25980 test_ret += test_xmlTextReaderQuoteChar();
25981 test_ret += test_xmlTextReaderRead();
25982 test_ret += test_xmlTextReaderReadAttributeValue();
25983 test_ret += test_xmlTextReaderReadState();
25984 test_ret += test_xmlTextReaderRelaxNGSetSchema();
25985 test_ret += test_xmlTextReaderRelaxNGValidate();
25986 test_ret += test_xmlTextReaderSetErrorHandler();
25987 test_ret += test_xmlTextReaderSetParserProp();
25988 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
25989 test_ret += test_xmlTextReaderStandalone();
25990 test_ret += test_xmlTextReaderValue();
25991 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000025992
Daniel Veillard42595322004-11-08 10:52:06 +000025993 if (test_ret != 0)
25994 printf("Module xmlreader: %d errors\n", test_ret);
25995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025996}
25997
Daniel Veillardce682bc2004-11-05 17:22:25 +000025998#define gen_nb_xmlSaveCtxtPtr 1
25999static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26000 return(NULL);
26001}
26002static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26003}
26004
Daniel Veillardd93f6252004-11-02 15:53:51 +000026005static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000026006test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026008
Daniel Veillardce682bc2004-11-05 17:22:25 +000026009#ifdef LIBXML_OUTPUT_ENABLED
26010 int mem_base;
26011 int ret_val;
26012 xmlSaveCtxtPtr ctxt; /* a document saving context */
26013 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026014
Daniel Veillardce682bc2004-11-05 17:22:25 +000026015 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
26016 mem_base = xmlMemBlocks();
26017 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
26018
26019 ret_val = xmlSaveClose(ctxt);
26020 desret_int(ret_val);
26021 call_tests++;
26022 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
26023 xmlResetLastError();
26024 if (mem_base != xmlMemBlocks()) {
26025 printf("Leak of %d blocks found in xmlSaveClose",
26026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026027 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026028 printf(" %d", n_ctxt);
26029 printf("\n");
26030 }
26031 }
26032#endif
26033
26034 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026036}
26037
26038
26039static int
26040test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026042
Daniel Veillardce682bc2004-11-05 17:22:25 +000026043#ifdef LIBXML_OUTPUT_ENABLED
26044 int mem_base;
26045 long ret_val;
26046 xmlSaveCtxtPtr ctxt; /* a document saving context */
26047 int n_ctxt;
26048 xmlDocPtr doc; /* a document */
26049 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026050
Daniel Veillardce682bc2004-11-05 17:22:25 +000026051 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
26052 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26053 mem_base = xmlMemBlocks();
26054 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
26055 doc = gen_xmlDocPtr(n_doc, 1);
26056
26057 ret_val = xmlSaveDoc(ctxt, doc);
26058 desret_long(ret_val);
26059 call_tests++;
26060 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
26061 des_xmlDocPtr(n_doc, doc, 1);
26062 xmlResetLastError();
26063 if (mem_base != xmlMemBlocks()) {
26064 printf("Leak of %d blocks found in xmlSaveDoc",
26065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026066 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026067 printf(" %d", n_ctxt);
26068 printf(" %d", n_doc);
26069 printf("\n");
26070 }
26071 }
26072 }
26073#endif
26074
26075 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026076 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026077}
26078
26079
26080static int
26081test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026082 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026083
Daniel Veillardce682bc2004-11-05 17:22:25 +000026084#ifdef LIBXML_OUTPUT_ENABLED
26085 int mem_base;
26086 int ret_val;
26087 xmlSaveCtxtPtr ctxt; /* a document saving context */
26088 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026089
Daniel Veillardce682bc2004-11-05 17:22:25 +000026090 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
26091 mem_base = xmlMemBlocks();
26092 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
26093
26094 ret_val = xmlSaveFlush(ctxt);
26095 desret_int(ret_val);
26096 call_tests++;
26097 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
26098 xmlResetLastError();
26099 if (mem_base != xmlMemBlocks()) {
26100 printf("Leak of %d blocks found in xmlSaveFlush",
26101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026102 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026103 printf(" %d", n_ctxt);
26104 printf("\n");
26105 }
26106 }
26107#endif
26108
26109 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026111}
26112
26113
26114static int
26115test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026117
26118
26119 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026121}
26122
26123
26124static int
26125test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026127
26128
26129 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026131}
26132
26133
26134static int
26135test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026137
26138
26139 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026141}
26142
26143
26144static int
26145test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026147
26148
26149 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026151}
26152
26153
26154static int
26155test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026157
Daniel Veillardce682bc2004-11-05 17:22:25 +000026158#ifdef LIBXML_OUTPUT_ENABLED
26159 int mem_base;
26160 long ret_val;
26161 xmlSaveCtxtPtr ctxt; /* a document saving context */
26162 int n_ctxt;
26163 xmlNodePtr node; /* a document */
26164 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026165
Daniel Veillardce682bc2004-11-05 17:22:25 +000026166 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
26167 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
26168 mem_base = xmlMemBlocks();
26169 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
26170 node = gen_xmlNodePtr(n_node, 1);
26171
26172 ret_val = xmlSaveTree(ctxt, node);
26173 desret_long(ret_val);
26174 call_tests++;
26175 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
26176 des_xmlNodePtr(n_node, node, 1);
26177 xmlResetLastError();
26178 if (mem_base != xmlMemBlocks()) {
26179 printf("Leak of %d blocks found in xmlSaveTree",
26180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026181 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026182 printf(" %d", n_ctxt);
26183 printf(" %d", n_node);
26184 printf("\n");
26185 }
26186 }
26187 }
26188#endif
26189
26190 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026191 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026192}
26193
26194static int
26195test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026197
Daniel Veillardce682bc2004-11-05 17:22:25 +000026198 printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026199 test_ret += test_xmlSaveClose();
26200 test_ret += test_xmlSaveDoc();
26201 test_ret += test_xmlSaveFlush();
26202 test_ret += test_xmlSaveSetAttrEscape();
26203 test_ret += test_xmlSaveSetEscape();
26204 test_ret += test_xmlSaveToFd();
26205 test_ret += test_xmlSaveToFilename();
26206 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026207
Daniel Veillard42595322004-11-08 10:52:06 +000026208 if (test_ret != 0)
26209 printf("Module xmlsave: %d errors\n", test_ret);
26210 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026211}
26212
Daniel Veillardce682bc2004-11-05 17:22:25 +000026213#define gen_nb_xmlSchemaPtr 1
26214static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26215 return(NULL);
26216}
26217static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26218}
26219
Daniel Veillardd93f6252004-11-02 15:53:51 +000026220static int
26221test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026222 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026223
Daniel Veillardce682bc2004-11-05 17:22:25 +000026224#ifdef LIBXML_SCHEMAS_ENABLED
26225#ifdef LIBXML_OUTPUT_ENABLED
26226 int mem_base;
26227 FILE * output; /* the file output */
26228 int n_output;
26229 xmlSchemaPtr schema; /* a schema structure */
26230 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026231
Daniel Veillardce682bc2004-11-05 17:22:25 +000026232 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
26233 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
26234 mem_base = xmlMemBlocks();
26235 output = gen_FILE_ptr(n_output, 0);
26236 schema = gen_xmlSchemaPtr(n_schema, 1);
26237
26238 xmlSchemaDump(output, schema);
26239 call_tests++;
26240 des_FILE_ptr(n_output, output, 0);
26241 des_xmlSchemaPtr(n_schema, schema, 1);
26242 xmlResetLastError();
26243 if (mem_base != xmlMemBlocks()) {
26244 printf("Leak of %d blocks found in xmlSchemaDump",
26245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026246 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026247 printf(" %d", n_output);
26248 printf(" %d", n_schema);
26249 printf("\n");
26250 }
26251 }
26252 }
26253#endif
26254#endif
26255
26256 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026257 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026258}
26259
26260
Daniel Veillardce682bc2004-11-05 17:22:25 +000026261#define gen_nb_xmlSchemaParserCtxtPtr 1
26262static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26263 return(NULL);
26264}
26265static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26266}
26267
26268#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
26269static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26270 return(NULL);
26271}
26272static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26273}
26274
26275#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
26276static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26277 return(NULL);
26278}
26279static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26280}
26281
Daniel Veillardd93f6252004-11-02 15:53:51 +000026282static int
26283test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026284 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026285
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026286#ifdef LIBXML_SCHEMAS_ENABLED
26287 int mem_base;
26288 int ret_val;
26289 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
26290 int n_ctxt;
26291 xmlSchemaValidityErrorFunc * err; /* the error callback result */
26292 int n_err;
26293 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
26294 int n_warn;
26295 void ** ctx; /* contextual data for the callbacks result */
26296 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026297
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026298 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
26299 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
26300 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
26301 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
26302 mem_base = xmlMemBlocks();
26303 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
26304 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
26305 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
26306 ctx = gen_void_ptr_ptr(n_ctx, 3);
26307
26308 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
26309 desret_int(ret_val);
26310 call_tests++;
26311 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
26312 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
26313 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
26314 des_void_ptr_ptr(n_ctx, ctx, 3);
26315 xmlResetLastError();
26316 if (mem_base != xmlMemBlocks()) {
26317 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
26318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026319 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026320 printf(" %d", n_ctxt);
26321 printf(" %d", n_err);
26322 printf(" %d", n_warn);
26323 printf(" %d", n_ctx);
26324 printf("\n");
26325 }
26326 }
26327 }
26328 }
26329 }
26330#endif
26331
26332 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026334}
26335
26336
Daniel Veillardce682bc2004-11-05 17:22:25 +000026337#define gen_nb_xmlSchemaValidCtxtPtr 1
26338static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26339 return(NULL);
26340}
26341static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26342}
26343
Daniel Veillardd93f6252004-11-02 15:53:51 +000026344static int
26345test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026347
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026348#ifdef LIBXML_SCHEMAS_ENABLED
26349 int mem_base;
26350 int ret_val;
26351 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
26352 int n_ctxt;
26353 xmlSchemaValidityErrorFunc * err; /* the error function result */
26354 int n_err;
26355 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
26356 int n_warn;
26357 void ** ctx; /* the functions context result */
26358 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026359
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026360 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
26361 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
26362 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
26363 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
26364 mem_base = xmlMemBlocks();
26365 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
26366 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
26367 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
26368 ctx = gen_void_ptr_ptr(n_ctx, 3);
26369
26370 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
26371 desret_int(ret_val);
26372 call_tests++;
26373 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
26374 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
26375 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
26376 des_void_ptr_ptr(n_ctx, ctx, 3);
26377 xmlResetLastError();
26378 if (mem_base != xmlMemBlocks()) {
26379 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
26380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026381 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026382 printf(" %d", n_ctxt);
26383 printf(" %d", n_err);
26384 printf(" %d", n_warn);
26385 printf(" %d", n_ctx);
26386 printf("\n");
26387 }
26388 }
26389 }
26390 }
26391 }
26392#endif
26393
26394 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026395 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026396}
26397
26398
26399static int
26400test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026401 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026402
Daniel Veillard42595322004-11-08 10:52:06 +000026403#ifdef LIBXML_SCHEMAS_ENABLED
26404 int mem_base;
26405 xmlSchemaParserCtxtPtr ret_val;
26406 xmlDocPtr doc; /* a preparsed document tree */
26407 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026408
Daniel Veillard42595322004-11-08 10:52:06 +000026409 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26410 mem_base = xmlMemBlocks();
26411 doc = gen_xmlDocPtr(n_doc, 0);
26412
26413 ret_val = xmlSchemaNewDocParserCtxt(doc);
26414 desret_xmlSchemaParserCtxtPtr(ret_val);
26415 call_tests++;
26416 des_xmlDocPtr(n_doc, doc, 0);
26417 xmlResetLastError();
26418 if (mem_base != xmlMemBlocks()) {
26419 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
26420 xmlMemBlocks() - mem_base);
26421 test_ret++;
26422 printf(" %d", n_doc);
26423 printf("\n");
26424 }
26425 }
26426#endif
26427
26428 function_tests++;
26429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026430}
26431
26432
26433static int
26434test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026436
Daniel Veillard42595322004-11-08 10:52:06 +000026437#ifdef LIBXML_SCHEMAS_ENABLED
26438 int mem_base;
26439 xmlSchemaParserCtxtPtr ret_val;
26440 char * buffer; /* a pointer to a char array containing the schemas */
26441 int n_buffer;
26442 int size; /* the size of the array */
26443 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026444
Daniel Veillard42595322004-11-08 10:52:06 +000026445 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
26446 for (n_size = 0;n_size < gen_nb_int;n_size++) {
26447 mem_base = xmlMemBlocks();
26448 buffer = gen_const_char_ptr(n_buffer, 0);
26449 size = gen_int(n_size, 1);
26450
26451 ret_val = xmlSchemaNewMemParserCtxt(buffer, size);
26452 desret_xmlSchemaParserCtxtPtr(ret_val);
26453 call_tests++;
26454 des_const_char_ptr(n_buffer, buffer, 0);
26455 des_int(n_size, size, 1);
26456 xmlResetLastError();
26457 if (mem_base != xmlMemBlocks()) {
26458 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
26459 xmlMemBlocks() - mem_base);
26460 test_ret++;
26461 printf(" %d", n_buffer);
26462 printf(" %d", n_size);
26463 printf("\n");
26464 }
26465 }
26466 }
26467#endif
26468
26469 function_tests++;
26470 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026471}
26472
26473
26474static int
26475test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026476 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026477
Daniel Veillard42595322004-11-08 10:52:06 +000026478#ifdef LIBXML_SCHEMAS_ENABLED
26479 int mem_base;
26480 xmlSchemaParserCtxtPtr ret_val;
26481 char * URL; /* the location of the schema */
26482 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026483
Daniel Veillard42595322004-11-08 10:52:06 +000026484 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
26485 mem_base = xmlMemBlocks();
26486 URL = gen_const_char_ptr(n_URL, 0);
26487
26488 ret_val = xmlSchemaNewParserCtxt(URL);
26489 desret_xmlSchemaParserCtxtPtr(ret_val);
26490 call_tests++;
26491 des_const_char_ptr(n_URL, URL, 0);
26492 xmlResetLastError();
26493 if (mem_base != xmlMemBlocks()) {
26494 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
26495 xmlMemBlocks() - mem_base);
26496 test_ret++;
26497 printf(" %d", n_URL);
26498 printf("\n");
26499 }
26500 }
26501#endif
26502
26503 function_tests++;
26504 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026505}
26506
26507
26508static int
26509test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026510 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026511
26512
26513 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026515}
26516
26517
26518static int
26519test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026520 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026521
26522
26523 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026524 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026525}
26526
26527
26528static int
26529test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026530 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026531
26532
26533 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026534 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026535}
26536
26537
26538static int
26539test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026540 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026541
26542
26543 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026545}
26546
26547
26548static int
26549test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026551
Daniel Veillardce682bc2004-11-05 17:22:25 +000026552#ifdef LIBXML_SCHEMAS_ENABLED
26553 int mem_base;
26554 int ret_val;
26555 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
26556 int n_ctxt;
26557 int options; /* a combination of xmlSchemaValidOption */
26558 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026559
Daniel Veillardce682bc2004-11-05 17:22:25 +000026560 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
26561 for (n_options = 0;n_options < gen_nb_int;n_options++) {
26562 mem_base = xmlMemBlocks();
26563 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
26564 options = gen_int(n_options, 1);
26565
26566 ret_val = xmlSchemaSetValidOptions(ctxt, options);
26567 desret_int(ret_val);
26568 call_tests++;
26569 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
26570 des_int(n_options, options, 1);
26571 xmlResetLastError();
26572 if (mem_base != xmlMemBlocks()) {
26573 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
26574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026575 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026576 printf(" %d", n_ctxt);
26577 printf(" %d", n_options);
26578 printf("\n");
26579 }
26580 }
26581 }
26582#endif
26583
26584 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026586}
26587
26588
26589static int
26590test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026592
Daniel Veillardce682bc2004-11-05 17:22:25 +000026593#ifdef LIBXML_SCHEMAS_ENABLED
26594 int mem_base;
26595 int ret_val;
26596 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
26597 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026598
Daniel Veillardce682bc2004-11-05 17:22:25 +000026599 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
26600 mem_base = xmlMemBlocks();
26601 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
26602
26603 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
26604 desret_int(ret_val);
26605 call_tests++;
26606 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
26607 xmlResetLastError();
26608 if (mem_base != xmlMemBlocks()) {
26609 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
26610 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026611 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026612 printf(" %d", n_ctxt);
26613 printf("\n");
26614 }
26615 }
26616#endif
26617
26618 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026620}
26621
26622
26623static int
26624test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026626
Daniel Veillardce682bc2004-11-05 17:22:25 +000026627#ifdef LIBXML_SCHEMAS_ENABLED
26628 int mem_base;
26629 int ret_val;
26630 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
26631 int n_ctxt;
26632 xmlDocPtr doc; /* a parsed document tree */
26633 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026634
Daniel Veillardce682bc2004-11-05 17:22:25 +000026635 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
26636 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26637 mem_base = xmlMemBlocks();
26638 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
26639 doc = gen_xmlDocPtr(n_doc, 1);
26640
26641 ret_val = xmlSchemaValidateDoc(ctxt, doc);
26642 desret_int(ret_val);
26643 call_tests++;
26644 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
26645 des_xmlDocPtr(n_doc, doc, 1);
26646 xmlResetLastError();
26647 if (mem_base != xmlMemBlocks()) {
26648 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
26649 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026650 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026651 printf(" %d", n_ctxt);
26652 printf(" %d", n_doc);
26653 printf("\n");
26654 }
26655 }
26656 }
26657#endif
26658
26659 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026661}
26662
26663
26664static int
26665test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026667
Daniel Veillardce682bc2004-11-05 17:22:25 +000026668#ifdef LIBXML_SCHEMAS_ENABLED
26669 int mem_base;
26670 int ret_val;
26671 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
26672 int n_ctxt;
26673 xmlNodePtr elem; /* an element node */
26674 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026675
Daniel Veillardce682bc2004-11-05 17:22:25 +000026676 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
26677 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
26678 mem_base = xmlMemBlocks();
26679 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
26680 elem = gen_xmlNodePtr(n_elem, 1);
26681
26682 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
26683 desret_int(ret_val);
26684 call_tests++;
26685 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
26686 des_xmlNodePtr(n_elem, elem, 1);
26687 xmlResetLastError();
26688 if (mem_base != xmlMemBlocks()) {
26689 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
26690 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026691 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026692 printf(" %d", n_ctxt);
26693 printf(" %d", n_elem);
26694 printf("\n");
26695 }
26696 }
26697 }
26698#endif
26699
26700 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026701 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026702}
26703
26704
26705static int
26706test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026707 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026708
Daniel Veillardce682bc2004-11-05 17:22:25 +000026709#ifdef LIBXML_SCHEMAS_ENABLED
26710 int mem_base;
26711 int ret_val;
26712 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
26713 int n_ctxt;
26714 xmlParserInputBufferPtr input; /* the input to use for reading the data */
26715 int n_input;
26716 xmlCharEncoding enc; /* an optional encoding information */
26717 int n_enc;
26718 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
26719 int n_sax;
26720 void * user_data; /* the context to provide to the SAX handler. */
26721 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026722
Daniel Veillardce682bc2004-11-05 17:22:25 +000026723 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
26724 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
26725 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26726 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
26727 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
26728 mem_base = xmlMemBlocks();
26729 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
26730 input = gen_xmlParserInputBufferPtr(n_input, 1);
26731 enc = gen_xmlCharEncoding(n_enc, 2);
26732 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
26733 user_data = gen_userdata(n_user_data, 4);
26734
26735 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
26736 desret_int(ret_val);
26737 call_tests++;
26738 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
26739 des_xmlParserInputBufferPtr(n_input, input, 1);
26740 des_xmlCharEncoding(n_enc, enc, 2);
26741 des_xmlSAXHandlerPtr(n_sax, sax, 3);
26742 des_userdata(n_user_data, user_data, 4);
26743 xmlResetLastError();
26744 if (mem_base != xmlMemBlocks()) {
26745 printf("Leak of %d blocks found in xmlSchemaValidateStream",
26746 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026747 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026748 printf(" %d", n_ctxt);
26749 printf(" %d", n_input);
26750 printf(" %d", n_enc);
26751 printf(" %d", n_sax);
26752 printf(" %d", n_user_data);
26753 printf("\n");
26754 }
26755 }
26756 }
26757 }
26758 }
26759 }
26760#endif
26761
26762 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026764}
26765
26766static int
26767test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026769
Daniel Veillard42595322004-11-08 10:52:06 +000026770 printf("Testing xmlschemas : 11 of 18 functions ...\n");
26771 test_ret += test_xmlSchemaDump();
26772 test_ret += test_xmlSchemaGetParserErrors();
26773 test_ret += test_xmlSchemaGetValidErrors();
26774 test_ret += test_xmlSchemaNewDocParserCtxt();
26775 test_ret += test_xmlSchemaNewMemParserCtxt();
26776 test_ret += test_xmlSchemaNewParserCtxt();
26777 test_ret += test_xmlSchemaNewValidCtxt();
26778 test_ret += test_xmlSchemaParse();
26779 test_ret += test_xmlSchemaSetParserErrors();
26780 test_ret += test_xmlSchemaSetValidErrors();
26781 test_ret += test_xmlSchemaSetValidOptions();
26782 test_ret += test_xmlSchemaValidCtxtGetOptions();
26783 test_ret += test_xmlSchemaValidateDoc();
26784 test_ret += test_xmlSchemaValidateOneElement();
26785 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026786
Daniel Veillard42595322004-11-08 10:52:06 +000026787 if (test_ret != 0)
26788 printf("Module xmlschemas: %d errors\n", test_ret);
26789 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026790}
26791
Daniel Veillardce682bc2004-11-05 17:22:25 +000026792#define gen_nb_xmlSchemaFacetPtr 1
26793static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26794 return(NULL);
26795}
26796static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26797}
26798
26799#define gen_nb_xmlSchemaTypePtr 1
26800static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26801 return(NULL);
26802}
26803static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26804}
26805
Daniel Veillardd93f6252004-11-02 15:53:51 +000026806static int
26807test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026808 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026809
Daniel Veillardce682bc2004-11-05 17:22:25 +000026810#ifdef LIBXML_SCHEMAS_ENABLED
26811 int mem_base;
26812 int ret_val;
26813 xmlSchemaFacetPtr facet; /* the facet */
26814 int n_facet;
26815 xmlSchemaTypePtr typeDecl; /* the schema type definition */
26816 int n_typeDecl;
26817 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
26818 int n_ctxt;
26819 xmlChar * name; /* name of the type */
26820 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026821
Daniel Veillardce682bc2004-11-05 17:22:25 +000026822 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
26823 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
26824 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
26825 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
26826 mem_base = xmlMemBlocks();
26827 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
26828 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
26829 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
26830 name = gen_const_xmlChar_ptr(n_name, 3);
26831
26832 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, name);
26833 desret_int(ret_val);
26834 call_tests++;
26835 des_xmlSchemaFacetPtr(n_facet, facet, 0);
26836 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
26837 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
26838 des_const_xmlChar_ptr(n_name, name, 3);
26839 xmlResetLastError();
26840 if (mem_base != xmlMemBlocks()) {
26841 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
26842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026843 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026844 printf(" %d", n_facet);
26845 printf(" %d", n_typeDecl);
26846 printf(" %d", n_ctxt);
26847 printf(" %d", n_name);
26848 printf("\n");
26849 }
26850 }
26851 }
26852 }
26853 }
26854#endif
26855
26856 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026858}
26859
26860
26861static int
26862test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026864
26865#ifdef LIBXML_SCHEMAS_ENABLED
26866 int mem_base;
26867
26868 mem_base = xmlMemBlocks();
26869
26870 xmlSchemaCleanupTypes();
26871 call_tests++;
26872 xmlResetLastError();
26873 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026874 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026875 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026876 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026877 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026878 }
26879#endif
26880
Daniel Veillard3d97e662004-11-04 10:49:00 +000026881 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026883}
26884
26885
26886static int
26887test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026889
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026890#ifdef LIBXML_SCHEMAS_ENABLED
26891 int mem_base;
26892 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026893 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026894 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026895
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026896 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
26897 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026898 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026899
26900 ret_val = xmlSchemaCollapseString(value);
26901 desret_xmlChar_ptr(ret_val);
26902 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026903 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026904 xmlResetLastError();
26905 if (mem_base != xmlMemBlocks()) {
26906 printf("Leak of %d blocks found in xmlSchemaCollapseString",
26907 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026908 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026909 printf(" %d", n_value);
26910 printf("\n");
26911 }
26912 }
26913#endif
26914
Daniel Veillard3d97e662004-11-04 10:49:00 +000026915 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026916 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026917}
26918
26919
Daniel Veillardce682bc2004-11-05 17:22:25 +000026920#define gen_nb_xmlSchemaValPtr 1
26921static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26922 return(NULL);
26923}
26924static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26925}
26926
Daniel Veillardd93f6252004-11-02 15:53:51 +000026927static int
26928test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026929 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026930
Daniel Veillardce682bc2004-11-05 17:22:25 +000026931#ifdef LIBXML_SCHEMAS_ENABLED
26932 int mem_base;
26933 int ret_val;
26934 xmlSchemaValPtr x; /* a first value */
26935 int n_x;
26936 xmlSchemaValPtr y; /* a second value */
26937 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026938
Daniel Veillardce682bc2004-11-05 17:22:25 +000026939 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
26940 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
26941 mem_base = xmlMemBlocks();
26942 x = gen_xmlSchemaValPtr(n_x, 0);
26943 y = gen_xmlSchemaValPtr(n_y, 1);
26944
26945 ret_val = xmlSchemaCompareValues(x, y);
26946 desret_int(ret_val);
26947 call_tests++;
26948 des_xmlSchemaValPtr(n_x, x, 0);
26949 des_xmlSchemaValPtr(n_y, y, 1);
26950 xmlResetLastError();
26951 if (mem_base != xmlMemBlocks()) {
26952 printf("Leak of %d blocks found in xmlSchemaCompareValues",
26953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026954 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026955 printf(" %d", n_x);
26956 printf(" %d", n_y);
26957 printf("\n");
26958 }
26959 }
26960 }
26961#endif
26962
26963 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026964 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026965}
26966
26967
26968static int
26969test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026970 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026971
Daniel Veillard42595322004-11-08 10:52:06 +000026972#ifdef LIBXML_SCHEMAS_ENABLED
26973 int mem_base;
26974 xmlSchemaTypePtr ret_val;
26975 xmlSchemaTypePtr type; /* the built-in simple type. */
26976 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026977
Daniel Veillard42595322004-11-08 10:52:06 +000026978 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
26979 mem_base = xmlMemBlocks();
26980 type = gen_xmlSchemaTypePtr(n_type, 0);
26981
26982 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
26983 desret_xmlSchemaTypePtr(ret_val);
26984 call_tests++;
26985 des_xmlSchemaTypePtr(n_type, type, 0);
26986 xmlResetLastError();
26987 if (mem_base != xmlMemBlocks()) {
26988 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
26989 xmlMemBlocks() - mem_base);
26990 test_ret++;
26991 printf(" %d", n_type);
26992 printf("\n");
26993 }
26994 }
26995#endif
26996
26997 function_tests++;
26998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026999}
27000
27001
27002static int
27003test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027005
Daniel Veillard42595322004-11-08 10:52:06 +000027006#ifdef LIBXML_SCHEMAS_ENABLED
27007 xmlSchemaTypePtr ret_val;
27008 xmlSchemaValType type; /* the type of the built in type */
27009 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027010
Daniel Veillard42595322004-11-08 10:52:06 +000027011 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
27012 type = gen_xmlSchemaValType(n_type, 0);
27013
27014 ret_val = xmlSchemaGetBuiltInType(type);
27015 desret_xmlSchemaTypePtr(ret_val);
27016 call_tests++;
27017 des_xmlSchemaValType(n_type, type, 0);
27018 xmlResetLastError();
27019 }
27020#endif
27021
27022 function_tests++;
27023 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027024}
27025
27026
27027static int
27028test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027029 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027030
27031
27032 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027033 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027034}
27035
27036
27037static int
27038test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027040
Daniel Veillard42595322004-11-08 10:52:06 +000027041#ifdef LIBXML_SCHEMAS_ENABLED
27042 int mem_base;
27043 xmlSchemaTypePtr ret_val;
27044 xmlChar * name; /* the type name */
27045 int n_name;
27046 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
27047 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027048
Daniel Veillard42595322004-11-08 10:52:06 +000027049 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
27050 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
27051 mem_base = xmlMemBlocks();
27052 name = gen_const_xmlChar_ptr(n_name, 0);
27053 ns = gen_const_xmlChar_ptr(n_ns, 1);
27054
27055 ret_val = xmlSchemaGetPredefinedType(name, ns);
27056 desret_xmlSchemaTypePtr(ret_val);
27057 call_tests++;
27058 des_const_xmlChar_ptr(n_name, name, 0);
27059 des_const_xmlChar_ptr(n_ns, ns, 1);
27060 xmlResetLastError();
27061 if (mem_base != xmlMemBlocks()) {
27062 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
27063 xmlMemBlocks() - mem_base);
27064 test_ret++;
27065 printf(" %d", n_name);
27066 printf(" %d", n_ns);
27067 printf("\n");
27068 }
27069 }
27070 }
27071#endif
27072
27073 function_tests++;
27074 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027075}
27076
27077
27078static int
27079test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027080 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027081
27082#ifdef LIBXML_SCHEMAS_ENABLED
27083
27084
27085 xmlSchemaInitTypes();
27086 call_tests++;
27087 xmlResetLastError();
27088#endif
27089
Daniel Veillard3d97e662004-11-04 10:49:00 +000027090 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027092}
27093
27094
27095static int
27096test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027098
Daniel Veillardce682bc2004-11-05 17:22:25 +000027099#ifdef LIBXML_SCHEMAS_ENABLED
27100 int mem_base;
27101 int ret_val;
27102 xmlSchemaTypePtr type; /* the built-in type */
27103 int n_type;
27104 int facetType; /* the facet type */
27105 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027106
Daniel Veillardce682bc2004-11-05 17:22:25 +000027107 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
27108 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
27109 mem_base = xmlMemBlocks();
27110 type = gen_xmlSchemaTypePtr(n_type, 0);
27111 facetType = gen_int(n_facetType, 1);
27112
27113 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
27114 desret_int(ret_val);
27115 call_tests++;
27116 des_xmlSchemaTypePtr(n_type, type, 0);
27117 des_int(n_facetType, facetType, 1);
27118 xmlResetLastError();
27119 if (mem_base != xmlMemBlocks()) {
27120 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
27121 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027122 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027123 printf(" %d", n_type);
27124 printf(" %d", n_facetType);
27125 printf("\n");
27126 }
27127 }
27128 }
27129#endif
27130
27131 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027133}
27134
27135
27136static int
27137test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027139
27140
27141 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027143}
27144
27145
Daniel Veillardce682bc2004-11-05 17:22:25 +000027146#define gen_nb_xmlSchemaValPtr_ptr 1
27147static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27148 return(NULL);
27149}
27150static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27151}
27152
Daniel Veillardd93f6252004-11-02 15:53:51 +000027153static int
27154test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027156
Daniel Veillardce682bc2004-11-05 17:22:25 +000027157#ifdef LIBXML_SCHEMAS_ENABLED
27158 int mem_base;
27159 int ret_val;
27160 xmlSchemaTypePtr type; /* the predefined type */
27161 int n_type;
27162 xmlChar * value; /* the value to check */
27163 int n_value;
27164 xmlSchemaValPtr * val; /* the return computed value */
27165 int n_val;
27166 xmlNodePtr node; /* the node containing the value */
27167 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027168
Daniel Veillardce682bc2004-11-05 17:22:25 +000027169 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
27170 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
27171 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
27172 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
27173 mem_base = xmlMemBlocks();
27174 type = gen_xmlSchemaTypePtr(n_type, 0);
27175 value = gen_const_xmlChar_ptr(n_value, 1);
27176 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
27177 node = gen_xmlNodePtr(n_node, 3);
27178
27179 ret_val = xmlSchemaValPredefTypeNode(type, value, val, node);
27180 desret_int(ret_val);
27181 call_tests++;
27182 des_xmlSchemaTypePtr(n_type, type, 0);
27183 des_const_xmlChar_ptr(n_value, value, 1);
27184 des_xmlSchemaValPtr_ptr(n_val, val, 2);
27185 des_xmlNodePtr(n_node, node, 3);
27186 xmlResetLastError();
27187 if (mem_base != xmlMemBlocks()) {
27188 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
27189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027190 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027191 printf(" %d", n_type);
27192 printf(" %d", n_value);
27193 printf(" %d", n_val);
27194 printf(" %d", n_node);
27195 printf("\n");
27196 }
27197 }
27198 }
27199 }
27200 }
27201#endif
27202
27203 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027204 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027205}
27206
27207
27208static int
27209test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027210 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027211
Daniel Veillardce682bc2004-11-05 17:22:25 +000027212#ifdef LIBXML_SCHEMAS_ENABLED
27213 int mem_base;
27214 int ret_val;
27215 xmlSchemaTypePtr type; /* the predefined type */
27216 int n_type;
27217 xmlChar * value; /* the value to check */
27218 int n_value;
27219 xmlSchemaValPtr * val; /* the return computed value */
27220 int n_val;
27221 xmlNodePtr node; /* the node containing the value */
27222 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027223
Daniel Veillardce682bc2004-11-05 17:22:25 +000027224 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
27225 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
27226 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
27227 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
27228 mem_base = xmlMemBlocks();
27229 type = gen_xmlSchemaTypePtr(n_type, 0);
27230 value = gen_const_xmlChar_ptr(n_value, 1);
27231 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
27232 node = gen_xmlNodePtr(n_node, 3);
27233
27234 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, value, val, node);
27235 desret_int(ret_val);
27236 call_tests++;
27237 des_xmlSchemaTypePtr(n_type, type, 0);
27238 des_const_xmlChar_ptr(n_value, value, 1);
27239 des_xmlSchemaValPtr_ptr(n_val, val, 2);
27240 des_xmlNodePtr(n_node, node, 3);
27241 xmlResetLastError();
27242 if (mem_base != xmlMemBlocks()) {
27243 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
27244 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027245 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027246 printf(" %d", n_type);
27247 printf(" %d", n_value);
27248 printf(" %d", n_val);
27249 printf(" %d", n_node);
27250 printf("\n");
27251 }
27252 }
27253 }
27254 }
27255 }
27256#endif
27257
27258 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027259 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027260}
27261
27262
27263static int
27264test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027265 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027266
Daniel Veillardce682bc2004-11-05 17:22:25 +000027267#ifdef LIBXML_SCHEMAS_ENABLED
27268 int mem_base;
27269 int ret_val;
27270 xmlSchemaTypePtr base; /* the base type */
27271 int n_base;
27272 xmlSchemaFacetPtr facet; /* the facet to check */
27273 int n_facet;
27274 xmlChar * value; /* the lexical repr of the value to validate */
27275 int n_value;
27276 xmlSchemaValPtr val; /* the precomputed value */
27277 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027278
Daniel Veillardce682bc2004-11-05 17:22:25 +000027279 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
27280 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
27281 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
27282 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
27283 mem_base = xmlMemBlocks();
27284 base = gen_xmlSchemaTypePtr(n_base, 0);
27285 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
27286 value = gen_const_xmlChar_ptr(n_value, 2);
27287 val = gen_xmlSchemaValPtr(n_val, 3);
27288
27289 ret_val = xmlSchemaValidateFacet(base, facet, value, val);
27290 desret_int(ret_val);
27291 call_tests++;
27292 des_xmlSchemaTypePtr(n_base, base, 0);
27293 des_xmlSchemaFacetPtr(n_facet, facet, 1);
27294 des_const_xmlChar_ptr(n_value, value, 2);
27295 des_xmlSchemaValPtr(n_val, val, 3);
27296 xmlResetLastError();
27297 if (mem_base != xmlMemBlocks()) {
27298 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
27299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027300 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027301 printf(" %d", n_base);
27302 printf(" %d", n_facet);
27303 printf(" %d", n_value);
27304 printf(" %d", n_val);
27305 printf("\n");
27306 }
27307 }
27308 }
27309 }
27310 }
27311#endif
27312
27313 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027315}
27316
27317
27318static int
27319test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027320 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027321
Daniel Veillardce682bc2004-11-05 17:22:25 +000027322#ifdef LIBXML_SCHEMAS_ENABLED
27323 int mem_base;
27324 int ret_val;
27325 xmlSchemaTypePtr type; /* the built-in type */
27326 int n_type;
27327 xmlSchemaFacetPtr facet; /* the facet to check */
27328 int n_facet;
27329 xmlChar * value; /* the lexical repr. of the value to be validated */
27330 int n_value;
27331 xmlSchemaValPtr val; /* the precomputed value */
27332 int n_val;
27333 unsigned long * length; /* the actual length of the value */
27334 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027335
Daniel Veillardce682bc2004-11-05 17:22:25 +000027336 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
27337 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
27338 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
27339 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
27340 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
27341 mem_base = xmlMemBlocks();
27342 type = gen_xmlSchemaTypePtr(n_type, 0);
27343 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
27344 value = gen_const_xmlChar_ptr(n_value, 2);
27345 val = gen_xmlSchemaValPtr(n_val, 3);
27346 length = gen_unsigned_long_ptr(n_length, 4);
27347
27348 ret_val = xmlSchemaValidateLengthFacet(type, facet, value, val, length);
27349 desret_int(ret_val);
27350 call_tests++;
27351 des_xmlSchemaTypePtr(n_type, type, 0);
27352 des_xmlSchemaFacetPtr(n_facet, facet, 1);
27353 des_const_xmlChar_ptr(n_value, value, 2);
27354 des_xmlSchemaValPtr(n_val, val, 3);
27355 des_unsigned_long_ptr(n_length, length, 4);
27356 xmlResetLastError();
27357 if (mem_base != xmlMemBlocks()) {
27358 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
27359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027360 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027361 printf(" %d", n_type);
27362 printf(" %d", n_facet);
27363 printf(" %d", n_value);
27364 printf(" %d", n_val);
27365 printf(" %d", n_length);
27366 printf("\n");
27367 }
27368 }
27369 }
27370 }
27371 }
27372 }
27373#endif
27374
27375 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027376 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027377}
27378
27379
27380static int
27381test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027382 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027383
Daniel Veillardce682bc2004-11-05 17:22:25 +000027384#ifdef LIBXML_SCHEMAS_ENABLED
27385 int mem_base;
27386 int ret_val;
27387 xmlSchemaFacetPtr facet; /* the facet to check */
27388 int n_facet;
27389 xmlChar * value; /* the lexical repr of the value to validate */
27390 int n_value;
27391 unsigned long actualLen; /* the number of list items */
27392 int n_actualLen;
27393 unsigned long * expectedLen; /* the resulting expected number of list items */
27394 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027395
Daniel Veillardce682bc2004-11-05 17:22:25 +000027396 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
27397 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
27398 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
27399 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
27400 mem_base = xmlMemBlocks();
27401 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
27402 value = gen_const_xmlChar_ptr(n_value, 1);
27403 actualLen = gen_unsigned_long(n_actualLen, 2);
27404 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
27405
27406 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, value, actualLen, expectedLen);
27407 desret_int(ret_val);
27408 call_tests++;
27409 des_xmlSchemaFacetPtr(n_facet, facet, 0);
27410 des_const_xmlChar_ptr(n_value, value, 1);
27411 des_unsigned_long(n_actualLen, actualLen, 2);
27412 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
27413 xmlResetLastError();
27414 if (mem_base != xmlMemBlocks()) {
27415 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
27416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027417 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027418 printf(" %d", n_facet);
27419 printf(" %d", n_value);
27420 printf(" %d", n_actualLen);
27421 printf(" %d", n_expectedLen);
27422 printf("\n");
27423 }
27424 }
27425 }
27426 }
27427 }
27428#endif
27429
27430 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027431 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027432}
27433
27434
27435static int
27436test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027437 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027438
Daniel Veillardce682bc2004-11-05 17:22:25 +000027439#ifdef LIBXML_SCHEMAS_ENABLED
27440 int mem_base;
27441 int ret_val;
27442 xmlSchemaTypePtr type; /* the predefined type */
27443 int n_type;
27444 xmlChar * value; /* the value to check */
27445 int n_value;
27446 xmlSchemaValPtr * val; /* the return computed value */
27447 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027448
Daniel Veillardce682bc2004-11-05 17:22:25 +000027449 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
27450 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
27451 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
27452 mem_base = xmlMemBlocks();
27453 type = gen_xmlSchemaTypePtr(n_type, 0);
27454 value = gen_const_xmlChar_ptr(n_value, 1);
27455 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
27456
27457 ret_val = xmlSchemaValidatePredefinedType(type, value, val);
27458 desret_int(ret_val);
27459 call_tests++;
27460 des_xmlSchemaTypePtr(n_type, type, 0);
27461 des_const_xmlChar_ptr(n_value, value, 1);
27462 des_xmlSchemaValPtr_ptr(n_val, val, 2);
27463 xmlResetLastError();
27464 if (mem_base != xmlMemBlocks()) {
27465 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
27466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027467 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027468 printf(" %d", n_type);
27469 printf(" %d", n_value);
27470 printf(" %d", n_val);
27471 printf("\n");
27472 }
27473 }
27474 }
27475 }
27476#endif
27477
27478 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027479 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027480}
27481
27482static int
27483test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027484 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027485
Daniel Veillard42595322004-11-08 10:52:06 +000027486 printf("Testing xmlschemastypes : 15 of 19 functions ...\n");
27487 test_ret += test_xmlSchemaCheckFacet();
27488 test_ret += test_xmlSchemaCleanupTypes();
27489 test_ret += test_xmlSchemaCollapseString();
27490 test_ret += test_xmlSchemaCompareValues();
27491 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
27492 test_ret += test_xmlSchemaGetBuiltInType();
27493 test_ret += test_xmlSchemaGetFacetValueAsULong();
27494 test_ret += test_xmlSchemaGetPredefinedType();
27495 test_ret += test_xmlSchemaInitTypes();
27496 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
27497 test_ret += test_xmlSchemaNewFacet();
27498 test_ret += test_xmlSchemaValPredefTypeNode();
27499 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
27500 test_ret += test_xmlSchemaValidateFacet();
27501 test_ret += test_xmlSchemaValidateLengthFacet();
27502 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
27503 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027504
Daniel Veillard42595322004-11-08 10:52:06 +000027505 if (test_ret != 0)
27506 printf("Module xmlschemastypes: %d errors\n", test_ret);
27507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027508}
27509
27510static int
27511test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027513
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027514 int mem_base;
27515 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027516 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027517 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027518
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027519 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
27520 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027521 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027522
27523 ret_val = xmlCharStrdup(cur);
27524 desret_xmlChar_ptr(ret_val);
27525 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027526 des_const_char_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027527 xmlResetLastError();
27528 if (mem_base != xmlMemBlocks()) {
27529 printf("Leak of %d blocks found in xmlCharStrdup",
27530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027531 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027532 printf(" %d", n_cur);
27533 printf("\n");
27534 }
27535 }
27536
Daniel Veillard3d97e662004-11-04 10:49:00 +000027537 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027539}
27540
27541
27542static int
27543test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027545
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027546 int mem_base;
27547 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027548 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027549 int n_cur;
27550 int len; /* the len of @cur */
27551 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027552
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027553 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
27554 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27555 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027556 cur = gen_const_char_ptr(n_cur, 0);
27557 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027558
27559 ret_val = xmlCharStrndup(cur, len);
27560 desret_xmlChar_ptr(ret_val);
27561 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027562 des_const_char_ptr(n_cur, cur, 0);
27563 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027564 xmlResetLastError();
27565 if (mem_base != xmlMemBlocks()) {
27566 printf("Leak of %d blocks found in xmlCharStrndup",
27567 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027568 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027569 printf(" %d", n_cur);
27570 printf(" %d", n_len);
27571 printf("\n");
27572 }
27573 }
27574 }
27575
Daniel Veillard3d97e662004-11-04 10:49:00 +000027576 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027577 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027578}
27579
27580
27581static int
27582test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027583 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027584
Daniel Veillardce682bc2004-11-05 17:22:25 +000027585 int mem_base;
27586 int ret_val;
27587 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
27588 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027589
Daniel Veillardce682bc2004-11-05 17:22:25 +000027590 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
27591 mem_base = xmlMemBlocks();
27592 utf = gen_const_unsigned_char_ptr(n_utf, 0);
27593
27594 ret_val = xmlCheckUTF8(utf);
27595 desret_int(ret_val);
27596 call_tests++;
27597 des_const_unsigned_char_ptr(n_utf, utf, 0);
27598 xmlResetLastError();
27599 if (mem_base != xmlMemBlocks()) {
27600 printf("Leak of %d blocks found in xmlCheckUTF8",
27601 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027602 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027603 printf(" %d", n_utf);
27604 printf("\n");
27605 }
27606 }
27607
27608 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027610}
27611
27612
27613static int
27614test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027616
Daniel Veillardce682bc2004-11-05 17:22:25 +000027617 int mem_base;
27618 int ret_val;
27619 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
27620 int n_utf;
27621 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. */
27622 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027623
Daniel Veillardce682bc2004-11-05 17:22:25 +000027624 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
27625 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
27626 mem_base = xmlMemBlocks();
27627 utf = gen_const_unsigned_char_ptr(n_utf, 0);
27628 len = gen_int_ptr(n_len, 1);
27629
27630 ret_val = xmlGetUTF8Char(utf, len);
27631 desret_int(ret_val);
27632 call_tests++;
27633 des_const_unsigned_char_ptr(n_utf, utf, 0);
27634 des_int_ptr(n_len, len, 1);
27635 xmlResetLastError();
27636 if (mem_base != xmlMemBlocks()) {
27637 printf("Leak of %d blocks found in xmlGetUTF8Char",
27638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027639 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027640 printf(" %d", n_utf);
27641 printf(" %d", n_len);
27642 printf("\n");
27643 }
27644 }
27645 }
27646
27647 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027649}
27650
27651
27652static int
27653test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027655
27656 int mem_base;
27657 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027658 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000027659 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027660 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000027661 int n_str2;
27662
27663 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
27664 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
27665 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027666 str1 = gen_const_xmlChar_ptr(n_str1, 0);
27667 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027668
27669 ret_val = xmlStrEqual(str1, str2);
27670 desret_int(ret_val);
27671 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027672 des_const_xmlChar_ptr(n_str1, str1, 0);
27673 des_const_xmlChar_ptr(n_str2, str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027674 xmlResetLastError();
27675 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027676 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027677 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027678 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027679 printf(" %d", n_str1);
27680 printf(" %d", n_str2);
27681 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027682 }
27683 }
27684 }
27685
Daniel Veillard3d97e662004-11-04 10:49:00 +000027686 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027688}
27689
27690
27691static int
27692test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027694
27695
27696 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027698}
27699
27700
27701static int
27702test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027704
27705 int mem_base;
27706 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027707 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000027708 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027709 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000027710 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027711 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000027712 int n_str;
27713
27714 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
27715 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
27716 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
27717 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027718 pref = gen_const_xmlChar_ptr(n_pref, 0);
27719 name = gen_const_xmlChar_ptr(n_name, 1);
27720 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027721
27722 ret_val = xmlStrQEqual(pref, name, str);
27723 desret_int(ret_val);
27724 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027725 des_const_xmlChar_ptr(n_pref, pref, 0);
27726 des_const_xmlChar_ptr(n_name, name, 1);
27727 des_const_xmlChar_ptr(n_str, str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027728 xmlResetLastError();
27729 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027730 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027731 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027732 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027733 printf(" %d", n_pref);
27734 printf(" %d", n_name);
27735 printf(" %d", n_str);
27736 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027737 }
27738 }
27739 }
27740 }
27741
Daniel Veillard3d97e662004-11-04 10:49:00 +000027742 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027744}
27745
27746
27747static int
27748test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027750
27751
27752 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027754}
27755
27756
27757static int
27758test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027760
27761 int mem_base;
27762 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027763 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000027764 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027765 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000027766 int n_str2;
27767
27768 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
27769 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
27770 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027771 str1 = gen_const_xmlChar_ptr(n_str1, 0);
27772 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027773
27774 ret_val = xmlStrcasecmp(str1, str2);
27775 desret_int(ret_val);
27776 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027777 des_const_xmlChar_ptr(n_str1, str1, 0);
27778 des_const_xmlChar_ptr(n_str2, str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027779 xmlResetLastError();
27780 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027781 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027782 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027783 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027784 printf(" %d", n_str1);
27785 printf(" %d", n_str2);
27786 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027787 }
27788 }
27789 }
27790
Daniel Veillard3d97e662004-11-04 10:49:00 +000027791 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027792 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027793}
27794
27795
27796static int
27797test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027798 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027799
Daniel Veillardd005b9e2004-11-03 17:07:05 +000027800 int mem_base;
27801 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027802 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000027803 int n_str;
27804 xmlChar * val; /* the xmlChar to search (needle) */
27805 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027806
Daniel Veillardd005b9e2004-11-03 17:07:05 +000027807 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
27808 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
27809 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027810 str = gen_const_xmlChar_ptr(n_str, 0);
27811 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000027812
27813 ret_val = xmlStrcasestr(str, val);
27814 desret_const_xmlChar_ptr(ret_val);
27815 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027816 des_const_xmlChar_ptr(n_str, str, 0);
27817 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000027818 xmlResetLastError();
27819 if (mem_base != xmlMemBlocks()) {
27820 printf("Leak of %d blocks found in xmlStrcasestr",
27821 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027822 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000027823 printf(" %d", n_str);
27824 printf(" %d", n_val);
27825 printf("\n");
27826 }
27827 }
27828 }
27829
Daniel Veillard3d97e662004-11-04 10:49:00 +000027830 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027831 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027832}
27833
27834
27835static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000027836test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027837 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027838
27839
27840 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027841 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027842}
27843
27844
27845static int
27846test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027847 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027848
27849 int mem_base;
27850 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027851 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000027852 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027853 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000027854 int n_str2;
27855
27856 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
27857 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
27858 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027859 str1 = gen_const_xmlChar_ptr(n_str1, 0);
27860 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027861
27862 ret_val = xmlStrcmp(str1, str2);
27863 desret_int(ret_val);
27864 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027865 des_const_xmlChar_ptr(n_str1, str1, 0);
27866 des_const_xmlChar_ptr(n_str2, str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027867 xmlResetLastError();
27868 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027869 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027870 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027871 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027872 printf(" %d", n_str1);
27873 printf(" %d", n_str2);
27874 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027875 }
27876 }
27877 }
27878
Daniel Veillard3d97e662004-11-04 10:49:00 +000027879 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027880 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027881}
27882
27883
27884static int
27885test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027886 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027887
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027888 int mem_base;
27889 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027890 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027891 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027892
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027893 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
27894 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027895 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027896
27897 ret_val = xmlStrdup(cur);
27898 desret_xmlChar_ptr(ret_val);
27899 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027900 des_const_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027901 xmlResetLastError();
27902 if (mem_base != xmlMemBlocks()) {
27903 printf("Leak of %d blocks found in xmlStrdup",
27904 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027905 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027906 printf(" %d", n_cur);
27907 printf("\n");
27908 }
27909 }
27910
Daniel Veillard3d97e662004-11-04 10:49:00 +000027911 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027913}
27914
27915
27916static int
27917test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027919
27920 int mem_base;
27921 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027922 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000027923 int n_str;
27924
27925 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
27926 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027927 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027928
27929 ret_val = xmlStrlen(str);
27930 desret_int(ret_val);
27931 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027932 des_const_xmlChar_ptr(n_str, str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027933 xmlResetLastError();
27934 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027935 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027936 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027937 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027938 printf(" %d", n_str);
27939 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027940 }
27941 }
27942
Daniel Veillard3d97e662004-11-04 10:49:00 +000027943 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027944 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027945}
27946
27947
27948static int
27949test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027950 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027951
27952 int mem_base;
27953 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027954 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000027955 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027956 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000027957 int n_str2;
27958 int len; /* the max comparison length */
27959 int n_len;
27960
27961 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
27962 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
27963 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27964 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027965 str1 = gen_const_xmlChar_ptr(n_str1, 0);
27966 str2 = gen_const_xmlChar_ptr(n_str2, 1);
27967 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027968
27969 ret_val = xmlStrncasecmp(str1, str2, len);
27970 desret_int(ret_val);
27971 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027972 des_const_xmlChar_ptr(n_str1, str1, 0);
27973 des_const_xmlChar_ptr(n_str2, str2, 1);
27974 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027975 xmlResetLastError();
27976 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027977 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027979 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027980 printf(" %d", n_str1);
27981 printf(" %d", n_str2);
27982 printf(" %d", n_len);
27983 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027984 }
27985 }
27986 }
27987 }
27988
Daniel Veillard3d97e662004-11-04 10:49:00 +000027989 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027991}
27992
27993
27994static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000027995test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027997
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027998 int mem_base;
27999 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028000 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028001 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028002 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028003 int n_str2;
28004 int len; /* the len of @str2 */
28005 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028006
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028007 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
28008 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
28009 for (n_len = 0;n_len < gen_nb_int;n_len++) {
28010 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028011 str1 = gen_const_xmlChar_ptr(n_str1, 0);
28012 str2 = gen_const_xmlChar_ptr(n_str2, 1);
28013 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028014
28015 ret_val = xmlStrncatNew(str1, str2, len);
28016 desret_xmlChar_ptr(ret_val);
28017 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028018 des_const_xmlChar_ptr(n_str1, str1, 0);
28019 des_const_xmlChar_ptr(n_str2, str2, 1);
28020 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028021 xmlResetLastError();
28022 if (mem_base != xmlMemBlocks()) {
28023 printf("Leak of %d blocks found in xmlStrncatNew",
28024 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028025 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028026 printf(" %d", n_str1);
28027 printf(" %d", n_str2);
28028 printf(" %d", n_len);
28029 printf("\n");
28030 }
28031 }
28032 }
28033 }
28034
Daniel Veillard3d97e662004-11-04 10:49:00 +000028035 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028036 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028037}
28038
28039
28040static int
28041test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028042 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028043
28044 int mem_base;
28045 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028046 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000028047 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028048 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000028049 int n_str2;
28050 int len; /* the max comparison length */
28051 int n_len;
28052
28053 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
28054 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
28055 for (n_len = 0;n_len < gen_nb_int;n_len++) {
28056 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028057 str1 = gen_const_xmlChar_ptr(n_str1, 0);
28058 str2 = gen_const_xmlChar_ptr(n_str2, 1);
28059 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028060
28061 ret_val = xmlStrncmp(str1, str2, len);
28062 desret_int(ret_val);
28063 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028064 des_const_xmlChar_ptr(n_str1, str1, 0);
28065 des_const_xmlChar_ptr(n_str2, str2, 1);
28066 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028067 xmlResetLastError();
28068 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000028069 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000028070 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028071 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000028072 printf(" %d", n_str1);
28073 printf(" %d", n_str2);
28074 printf(" %d", n_len);
28075 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000028076 }
28077 }
28078 }
28079 }
28080
Daniel Veillard3d97e662004-11-04 10:49:00 +000028081 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028083}
28084
28085
28086static int
28087test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028089
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028090 int mem_base;
28091 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028092 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028093 int n_cur;
28094 int len; /* the len of @cur */
28095 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028096
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028097 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28098 for (n_len = 0;n_len < gen_nb_int;n_len++) {
28099 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028100 cur = gen_const_xmlChar_ptr(n_cur, 0);
28101 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028102
28103 ret_val = xmlStrndup(cur, len);
28104 desret_xmlChar_ptr(ret_val);
28105 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028106 des_const_xmlChar_ptr(n_cur, cur, 0);
28107 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028108 xmlResetLastError();
28109 if (mem_base != xmlMemBlocks()) {
28110 printf("Leak of %d blocks found in xmlStrndup",
28111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028112 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028113 printf(" %d", n_cur);
28114 printf(" %d", n_len);
28115 printf("\n");
28116 }
28117 }
28118 }
28119
Daniel Veillard3d97e662004-11-04 10:49:00 +000028120 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028122}
28123
28124
28125static int
28126test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028128
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028129 int mem_base;
28130 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028131 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028132 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028133 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028134 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028135
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028136 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
28137 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
28138 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028139 str = gen_const_xmlChar_ptr(n_str, 0);
28140 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028141
28142 ret_val = xmlStrstr(str, val);
28143 desret_const_xmlChar_ptr(ret_val);
28144 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028145 des_const_xmlChar_ptr(n_str, str, 0);
28146 des_const_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028147 xmlResetLastError();
28148 if (mem_base != xmlMemBlocks()) {
28149 printf("Leak of %d blocks found in xmlStrstr",
28150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028151 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028152 printf(" %d", n_str);
28153 printf(" %d", n_val);
28154 printf("\n");
28155 }
28156 }
28157 }
28158
Daniel Veillard3d97e662004-11-04 10:49:00 +000028159 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028160 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028161}
28162
28163
28164static int
28165test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028166 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028167
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028168 int mem_base;
28169 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028170 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028171 int n_str;
28172 int start; /* the index of the first char (zero based) */
28173 int n_start;
28174 int len; /* the length of the substring */
28175 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028176
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028177 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
28178 for (n_start = 0;n_start < gen_nb_int;n_start++) {
28179 for (n_len = 0;n_len < gen_nb_int;n_len++) {
28180 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028181 str = gen_const_xmlChar_ptr(n_str, 0);
28182 start = gen_int(n_start, 1);
28183 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028184
28185 ret_val = xmlStrsub(str, start, len);
28186 desret_xmlChar_ptr(ret_val);
28187 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028188 des_const_xmlChar_ptr(n_str, str, 0);
28189 des_int(n_start, start, 1);
28190 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028191 xmlResetLastError();
28192 if (mem_base != xmlMemBlocks()) {
28193 printf("Leak of %d blocks found in xmlStrsub",
28194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028195 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028196 printf(" %d", n_str);
28197 printf(" %d", n_start);
28198 printf(" %d", n_len);
28199 printf("\n");
28200 }
28201 }
28202 }
28203 }
28204
Daniel Veillard3d97e662004-11-04 10:49:00 +000028205 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028206 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028207}
28208
28209
28210static int
28211test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028212 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028213
28214 int mem_base;
28215 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028216 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000028217 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028218 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000028219 int n_utf2;
28220
28221 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
28222 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
28223 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028224 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
28225 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028226
28227 ret_val = xmlUTF8Charcmp(utf1, utf2);
28228 desret_int(ret_val);
28229 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028230 des_const_xmlChar_ptr(n_utf1, utf1, 0);
28231 des_const_xmlChar_ptr(n_utf2, utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028232 xmlResetLastError();
28233 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000028234 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000028235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028236 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000028237 printf(" %d", n_utf1);
28238 printf(" %d", n_utf2);
28239 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000028240 }
28241 }
28242 }
28243
Daniel Veillard3d97e662004-11-04 10:49:00 +000028244 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028246}
28247
28248
28249static int
28250test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028252
28253 int mem_base;
28254 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028255 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000028256 int n_utf;
28257
28258 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
28259 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028260 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028261
28262 ret_val = xmlUTF8Size(utf);
28263 desret_int(ret_val);
28264 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028265 des_const_xmlChar_ptr(n_utf, utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028266 xmlResetLastError();
28267 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000028268 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000028269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028270 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000028271 printf(" %d", n_utf);
28272 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000028273 }
28274 }
28275
Daniel Veillard3d97e662004-11-04 10:49:00 +000028276 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028278}
28279
28280
28281static int
28282test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028284
28285 int mem_base;
28286 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028287 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000028288 int n_utf;
28289
28290 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
28291 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028292 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028293
28294 ret_val = xmlUTF8Strlen(utf);
28295 desret_int(ret_val);
28296 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028297 des_const_xmlChar_ptr(n_utf, utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028298 xmlResetLastError();
28299 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000028300 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000028301 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028302 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000028303 printf(" %d", n_utf);
28304 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000028305 }
28306 }
28307
Daniel Veillard3d97e662004-11-04 10:49:00 +000028308 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028309 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028310}
28311
28312
28313static int
28314test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028315 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028316
28317 int mem_base;
28318 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028319 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000028320 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028321 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000028322 int n_utfchar;
28323
28324 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
28325 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
28326 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028327 utf = gen_const_xmlChar_ptr(n_utf, 0);
28328 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028329
28330 ret_val = xmlUTF8Strloc(utf, utfchar);
28331 desret_int(ret_val);
28332 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028333 des_const_xmlChar_ptr(n_utf, utf, 0);
28334 des_const_xmlChar_ptr(n_utfchar, utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028335 xmlResetLastError();
28336 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000028337 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000028338 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028339 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000028340 printf(" %d", n_utf);
28341 printf(" %d", n_utfchar);
28342 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000028343 }
28344 }
28345 }
28346
Daniel Veillard3d97e662004-11-04 10:49:00 +000028347 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028349}
28350
28351
28352static int
28353test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028355
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028356 int mem_base;
28357 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028358 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028359 int n_utf;
28360 int len; /* the len of @utf (in chars) */
28361 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028362
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028363 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
28364 for (n_len = 0;n_len < gen_nb_int;n_len++) {
28365 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028366 utf = gen_const_xmlChar_ptr(n_utf, 0);
28367 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028368
28369 ret_val = xmlUTF8Strndup(utf, len);
28370 desret_xmlChar_ptr(ret_val);
28371 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028372 des_const_xmlChar_ptr(n_utf, utf, 0);
28373 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028374 xmlResetLastError();
28375 if (mem_base != xmlMemBlocks()) {
28376 printf("Leak of %d blocks found in xmlUTF8Strndup",
28377 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028378 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028379 printf(" %d", n_utf);
28380 printf(" %d", n_len);
28381 printf("\n");
28382 }
28383 }
28384 }
28385
Daniel Veillard3d97e662004-11-04 10:49:00 +000028386 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028388}
28389
28390
28391static int
28392test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028394
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028395 int mem_base;
28396 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028397 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028398 int n_utf;
28399 int pos; /* the position of the desired UTF8 char (in chars) */
28400 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028401
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028402 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
28403 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
28404 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028405 utf = gen_const_xmlChar_ptr(n_utf, 0);
28406 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028407
28408 ret_val = xmlUTF8Strpos(utf, pos);
28409 desret_const_xmlChar_ptr(ret_val);
28410 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028411 des_const_xmlChar_ptr(n_utf, utf, 0);
28412 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028413 xmlResetLastError();
28414 if (mem_base != xmlMemBlocks()) {
28415 printf("Leak of %d blocks found in xmlUTF8Strpos",
28416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028417 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028418 printf(" %d", n_utf);
28419 printf(" %d", n_pos);
28420 printf("\n");
28421 }
28422 }
28423 }
28424
Daniel Veillard3d97e662004-11-04 10:49:00 +000028425 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028426 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028427}
28428
28429
28430static int
28431test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028432 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028433
28434 int mem_base;
28435 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028436 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000028437 int n_utf;
28438 int len; /* the number of characters in the array */
28439 int n_len;
28440
28441 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
28442 for (n_len = 0;n_len < gen_nb_int;n_len++) {
28443 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028444 utf = gen_const_xmlChar_ptr(n_utf, 0);
28445 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028446
28447 ret_val = xmlUTF8Strsize(utf, len);
28448 desret_int(ret_val);
28449 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028450 des_const_xmlChar_ptr(n_utf, utf, 0);
28451 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028452 xmlResetLastError();
28453 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000028454 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000028455 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028456 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000028457 printf(" %d", n_utf);
28458 printf(" %d", n_len);
28459 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000028460 }
28461 }
28462 }
28463
Daniel Veillard3d97e662004-11-04 10:49:00 +000028464 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028465 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028466}
28467
28468
28469static int
28470test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028471 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028472
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028473 int mem_base;
28474 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028475 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028476 int n_utf;
28477 int start; /* relative pos of first char */
28478 int n_start;
28479 int len; /* total number to copy */
28480 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028481
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028482 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
28483 for (n_start = 0;n_start < gen_nb_int;n_start++) {
28484 for (n_len = 0;n_len < gen_nb_int;n_len++) {
28485 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028486 utf = gen_const_xmlChar_ptr(n_utf, 0);
28487 start = gen_int(n_start, 1);
28488 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028489
28490 ret_val = xmlUTF8Strsub(utf, start, len);
28491 desret_xmlChar_ptr(ret_val);
28492 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028493 des_const_xmlChar_ptr(n_utf, utf, 0);
28494 des_int(n_start, start, 1);
28495 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028496 xmlResetLastError();
28497 if (mem_base != xmlMemBlocks()) {
28498 printf("Leak of %d blocks found in xmlUTF8Strsub",
28499 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028500 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000028501 printf(" %d", n_utf);
28502 printf(" %d", n_start);
28503 printf(" %d", n_len);
28504 printf("\n");
28505 }
28506 }
28507 }
28508 }
28509
Daniel Veillard3d97e662004-11-04 10:49:00 +000028510 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028511 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028512}
28513
28514static int
28515test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028516 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028517
Daniel Veillardce682bc2004-11-05 17:22:25 +000028518 printf("Testing xmlstring : 25 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028519 test_ret += test_xmlCharStrdup();
28520 test_ret += test_xmlCharStrndup();
28521 test_ret += test_xmlCheckUTF8();
28522 test_ret += test_xmlGetUTF8Char();
28523 test_ret += test_xmlStrEqual();
28524 test_ret += test_xmlStrPrintf();
28525 test_ret += test_xmlStrQEqual();
28526 test_ret += test_xmlStrVPrintf();
28527 test_ret += test_xmlStrcasecmp();
28528 test_ret += test_xmlStrcasestr();
28529 test_ret += test_xmlStrchr();
28530 test_ret += test_xmlStrcmp();
28531 test_ret += test_xmlStrdup();
28532 test_ret += test_xmlStrlen();
28533 test_ret += test_xmlStrncasecmp();
28534 test_ret += test_xmlStrncatNew();
28535 test_ret += test_xmlStrncmp();
28536 test_ret += test_xmlStrndup();
28537 test_ret += test_xmlStrstr();
28538 test_ret += test_xmlStrsub();
28539 test_ret += test_xmlUTF8Charcmp();
28540 test_ret += test_xmlUTF8Size();
28541 test_ret += test_xmlUTF8Strlen();
28542 test_ret += test_xmlUTF8Strloc();
28543 test_ret += test_xmlUTF8Strndup();
28544 test_ret += test_xmlUTF8Strpos();
28545 test_ret += test_xmlUTF8Strsize();
28546 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028547
Daniel Veillard42595322004-11-08 10:52:06 +000028548 if (test_ret != 0)
28549 printf("Module xmlstring: %d errors\n", test_ret);
28550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028551}
28552
28553static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028554test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028555 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028556
28557#ifdef LIBXML_UNICODE_ENABLED
28558 int mem_base;
28559 int ret_val;
28560 int code; /* UCS code point */
28561 int n_code;
28562
28563 for (n_code = 0;n_code < gen_nb_int;n_code++) {
28564 mem_base = xmlMemBlocks();
28565 code = gen_int(n_code, 0);
28566
28567 ret_val = xmlUCSIsAegeanNumbers(code);
28568 desret_int(ret_val);
28569 call_tests++;
28570 des_int(n_code, code, 0);
28571 xmlResetLastError();
28572 if (mem_base != xmlMemBlocks()) {
28573 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
28574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028575 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028576 printf(" %d", n_code);
28577 printf("\n");
28578 }
28579 }
28580#endif
28581
28582 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028583 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028584}
28585
28586
28587static int
28588test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028589 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028590
28591#ifdef LIBXML_UNICODE_ENABLED
28592 int mem_base;
28593 int ret_val;
28594 int code; /* UCS code point */
28595 int n_code;
28596
28597 for (n_code = 0;n_code < gen_nb_int;n_code++) {
28598 mem_base = xmlMemBlocks();
28599 code = gen_int(n_code, 0);
28600
28601 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
28602 desret_int(ret_val);
28603 call_tests++;
28604 des_int(n_code, code, 0);
28605 xmlResetLastError();
28606 if (mem_base != xmlMemBlocks()) {
28607 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
28608 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028609 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028610 printf(" %d", n_code);
28611 printf("\n");
28612 }
28613 }
28614#endif
28615
28616 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028617 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028618}
28619
28620
28621static int
28622test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028623 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028624
28625#ifdef LIBXML_UNICODE_ENABLED
28626 int mem_base;
28627 int ret_val;
28628 int code; /* UCS code point */
28629 int n_code;
28630
28631 for (n_code = 0;n_code < gen_nb_int;n_code++) {
28632 mem_base = xmlMemBlocks();
28633 code = gen_int(n_code, 0);
28634
28635 ret_val = xmlUCSIsArabic(code);
28636 desret_int(ret_val);
28637 call_tests++;
28638 des_int(n_code, code, 0);
28639 xmlResetLastError();
28640 if (mem_base != xmlMemBlocks()) {
28641 printf("Leak of %d blocks found in xmlUCSIsArabic",
28642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028643 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028644 printf(" %d", n_code);
28645 printf("\n");
28646 }
28647 }
28648#endif
28649
28650 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028651 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028652}
28653
28654
28655static int
28656test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028657 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028658
28659#ifdef LIBXML_UNICODE_ENABLED
28660 int mem_base;
28661 int ret_val;
28662 int code; /* UCS code point */
28663 int n_code;
28664
28665 for (n_code = 0;n_code < gen_nb_int;n_code++) {
28666 mem_base = xmlMemBlocks();
28667 code = gen_int(n_code, 0);
28668
28669 ret_val = xmlUCSIsArabicPresentationFormsA(code);
28670 desret_int(ret_val);
28671 call_tests++;
28672 des_int(n_code, code, 0);
28673 xmlResetLastError();
28674 if (mem_base != xmlMemBlocks()) {
28675 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
28676 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028677 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028678 printf(" %d", n_code);
28679 printf("\n");
28680 }
28681 }
28682#endif
28683
28684 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028685 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028686}
28687
28688
28689static int
28690test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028691 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028692
28693#ifdef LIBXML_UNICODE_ENABLED
28694 int mem_base;
28695 int ret_val;
28696 int code; /* UCS code point */
28697 int n_code;
28698
28699 for (n_code = 0;n_code < gen_nb_int;n_code++) {
28700 mem_base = xmlMemBlocks();
28701 code = gen_int(n_code, 0);
28702
28703 ret_val = xmlUCSIsArabicPresentationFormsB(code);
28704 desret_int(ret_val);
28705 call_tests++;
28706 des_int(n_code, code, 0);
28707 xmlResetLastError();
28708 if (mem_base != xmlMemBlocks()) {
28709 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
28710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028711 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028712 printf(" %d", n_code);
28713 printf("\n");
28714 }
28715 }
28716#endif
28717
28718 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028719 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028720}
28721
28722
28723static int
28724test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028725 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028726
28727#ifdef LIBXML_UNICODE_ENABLED
28728 int mem_base;
28729 int ret_val;
28730 int code; /* UCS code point */
28731 int n_code;
28732
28733 for (n_code = 0;n_code < gen_nb_int;n_code++) {
28734 mem_base = xmlMemBlocks();
28735 code = gen_int(n_code, 0);
28736
28737 ret_val = xmlUCSIsArmenian(code);
28738 desret_int(ret_val);
28739 call_tests++;
28740 des_int(n_code, code, 0);
28741 xmlResetLastError();
28742 if (mem_base != xmlMemBlocks()) {
28743 printf("Leak of %d blocks found in xmlUCSIsArmenian",
28744 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028745 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028746 printf(" %d", n_code);
28747 printf("\n");
28748 }
28749 }
28750#endif
28751
28752 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028753 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028754}
28755
28756
28757static int
28758test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028759 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028760
28761#ifdef LIBXML_UNICODE_ENABLED
28762 int mem_base;
28763 int ret_val;
28764 int code; /* UCS code point */
28765 int n_code;
28766
28767 for (n_code = 0;n_code < gen_nb_int;n_code++) {
28768 mem_base = xmlMemBlocks();
28769 code = gen_int(n_code, 0);
28770
28771 ret_val = xmlUCSIsArrows(code);
28772 desret_int(ret_val);
28773 call_tests++;
28774 des_int(n_code, code, 0);
28775 xmlResetLastError();
28776 if (mem_base != xmlMemBlocks()) {
28777 printf("Leak of %d blocks found in xmlUCSIsArrows",
28778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028779 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028780 printf(" %d", n_code);
28781 printf("\n");
28782 }
28783 }
28784#endif
28785
28786 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028787 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028788}
28789
28790
28791static int
28792test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028793 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028794
28795#ifdef LIBXML_UNICODE_ENABLED
28796 int mem_base;
28797 int ret_val;
28798 int code; /* UCS code point */
28799 int n_code;
28800
28801 for (n_code = 0;n_code < gen_nb_int;n_code++) {
28802 mem_base = xmlMemBlocks();
28803 code = gen_int(n_code, 0);
28804
28805 ret_val = xmlUCSIsBasicLatin(code);
28806 desret_int(ret_val);
28807 call_tests++;
28808 des_int(n_code, code, 0);
28809 xmlResetLastError();
28810 if (mem_base != xmlMemBlocks()) {
28811 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
28812 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028813 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028814 printf(" %d", n_code);
28815 printf("\n");
28816 }
28817 }
28818#endif
28819
28820 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028821 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028822}
28823
28824
28825static int
28826test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028827 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028828
28829#ifdef LIBXML_UNICODE_ENABLED
28830 int mem_base;
28831 int ret_val;
28832 int code; /* UCS code point */
28833 int n_code;
28834
28835 for (n_code = 0;n_code < gen_nb_int;n_code++) {
28836 mem_base = xmlMemBlocks();
28837 code = gen_int(n_code, 0);
28838
28839 ret_val = xmlUCSIsBengali(code);
28840 desret_int(ret_val);
28841 call_tests++;
28842 des_int(n_code, code, 0);
28843 xmlResetLastError();
28844 if (mem_base != xmlMemBlocks()) {
28845 printf("Leak of %d blocks found in xmlUCSIsBengali",
28846 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028847 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028848 printf(" %d", n_code);
28849 printf("\n");
28850 }
28851 }
28852#endif
28853
28854 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028855 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028856}
28857
28858
28859static int
28860test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028861 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028862
28863#ifdef LIBXML_UNICODE_ENABLED
28864 int mem_base;
28865 int ret_val;
28866 int code; /* UCS code point */
28867 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028868 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028869 int n_block;
28870
28871 for (n_code = 0;n_code < gen_nb_int;n_code++) {
28872 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
28873 mem_base = xmlMemBlocks();
28874 code = gen_int(n_code, 0);
28875 block = gen_const_char_ptr(n_block, 1);
28876
28877 ret_val = xmlUCSIsBlock(code, block);
28878 desret_int(ret_val);
28879 call_tests++;
28880 des_int(n_code, code, 0);
28881 des_const_char_ptr(n_block, block, 1);
28882 xmlResetLastError();
28883 if (mem_base != xmlMemBlocks()) {
28884 printf("Leak of %d blocks found in xmlUCSIsBlock",
28885 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028886 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028887 printf(" %d", n_code);
28888 printf(" %d", n_block);
28889 printf("\n");
28890 }
28891 }
28892 }
28893#endif
28894
28895 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028896 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028897}
28898
28899
28900static int
28901test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028902 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028903
28904#ifdef LIBXML_UNICODE_ENABLED
28905 int mem_base;
28906 int ret_val;
28907 int code; /* UCS code point */
28908 int n_code;
28909
28910 for (n_code = 0;n_code < gen_nb_int;n_code++) {
28911 mem_base = xmlMemBlocks();
28912 code = gen_int(n_code, 0);
28913
28914 ret_val = xmlUCSIsBlockElements(code);
28915 desret_int(ret_val);
28916 call_tests++;
28917 des_int(n_code, code, 0);
28918 xmlResetLastError();
28919 if (mem_base != xmlMemBlocks()) {
28920 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
28921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028922 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028923 printf(" %d", n_code);
28924 printf("\n");
28925 }
28926 }
28927#endif
28928
28929 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028930 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028931}
28932
28933
28934static int
28935test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028936 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028937
28938#ifdef LIBXML_UNICODE_ENABLED
28939 int mem_base;
28940 int ret_val;
28941 int code; /* UCS code point */
28942 int n_code;
28943
28944 for (n_code = 0;n_code < gen_nb_int;n_code++) {
28945 mem_base = xmlMemBlocks();
28946 code = gen_int(n_code, 0);
28947
28948 ret_val = xmlUCSIsBopomofo(code);
28949 desret_int(ret_val);
28950 call_tests++;
28951 des_int(n_code, code, 0);
28952 xmlResetLastError();
28953 if (mem_base != xmlMemBlocks()) {
28954 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
28955 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028956 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028957 printf(" %d", n_code);
28958 printf("\n");
28959 }
28960 }
28961#endif
28962
28963 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028964 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028965}
28966
28967
28968static int
28969test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028970 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028971
28972#ifdef LIBXML_UNICODE_ENABLED
28973 int mem_base;
28974 int ret_val;
28975 int code; /* UCS code point */
28976 int n_code;
28977
28978 for (n_code = 0;n_code < gen_nb_int;n_code++) {
28979 mem_base = xmlMemBlocks();
28980 code = gen_int(n_code, 0);
28981
28982 ret_val = xmlUCSIsBopomofoExtended(code);
28983 desret_int(ret_val);
28984 call_tests++;
28985 des_int(n_code, code, 0);
28986 xmlResetLastError();
28987 if (mem_base != xmlMemBlocks()) {
28988 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
28989 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028990 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028991 printf(" %d", n_code);
28992 printf("\n");
28993 }
28994 }
28995#endif
28996
28997 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028998 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000028999}
29000
29001
29002static int
29003test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029004 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029005
29006#ifdef LIBXML_UNICODE_ENABLED
29007 int mem_base;
29008 int ret_val;
29009 int code; /* UCS code point */
29010 int n_code;
29011
29012 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29013 mem_base = xmlMemBlocks();
29014 code = gen_int(n_code, 0);
29015
29016 ret_val = xmlUCSIsBoxDrawing(code);
29017 desret_int(ret_val);
29018 call_tests++;
29019 des_int(n_code, code, 0);
29020 xmlResetLastError();
29021 if (mem_base != xmlMemBlocks()) {
29022 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
29023 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029024 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029025 printf(" %d", n_code);
29026 printf("\n");
29027 }
29028 }
29029#endif
29030
29031 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029032 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029033}
29034
29035
29036static int
29037test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029038 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029039
29040#ifdef LIBXML_UNICODE_ENABLED
29041 int mem_base;
29042 int ret_val;
29043 int code; /* UCS code point */
29044 int n_code;
29045
29046 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29047 mem_base = xmlMemBlocks();
29048 code = gen_int(n_code, 0);
29049
29050 ret_val = xmlUCSIsBraillePatterns(code);
29051 desret_int(ret_val);
29052 call_tests++;
29053 des_int(n_code, code, 0);
29054 xmlResetLastError();
29055 if (mem_base != xmlMemBlocks()) {
29056 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
29057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029058 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029059 printf(" %d", n_code);
29060 printf("\n");
29061 }
29062 }
29063#endif
29064
29065 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029066 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029067}
29068
29069
29070static int
29071test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029072 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029073
29074#ifdef LIBXML_UNICODE_ENABLED
29075 int mem_base;
29076 int ret_val;
29077 int code; /* UCS code point */
29078 int n_code;
29079
29080 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29081 mem_base = xmlMemBlocks();
29082 code = gen_int(n_code, 0);
29083
29084 ret_val = xmlUCSIsBuhid(code);
29085 desret_int(ret_val);
29086 call_tests++;
29087 des_int(n_code, code, 0);
29088 xmlResetLastError();
29089 if (mem_base != xmlMemBlocks()) {
29090 printf("Leak of %d blocks found in xmlUCSIsBuhid",
29091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029092 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029093 printf(" %d", n_code);
29094 printf("\n");
29095 }
29096 }
29097#endif
29098
29099 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029100 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029101}
29102
29103
29104static int
29105test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029106 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029107
29108#ifdef LIBXML_UNICODE_ENABLED
29109 int mem_base;
29110 int ret_val;
29111 int code; /* UCS code point */
29112 int n_code;
29113
29114 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29115 mem_base = xmlMemBlocks();
29116 code = gen_int(n_code, 0);
29117
29118 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
29119 desret_int(ret_val);
29120 call_tests++;
29121 des_int(n_code, code, 0);
29122 xmlResetLastError();
29123 if (mem_base != xmlMemBlocks()) {
29124 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
29125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029126 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029127 printf(" %d", n_code);
29128 printf("\n");
29129 }
29130 }
29131#endif
29132
29133 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029134 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029135}
29136
29137
29138static int
29139test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029140 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029141
29142#ifdef LIBXML_UNICODE_ENABLED
29143 int mem_base;
29144 int ret_val;
29145 int code; /* UCS code point */
29146 int n_code;
29147
29148 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29149 mem_base = xmlMemBlocks();
29150 code = gen_int(n_code, 0);
29151
29152 ret_val = xmlUCSIsCJKCompatibility(code);
29153 desret_int(ret_val);
29154 call_tests++;
29155 des_int(n_code, code, 0);
29156 xmlResetLastError();
29157 if (mem_base != xmlMemBlocks()) {
29158 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
29159 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029160 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029161 printf(" %d", n_code);
29162 printf("\n");
29163 }
29164 }
29165#endif
29166
29167 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029168 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029169}
29170
29171
29172static int
29173test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029174 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029175
29176#ifdef LIBXML_UNICODE_ENABLED
29177 int mem_base;
29178 int ret_val;
29179 int code; /* UCS code point */
29180 int n_code;
29181
29182 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29183 mem_base = xmlMemBlocks();
29184 code = gen_int(n_code, 0);
29185
29186 ret_val = xmlUCSIsCJKCompatibilityForms(code);
29187 desret_int(ret_val);
29188 call_tests++;
29189 des_int(n_code, code, 0);
29190 xmlResetLastError();
29191 if (mem_base != xmlMemBlocks()) {
29192 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
29193 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029194 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029195 printf(" %d", n_code);
29196 printf("\n");
29197 }
29198 }
29199#endif
29200
29201 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029202 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029203}
29204
29205
29206static int
29207test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029208 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029209
29210#ifdef LIBXML_UNICODE_ENABLED
29211 int mem_base;
29212 int ret_val;
29213 int code; /* UCS code point */
29214 int n_code;
29215
29216 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29217 mem_base = xmlMemBlocks();
29218 code = gen_int(n_code, 0);
29219
29220 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
29221 desret_int(ret_val);
29222 call_tests++;
29223 des_int(n_code, code, 0);
29224 xmlResetLastError();
29225 if (mem_base != xmlMemBlocks()) {
29226 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
29227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029228 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029229 printf(" %d", n_code);
29230 printf("\n");
29231 }
29232 }
29233#endif
29234
29235 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029236 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029237}
29238
29239
29240static int
29241test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029242 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029243
29244#ifdef LIBXML_UNICODE_ENABLED
29245 int mem_base;
29246 int ret_val;
29247 int code; /* UCS code point */
29248 int n_code;
29249
29250 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29251 mem_base = xmlMemBlocks();
29252 code = gen_int(n_code, 0);
29253
29254 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
29255 desret_int(ret_val);
29256 call_tests++;
29257 des_int(n_code, code, 0);
29258 xmlResetLastError();
29259 if (mem_base != xmlMemBlocks()) {
29260 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
29261 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029262 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029263 printf(" %d", n_code);
29264 printf("\n");
29265 }
29266 }
29267#endif
29268
29269 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029270 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029271}
29272
29273
29274static int
29275test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029276 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029277
29278#ifdef LIBXML_UNICODE_ENABLED
29279 int mem_base;
29280 int ret_val;
29281 int code; /* UCS code point */
29282 int n_code;
29283
29284 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29285 mem_base = xmlMemBlocks();
29286 code = gen_int(n_code, 0);
29287
29288 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
29289 desret_int(ret_val);
29290 call_tests++;
29291 des_int(n_code, code, 0);
29292 xmlResetLastError();
29293 if (mem_base != xmlMemBlocks()) {
29294 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
29295 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029296 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029297 printf(" %d", n_code);
29298 printf("\n");
29299 }
29300 }
29301#endif
29302
29303 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029304 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029305}
29306
29307
29308static int
29309test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029310 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029311
29312#ifdef LIBXML_UNICODE_ENABLED
29313 int mem_base;
29314 int ret_val;
29315 int code; /* UCS code point */
29316 int n_code;
29317
29318 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29319 mem_base = xmlMemBlocks();
29320 code = gen_int(n_code, 0);
29321
29322 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
29323 desret_int(ret_val);
29324 call_tests++;
29325 des_int(n_code, code, 0);
29326 xmlResetLastError();
29327 if (mem_base != xmlMemBlocks()) {
29328 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
29329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029330 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029331 printf(" %d", n_code);
29332 printf("\n");
29333 }
29334 }
29335#endif
29336
29337 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029338 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029339}
29340
29341
29342static int
29343test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029344 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029345
29346#ifdef LIBXML_UNICODE_ENABLED
29347 int mem_base;
29348 int ret_val;
29349 int code; /* UCS code point */
29350 int n_code;
29351
29352 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29353 mem_base = xmlMemBlocks();
29354 code = gen_int(n_code, 0);
29355
29356 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
29357 desret_int(ret_val);
29358 call_tests++;
29359 des_int(n_code, code, 0);
29360 xmlResetLastError();
29361 if (mem_base != xmlMemBlocks()) {
29362 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
29363 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029364 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029365 printf(" %d", n_code);
29366 printf("\n");
29367 }
29368 }
29369#endif
29370
29371 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029372 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029373}
29374
29375
29376static int
29377test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029378 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029379
29380#ifdef LIBXML_UNICODE_ENABLED
29381 int mem_base;
29382 int ret_val;
29383 int code; /* UCS code point */
29384 int n_code;
29385
29386 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29387 mem_base = xmlMemBlocks();
29388 code = gen_int(n_code, 0);
29389
29390 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
29391 desret_int(ret_val);
29392 call_tests++;
29393 des_int(n_code, code, 0);
29394 xmlResetLastError();
29395 if (mem_base != xmlMemBlocks()) {
29396 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
29397 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029398 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029399 printf(" %d", n_code);
29400 printf("\n");
29401 }
29402 }
29403#endif
29404
29405 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029406 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029407}
29408
29409
29410static int
29411test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029412 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029413
29414#ifdef LIBXML_UNICODE_ENABLED
29415 int mem_base;
29416 int ret_val;
29417 int code; /* UCS code point */
29418 int n_code;
29419
29420 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29421 mem_base = xmlMemBlocks();
29422 code = gen_int(n_code, 0);
29423
29424 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
29425 desret_int(ret_val);
29426 call_tests++;
29427 des_int(n_code, code, 0);
29428 xmlResetLastError();
29429 if (mem_base != xmlMemBlocks()) {
29430 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
29431 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029432 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029433 printf(" %d", n_code);
29434 printf("\n");
29435 }
29436 }
29437#endif
29438
29439 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029440 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029441}
29442
29443
29444static int
29445test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029446 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029447
29448#ifdef LIBXML_UNICODE_ENABLED
29449 int mem_base;
29450 int ret_val;
29451 int code; /* UCS code point */
29452 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029453 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029454 int n_cat;
29455
29456 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29457 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
29458 mem_base = xmlMemBlocks();
29459 code = gen_int(n_code, 0);
29460 cat = gen_const_char_ptr(n_cat, 1);
29461
29462 ret_val = xmlUCSIsCat(code, cat);
29463 desret_int(ret_val);
29464 call_tests++;
29465 des_int(n_code, code, 0);
29466 des_const_char_ptr(n_cat, cat, 1);
29467 xmlResetLastError();
29468 if (mem_base != xmlMemBlocks()) {
29469 printf("Leak of %d blocks found in xmlUCSIsCat",
29470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029471 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029472 printf(" %d", n_code);
29473 printf(" %d", n_cat);
29474 printf("\n");
29475 }
29476 }
29477 }
29478#endif
29479
29480 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029481 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029482}
29483
29484
29485static int
29486test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029487 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029488
29489#ifdef LIBXML_UNICODE_ENABLED
29490 int mem_base;
29491 int ret_val;
29492 int code; /* UCS code point */
29493 int n_code;
29494
29495 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29496 mem_base = xmlMemBlocks();
29497 code = gen_int(n_code, 0);
29498
29499 ret_val = xmlUCSIsCatC(code);
29500 desret_int(ret_val);
29501 call_tests++;
29502 des_int(n_code, code, 0);
29503 xmlResetLastError();
29504 if (mem_base != xmlMemBlocks()) {
29505 printf("Leak of %d blocks found in xmlUCSIsCatC",
29506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029507 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029508 printf(" %d", n_code);
29509 printf("\n");
29510 }
29511 }
29512#endif
29513
29514 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029515 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029516}
29517
29518
29519static int
29520test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029521 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029522
29523#ifdef LIBXML_UNICODE_ENABLED
29524 int mem_base;
29525 int ret_val;
29526 int code; /* UCS code point */
29527 int n_code;
29528
29529 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29530 mem_base = xmlMemBlocks();
29531 code = gen_int(n_code, 0);
29532
29533 ret_val = xmlUCSIsCatCc(code);
29534 desret_int(ret_val);
29535 call_tests++;
29536 des_int(n_code, code, 0);
29537 xmlResetLastError();
29538 if (mem_base != xmlMemBlocks()) {
29539 printf("Leak of %d blocks found in xmlUCSIsCatCc",
29540 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029541 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029542 printf(" %d", n_code);
29543 printf("\n");
29544 }
29545 }
29546#endif
29547
29548 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029549 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029550}
29551
29552
29553static int
29554test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029555 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029556
29557#ifdef LIBXML_UNICODE_ENABLED
29558 int mem_base;
29559 int ret_val;
29560 int code; /* UCS code point */
29561 int n_code;
29562
29563 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29564 mem_base = xmlMemBlocks();
29565 code = gen_int(n_code, 0);
29566
29567 ret_val = xmlUCSIsCatCf(code);
29568 desret_int(ret_val);
29569 call_tests++;
29570 des_int(n_code, code, 0);
29571 xmlResetLastError();
29572 if (mem_base != xmlMemBlocks()) {
29573 printf("Leak of %d blocks found in xmlUCSIsCatCf",
29574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029575 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029576 printf(" %d", n_code);
29577 printf("\n");
29578 }
29579 }
29580#endif
29581
29582 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029583 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029584}
29585
29586
29587static int
29588test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029589 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029590
29591#ifdef LIBXML_UNICODE_ENABLED
29592 int mem_base;
29593 int ret_val;
29594 int code; /* UCS code point */
29595 int n_code;
29596
29597 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29598 mem_base = xmlMemBlocks();
29599 code = gen_int(n_code, 0);
29600
29601 ret_val = xmlUCSIsCatCo(code);
29602 desret_int(ret_val);
29603 call_tests++;
29604 des_int(n_code, code, 0);
29605 xmlResetLastError();
29606 if (mem_base != xmlMemBlocks()) {
29607 printf("Leak of %d blocks found in xmlUCSIsCatCo",
29608 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029609 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029610 printf(" %d", n_code);
29611 printf("\n");
29612 }
29613 }
29614#endif
29615
29616 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029617 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029618}
29619
29620
29621static int
29622test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029623 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029624
29625#ifdef LIBXML_UNICODE_ENABLED
29626 int mem_base;
29627 int ret_val;
29628 int code; /* UCS code point */
29629 int n_code;
29630
29631 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29632 mem_base = xmlMemBlocks();
29633 code = gen_int(n_code, 0);
29634
29635 ret_val = xmlUCSIsCatCs(code);
29636 desret_int(ret_val);
29637 call_tests++;
29638 des_int(n_code, code, 0);
29639 xmlResetLastError();
29640 if (mem_base != xmlMemBlocks()) {
29641 printf("Leak of %d blocks found in xmlUCSIsCatCs",
29642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029643 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029644 printf(" %d", n_code);
29645 printf("\n");
29646 }
29647 }
29648#endif
29649
29650 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029651 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029652}
29653
29654
29655static int
29656test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029657 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029658
29659#ifdef LIBXML_UNICODE_ENABLED
29660 int mem_base;
29661 int ret_val;
29662 int code; /* UCS code point */
29663 int n_code;
29664
29665 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29666 mem_base = xmlMemBlocks();
29667 code = gen_int(n_code, 0);
29668
29669 ret_val = xmlUCSIsCatL(code);
29670 desret_int(ret_val);
29671 call_tests++;
29672 des_int(n_code, code, 0);
29673 xmlResetLastError();
29674 if (mem_base != xmlMemBlocks()) {
29675 printf("Leak of %d blocks found in xmlUCSIsCatL",
29676 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029677 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029678 printf(" %d", n_code);
29679 printf("\n");
29680 }
29681 }
29682#endif
29683
29684 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029685 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029686}
29687
29688
29689static int
29690test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029691 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029692
29693#ifdef LIBXML_UNICODE_ENABLED
29694 int mem_base;
29695 int ret_val;
29696 int code; /* UCS code point */
29697 int n_code;
29698
29699 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29700 mem_base = xmlMemBlocks();
29701 code = gen_int(n_code, 0);
29702
29703 ret_val = xmlUCSIsCatLl(code);
29704 desret_int(ret_val);
29705 call_tests++;
29706 des_int(n_code, code, 0);
29707 xmlResetLastError();
29708 if (mem_base != xmlMemBlocks()) {
29709 printf("Leak of %d blocks found in xmlUCSIsCatLl",
29710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029711 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029712 printf(" %d", n_code);
29713 printf("\n");
29714 }
29715 }
29716#endif
29717
29718 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029719 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029720}
29721
29722
29723static int
29724test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029725 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029726
29727#ifdef LIBXML_UNICODE_ENABLED
29728 int mem_base;
29729 int ret_val;
29730 int code; /* UCS code point */
29731 int n_code;
29732
29733 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29734 mem_base = xmlMemBlocks();
29735 code = gen_int(n_code, 0);
29736
29737 ret_val = xmlUCSIsCatLm(code);
29738 desret_int(ret_val);
29739 call_tests++;
29740 des_int(n_code, code, 0);
29741 xmlResetLastError();
29742 if (mem_base != xmlMemBlocks()) {
29743 printf("Leak of %d blocks found in xmlUCSIsCatLm",
29744 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029745 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029746 printf(" %d", n_code);
29747 printf("\n");
29748 }
29749 }
29750#endif
29751
29752 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029753 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029754}
29755
29756
29757static int
29758test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029759 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029760
29761#ifdef LIBXML_UNICODE_ENABLED
29762 int mem_base;
29763 int ret_val;
29764 int code; /* UCS code point */
29765 int n_code;
29766
29767 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29768 mem_base = xmlMemBlocks();
29769 code = gen_int(n_code, 0);
29770
29771 ret_val = xmlUCSIsCatLo(code);
29772 desret_int(ret_val);
29773 call_tests++;
29774 des_int(n_code, code, 0);
29775 xmlResetLastError();
29776 if (mem_base != xmlMemBlocks()) {
29777 printf("Leak of %d blocks found in xmlUCSIsCatLo",
29778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029779 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029780 printf(" %d", n_code);
29781 printf("\n");
29782 }
29783 }
29784#endif
29785
29786 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029787 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029788}
29789
29790
29791static int
29792test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029793 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029794
29795#ifdef LIBXML_UNICODE_ENABLED
29796 int mem_base;
29797 int ret_val;
29798 int code; /* UCS code point */
29799 int n_code;
29800
29801 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29802 mem_base = xmlMemBlocks();
29803 code = gen_int(n_code, 0);
29804
29805 ret_val = xmlUCSIsCatLt(code);
29806 desret_int(ret_val);
29807 call_tests++;
29808 des_int(n_code, code, 0);
29809 xmlResetLastError();
29810 if (mem_base != xmlMemBlocks()) {
29811 printf("Leak of %d blocks found in xmlUCSIsCatLt",
29812 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029813 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029814 printf(" %d", n_code);
29815 printf("\n");
29816 }
29817 }
29818#endif
29819
29820 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029821 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029822}
29823
29824
29825static int
29826test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029827 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029828
29829#ifdef LIBXML_UNICODE_ENABLED
29830 int mem_base;
29831 int ret_val;
29832 int code; /* UCS code point */
29833 int n_code;
29834
29835 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29836 mem_base = xmlMemBlocks();
29837 code = gen_int(n_code, 0);
29838
29839 ret_val = xmlUCSIsCatLu(code);
29840 desret_int(ret_val);
29841 call_tests++;
29842 des_int(n_code, code, 0);
29843 xmlResetLastError();
29844 if (mem_base != xmlMemBlocks()) {
29845 printf("Leak of %d blocks found in xmlUCSIsCatLu",
29846 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029847 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029848 printf(" %d", n_code);
29849 printf("\n");
29850 }
29851 }
29852#endif
29853
29854 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029855 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029856}
29857
29858
29859static int
29860test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029861 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029862
29863#ifdef LIBXML_UNICODE_ENABLED
29864 int mem_base;
29865 int ret_val;
29866 int code; /* UCS code point */
29867 int n_code;
29868
29869 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29870 mem_base = xmlMemBlocks();
29871 code = gen_int(n_code, 0);
29872
29873 ret_val = xmlUCSIsCatM(code);
29874 desret_int(ret_val);
29875 call_tests++;
29876 des_int(n_code, code, 0);
29877 xmlResetLastError();
29878 if (mem_base != xmlMemBlocks()) {
29879 printf("Leak of %d blocks found in xmlUCSIsCatM",
29880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029881 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029882 printf(" %d", n_code);
29883 printf("\n");
29884 }
29885 }
29886#endif
29887
29888 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029889 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029890}
29891
29892
29893static int
29894test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029895 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029896
29897#ifdef LIBXML_UNICODE_ENABLED
29898 int mem_base;
29899 int ret_val;
29900 int code; /* UCS code point */
29901 int n_code;
29902
29903 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29904 mem_base = xmlMemBlocks();
29905 code = gen_int(n_code, 0);
29906
29907 ret_val = xmlUCSIsCatMc(code);
29908 desret_int(ret_val);
29909 call_tests++;
29910 des_int(n_code, code, 0);
29911 xmlResetLastError();
29912 if (mem_base != xmlMemBlocks()) {
29913 printf("Leak of %d blocks found in xmlUCSIsCatMc",
29914 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029915 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029916 printf(" %d", n_code);
29917 printf("\n");
29918 }
29919 }
29920#endif
29921
29922 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029923 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029924}
29925
29926
29927static int
29928test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029929 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029930
29931#ifdef LIBXML_UNICODE_ENABLED
29932 int mem_base;
29933 int ret_val;
29934 int code; /* UCS code point */
29935 int n_code;
29936
29937 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29938 mem_base = xmlMemBlocks();
29939 code = gen_int(n_code, 0);
29940
29941 ret_val = xmlUCSIsCatMe(code);
29942 desret_int(ret_val);
29943 call_tests++;
29944 des_int(n_code, code, 0);
29945 xmlResetLastError();
29946 if (mem_base != xmlMemBlocks()) {
29947 printf("Leak of %d blocks found in xmlUCSIsCatMe",
29948 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029949 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029950 printf(" %d", n_code);
29951 printf("\n");
29952 }
29953 }
29954#endif
29955
29956 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029957 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029958}
29959
29960
29961static int
29962test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029963 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029964
29965#ifdef LIBXML_UNICODE_ENABLED
29966 int mem_base;
29967 int ret_val;
29968 int code; /* UCS code point */
29969 int n_code;
29970
29971 for (n_code = 0;n_code < gen_nb_int;n_code++) {
29972 mem_base = xmlMemBlocks();
29973 code = gen_int(n_code, 0);
29974
29975 ret_val = xmlUCSIsCatMn(code);
29976 desret_int(ret_val);
29977 call_tests++;
29978 des_int(n_code, code, 0);
29979 xmlResetLastError();
29980 if (mem_base != xmlMemBlocks()) {
29981 printf("Leak of %d blocks found in xmlUCSIsCatMn",
29982 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029983 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029984 printf(" %d", n_code);
29985 printf("\n");
29986 }
29987 }
29988#endif
29989
29990 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029991 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029992}
29993
29994
29995static int
29996test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029997 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000029998
29999#ifdef LIBXML_UNICODE_ENABLED
30000 int mem_base;
30001 int ret_val;
30002 int code; /* UCS code point */
30003 int n_code;
30004
30005 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30006 mem_base = xmlMemBlocks();
30007 code = gen_int(n_code, 0);
30008
30009 ret_val = xmlUCSIsCatN(code);
30010 desret_int(ret_val);
30011 call_tests++;
30012 des_int(n_code, code, 0);
30013 xmlResetLastError();
30014 if (mem_base != xmlMemBlocks()) {
30015 printf("Leak of %d blocks found in xmlUCSIsCatN",
30016 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030017 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030018 printf(" %d", n_code);
30019 printf("\n");
30020 }
30021 }
30022#endif
30023
30024 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030025 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030026}
30027
30028
30029static int
30030test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030031 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030032
30033#ifdef LIBXML_UNICODE_ENABLED
30034 int mem_base;
30035 int ret_val;
30036 int code; /* UCS code point */
30037 int n_code;
30038
30039 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30040 mem_base = xmlMemBlocks();
30041 code = gen_int(n_code, 0);
30042
30043 ret_val = xmlUCSIsCatNd(code);
30044 desret_int(ret_val);
30045 call_tests++;
30046 des_int(n_code, code, 0);
30047 xmlResetLastError();
30048 if (mem_base != xmlMemBlocks()) {
30049 printf("Leak of %d blocks found in xmlUCSIsCatNd",
30050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030051 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030052 printf(" %d", n_code);
30053 printf("\n");
30054 }
30055 }
30056#endif
30057
30058 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030059 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030060}
30061
30062
30063static int
30064test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030065 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030066
30067#ifdef LIBXML_UNICODE_ENABLED
30068 int mem_base;
30069 int ret_val;
30070 int code; /* UCS code point */
30071 int n_code;
30072
30073 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30074 mem_base = xmlMemBlocks();
30075 code = gen_int(n_code, 0);
30076
30077 ret_val = xmlUCSIsCatNl(code);
30078 desret_int(ret_val);
30079 call_tests++;
30080 des_int(n_code, code, 0);
30081 xmlResetLastError();
30082 if (mem_base != xmlMemBlocks()) {
30083 printf("Leak of %d blocks found in xmlUCSIsCatNl",
30084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030085 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030086 printf(" %d", n_code);
30087 printf("\n");
30088 }
30089 }
30090#endif
30091
30092 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030093 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030094}
30095
30096
30097static int
30098test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030099 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030100
30101#ifdef LIBXML_UNICODE_ENABLED
30102 int mem_base;
30103 int ret_val;
30104 int code; /* UCS code point */
30105 int n_code;
30106
30107 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30108 mem_base = xmlMemBlocks();
30109 code = gen_int(n_code, 0);
30110
30111 ret_val = xmlUCSIsCatNo(code);
30112 desret_int(ret_val);
30113 call_tests++;
30114 des_int(n_code, code, 0);
30115 xmlResetLastError();
30116 if (mem_base != xmlMemBlocks()) {
30117 printf("Leak of %d blocks found in xmlUCSIsCatNo",
30118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030119 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030120 printf(" %d", n_code);
30121 printf("\n");
30122 }
30123 }
30124#endif
30125
30126 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030127 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030128}
30129
30130
30131static int
30132test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030133 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030134
30135#ifdef LIBXML_UNICODE_ENABLED
30136 int mem_base;
30137 int ret_val;
30138 int code; /* UCS code point */
30139 int n_code;
30140
30141 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30142 mem_base = xmlMemBlocks();
30143 code = gen_int(n_code, 0);
30144
30145 ret_val = xmlUCSIsCatP(code);
30146 desret_int(ret_val);
30147 call_tests++;
30148 des_int(n_code, code, 0);
30149 xmlResetLastError();
30150 if (mem_base != xmlMemBlocks()) {
30151 printf("Leak of %d blocks found in xmlUCSIsCatP",
30152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030153 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030154 printf(" %d", n_code);
30155 printf("\n");
30156 }
30157 }
30158#endif
30159
30160 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030161 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030162}
30163
30164
30165static int
30166test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030167 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030168
30169#ifdef LIBXML_UNICODE_ENABLED
30170 int mem_base;
30171 int ret_val;
30172 int code; /* UCS code point */
30173 int n_code;
30174
30175 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30176 mem_base = xmlMemBlocks();
30177 code = gen_int(n_code, 0);
30178
30179 ret_val = xmlUCSIsCatPc(code);
30180 desret_int(ret_val);
30181 call_tests++;
30182 des_int(n_code, code, 0);
30183 xmlResetLastError();
30184 if (mem_base != xmlMemBlocks()) {
30185 printf("Leak of %d blocks found in xmlUCSIsCatPc",
30186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030187 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030188 printf(" %d", n_code);
30189 printf("\n");
30190 }
30191 }
30192#endif
30193
30194 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030195 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030196}
30197
30198
30199static int
30200test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030201 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030202
30203#ifdef LIBXML_UNICODE_ENABLED
30204 int mem_base;
30205 int ret_val;
30206 int code; /* UCS code point */
30207 int n_code;
30208
30209 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30210 mem_base = xmlMemBlocks();
30211 code = gen_int(n_code, 0);
30212
30213 ret_val = xmlUCSIsCatPd(code);
30214 desret_int(ret_val);
30215 call_tests++;
30216 des_int(n_code, code, 0);
30217 xmlResetLastError();
30218 if (mem_base != xmlMemBlocks()) {
30219 printf("Leak of %d blocks found in xmlUCSIsCatPd",
30220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030221 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030222 printf(" %d", n_code);
30223 printf("\n");
30224 }
30225 }
30226#endif
30227
30228 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030229 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030230}
30231
30232
30233static int
30234test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030235 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030236
30237#ifdef LIBXML_UNICODE_ENABLED
30238 int mem_base;
30239 int ret_val;
30240 int code; /* UCS code point */
30241 int n_code;
30242
30243 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30244 mem_base = xmlMemBlocks();
30245 code = gen_int(n_code, 0);
30246
30247 ret_val = xmlUCSIsCatPe(code);
30248 desret_int(ret_val);
30249 call_tests++;
30250 des_int(n_code, code, 0);
30251 xmlResetLastError();
30252 if (mem_base != xmlMemBlocks()) {
30253 printf("Leak of %d blocks found in xmlUCSIsCatPe",
30254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030255 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030256 printf(" %d", n_code);
30257 printf("\n");
30258 }
30259 }
30260#endif
30261
30262 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030263 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030264}
30265
30266
30267static int
30268test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030269 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030270
30271#ifdef LIBXML_UNICODE_ENABLED
30272 int mem_base;
30273 int ret_val;
30274 int code; /* UCS code point */
30275 int n_code;
30276
30277 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30278 mem_base = xmlMemBlocks();
30279 code = gen_int(n_code, 0);
30280
30281 ret_val = xmlUCSIsCatPf(code);
30282 desret_int(ret_val);
30283 call_tests++;
30284 des_int(n_code, code, 0);
30285 xmlResetLastError();
30286 if (mem_base != xmlMemBlocks()) {
30287 printf("Leak of %d blocks found in xmlUCSIsCatPf",
30288 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030289 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030290 printf(" %d", n_code);
30291 printf("\n");
30292 }
30293 }
30294#endif
30295
30296 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030297 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030298}
30299
30300
30301static int
30302test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030303 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030304
30305#ifdef LIBXML_UNICODE_ENABLED
30306 int mem_base;
30307 int ret_val;
30308 int code; /* UCS code point */
30309 int n_code;
30310
30311 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30312 mem_base = xmlMemBlocks();
30313 code = gen_int(n_code, 0);
30314
30315 ret_val = xmlUCSIsCatPi(code);
30316 desret_int(ret_val);
30317 call_tests++;
30318 des_int(n_code, code, 0);
30319 xmlResetLastError();
30320 if (mem_base != xmlMemBlocks()) {
30321 printf("Leak of %d blocks found in xmlUCSIsCatPi",
30322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030323 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030324 printf(" %d", n_code);
30325 printf("\n");
30326 }
30327 }
30328#endif
30329
30330 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030331 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030332}
30333
30334
30335static int
30336test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030337 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030338
30339#ifdef LIBXML_UNICODE_ENABLED
30340 int mem_base;
30341 int ret_val;
30342 int code; /* UCS code point */
30343 int n_code;
30344
30345 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30346 mem_base = xmlMemBlocks();
30347 code = gen_int(n_code, 0);
30348
30349 ret_val = xmlUCSIsCatPo(code);
30350 desret_int(ret_val);
30351 call_tests++;
30352 des_int(n_code, code, 0);
30353 xmlResetLastError();
30354 if (mem_base != xmlMemBlocks()) {
30355 printf("Leak of %d blocks found in xmlUCSIsCatPo",
30356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030357 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030358 printf(" %d", n_code);
30359 printf("\n");
30360 }
30361 }
30362#endif
30363
30364 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030365 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030366}
30367
30368
30369static int
30370test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030371 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030372
30373#ifdef LIBXML_UNICODE_ENABLED
30374 int mem_base;
30375 int ret_val;
30376 int code; /* UCS code point */
30377 int n_code;
30378
30379 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30380 mem_base = xmlMemBlocks();
30381 code = gen_int(n_code, 0);
30382
30383 ret_val = xmlUCSIsCatPs(code);
30384 desret_int(ret_val);
30385 call_tests++;
30386 des_int(n_code, code, 0);
30387 xmlResetLastError();
30388 if (mem_base != xmlMemBlocks()) {
30389 printf("Leak of %d blocks found in xmlUCSIsCatPs",
30390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030391 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030392 printf(" %d", n_code);
30393 printf("\n");
30394 }
30395 }
30396#endif
30397
30398 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030399 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030400}
30401
30402
30403static int
30404test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030405 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030406
30407#ifdef LIBXML_UNICODE_ENABLED
30408 int mem_base;
30409 int ret_val;
30410 int code; /* UCS code point */
30411 int n_code;
30412
30413 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30414 mem_base = xmlMemBlocks();
30415 code = gen_int(n_code, 0);
30416
30417 ret_val = xmlUCSIsCatS(code);
30418 desret_int(ret_val);
30419 call_tests++;
30420 des_int(n_code, code, 0);
30421 xmlResetLastError();
30422 if (mem_base != xmlMemBlocks()) {
30423 printf("Leak of %d blocks found in xmlUCSIsCatS",
30424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030425 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030426 printf(" %d", n_code);
30427 printf("\n");
30428 }
30429 }
30430#endif
30431
30432 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030433 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030434}
30435
30436
30437static int
30438test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030439 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030440
30441#ifdef LIBXML_UNICODE_ENABLED
30442 int mem_base;
30443 int ret_val;
30444 int code; /* UCS code point */
30445 int n_code;
30446
30447 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30448 mem_base = xmlMemBlocks();
30449 code = gen_int(n_code, 0);
30450
30451 ret_val = xmlUCSIsCatSc(code);
30452 desret_int(ret_val);
30453 call_tests++;
30454 des_int(n_code, code, 0);
30455 xmlResetLastError();
30456 if (mem_base != xmlMemBlocks()) {
30457 printf("Leak of %d blocks found in xmlUCSIsCatSc",
30458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030459 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030460 printf(" %d", n_code);
30461 printf("\n");
30462 }
30463 }
30464#endif
30465
30466 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030467 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030468}
30469
30470
30471static int
30472test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030473 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030474
30475#ifdef LIBXML_UNICODE_ENABLED
30476 int mem_base;
30477 int ret_val;
30478 int code; /* UCS code point */
30479 int n_code;
30480
30481 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30482 mem_base = xmlMemBlocks();
30483 code = gen_int(n_code, 0);
30484
30485 ret_val = xmlUCSIsCatSk(code);
30486 desret_int(ret_val);
30487 call_tests++;
30488 des_int(n_code, code, 0);
30489 xmlResetLastError();
30490 if (mem_base != xmlMemBlocks()) {
30491 printf("Leak of %d blocks found in xmlUCSIsCatSk",
30492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030493 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030494 printf(" %d", n_code);
30495 printf("\n");
30496 }
30497 }
30498#endif
30499
30500 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030501 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030502}
30503
30504
30505static int
30506test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030507 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030508
30509#ifdef LIBXML_UNICODE_ENABLED
30510 int mem_base;
30511 int ret_val;
30512 int code; /* UCS code point */
30513 int n_code;
30514
30515 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30516 mem_base = xmlMemBlocks();
30517 code = gen_int(n_code, 0);
30518
30519 ret_val = xmlUCSIsCatSm(code);
30520 desret_int(ret_val);
30521 call_tests++;
30522 des_int(n_code, code, 0);
30523 xmlResetLastError();
30524 if (mem_base != xmlMemBlocks()) {
30525 printf("Leak of %d blocks found in xmlUCSIsCatSm",
30526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030527 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030528 printf(" %d", n_code);
30529 printf("\n");
30530 }
30531 }
30532#endif
30533
30534 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030535 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030536}
30537
30538
30539static int
30540test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030541 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030542
30543#ifdef LIBXML_UNICODE_ENABLED
30544 int mem_base;
30545 int ret_val;
30546 int code; /* UCS code point */
30547 int n_code;
30548
30549 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30550 mem_base = xmlMemBlocks();
30551 code = gen_int(n_code, 0);
30552
30553 ret_val = xmlUCSIsCatSo(code);
30554 desret_int(ret_val);
30555 call_tests++;
30556 des_int(n_code, code, 0);
30557 xmlResetLastError();
30558 if (mem_base != xmlMemBlocks()) {
30559 printf("Leak of %d blocks found in xmlUCSIsCatSo",
30560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030561 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030562 printf(" %d", n_code);
30563 printf("\n");
30564 }
30565 }
30566#endif
30567
30568 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030569 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030570}
30571
30572
30573static int
30574test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030575 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030576
30577#ifdef LIBXML_UNICODE_ENABLED
30578 int mem_base;
30579 int ret_val;
30580 int code; /* UCS code point */
30581 int n_code;
30582
30583 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30584 mem_base = xmlMemBlocks();
30585 code = gen_int(n_code, 0);
30586
30587 ret_val = xmlUCSIsCatZ(code);
30588 desret_int(ret_val);
30589 call_tests++;
30590 des_int(n_code, code, 0);
30591 xmlResetLastError();
30592 if (mem_base != xmlMemBlocks()) {
30593 printf("Leak of %d blocks found in xmlUCSIsCatZ",
30594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030595 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030596 printf(" %d", n_code);
30597 printf("\n");
30598 }
30599 }
30600#endif
30601
30602 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030603 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030604}
30605
30606
30607static int
30608test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030609 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030610
30611#ifdef LIBXML_UNICODE_ENABLED
30612 int mem_base;
30613 int ret_val;
30614 int code; /* UCS code point */
30615 int n_code;
30616
30617 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30618 mem_base = xmlMemBlocks();
30619 code = gen_int(n_code, 0);
30620
30621 ret_val = xmlUCSIsCatZl(code);
30622 desret_int(ret_val);
30623 call_tests++;
30624 des_int(n_code, code, 0);
30625 xmlResetLastError();
30626 if (mem_base != xmlMemBlocks()) {
30627 printf("Leak of %d blocks found in xmlUCSIsCatZl",
30628 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030629 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030630 printf(" %d", n_code);
30631 printf("\n");
30632 }
30633 }
30634#endif
30635
30636 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030637 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030638}
30639
30640
30641static int
30642test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030643 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030644
30645#ifdef LIBXML_UNICODE_ENABLED
30646 int mem_base;
30647 int ret_val;
30648 int code; /* UCS code point */
30649 int n_code;
30650
30651 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30652 mem_base = xmlMemBlocks();
30653 code = gen_int(n_code, 0);
30654
30655 ret_val = xmlUCSIsCatZp(code);
30656 desret_int(ret_val);
30657 call_tests++;
30658 des_int(n_code, code, 0);
30659 xmlResetLastError();
30660 if (mem_base != xmlMemBlocks()) {
30661 printf("Leak of %d blocks found in xmlUCSIsCatZp",
30662 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030663 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030664 printf(" %d", n_code);
30665 printf("\n");
30666 }
30667 }
30668#endif
30669
30670 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030671 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030672}
30673
30674
30675static int
30676test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030677 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030678
30679#ifdef LIBXML_UNICODE_ENABLED
30680 int mem_base;
30681 int ret_val;
30682 int code; /* UCS code point */
30683 int n_code;
30684
30685 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30686 mem_base = xmlMemBlocks();
30687 code = gen_int(n_code, 0);
30688
30689 ret_val = xmlUCSIsCatZs(code);
30690 desret_int(ret_val);
30691 call_tests++;
30692 des_int(n_code, code, 0);
30693 xmlResetLastError();
30694 if (mem_base != xmlMemBlocks()) {
30695 printf("Leak of %d blocks found in xmlUCSIsCatZs",
30696 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030697 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030698 printf(" %d", n_code);
30699 printf("\n");
30700 }
30701 }
30702#endif
30703
30704 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030705 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030706}
30707
30708
30709static int
30710test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030711 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030712
30713#ifdef LIBXML_UNICODE_ENABLED
30714 int mem_base;
30715 int ret_val;
30716 int code; /* UCS code point */
30717 int n_code;
30718
30719 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30720 mem_base = xmlMemBlocks();
30721 code = gen_int(n_code, 0);
30722
30723 ret_val = xmlUCSIsCherokee(code);
30724 desret_int(ret_val);
30725 call_tests++;
30726 des_int(n_code, code, 0);
30727 xmlResetLastError();
30728 if (mem_base != xmlMemBlocks()) {
30729 printf("Leak of %d blocks found in xmlUCSIsCherokee",
30730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030731 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030732 printf(" %d", n_code);
30733 printf("\n");
30734 }
30735 }
30736#endif
30737
30738 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030739 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030740}
30741
30742
30743static int
30744test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030745 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030746
30747#ifdef LIBXML_UNICODE_ENABLED
30748 int mem_base;
30749 int ret_val;
30750 int code; /* UCS code point */
30751 int n_code;
30752
30753 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30754 mem_base = xmlMemBlocks();
30755 code = gen_int(n_code, 0);
30756
30757 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
30758 desret_int(ret_val);
30759 call_tests++;
30760 des_int(n_code, code, 0);
30761 xmlResetLastError();
30762 if (mem_base != xmlMemBlocks()) {
30763 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
30764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030765 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030766 printf(" %d", n_code);
30767 printf("\n");
30768 }
30769 }
30770#endif
30771
30772 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030773 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030774}
30775
30776
30777static int
30778test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030779 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030780
30781#ifdef LIBXML_UNICODE_ENABLED
30782 int mem_base;
30783 int ret_val;
30784 int code; /* UCS code point */
30785 int n_code;
30786
30787 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30788 mem_base = xmlMemBlocks();
30789 code = gen_int(n_code, 0);
30790
30791 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
30792 desret_int(ret_val);
30793 call_tests++;
30794 des_int(n_code, code, 0);
30795 xmlResetLastError();
30796 if (mem_base != xmlMemBlocks()) {
30797 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
30798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030799 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030800 printf(" %d", n_code);
30801 printf("\n");
30802 }
30803 }
30804#endif
30805
30806 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030807 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030808}
30809
30810
30811static int
30812test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030813 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030814
30815#ifdef LIBXML_UNICODE_ENABLED
30816 int mem_base;
30817 int ret_val;
30818 int code; /* UCS code point */
30819 int n_code;
30820
30821 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30822 mem_base = xmlMemBlocks();
30823 code = gen_int(n_code, 0);
30824
30825 ret_val = xmlUCSIsCombiningHalfMarks(code);
30826 desret_int(ret_val);
30827 call_tests++;
30828 des_int(n_code, code, 0);
30829 xmlResetLastError();
30830 if (mem_base != xmlMemBlocks()) {
30831 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
30832 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030833 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030834 printf(" %d", n_code);
30835 printf("\n");
30836 }
30837 }
30838#endif
30839
30840 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030841 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030842}
30843
30844
30845static int
30846test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030847 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030848
30849#ifdef LIBXML_UNICODE_ENABLED
30850 int mem_base;
30851 int ret_val;
30852 int code; /* UCS code point */
30853 int n_code;
30854
30855 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30856 mem_base = xmlMemBlocks();
30857 code = gen_int(n_code, 0);
30858
30859 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
30860 desret_int(ret_val);
30861 call_tests++;
30862 des_int(n_code, code, 0);
30863 xmlResetLastError();
30864 if (mem_base != xmlMemBlocks()) {
30865 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
30866 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030867 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030868 printf(" %d", n_code);
30869 printf("\n");
30870 }
30871 }
30872#endif
30873
30874 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030875 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030876}
30877
30878
30879static int
30880test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030881 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030882
30883#ifdef LIBXML_UNICODE_ENABLED
30884 int mem_base;
30885 int ret_val;
30886 int code; /* UCS code point */
30887 int n_code;
30888
30889 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30890 mem_base = xmlMemBlocks();
30891 code = gen_int(n_code, 0);
30892
30893 ret_val = xmlUCSIsControlPictures(code);
30894 desret_int(ret_val);
30895 call_tests++;
30896 des_int(n_code, code, 0);
30897 xmlResetLastError();
30898 if (mem_base != xmlMemBlocks()) {
30899 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
30900 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030901 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030902 printf(" %d", n_code);
30903 printf("\n");
30904 }
30905 }
30906#endif
30907
30908 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030909 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030910}
30911
30912
30913static int
30914test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030915 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030916
30917#ifdef LIBXML_UNICODE_ENABLED
30918 int mem_base;
30919 int ret_val;
30920 int code; /* UCS code point */
30921 int n_code;
30922
30923 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30924 mem_base = xmlMemBlocks();
30925 code = gen_int(n_code, 0);
30926
30927 ret_val = xmlUCSIsCurrencySymbols(code);
30928 desret_int(ret_val);
30929 call_tests++;
30930 des_int(n_code, code, 0);
30931 xmlResetLastError();
30932 if (mem_base != xmlMemBlocks()) {
30933 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
30934 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030935 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030936 printf(" %d", n_code);
30937 printf("\n");
30938 }
30939 }
30940#endif
30941
30942 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030943 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030944}
30945
30946
30947static int
30948test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030949 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030950
30951#ifdef LIBXML_UNICODE_ENABLED
30952 int mem_base;
30953 int ret_val;
30954 int code; /* UCS code point */
30955 int n_code;
30956
30957 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30958 mem_base = xmlMemBlocks();
30959 code = gen_int(n_code, 0);
30960
30961 ret_val = xmlUCSIsCypriotSyllabary(code);
30962 desret_int(ret_val);
30963 call_tests++;
30964 des_int(n_code, code, 0);
30965 xmlResetLastError();
30966 if (mem_base != xmlMemBlocks()) {
30967 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
30968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030969 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030970 printf(" %d", n_code);
30971 printf("\n");
30972 }
30973 }
30974#endif
30975
30976 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030977 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030978}
30979
30980
30981static int
30982test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030983 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000030984
30985#ifdef LIBXML_UNICODE_ENABLED
30986 int mem_base;
30987 int ret_val;
30988 int code; /* UCS code point */
30989 int n_code;
30990
30991 for (n_code = 0;n_code < gen_nb_int;n_code++) {
30992 mem_base = xmlMemBlocks();
30993 code = gen_int(n_code, 0);
30994
30995 ret_val = xmlUCSIsCyrillic(code);
30996 desret_int(ret_val);
30997 call_tests++;
30998 des_int(n_code, code, 0);
30999 xmlResetLastError();
31000 if (mem_base != xmlMemBlocks()) {
31001 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
31002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031003 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031004 printf(" %d", n_code);
31005 printf("\n");
31006 }
31007 }
31008#endif
31009
31010 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031011 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031012}
31013
31014
31015static int
31016test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031017 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031018
31019#ifdef LIBXML_UNICODE_ENABLED
31020 int mem_base;
31021 int ret_val;
31022 int code; /* UCS code point */
31023 int n_code;
31024
31025 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31026 mem_base = xmlMemBlocks();
31027 code = gen_int(n_code, 0);
31028
31029 ret_val = xmlUCSIsCyrillicSupplement(code);
31030 desret_int(ret_val);
31031 call_tests++;
31032 des_int(n_code, code, 0);
31033 xmlResetLastError();
31034 if (mem_base != xmlMemBlocks()) {
31035 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
31036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031037 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031038 printf(" %d", n_code);
31039 printf("\n");
31040 }
31041 }
31042#endif
31043
31044 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031045 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031046}
31047
31048
31049static int
31050test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031051 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031052
31053#ifdef LIBXML_UNICODE_ENABLED
31054 int mem_base;
31055 int ret_val;
31056 int code; /* UCS code point */
31057 int n_code;
31058
31059 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31060 mem_base = xmlMemBlocks();
31061 code = gen_int(n_code, 0);
31062
31063 ret_val = xmlUCSIsDeseret(code);
31064 desret_int(ret_val);
31065 call_tests++;
31066 des_int(n_code, code, 0);
31067 xmlResetLastError();
31068 if (mem_base != xmlMemBlocks()) {
31069 printf("Leak of %d blocks found in xmlUCSIsDeseret",
31070 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031071 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031072 printf(" %d", n_code);
31073 printf("\n");
31074 }
31075 }
31076#endif
31077
31078 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031079 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031080}
31081
31082
31083static int
31084test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031085 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031086
31087#ifdef LIBXML_UNICODE_ENABLED
31088 int mem_base;
31089 int ret_val;
31090 int code; /* UCS code point */
31091 int n_code;
31092
31093 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31094 mem_base = xmlMemBlocks();
31095 code = gen_int(n_code, 0);
31096
31097 ret_val = xmlUCSIsDevanagari(code);
31098 desret_int(ret_val);
31099 call_tests++;
31100 des_int(n_code, code, 0);
31101 xmlResetLastError();
31102 if (mem_base != xmlMemBlocks()) {
31103 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
31104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031105 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031106 printf(" %d", n_code);
31107 printf("\n");
31108 }
31109 }
31110#endif
31111
31112 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031113 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031114}
31115
31116
31117static int
31118test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031119 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031120
31121#ifdef LIBXML_UNICODE_ENABLED
31122 int mem_base;
31123 int ret_val;
31124 int code; /* UCS code point */
31125 int n_code;
31126
31127 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31128 mem_base = xmlMemBlocks();
31129 code = gen_int(n_code, 0);
31130
31131 ret_val = xmlUCSIsDingbats(code);
31132 desret_int(ret_val);
31133 call_tests++;
31134 des_int(n_code, code, 0);
31135 xmlResetLastError();
31136 if (mem_base != xmlMemBlocks()) {
31137 printf("Leak of %d blocks found in xmlUCSIsDingbats",
31138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031139 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031140 printf(" %d", n_code);
31141 printf("\n");
31142 }
31143 }
31144#endif
31145
31146 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031147 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031148}
31149
31150
31151static int
31152test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031153 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031154
31155#ifdef LIBXML_UNICODE_ENABLED
31156 int mem_base;
31157 int ret_val;
31158 int code; /* UCS code point */
31159 int n_code;
31160
31161 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31162 mem_base = xmlMemBlocks();
31163 code = gen_int(n_code, 0);
31164
31165 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
31166 desret_int(ret_val);
31167 call_tests++;
31168 des_int(n_code, code, 0);
31169 xmlResetLastError();
31170 if (mem_base != xmlMemBlocks()) {
31171 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
31172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031173 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031174 printf(" %d", n_code);
31175 printf("\n");
31176 }
31177 }
31178#endif
31179
31180 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031181 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031182}
31183
31184
31185static int
31186test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031187 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031188
31189#ifdef LIBXML_UNICODE_ENABLED
31190 int mem_base;
31191 int ret_val;
31192 int code; /* UCS code point */
31193 int n_code;
31194
31195 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31196 mem_base = xmlMemBlocks();
31197 code = gen_int(n_code, 0);
31198
31199 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
31200 desret_int(ret_val);
31201 call_tests++;
31202 des_int(n_code, code, 0);
31203 xmlResetLastError();
31204 if (mem_base != xmlMemBlocks()) {
31205 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
31206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031207 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031208 printf(" %d", n_code);
31209 printf("\n");
31210 }
31211 }
31212#endif
31213
31214 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031215 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031216}
31217
31218
31219static int
31220test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031221 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031222
31223#ifdef LIBXML_UNICODE_ENABLED
31224 int mem_base;
31225 int ret_val;
31226 int code; /* UCS code point */
31227 int n_code;
31228
31229 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31230 mem_base = xmlMemBlocks();
31231 code = gen_int(n_code, 0);
31232
31233 ret_val = xmlUCSIsEthiopic(code);
31234 desret_int(ret_val);
31235 call_tests++;
31236 des_int(n_code, code, 0);
31237 xmlResetLastError();
31238 if (mem_base != xmlMemBlocks()) {
31239 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
31240 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031241 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031242 printf(" %d", n_code);
31243 printf("\n");
31244 }
31245 }
31246#endif
31247
31248 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031249 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031250}
31251
31252
31253static int
31254test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031255 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031256
31257#ifdef LIBXML_UNICODE_ENABLED
31258 int mem_base;
31259 int ret_val;
31260 int code; /* UCS code point */
31261 int n_code;
31262
31263 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31264 mem_base = xmlMemBlocks();
31265 code = gen_int(n_code, 0);
31266
31267 ret_val = xmlUCSIsGeneralPunctuation(code);
31268 desret_int(ret_val);
31269 call_tests++;
31270 des_int(n_code, code, 0);
31271 xmlResetLastError();
31272 if (mem_base != xmlMemBlocks()) {
31273 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
31274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031275 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031276 printf(" %d", n_code);
31277 printf("\n");
31278 }
31279 }
31280#endif
31281
31282 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031283 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031284}
31285
31286
31287static int
31288test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031289 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031290
31291#ifdef LIBXML_UNICODE_ENABLED
31292 int mem_base;
31293 int ret_val;
31294 int code; /* UCS code point */
31295 int n_code;
31296
31297 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31298 mem_base = xmlMemBlocks();
31299 code = gen_int(n_code, 0);
31300
31301 ret_val = xmlUCSIsGeometricShapes(code);
31302 desret_int(ret_val);
31303 call_tests++;
31304 des_int(n_code, code, 0);
31305 xmlResetLastError();
31306 if (mem_base != xmlMemBlocks()) {
31307 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
31308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031309 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031310 printf(" %d", n_code);
31311 printf("\n");
31312 }
31313 }
31314#endif
31315
31316 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031317 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031318}
31319
31320
31321static int
31322test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031323 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031324
31325#ifdef LIBXML_UNICODE_ENABLED
31326 int mem_base;
31327 int ret_val;
31328 int code; /* UCS code point */
31329 int n_code;
31330
31331 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31332 mem_base = xmlMemBlocks();
31333 code = gen_int(n_code, 0);
31334
31335 ret_val = xmlUCSIsGeorgian(code);
31336 desret_int(ret_val);
31337 call_tests++;
31338 des_int(n_code, code, 0);
31339 xmlResetLastError();
31340 if (mem_base != xmlMemBlocks()) {
31341 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
31342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031343 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031344 printf(" %d", n_code);
31345 printf("\n");
31346 }
31347 }
31348#endif
31349
31350 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031351 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031352}
31353
31354
31355static int
31356test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031357 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031358
31359#ifdef LIBXML_UNICODE_ENABLED
31360 int mem_base;
31361 int ret_val;
31362 int code; /* UCS code point */
31363 int n_code;
31364
31365 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31366 mem_base = xmlMemBlocks();
31367 code = gen_int(n_code, 0);
31368
31369 ret_val = xmlUCSIsGothic(code);
31370 desret_int(ret_val);
31371 call_tests++;
31372 des_int(n_code, code, 0);
31373 xmlResetLastError();
31374 if (mem_base != xmlMemBlocks()) {
31375 printf("Leak of %d blocks found in xmlUCSIsGothic",
31376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031377 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031378 printf(" %d", n_code);
31379 printf("\n");
31380 }
31381 }
31382#endif
31383
31384 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031385 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031386}
31387
31388
31389static int
31390test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031391 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031392
31393#ifdef LIBXML_UNICODE_ENABLED
31394 int mem_base;
31395 int ret_val;
31396 int code; /* UCS code point */
31397 int n_code;
31398
31399 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31400 mem_base = xmlMemBlocks();
31401 code = gen_int(n_code, 0);
31402
31403 ret_val = xmlUCSIsGreek(code);
31404 desret_int(ret_val);
31405 call_tests++;
31406 des_int(n_code, code, 0);
31407 xmlResetLastError();
31408 if (mem_base != xmlMemBlocks()) {
31409 printf("Leak of %d blocks found in xmlUCSIsGreek",
31410 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031411 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031412 printf(" %d", n_code);
31413 printf("\n");
31414 }
31415 }
31416#endif
31417
31418 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031419 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031420}
31421
31422
31423static int
31424test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031425 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031426
31427#ifdef LIBXML_UNICODE_ENABLED
31428 int mem_base;
31429 int ret_val;
31430 int code; /* UCS code point */
31431 int n_code;
31432
31433 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31434 mem_base = xmlMemBlocks();
31435 code = gen_int(n_code, 0);
31436
31437 ret_val = xmlUCSIsGreekExtended(code);
31438 desret_int(ret_val);
31439 call_tests++;
31440 des_int(n_code, code, 0);
31441 xmlResetLastError();
31442 if (mem_base != xmlMemBlocks()) {
31443 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
31444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031445 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031446 printf(" %d", n_code);
31447 printf("\n");
31448 }
31449 }
31450#endif
31451
31452 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031453 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031454}
31455
31456
31457static int
31458test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031459 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031460
31461#ifdef LIBXML_UNICODE_ENABLED
31462 int mem_base;
31463 int ret_val;
31464 int code; /* UCS code point */
31465 int n_code;
31466
31467 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31468 mem_base = xmlMemBlocks();
31469 code = gen_int(n_code, 0);
31470
31471 ret_val = xmlUCSIsGreekandCoptic(code);
31472 desret_int(ret_val);
31473 call_tests++;
31474 des_int(n_code, code, 0);
31475 xmlResetLastError();
31476 if (mem_base != xmlMemBlocks()) {
31477 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
31478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031479 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031480 printf(" %d", n_code);
31481 printf("\n");
31482 }
31483 }
31484#endif
31485
31486 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031487 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031488}
31489
31490
31491static int
31492test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031493 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031494
31495#ifdef LIBXML_UNICODE_ENABLED
31496 int mem_base;
31497 int ret_val;
31498 int code; /* UCS code point */
31499 int n_code;
31500
31501 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31502 mem_base = xmlMemBlocks();
31503 code = gen_int(n_code, 0);
31504
31505 ret_val = xmlUCSIsGujarati(code);
31506 desret_int(ret_val);
31507 call_tests++;
31508 des_int(n_code, code, 0);
31509 xmlResetLastError();
31510 if (mem_base != xmlMemBlocks()) {
31511 printf("Leak of %d blocks found in xmlUCSIsGujarati",
31512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031513 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031514 printf(" %d", n_code);
31515 printf("\n");
31516 }
31517 }
31518#endif
31519
31520 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031521 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031522}
31523
31524
31525static int
31526test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031527 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031528
31529#ifdef LIBXML_UNICODE_ENABLED
31530 int mem_base;
31531 int ret_val;
31532 int code; /* UCS code point */
31533 int n_code;
31534
31535 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31536 mem_base = xmlMemBlocks();
31537 code = gen_int(n_code, 0);
31538
31539 ret_val = xmlUCSIsGurmukhi(code);
31540 desret_int(ret_val);
31541 call_tests++;
31542 des_int(n_code, code, 0);
31543 xmlResetLastError();
31544 if (mem_base != xmlMemBlocks()) {
31545 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
31546 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031547 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031548 printf(" %d", n_code);
31549 printf("\n");
31550 }
31551 }
31552#endif
31553
31554 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031555 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031556}
31557
31558
31559static int
31560test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031561 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031562
31563#ifdef LIBXML_UNICODE_ENABLED
31564 int mem_base;
31565 int ret_val;
31566 int code; /* UCS code point */
31567 int n_code;
31568
31569 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31570 mem_base = xmlMemBlocks();
31571 code = gen_int(n_code, 0);
31572
31573 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
31574 desret_int(ret_val);
31575 call_tests++;
31576 des_int(n_code, code, 0);
31577 xmlResetLastError();
31578 if (mem_base != xmlMemBlocks()) {
31579 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
31580 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031581 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031582 printf(" %d", n_code);
31583 printf("\n");
31584 }
31585 }
31586#endif
31587
31588 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031589 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031590}
31591
31592
31593static int
31594test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031595 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031596
31597#ifdef LIBXML_UNICODE_ENABLED
31598 int mem_base;
31599 int ret_val;
31600 int code; /* UCS code point */
31601 int n_code;
31602
31603 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31604 mem_base = xmlMemBlocks();
31605 code = gen_int(n_code, 0);
31606
31607 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
31608 desret_int(ret_val);
31609 call_tests++;
31610 des_int(n_code, code, 0);
31611 xmlResetLastError();
31612 if (mem_base != xmlMemBlocks()) {
31613 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
31614 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031615 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031616 printf(" %d", n_code);
31617 printf("\n");
31618 }
31619 }
31620#endif
31621
31622 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031623 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031624}
31625
31626
31627static int
31628test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031629 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031630
31631#ifdef LIBXML_UNICODE_ENABLED
31632 int mem_base;
31633 int ret_val;
31634 int code; /* UCS code point */
31635 int n_code;
31636
31637 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31638 mem_base = xmlMemBlocks();
31639 code = gen_int(n_code, 0);
31640
31641 ret_val = xmlUCSIsHangulJamo(code);
31642 desret_int(ret_val);
31643 call_tests++;
31644 des_int(n_code, code, 0);
31645 xmlResetLastError();
31646 if (mem_base != xmlMemBlocks()) {
31647 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
31648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031649 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031650 printf(" %d", n_code);
31651 printf("\n");
31652 }
31653 }
31654#endif
31655
31656 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031657 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031658}
31659
31660
31661static int
31662test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031663 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031664
31665#ifdef LIBXML_UNICODE_ENABLED
31666 int mem_base;
31667 int ret_val;
31668 int code; /* UCS code point */
31669 int n_code;
31670
31671 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31672 mem_base = xmlMemBlocks();
31673 code = gen_int(n_code, 0);
31674
31675 ret_val = xmlUCSIsHangulSyllables(code);
31676 desret_int(ret_val);
31677 call_tests++;
31678 des_int(n_code, code, 0);
31679 xmlResetLastError();
31680 if (mem_base != xmlMemBlocks()) {
31681 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
31682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031683 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031684 printf(" %d", n_code);
31685 printf("\n");
31686 }
31687 }
31688#endif
31689
31690 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031691 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031692}
31693
31694
31695static int
31696test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031697 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031698
31699#ifdef LIBXML_UNICODE_ENABLED
31700 int mem_base;
31701 int ret_val;
31702 int code; /* UCS code point */
31703 int n_code;
31704
31705 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31706 mem_base = xmlMemBlocks();
31707 code = gen_int(n_code, 0);
31708
31709 ret_val = xmlUCSIsHanunoo(code);
31710 desret_int(ret_val);
31711 call_tests++;
31712 des_int(n_code, code, 0);
31713 xmlResetLastError();
31714 if (mem_base != xmlMemBlocks()) {
31715 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
31716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031717 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031718 printf(" %d", n_code);
31719 printf("\n");
31720 }
31721 }
31722#endif
31723
31724 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031725 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031726}
31727
31728
31729static int
31730test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031731 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031732
31733#ifdef LIBXML_UNICODE_ENABLED
31734 int mem_base;
31735 int ret_val;
31736 int code; /* UCS code point */
31737 int n_code;
31738
31739 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31740 mem_base = xmlMemBlocks();
31741 code = gen_int(n_code, 0);
31742
31743 ret_val = xmlUCSIsHebrew(code);
31744 desret_int(ret_val);
31745 call_tests++;
31746 des_int(n_code, code, 0);
31747 xmlResetLastError();
31748 if (mem_base != xmlMemBlocks()) {
31749 printf("Leak of %d blocks found in xmlUCSIsHebrew",
31750 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031751 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031752 printf(" %d", n_code);
31753 printf("\n");
31754 }
31755 }
31756#endif
31757
31758 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031759 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031760}
31761
31762
31763static int
31764test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031765 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031766
31767#ifdef LIBXML_UNICODE_ENABLED
31768 int mem_base;
31769 int ret_val;
31770 int code; /* UCS code point */
31771 int n_code;
31772
31773 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31774 mem_base = xmlMemBlocks();
31775 code = gen_int(n_code, 0);
31776
31777 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
31778 desret_int(ret_val);
31779 call_tests++;
31780 des_int(n_code, code, 0);
31781 xmlResetLastError();
31782 if (mem_base != xmlMemBlocks()) {
31783 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
31784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031785 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031786 printf(" %d", n_code);
31787 printf("\n");
31788 }
31789 }
31790#endif
31791
31792 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031793 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031794}
31795
31796
31797static int
31798test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031799 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031800
31801#ifdef LIBXML_UNICODE_ENABLED
31802 int mem_base;
31803 int ret_val;
31804 int code; /* UCS code point */
31805 int n_code;
31806
31807 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31808 mem_base = xmlMemBlocks();
31809 code = gen_int(n_code, 0);
31810
31811 ret_val = xmlUCSIsHighSurrogates(code);
31812 desret_int(ret_val);
31813 call_tests++;
31814 des_int(n_code, code, 0);
31815 xmlResetLastError();
31816 if (mem_base != xmlMemBlocks()) {
31817 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
31818 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031819 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031820 printf(" %d", n_code);
31821 printf("\n");
31822 }
31823 }
31824#endif
31825
31826 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031827 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031828}
31829
31830
31831static int
31832test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031833 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031834
31835#ifdef LIBXML_UNICODE_ENABLED
31836 int mem_base;
31837 int ret_val;
31838 int code; /* UCS code point */
31839 int n_code;
31840
31841 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31842 mem_base = xmlMemBlocks();
31843 code = gen_int(n_code, 0);
31844
31845 ret_val = xmlUCSIsHiragana(code);
31846 desret_int(ret_val);
31847 call_tests++;
31848 des_int(n_code, code, 0);
31849 xmlResetLastError();
31850 if (mem_base != xmlMemBlocks()) {
31851 printf("Leak of %d blocks found in xmlUCSIsHiragana",
31852 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031853 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031854 printf(" %d", n_code);
31855 printf("\n");
31856 }
31857 }
31858#endif
31859
31860 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031861 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031862}
31863
31864
31865static int
31866test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031867 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031868
31869#ifdef LIBXML_UNICODE_ENABLED
31870 int mem_base;
31871 int ret_val;
31872 int code; /* UCS code point */
31873 int n_code;
31874
31875 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31876 mem_base = xmlMemBlocks();
31877 code = gen_int(n_code, 0);
31878
31879 ret_val = xmlUCSIsIPAExtensions(code);
31880 desret_int(ret_val);
31881 call_tests++;
31882 des_int(n_code, code, 0);
31883 xmlResetLastError();
31884 if (mem_base != xmlMemBlocks()) {
31885 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
31886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031887 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031888 printf(" %d", n_code);
31889 printf("\n");
31890 }
31891 }
31892#endif
31893
31894 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031895 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031896}
31897
31898
31899static int
31900test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031901 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031902
31903#ifdef LIBXML_UNICODE_ENABLED
31904 int mem_base;
31905 int ret_val;
31906 int code; /* UCS code point */
31907 int n_code;
31908
31909 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31910 mem_base = xmlMemBlocks();
31911 code = gen_int(n_code, 0);
31912
31913 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
31914 desret_int(ret_val);
31915 call_tests++;
31916 des_int(n_code, code, 0);
31917 xmlResetLastError();
31918 if (mem_base != xmlMemBlocks()) {
31919 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
31920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031921 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031922 printf(" %d", n_code);
31923 printf("\n");
31924 }
31925 }
31926#endif
31927
31928 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031929 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031930}
31931
31932
31933static int
31934test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031935 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031936
31937#ifdef LIBXML_UNICODE_ENABLED
31938 int mem_base;
31939 int ret_val;
31940 int code; /* UCS code point */
31941 int n_code;
31942
31943 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31944 mem_base = xmlMemBlocks();
31945 code = gen_int(n_code, 0);
31946
31947 ret_val = xmlUCSIsKanbun(code);
31948 desret_int(ret_val);
31949 call_tests++;
31950 des_int(n_code, code, 0);
31951 xmlResetLastError();
31952 if (mem_base != xmlMemBlocks()) {
31953 printf("Leak of %d blocks found in xmlUCSIsKanbun",
31954 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031955 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031956 printf(" %d", n_code);
31957 printf("\n");
31958 }
31959 }
31960#endif
31961
31962 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031963 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031964}
31965
31966
31967static int
31968test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031969 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031970
31971#ifdef LIBXML_UNICODE_ENABLED
31972 int mem_base;
31973 int ret_val;
31974 int code; /* UCS code point */
31975 int n_code;
31976
31977 for (n_code = 0;n_code < gen_nb_int;n_code++) {
31978 mem_base = xmlMemBlocks();
31979 code = gen_int(n_code, 0);
31980
31981 ret_val = xmlUCSIsKangxiRadicals(code);
31982 desret_int(ret_val);
31983 call_tests++;
31984 des_int(n_code, code, 0);
31985 xmlResetLastError();
31986 if (mem_base != xmlMemBlocks()) {
31987 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
31988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031989 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031990 printf(" %d", n_code);
31991 printf("\n");
31992 }
31993 }
31994#endif
31995
31996 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031997 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000031998}
31999
32000
32001static int
32002test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032003 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032004
32005#ifdef LIBXML_UNICODE_ENABLED
32006 int mem_base;
32007 int ret_val;
32008 int code; /* UCS code point */
32009 int n_code;
32010
32011 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32012 mem_base = xmlMemBlocks();
32013 code = gen_int(n_code, 0);
32014
32015 ret_val = xmlUCSIsKannada(code);
32016 desret_int(ret_val);
32017 call_tests++;
32018 des_int(n_code, code, 0);
32019 xmlResetLastError();
32020 if (mem_base != xmlMemBlocks()) {
32021 printf("Leak of %d blocks found in xmlUCSIsKannada",
32022 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032023 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032024 printf(" %d", n_code);
32025 printf("\n");
32026 }
32027 }
32028#endif
32029
32030 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032031 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032032}
32033
32034
32035static int
32036test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032037 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032038
32039#ifdef LIBXML_UNICODE_ENABLED
32040 int mem_base;
32041 int ret_val;
32042 int code; /* UCS code point */
32043 int n_code;
32044
32045 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32046 mem_base = xmlMemBlocks();
32047 code = gen_int(n_code, 0);
32048
32049 ret_val = xmlUCSIsKatakana(code);
32050 desret_int(ret_val);
32051 call_tests++;
32052 des_int(n_code, code, 0);
32053 xmlResetLastError();
32054 if (mem_base != xmlMemBlocks()) {
32055 printf("Leak of %d blocks found in xmlUCSIsKatakana",
32056 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032057 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032058 printf(" %d", n_code);
32059 printf("\n");
32060 }
32061 }
32062#endif
32063
32064 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032065 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032066}
32067
32068
32069static int
32070test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032071 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032072
32073#ifdef LIBXML_UNICODE_ENABLED
32074 int mem_base;
32075 int ret_val;
32076 int code; /* UCS code point */
32077 int n_code;
32078
32079 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32080 mem_base = xmlMemBlocks();
32081 code = gen_int(n_code, 0);
32082
32083 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
32084 desret_int(ret_val);
32085 call_tests++;
32086 des_int(n_code, code, 0);
32087 xmlResetLastError();
32088 if (mem_base != xmlMemBlocks()) {
32089 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
32090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032091 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032092 printf(" %d", n_code);
32093 printf("\n");
32094 }
32095 }
32096#endif
32097
32098 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032099 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032100}
32101
32102
32103static int
32104test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032105 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032106
32107#ifdef LIBXML_UNICODE_ENABLED
32108 int mem_base;
32109 int ret_val;
32110 int code; /* UCS code point */
32111 int n_code;
32112
32113 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32114 mem_base = xmlMemBlocks();
32115 code = gen_int(n_code, 0);
32116
32117 ret_val = xmlUCSIsKhmer(code);
32118 desret_int(ret_val);
32119 call_tests++;
32120 des_int(n_code, code, 0);
32121 xmlResetLastError();
32122 if (mem_base != xmlMemBlocks()) {
32123 printf("Leak of %d blocks found in xmlUCSIsKhmer",
32124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032125 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032126 printf(" %d", n_code);
32127 printf("\n");
32128 }
32129 }
32130#endif
32131
32132 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032133 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032134}
32135
32136
32137static int
32138test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032139 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032140
32141#ifdef LIBXML_UNICODE_ENABLED
32142 int mem_base;
32143 int ret_val;
32144 int code; /* UCS code point */
32145 int n_code;
32146
32147 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32148 mem_base = xmlMemBlocks();
32149 code = gen_int(n_code, 0);
32150
32151 ret_val = xmlUCSIsKhmerSymbols(code);
32152 desret_int(ret_val);
32153 call_tests++;
32154 des_int(n_code, code, 0);
32155 xmlResetLastError();
32156 if (mem_base != xmlMemBlocks()) {
32157 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
32158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032159 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032160 printf(" %d", n_code);
32161 printf("\n");
32162 }
32163 }
32164#endif
32165
32166 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032167 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032168}
32169
32170
32171static int
32172test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032173 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032174
32175#ifdef LIBXML_UNICODE_ENABLED
32176 int mem_base;
32177 int ret_val;
32178 int code; /* UCS code point */
32179 int n_code;
32180
32181 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32182 mem_base = xmlMemBlocks();
32183 code = gen_int(n_code, 0);
32184
32185 ret_val = xmlUCSIsLao(code);
32186 desret_int(ret_val);
32187 call_tests++;
32188 des_int(n_code, code, 0);
32189 xmlResetLastError();
32190 if (mem_base != xmlMemBlocks()) {
32191 printf("Leak of %d blocks found in xmlUCSIsLao",
32192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032193 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032194 printf(" %d", n_code);
32195 printf("\n");
32196 }
32197 }
32198#endif
32199
32200 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032201 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032202}
32203
32204
32205static int
32206test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032207 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032208
32209#ifdef LIBXML_UNICODE_ENABLED
32210 int mem_base;
32211 int ret_val;
32212 int code; /* UCS code point */
32213 int n_code;
32214
32215 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32216 mem_base = xmlMemBlocks();
32217 code = gen_int(n_code, 0);
32218
32219 ret_val = xmlUCSIsLatin1Supplement(code);
32220 desret_int(ret_val);
32221 call_tests++;
32222 des_int(n_code, code, 0);
32223 xmlResetLastError();
32224 if (mem_base != xmlMemBlocks()) {
32225 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
32226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032227 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032228 printf(" %d", n_code);
32229 printf("\n");
32230 }
32231 }
32232#endif
32233
32234 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032235 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032236}
32237
32238
32239static int
32240test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032241 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032242
32243#ifdef LIBXML_UNICODE_ENABLED
32244 int mem_base;
32245 int ret_val;
32246 int code; /* UCS code point */
32247 int n_code;
32248
32249 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32250 mem_base = xmlMemBlocks();
32251 code = gen_int(n_code, 0);
32252
32253 ret_val = xmlUCSIsLatinExtendedA(code);
32254 desret_int(ret_val);
32255 call_tests++;
32256 des_int(n_code, code, 0);
32257 xmlResetLastError();
32258 if (mem_base != xmlMemBlocks()) {
32259 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
32260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032261 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032262 printf(" %d", n_code);
32263 printf("\n");
32264 }
32265 }
32266#endif
32267
32268 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032269 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032270}
32271
32272
32273static int
32274test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032275 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032276
32277#ifdef LIBXML_UNICODE_ENABLED
32278 int mem_base;
32279 int ret_val;
32280 int code; /* UCS code point */
32281 int n_code;
32282
32283 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32284 mem_base = xmlMemBlocks();
32285 code = gen_int(n_code, 0);
32286
32287 ret_val = xmlUCSIsLatinExtendedAdditional(code);
32288 desret_int(ret_val);
32289 call_tests++;
32290 des_int(n_code, code, 0);
32291 xmlResetLastError();
32292 if (mem_base != xmlMemBlocks()) {
32293 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
32294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032295 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032296 printf(" %d", n_code);
32297 printf("\n");
32298 }
32299 }
32300#endif
32301
32302 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032303 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032304}
32305
32306
32307static int
32308test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032309 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032310
32311#ifdef LIBXML_UNICODE_ENABLED
32312 int mem_base;
32313 int ret_val;
32314 int code; /* UCS code point */
32315 int n_code;
32316
32317 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32318 mem_base = xmlMemBlocks();
32319 code = gen_int(n_code, 0);
32320
32321 ret_val = xmlUCSIsLatinExtendedB(code);
32322 desret_int(ret_val);
32323 call_tests++;
32324 des_int(n_code, code, 0);
32325 xmlResetLastError();
32326 if (mem_base != xmlMemBlocks()) {
32327 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
32328 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032329 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032330 printf(" %d", n_code);
32331 printf("\n");
32332 }
32333 }
32334#endif
32335
32336 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032337 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032338}
32339
32340
32341static int
32342test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032343 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032344
32345#ifdef LIBXML_UNICODE_ENABLED
32346 int mem_base;
32347 int ret_val;
32348 int code; /* UCS code point */
32349 int n_code;
32350
32351 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32352 mem_base = xmlMemBlocks();
32353 code = gen_int(n_code, 0);
32354
32355 ret_val = xmlUCSIsLetterlikeSymbols(code);
32356 desret_int(ret_val);
32357 call_tests++;
32358 des_int(n_code, code, 0);
32359 xmlResetLastError();
32360 if (mem_base != xmlMemBlocks()) {
32361 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
32362 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032363 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032364 printf(" %d", n_code);
32365 printf("\n");
32366 }
32367 }
32368#endif
32369
32370 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032371 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032372}
32373
32374
32375static int
32376test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032377 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032378
32379#ifdef LIBXML_UNICODE_ENABLED
32380 int mem_base;
32381 int ret_val;
32382 int code; /* UCS code point */
32383 int n_code;
32384
32385 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32386 mem_base = xmlMemBlocks();
32387 code = gen_int(n_code, 0);
32388
32389 ret_val = xmlUCSIsLimbu(code);
32390 desret_int(ret_val);
32391 call_tests++;
32392 des_int(n_code, code, 0);
32393 xmlResetLastError();
32394 if (mem_base != xmlMemBlocks()) {
32395 printf("Leak of %d blocks found in xmlUCSIsLimbu",
32396 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032397 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032398 printf(" %d", n_code);
32399 printf("\n");
32400 }
32401 }
32402#endif
32403
32404 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032405 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032406}
32407
32408
32409static int
32410test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032411 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032412
32413#ifdef LIBXML_UNICODE_ENABLED
32414 int mem_base;
32415 int ret_val;
32416 int code; /* UCS code point */
32417 int n_code;
32418
32419 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32420 mem_base = xmlMemBlocks();
32421 code = gen_int(n_code, 0);
32422
32423 ret_val = xmlUCSIsLinearBIdeograms(code);
32424 desret_int(ret_val);
32425 call_tests++;
32426 des_int(n_code, code, 0);
32427 xmlResetLastError();
32428 if (mem_base != xmlMemBlocks()) {
32429 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
32430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032431 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032432 printf(" %d", n_code);
32433 printf("\n");
32434 }
32435 }
32436#endif
32437
32438 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032439 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032440}
32441
32442
32443static int
32444test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032445 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032446
32447#ifdef LIBXML_UNICODE_ENABLED
32448 int mem_base;
32449 int ret_val;
32450 int code; /* UCS code point */
32451 int n_code;
32452
32453 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32454 mem_base = xmlMemBlocks();
32455 code = gen_int(n_code, 0);
32456
32457 ret_val = xmlUCSIsLinearBSyllabary(code);
32458 desret_int(ret_val);
32459 call_tests++;
32460 des_int(n_code, code, 0);
32461 xmlResetLastError();
32462 if (mem_base != xmlMemBlocks()) {
32463 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
32464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032465 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032466 printf(" %d", n_code);
32467 printf("\n");
32468 }
32469 }
32470#endif
32471
32472 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032473 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032474}
32475
32476
32477static int
32478test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032479 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032480
32481#ifdef LIBXML_UNICODE_ENABLED
32482 int mem_base;
32483 int ret_val;
32484 int code; /* UCS code point */
32485 int n_code;
32486
32487 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32488 mem_base = xmlMemBlocks();
32489 code = gen_int(n_code, 0);
32490
32491 ret_val = xmlUCSIsLowSurrogates(code);
32492 desret_int(ret_val);
32493 call_tests++;
32494 des_int(n_code, code, 0);
32495 xmlResetLastError();
32496 if (mem_base != xmlMemBlocks()) {
32497 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
32498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032499 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032500 printf(" %d", n_code);
32501 printf("\n");
32502 }
32503 }
32504#endif
32505
32506 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032507 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032508}
32509
32510
32511static int
32512test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032513 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032514
32515#ifdef LIBXML_UNICODE_ENABLED
32516 int mem_base;
32517 int ret_val;
32518 int code; /* UCS code point */
32519 int n_code;
32520
32521 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32522 mem_base = xmlMemBlocks();
32523 code = gen_int(n_code, 0);
32524
32525 ret_val = xmlUCSIsMalayalam(code);
32526 desret_int(ret_val);
32527 call_tests++;
32528 des_int(n_code, code, 0);
32529 xmlResetLastError();
32530 if (mem_base != xmlMemBlocks()) {
32531 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
32532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032533 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032534 printf(" %d", n_code);
32535 printf("\n");
32536 }
32537 }
32538#endif
32539
32540 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032541 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032542}
32543
32544
32545static int
32546test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032547 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032548
32549#ifdef LIBXML_UNICODE_ENABLED
32550 int mem_base;
32551 int ret_val;
32552 int code; /* UCS code point */
32553 int n_code;
32554
32555 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32556 mem_base = xmlMemBlocks();
32557 code = gen_int(n_code, 0);
32558
32559 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
32560 desret_int(ret_val);
32561 call_tests++;
32562 des_int(n_code, code, 0);
32563 xmlResetLastError();
32564 if (mem_base != xmlMemBlocks()) {
32565 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
32566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032567 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032568 printf(" %d", n_code);
32569 printf("\n");
32570 }
32571 }
32572#endif
32573
32574 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032575 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032576}
32577
32578
32579static int
32580test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032581 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032582
32583#ifdef LIBXML_UNICODE_ENABLED
32584 int mem_base;
32585 int ret_val;
32586 int code; /* UCS code point */
32587 int n_code;
32588
32589 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32590 mem_base = xmlMemBlocks();
32591 code = gen_int(n_code, 0);
32592
32593 ret_val = xmlUCSIsMathematicalOperators(code);
32594 desret_int(ret_val);
32595 call_tests++;
32596 des_int(n_code, code, 0);
32597 xmlResetLastError();
32598 if (mem_base != xmlMemBlocks()) {
32599 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
32600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032601 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032602 printf(" %d", n_code);
32603 printf("\n");
32604 }
32605 }
32606#endif
32607
32608 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032609 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032610}
32611
32612
32613static int
32614test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032615 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032616
32617#ifdef LIBXML_UNICODE_ENABLED
32618 int mem_base;
32619 int ret_val;
32620 int code; /* UCS code point */
32621 int n_code;
32622
32623 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32624 mem_base = xmlMemBlocks();
32625 code = gen_int(n_code, 0);
32626
32627 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
32628 desret_int(ret_val);
32629 call_tests++;
32630 des_int(n_code, code, 0);
32631 xmlResetLastError();
32632 if (mem_base != xmlMemBlocks()) {
32633 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
32634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032635 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032636 printf(" %d", n_code);
32637 printf("\n");
32638 }
32639 }
32640#endif
32641
32642 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032643 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032644}
32645
32646
32647static int
32648test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032649 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032650
32651#ifdef LIBXML_UNICODE_ENABLED
32652 int mem_base;
32653 int ret_val;
32654 int code; /* UCS code point */
32655 int n_code;
32656
32657 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32658 mem_base = xmlMemBlocks();
32659 code = gen_int(n_code, 0);
32660
32661 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
32662 desret_int(ret_val);
32663 call_tests++;
32664 des_int(n_code, code, 0);
32665 xmlResetLastError();
32666 if (mem_base != xmlMemBlocks()) {
32667 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
32668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032669 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032670 printf(" %d", n_code);
32671 printf("\n");
32672 }
32673 }
32674#endif
32675
32676 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032677 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032678}
32679
32680
32681static int
32682test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032683 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032684
32685#ifdef LIBXML_UNICODE_ENABLED
32686 int mem_base;
32687 int ret_val;
32688 int code; /* UCS code point */
32689 int n_code;
32690
32691 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32692 mem_base = xmlMemBlocks();
32693 code = gen_int(n_code, 0);
32694
32695 ret_val = xmlUCSIsMiscellaneousSymbols(code);
32696 desret_int(ret_val);
32697 call_tests++;
32698 des_int(n_code, code, 0);
32699 xmlResetLastError();
32700 if (mem_base != xmlMemBlocks()) {
32701 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
32702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032703 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032704 printf(" %d", n_code);
32705 printf("\n");
32706 }
32707 }
32708#endif
32709
32710 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032711 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032712}
32713
32714
32715static int
32716test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032717 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032718
32719#ifdef LIBXML_UNICODE_ENABLED
32720 int mem_base;
32721 int ret_val;
32722 int code; /* UCS code point */
32723 int n_code;
32724
32725 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32726 mem_base = xmlMemBlocks();
32727 code = gen_int(n_code, 0);
32728
32729 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
32730 desret_int(ret_val);
32731 call_tests++;
32732 des_int(n_code, code, 0);
32733 xmlResetLastError();
32734 if (mem_base != xmlMemBlocks()) {
32735 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
32736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032737 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032738 printf(" %d", n_code);
32739 printf("\n");
32740 }
32741 }
32742#endif
32743
32744 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032745 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032746}
32747
32748
32749static int
32750test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032751 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032752
32753#ifdef LIBXML_UNICODE_ENABLED
32754 int mem_base;
32755 int ret_val;
32756 int code; /* UCS code point */
32757 int n_code;
32758
32759 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32760 mem_base = xmlMemBlocks();
32761 code = gen_int(n_code, 0);
32762
32763 ret_val = xmlUCSIsMiscellaneousTechnical(code);
32764 desret_int(ret_val);
32765 call_tests++;
32766 des_int(n_code, code, 0);
32767 xmlResetLastError();
32768 if (mem_base != xmlMemBlocks()) {
32769 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
32770 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032771 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032772 printf(" %d", n_code);
32773 printf("\n");
32774 }
32775 }
32776#endif
32777
32778 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032779 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032780}
32781
32782
32783static int
32784test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032785 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032786
32787#ifdef LIBXML_UNICODE_ENABLED
32788 int mem_base;
32789 int ret_val;
32790 int code; /* UCS code point */
32791 int n_code;
32792
32793 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32794 mem_base = xmlMemBlocks();
32795 code = gen_int(n_code, 0);
32796
32797 ret_val = xmlUCSIsMongolian(code);
32798 desret_int(ret_val);
32799 call_tests++;
32800 des_int(n_code, code, 0);
32801 xmlResetLastError();
32802 if (mem_base != xmlMemBlocks()) {
32803 printf("Leak of %d blocks found in xmlUCSIsMongolian",
32804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032805 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032806 printf(" %d", n_code);
32807 printf("\n");
32808 }
32809 }
32810#endif
32811
32812 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032813 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032814}
32815
32816
32817static int
32818test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032819 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032820
32821#ifdef LIBXML_UNICODE_ENABLED
32822 int mem_base;
32823 int ret_val;
32824 int code; /* UCS code point */
32825 int n_code;
32826
32827 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32828 mem_base = xmlMemBlocks();
32829 code = gen_int(n_code, 0);
32830
32831 ret_val = xmlUCSIsMusicalSymbols(code);
32832 desret_int(ret_val);
32833 call_tests++;
32834 des_int(n_code, code, 0);
32835 xmlResetLastError();
32836 if (mem_base != xmlMemBlocks()) {
32837 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
32838 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032839 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032840 printf(" %d", n_code);
32841 printf("\n");
32842 }
32843 }
32844#endif
32845
32846 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032847 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032848}
32849
32850
32851static int
32852test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032853 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032854
32855#ifdef LIBXML_UNICODE_ENABLED
32856 int mem_base;
32857 int ret_val;
32858 int code; /* UCS code point */
32859 int n_code;
32860
32861 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32862 mem_base = xmlMemBlocks();
32863 code = gen_int(n_code, 0);
32864
32865 ret_val = xmlUCSIsMyanmar(code);
32866 desret_int(ret_val);
32867 call_tests++;
32868 des_int(n_code, code, 0);
32869 xmlResetLastError();
32870 if (mem_base != xmlMemBlocks()) {
32871 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
32872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032873 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032874 printf(" %d", n_code);
32875 printf("\n");
32876 }
32877 }
32878#endif
32879
32880 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032881 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032882}
32883
32884
32885static int
32886test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032887 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032888
32889#ifdef LIBXML_UNICODE_ENABLED
32890 int mem_base;
32891 int ret_val;
32892 int code; /* UCS code point */
32893 int n_code;
32894
32895 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32896 mem_base = xmlMemBlocks();
32897 code = gen_int(n_code, 0);
32898
32899 ret_val = xmlUCSIsNumberForms(code);
32900 desret_int(ret_val);
32901 call_tests++;
32902 des_int(n_code, code, 0);
32903 xmlResetLastError();
32904 if (mem_base != xmlMemBlocks()) {
32905 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
32906 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032907 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032908 printf(" %d", n_code);
32909 printf("\n");
32910 }
32911 }
32912#endif
32913
32914 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032915 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032916}
32917
32918
32919static int
32920test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032921 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032922
32923#ifdef LIBXML_UNICODE_ENABLED
32924 int mem_base;
32925 int ret_val;
32926 int code; /* UCS code point */
32927 int n_code;
32928
32929 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32930 mem_base = xmlMemBlocks();
32931 code = gen_int(n_code, 0);
32932
32933 ret_val = xmlUCSIsOgham(code);
32934 desret_int(ret_val);
32935 call_tests++;
32936 des_int(n_code, code, 0);
32937 xmlResetLastError();
32938 if (mem_base != xmlMemBlocks()) {
32939 printf("Leak of %d blocks found in xmlUCSIsOgham",
32940 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032941 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032942 printf(" %d", n_code);
32943 printf("\n");
32944 }
32945 }
32946#endif
32947
32948 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032949 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032950}
32951
32952
32953static int
32954test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032955 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032956
32957#ifdef LIBXML_UNICODE_ENABLED
32958 int mem_base;
32959 int ret_val;
32960 int code; /* UCS code point */
32961 int n_code;
32962
32963 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32964 mem_base = xmlMemBlocks();
32965 code = gen_int(n_code, 0);
32966
32967 ret_val = xmlUCSIsOldItalic(code);
32968 desret_int(ret_val);
32969 call_tests++;
32970 des_int(n_code, code, 0);
32971 xmlResetLastError();
32972 if (mem_base != xmlMemBlocks()) {
32973 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
32974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032975 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032976 printf(" %d", n_code);
32977 printf("\n");
32978 }
32979 }
32980#endif
32981
32982 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032983 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032984}
32985
32986
32987static int
32988test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032989 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000032990
32991#ifdef LIBXML_UNICODE_ENABLED
32992 int mem_base;
32993 int ret_val;
32994 int code; /* UCS code point */
32995 int n_code;
32996
32997 for (n_code = 0;n_code < gen_nb_int;n_code++) {
32998 mem_base = xmlMemBlocks();
32999 code = gen_int(n_code, 0);
33000
33001 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
33002 desret_int(ret_val);
33003 call_tests++;
33004 des_int(n_code, code, 0);
33005 xmlResetLastError();
33006 if (mem_base != xmlMemBlocks()) {
33007 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
33008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033009 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033010 printf(" %d", n_code);
33011 printf("\n");
33012 }
33013 }
33014#endif
33015
33016 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033017 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033018}
33019
33020
33021static int
33022test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033023 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033024
33025#ifdef LIBXML_UNICODE_ENABLED
33026 int mem_base;
33027 int ret_val;
33028 int code; /* UCS code point */
33029 int n_code;
33030
33031 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33032 mem_base = xmlMemBlocks();
33033 code = gen_int(n_code, 0);
33034
33035 ret_val = xmlUCSIsOriya(code);
33036 desret_int(ret_val);
33037 call_tests++;
33038 des_int(n_code, code, 0);
33039 xmlResetLastError();
33040 if (mem_base != xmlMemBlocks()) {
33041 printf("Leak of %d blocks found in xmlUCSIsOriya",
33042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033043 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033044 printf(" %d", n_code);
33045 printf("\n");
33046 }
33047 }
33048#endif
33049
33050 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033051 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033052}
33053
33054
33055static int
33056test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033057 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033058
33059#ifdef LIBXML_UNICODE_ENABLED
33060 int mem_base;
33061 int ret_val;
33062 int code; /* UCS code point */
33063 int n_code;
33064
33065 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33066 mem_base = xmlMemBlocks();
33067 code = gen_int(n_code, 0);
33068
33069 ret_val = xmlUCSIsOsmanya(code);
33070 desret_int(ret_val);
33071 call_tests++;
33072 des_int(n_code, code, 0);
33073 xmlResetLastError();
33074 if (mem_base != xmlMemBlocks()) {
33075 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
33076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033077 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033078 printf(" %d", n_code);
33079 printf("\n");
33080 }
33081 }
33082#endif
33083
33084 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033085 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033086}
33087
33088
33089static int
33090test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033091 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033092
33093#ifdef LIBXML_UNICODE_ENABLED
33094 int mem_base;
33095 int ret_val;
33096 int code; /* UCS code point */
33097 int n_code;
33098
33099 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33100 mem_base = xmlMemBlocks();
33101 code = gen_int(n_code, 0);
33102
33103 ret_val = xmlUCSIsPhoneticExtensions(code);
33104 desret_int(ret_val);
33105 call_tests++;
33106 des_int(n_code, code, 0);
33107 xmlResetLastError();
33108 if (mem_base != xmlMemBlocks()) {
33109 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
33110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033111 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033112 printf(" %d", n_code);
33113 printf("\n");
33114 }
33115 }
33116#endif
33117
33118 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033119 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033120}
33121
33122
33123static int
33124test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033125 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033126
33127#ifdef LIBXML_UNICODE_ENABLED
33128 int mem_base;
33129 int ret_val;
33130 int code; /* UCS code point */
33131 int n_code;
33132
33133 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33134 mem_base = xmlMemBlocks();
33135 code = gen_int(n_code, 0);
33136
33137 ret_val = xmlUCSIsPrivateUse(code);
33138 desret_int(ret_val);
33139 call_tests++;
33140 des_int(n_code, code, 0);
33141 xmlResetLastError();
33142 if (mem_base != xmlMemBlocks()) {
33143 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
33144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033145 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033146 printf(" %d", n_code);
33147 printf("\n");
33148 }
33149 }
33150#endif
33151
33152 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033153 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033154}
33155
33156
33157static int
33158test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033159 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033160
33161#ifdef LIBXML_UNICODE_ENABLED
33162 int mem_base;
33163 int ret_val;
33164 int code; /* UCS code point */
33165 int n_code;
33166
33167 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33168 mem_base = xmlMemBlocks();
33169 code = gen_int(n_code, 0);
33170
33171 ret_val = xmlUCSIsPrivateUseArea(code);
33172 desret_int(ret_val);
33173 call_tests++;
33174 des_int(n_code, code, 0);
33175 xmlResetLastError();
33176 if (mem_base != xmlMemBlocks()) {
33177 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
33178 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033179 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033180 printf(" %d", n_code);
33181 printf("\n");
33182 }
33183 }
33184#endif
33185
33186 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033187 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033188}
33189
33190
33191static int
33192test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033193 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033194
33195#ifdef LIBXML_UNICODE_ENABLED
33196 int mem_base;
33197 int ret_val;
33198 int code; /* UCS code point */
33199 int n_code;
33200
33201 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33202 mem_base = xmlMemBlocks();
33203 code = gen_int(n_code, 0);
33204
33205 ret_val = xmlUCSIsRunic(code);
33206 desret_int(ret_val);
33207 call_tests++;
33208 des_int(n_code, code, 0);
33209 xmlResetLastError();
33210 if (mem_base != xmlMemBlocks()) {
33211 printf("Leak of %d blocks found in xmlUCSIsRunic",
33212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033213 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033214 printf(" %d", n_code);
33215 printf("\n");
33216 }
33217 }
33218#endif
33219
33220 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033221 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033222}
33223
33224
33225static int
33226test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033227 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033228
33229#ifdef LIBXML_UNICODE_ENABLED
33230 int mem_base;
33231 int ret_val;
33232 int code; /* UCS code point */
33233 int n_code;
33234
33235 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33236 mem_base = xmlMemBlocks();
33237 code = gen_int(n_code, 0);
33238
33239 ret_val = xmlUCSIsShavian(code);
33240 desret_int(ret_val);
33241 call_tests++;
33242 des_int(n_code, code, 0);
33243 xmlResetLastError();
33244 if (mem_base != xmlMemBlocks()) {
33245 printf("Leak of %d blocks found in xmlUCSIsShavian",
33246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033247 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033248 printf(" %d", n_code);
33249 printf("\n");
33250 }
33251 }
33252#endif
33253
33254 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033255 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033256}
33257
33258
33259static int
33260test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033261 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033262
33263#ifdef LIBXML_UNICODE_ENABLED
33264 int mem_base;
33265 int ret_val;
33266 int code; /* UCS code point */
33267 int n_code;
33268
33269 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33270 mem_base = xmlMemBlocks();
33271 code = gen_int(n_code, 0);
33272
33273 ret_val = xmlUCSIsSinhala(code);
33274 desret_int(ret_val);
33275 call_tests++;
33276 des_int(n_code, code, 0);
33277 xmlResetLastError();
33278 if (mem_base != xmlMemBlocks()) {
33279 printf("Leak of %d blocks found in xmlUCSIsSinhala",
33280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033281 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033282 printf(" %d", n_code);
33283 printf("\n");
33284 }
33285 }
33286#endif
33287
33288 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033289 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033290}
33291
33292
33293static int
33294test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033295 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033296
33297#ifdef LIBXML_UNICODE_ENABLED
33298 int mem_base;
33299 int ret_val;
33300 int code; /* UCS code point */
33301 int n_code;
33302
33303 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33304 mem_base = xmlMemBlocks();
33305 code = gen_int(n_code, 0);
33306
33307 ret_val = xmlUCSIsSmallFormVariants(code);
33308 desret_int(ret_val);
33309 call_tests++;
33310 des_int(n_code, code, 0);
33311 xmlResetLastError();
33312 if (mem_base != xmlMemBlocks()) {
33313 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
33314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033315 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033316 printf(" %d", n_code);
33317 printf("\n");
33318 }
33319 }
33320#endif
33321
33322 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033323 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033324}
33325
33326
33327static int
33328test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033329 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033330
33331#ifdef LIBXML_UNICODE_ENABLED
33332 int mem_base;
33333 int ret_val;
33334 int code; /* UCS code point */
33335 int n_code;
33336
33337 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33338 mem_base = xmlMemBlocks();
33339 code = gen_int(n_code, 0);
33340
33341 ret_val = xmlUCSIsSpacingModifierLetters(code);
33342 desret_int(ret_val);
33343 call_tests++;
33344 des_int(n_code, code, 0);
33345 xmlResetLastError();
33346 if (mem_base != xmlMemBlocks()) {
33347 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
33348 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033349 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033350 printf(" %d", n_code);
33351 printf("\n");
33352 }
33353 }
33354#endif
33355
33356 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033357 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033358}
33359
33360
33361static int
33362test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033363 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033364
33365#ifdef LIBXML_UNICODE_ENABLED
33366 int mem_base;
33367 int ret_val;
33368 int code; /* UCS code point */
33369 int n_code;
33370
33371 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33372 mem_base = xmlMemBlocks();
33373 code = gen_int(n_code, 0);
33374
33375 ret_val = xmlUCSIsSpecials(code);
33376 desret_int(ret_val);
33377 call_tests++;
33378 des_int(n_code, code, 0);
33379 xmlResetLastError();
33380 if (mem_base != xmlMemBlocks()) {
33381 printf("Leak of %d blocks found in xmlUCSIsSpecials",
33382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033383 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033384 printf(" %d", n_code);
33385 printf("\n");
33386 }
33387 }
33388#endif
33389
33390 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033391 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033392}
33393
33394
33395static int
33396test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033397 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033398
33399#ifdef LIBXML_UNICODE_ENABLED
33400 int mem_base;
33401 int ret_val;
33402 int code; /* UCS code point */
33403 int n_code;
33404
33405 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33406 mem_base = xmlMemBlocks();
33407 code = gen_int(n_code, 0);
33408
33409 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
33410 desret_int(ret_val);
33411 call_tests++;
33412 des_int(n_code, code, 0);
33413 xmlResetLastError();
33414 if (mem_base != xmlMemBlocks()) {
33415 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
33416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033417 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033418 printf(" %d", n_code);
33419 printf("\n");
33420 }
33421 }
33422#endif
33423
33424 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033425 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033426}
33427
33428
33429static int
33430test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033431 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033432
33433#ifdef LIBXML_UNICODE_ENABLED
33434 int mem_base;
33435 int ret_val;
33436 int code; /* UCS code point */
33437 int n_code;
33438
33439 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33440 mem_base = xmlMemBlocks();
33441 code = gen_int(n_code, 0);
33442
33443 ret_val = xmlUCSIsSupplementalArrowsA(code);
33444 desret_int(ret_val);
33445 call_tests++;
33446 des_int(n_code, code, 0);
33447 xmlResetLastError();
33448 if (mem_base != xmlMemBlocks()) {
33449 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
33450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033451 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033452 printf(" %d", n_code);
33453 printf("\n");
33454 }
33455 }
33456#endif
33457
33458 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033459 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033460}
33461
33462
33463static int
33464test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033465 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033466
33467#ifdef LIBXML_UNICODE_ENABLED
33468 int mem_base;
33469 int ret_val;
33470 int code; /* UCS code point */
33471 int n_code;
33472
33473 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33474 mem_base = xmlMemBlocks();
33475 code = gen_int(n_code, 0);
33476
33477 ret_val = xmlUCSIsSupplementalArrowsB(code);
33478 desret_int(ret_val);
33479 call_tests++;
33480 des_int(n_code, code, 0);
33481 xmlResetLastError();
33482 if (mem_base != xmlMemBlocks()) {
33483 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
33484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033485 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033486 printf(" %d", n_code);
33487 printf("\n");
33488 }
33489 }
33490#endif
33491
33492 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033493 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033494}
33495
33496
33497static int
33498test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033499 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033500
33501#ifdef LIBXML_UNICODE_ENABLED
33502 int mem_base;
33503 int ret_val;
33504 int code; /* UCS code point */
33505 int n_code;
33506
33507 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33508 mem_base = xmlMemBlocks();
33509 code = gen_int(n_code, 0);
33510
33511 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
33512 desret_int(ret_val);
33513 call_tests++;
33514 des_int(n_code, code, 0);
33515 xmlResetLastError();
33516 if (mem_base != xmlMemBlocks()) {
33517 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
33518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033519 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033520 printf(" %d", n_code);
33521 printf("\n");
33522 }
33523 }
33524#endif
33525
33526 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033527 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033528}
33529
33530
33531static int
33532test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033533 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033534
33535#ifdef LIBXML_UNICODE_ENABLED
33536 int mem_base;
33537 int ret_val;
33538 int code; /* UCS code point */
33539 int n_code;
33540
33541 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33542 mem_base = xmlMemBlocks();
33543 code = gen_int(n_code, 0);
33544
33545 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
33546 desret_int(ret_val);
33547 call_tests++;
33548 des_int(n_code, code, 0);
33549 xmlResetLastError();
33550 if (mem_base != xmlMemBlocks()) {
33551 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
33552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033553 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033554 printf(" %d", n_code);
33555 printf("\n");
33556 }
33557 }
33558#endif
33559
33560 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033561 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033562}
33563
33564
33565static int
33566test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033567 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033568
33569#ifdef LIBXML_UNICODE_ENABLED
33570 int mem_base;
33571 int ret_val;
33572 int code; /* UCS code point */
33573 int n_code;
33574
33575 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33576 mem_base = xmlMemBlocks();
33577 code = gen_int(n_code, 0);
33578
33579 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
33580 desret_int(ret_val);
33581 call_tests++;
33582 des_int(n_code, code, 0);
33583 xmlResetLastError();
33584 if (mem_base != xmlMemBlocks()) {
33585 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
33586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033587 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033588 printf(" %d", n_code);
33589 printf("\n");
33590 }
33591 }
33592#endif
33593
33594 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033595 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033596}
33597
33598
33599static int
33600test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033601 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033602
33603#ifdef LIBXML_UNICODE_ENABLED
33604 int mem_base;
33605 int ret_val;
33606 int code; /* UCS code point */
33607 int n_code;
33608
33609 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33610 mem_base = xmlMemBlocks();
33611 code = gen_int(n_code, 0);
33612
33613 ret_val = xmlUCSIsSyriac(code);
33614 desret_int(ret_val);
33615 call_tests++;
33616 des_int(n_code, code, 0);
33617 xmlResetLastError();
33618 if (mem_base != xmlMemBlocks()) {
33619 printf("Leak of %d blocks found in xmlUCSIsSyriac",
33620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033621 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033622 printf(" %d", n_code);
33623 printf("\n");
33624 }
33625 }
33626#endif
33627
33628 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033629 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033630}
33631
33632
33633static int
33634test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033635 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033636
33637#ifdef LIBXML_UNICODE_ENABLED
33638 int mem_base;
33639 int ret_val;
33640 int code; /* UCS code point */
33641 int n_code;
33642
33643 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33644 mem_base = xmlMemBlocks();
33645 code = gen_int(n_code, 0);
33646
33647 ret_val = xmlUCSIsTagalog(code);
33648 desret_int(ret_val);
33649 call_tests++;
33650 des_int(n_code, code, 0);
33651 xmlResetLastError();
33652 if (mem_base != xmlMemBlocks()) {
33653 printf("Leak of %d blocks found in xmlUCSIsTagalog",
33654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033655 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033656 printf(" %d", n_code);
33657 printf("\n");
33658 }
33659 }
33660#endif
33661
33662 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033663 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033664}
33665
33666
33667static int
33668test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033669 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033670
33671#ifdef LIBXML_UNICODE_ENABLED
33672 int mem_base;
33673 int ret_val;
33674 int code; /* UCS code point */
33675 int n_code;
33676
33677 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33678 mem_base = xmlMemBlocks();
33679 code = gen_int(n_code, 0);
33680
33681 ret_val = xmlUCSIsTagbanwa(code);
33682 desret_int(ret_val);
33683 call_tests++;
33684 des_int(n_code, code, 0);
33685 xmlResetLastError();
33686 if (mem_base != xmlMemBlocks()) {
33687 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
33688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033689 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033690 printf(" %d", n_code);
33691 printf("\n");
33692 }
33693 }
33694#endif
33695
33696 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033697 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033698}
33699
33700
33701static int
33702test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033703 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033704
33705#ifdef LIBXML_UNICODE_ENABLED
33706 int mem_base;
33707 int ret_val;
33708 int code; /* UCS code point */
33709 int n_code;
33710
33711 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33712 mem_base = xmlMemBlocks();
33713 code = gen_int(n_code, 0);
33714
33715 ret_val = xmlUCSIsTags(code);
33716 desret_int(ret_val);
33717 call_tests++;
33718 des_int(n_code, code, 0);
33719 xmlResetLastError();
33720 if (mem_base != xmlMemBlocks()) {
33721 printf("Leak of %d blocks found in xmlUCSIsTags",
33722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033723 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033724 printf(" %d", n_code);
33725 printf("\n");
33726 }
33727 }
33728#endif
33729
33730 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033731 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033732}
33733
33734
33735static int
33736test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033737 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033738
33739#ifdef LIBXML_UNICODE_ENABLED
33740 int mem_base;
33741 int ret_val;
33742 int code; /* UCS code point */
33743 int n_code;
33744
33745 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33746 mem_base = xmlMemBlocks();
33747 code = gen_int(n_code, 0);
33748
33749 ret_val = xmlUCSIsTaiLe(code);
33750 desret_int(ret_val);
33751 call_tests++;
33752 des_int(n_code, code, 0);
33753 xmlResetLastError();
33754 if (mem_base != xmlMemBlocks()) {
33755 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
33756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033757 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033758 printf(" %d", n_code);
33759 printf("\n");
33760 }
33761 }
33762#endif
33763
33764 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033765 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033766}
33767
33768
33769static int
33770test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033771 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033772
33773#ifdef LIBXML_UNICODE_ENABLED
33774 int mem_base;
33775 int ret_val;
33776 int code; /* UCS code point */
33777 int n_code;
33778
33779 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33780 mem_base = xmlMemBlocks();
33781 code = gen_int(n_code, 0);
33782
33783 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
33784 desret_int(ret_val);
33785 call_tests++;
33786 des_int(n_code, code, 0);
33787 xmlResetLastError();
33788 if (mem_base != xmlMemBlocks()) {
33789 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
33790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033791 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033792 printf(" %d", n_code);
33793 printf("\n");
33794 }
33795 }
33796#endif
33797
33798 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033799 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033800}
33801
33802
33803static int
33804test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033805 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033806
33807#ifdef LIBXML_UNICODE_ENABLED
33808 int mem_base;
33809 int ret_val;
33810 int code; /* UCS code point */
33811 int n_code;
33812
33813 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33814 mem_base = xmlMemBlocks();
33815 code = gen_int(n_code, 0);
33816
33817 ret_val = xmlUCSIsTamil(code);
33818 desret_int(ret_val);
33819 call_tests++;
33820 des_int(n_code, code, 0);
33821 xmlResetLastError();
33822 if (mem_base != xmlMemBlocks()) {
33823 printf("Leak of %d blocks found in xmlUCSIsTamil",
33824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033825 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033826 printf(" %d", n_code);
33827 printf("\n");
33828 }
33829 }
33830#endif
33831
33832 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033833 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033834}
33835
33836
33837static int
33838test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033839 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033840
33841#ifdef LIBXML_UNICODE_ENABLED
33842 int mem_base;
33843 int ret_val;
33844 int code; /* UCS code point */
33845 int n_code;
33846
33847 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33848 mem_base = xmlMemBlocks();
33849 code = gen_int(n_code, 0);
33850
33851 ret_val = xmlUCSIsTelugu(code);
33852 desret_int(ret_val);
33853 call_tests++;
33854 des_int(n_code, code, 0);
33855 xmlResetLastError();
33856 if (mem_base != xmlMemBlocks()) {
33857 printf("Leak of %d blocks found in xmlUCSIsTelugu",
33858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033859 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033860 printf(" %d", n_code);
33861 printf("\n");
33862 }
33863 }
33864#endif
33865
33866 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033867 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033868}
33869
33870
33871static int
33872test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033873 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033874
33875#ifdef LIBXML_UNICODE_ENABLED
33876 int mem_base;
33877 int ret_val;
33878 int code; /* UCS code point */
33879 int n_code;
33880
33881 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33882 mem_base = xmlMemBlocks();
33883 code = gen_int(n_code, 0);
33884
33885 ret_val = xmlUCSIsThaana(code);
33886 desret_int(ret_val);
33887 call_tests++;
33888 des_int(n_code, code, 0);
33889 xmlResetLastError();
33890 if (mem_base != xmlMemBlocks()) {
33891 printf("Leak of %d blocks found in xmlUCSIsThaana",
33892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033893 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033894 printf(" %d", n_code);
33895 printf("\n");
33896 }
33897 }
33898#endif
33899
33900 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033901 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033902}
33903
33904
33905static int
33906test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033907 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033908
33909#ifdef LIBXML_UNICODE_ENABLED
33910 int mem_base;
33911 int ret_val;
33912 int code; /* UCS code point */
33913 int n_code;
33914
33915 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33916 mem_base = xmlMemBlocks();
33917 code = gen_int(n_code, 0);
33918
33919 ret_val = xmlUCSIsThai(code);
33920 desret_int(ret_val);
33921 call_tests++;
33922 des_int(n_code, code, 0);
33923 xmlResetLastError();
33924 if (mem_base != xmlMemBlocks()) {
33925 printf("Leak of %d blocks found in xmlUCSIsThai",
33926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033927 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033928 printf(" %d", n_code);
33929 printf("\n");
33930 }
33931 }
33932#endif
33933
33934 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033935 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033936}
33937
33938
33939static int
33940test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033941 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033942
33943#ifdef LIBXML_UNICODE_ENABLED
33944 int mem_base;
33945 int ret_val;
33946 int code; /* UCS code point */
33947 int n_code;
33948
33949 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33950 mem_base = xmlMemBlocks();
33951 code = gen_int(n_code, 0);
33952
33953 ret_val = xmlUCSIsTibetan(code);
33954 desret_int(ret_val);
33955 call_tests++;
33956 des_int(n_code, code, 0);
33957 xmlResetLastError();
33958 if (mem_base != xmlMemBlocks()) {
33959 printf("Leak of %d blocks found in xmlUCSIsTibetan",
33960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033961 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033962 printf(" %d", n_code);
33963 printf("\n");
33964 }
33965 }
33966#endif
33967
33968 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033969 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033970}
33971
33972
33973static int
33974test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033975 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033976
33977#ifdef LIBXML_UNICODE_ENABLED
33978 int mem_base;
33979 int ret_val;
33980 int code; /* UCS code point */
33981 int n_code;
33982
33983 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33984 mem_base = xmlMemBlocks();
33985 code = gen_int(n_code, 0);
33986
33987 ret_val = xmlUCSIsUgaritic(code);
33988 desret_int(ret_val);
33989 call_tests++;
33990 des_int(n_code, code, 0);
33991 xmlResetLastError();
33992 if (mem_base != xmlMemBlocks()) {
33993 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
33994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033995 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033996 printf(" %d", n_code);
33997 printf("\n");
33998 }
33999 }
34000#endif
34001
34002 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034003 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034004}
34005
34006
34007static int
34008test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034009 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034010
34011#ifdef LIBXML_UNICODE_ENABLED
34012 int mem_base;
34013 int ret_val;
34014 int code; /* UCS code point */
34015 int n_code;
34016
34017 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34018 mem_base = xmlMemBlocks();
34019 code = gen_int(n_code, 0);
34020
34021 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
34022 desret_int(ret_val);
34023 call_tests++;
34024 des_int(n_code, code, 0);
34025 xmlResetLastError();
34026 if (mem_base != xmlMemBlocks()) {
34027 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
34028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034029 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034030 printf(" %d", n_code);
34031 printf("\n");
34032 }
34033 }
34034#endif
34035
34036 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034037 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034038}
34039
34040
34041static int
34042test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034043 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034044
34045#ifdef LIBXML_UNICODE_ENABLED
34046 int mem_base;
34047 int ret_val;
34048 int code; /* UCS code point */
34049 int n_code;
34050
34051 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34052 mem_base = xmlMemBlocks();
34053 code = gen_int(n_code, 0);
34054
34055 ret_val = xmlUCSIsVariationSelectors(code);
34056 desret_int(ret_val);
34057 call_tests++;
34058 des_int(n_code, code, 0);
34059 xmlResetLastError();
34060 if (mem_base != xmlMemBlocks()) {
34061 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
34062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034063 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034064 printf(" %d", n_code);
34065 printf("\n");
34066 }
34067 }
34068#endif
34069
34070 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034071 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034072}
34073
34074
34075static int
34076test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034077 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034078
34079#ifdef LIBXML_UNICODE_ENABLED
34080 int mem_base;
34081 int ret_val;
34082 int code; /* UCS code point */
34083 int n_code;
34084
34085 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34086 mem_base = xmlMemBlocks();
34087 code = gen_int(n_code, 0);
34088
34089 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
34090 desret_int(ret_val);
34091 call_tests++;
34092 des_int(n_code, code, 0);
34093 xmlResetLastError();
34094 if (mem_base != xmlMemBlocks()) {
34095 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
34096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034097 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034098 printf(" %d", n_code);
34099 printf("\n");
34100 }
34101 }
34102#endif
34103
34104 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034105 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034106}
34107
34108
34109static int
34110test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034111 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034112
34113#ifdef LIBXML_UNICODE_ENABLED
34114 int mem_base;
34115 int ret_val;
34116 int code; /* UCS code point */
34117 int n_code;
34118
34119 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34120 mem_base = xmlMemBlocks();
34121 code = gen_int(n_code, 0);
34122
34123 ret_val = xmlUCSIsYiRadicals(code);
34124 desret_int(ret_val);
34125 call_tests++;
34126 des_int(n_code, code, 0);
34127 xmlResetLastError();
34128 if (mem_base != xmlMemBlocks()) {
34129 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
34130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034131 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034132 printf(" %d", n_code);
34133 printf("\n");
34134 }
34135 }
34136#endif
34137
34138 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034139 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034140}
34141
34142
34143static int
34144test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034145 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034146
34147#ifdef LIBXML_UNICODE_ENABLED
34148 int mem_base;
34149 int ret_val;
34150 int code; /* UCS code point */
34151 int n_code;
34152
34153 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34154 mem_base = xmlMemBlocks();
34155 code = gen_int(n_code, 0);
34156
34157 ret_val = xmlUCSIsYiSyllables(code);
34158 desret_int(ret_val);
34159 call_tests++;
34160 des_int(n_code, code, 0);
34161 xmlResetLastError();
34162 if (mem_base != xmlMemBlocks()) {
34163 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
34164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034165 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034166 printf(" %d", n_code);
34167 printf("\n");
34168 }
34169 }
34170#endif
34171
34172 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034173 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034174}
34175
34176
34177static int
34178test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034179 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034180
34181#ifdef LIBXML_UNICODE_ENABLED
34182 int mem_base;
34183 int ret_val;
34184 int code; /* UCS code point */
34185 int n_code;
34186
34187 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34188 mem_base = xmlMemBlocks();
34189 code = gen_int(n_code, 0);
34190
34191 ret_val = xmlUCSIsYijingHexagramSymbols(code);
34192 desret_int(ret_val);
34193 call_tests++;
34194 des_int(n_code, code, 0);
34195 xmlResetLastError();
34196 if (mem_base != xmlMemBlocks()) {
34197 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
34198 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034199 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034200 printf(" %d", n_code);
34201 printf("\n");
34202 }
34203 }
34204#endif
34205
34206 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034207 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034208}
34209
34210static int
34211test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034212 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034213
34214 printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000034215 test_ret += test_xmlUCSIsAegeanNumbers();
34216 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
34217 test_ret += test_xmlUCSIsArabic();
34218 test_ret += test_xmlUCSIsArabicPresentationFormsA();
34219 test_ret += test_xmlUCSIsArabicPresentationFormsB();
34220 test_ret += test_xmlUCSIsArmenian();
34221 test_ret += test_xmlUCSIsArrows();
34222 test_ret += test_xmlUCSIsBasicLatin();
34223 test_ret += test_xmlUCSIsBengali();
34224 test_ret += test_xmlUCSIsBlock();
34225 test_ret += test_xmlUCSIsBlockElements();
34226 test_ret += test_xmlUCSIsBopomofo();
34227 test_ret += test_xmlUCSIsBopomofoExtended();
34228 test_ret += test_xmlUCSIsBoxDrawing();
34229 test_ret += test_xmlUCSIsBraillePatterns();
34230 test_ret += test_xmlUCSIsBuhid();
34231 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
34232 test_ret += test_xmlUCSIsCJKCompatibility();
34233 test_ret += test_xmlUCSIsCJKCompatibilityForms();
34234 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
34235 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
34236 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
34237 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
34238 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
34239 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
34240 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
34241 test_ret += test_xmlUCSIsCat();
34242 test_ret += test_xmlUCSIsCatC();
34243 test_ret += test_xmlUCSIsCatCc();
34244 test_ret += test_xmlUCSIsCatCf();
34245 test_ret += test_xmlUCSIsCatCo();
34246 test_ret += test_xmlUCSIsCatCs();
34247 test_ret += test_xmlUCSIsCatL();
34248 test_ret += test_xmlUCSIsCatLl();
34249 test_ret += test_xmlUCSIsCatLm();
34250 test_ret += test_xmlUCSIsCatLo();
34251 test_ret += test_xmlUCSIsCatLt();
34252 test_ret += test_xmlUCSIsCatLu();
34253 test_ret += test_xmlUCSIsCatM();
34254 test_ret += test_xmlUCSIsCatMc();
34255 test_ret += test_xmlUCSIsCatMe();
34256 test_ret += test_xmlUCSIsCatMn();
34257 test_ret += test_xmlUCSIsCatN();
34258 test_ret += test_xmlUCSIsCatNd();
34259 test_ret += test_xmlUCSIsCatNl();
34260 test_ret += test_xmlUCSIsCatNo();
34261 test_ret += test_xmlUCSIsCatP();
34262 test_ret += test_xmlUCSIsCatPc();
34263 test_ret += test_xmlUCSIsCatPd();
34264 test_ret += test_xmlUCSIsCatPe();
34265 test_ret += test_xmlUCSIsCatPf();
34266 test_ret += test_xmlUCSIsCatPi();
34267 test_ret += test_xmlUCSIsCatPo();
34268 test_ret += test_xmlUCSIsCatPs();
34269 test_ret += test_xmlUCSIsCatS();
34270 test_ret += test_xmlUCSIsCatSc();
34271 test_ret += test_xmlUCSIsCatSk();
34272 test_ret += test_xmlUCSIsCatSm();
34273 test_ret += test_xmlUCSIsCatSo();
34274 test_ret += test_xmlUCSIsCatZ();
34275 test_ret += test_xmlUCSIsCatZl();
34276 test_ret += test_xmlUCSIsCatZp();
34277 test_ret += test_xmlUCSIsCatZs();
34278 test_ret += test_xmlUCSIsCherokee();
34279 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
34280 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
34281 test_ret += test_xmlUCSIsCombiningHalfMarks();
34282 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
34283 test_ret += test_xmlUCSIsControlPictures();
34284 test_ret += test_xmlUCSIsCurrencySymbols();
34285 test_ret += test_xmlUCSIsCypriotSyllabary();
34286 test_ret += test_xmlUCSIsCyrillic();
34287 test_ret += test_xmlUCSIsCyrillicSupplement();
34288 test_ret += test_xmlUCSIsDeseret();
34289 test_ret += test_xmlUCSIsDevanagari();
34290 test_ret += test_xmlUCSIsDingbats();
34291 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
34292 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
34293 test_ret += test_xmlUCSIsEthiopic();
34294 test_ret += test_xmlUCSIsGeneralPunctuation();
34295 test_ret += test_xmlUCSIsGeometricShapes();
34296 test_ret += test_xmlUCSIsGeorgian();
34297 test_ret += test_xmlUCSIsGothic();
34298 test_ret += test_xmlUCSIsGreek();
34299 test_ret += test_xmlUCSIsGreekExtended();
34300 test_ret += test_xmlUCSIsGreekandCoptic();
34301 test_ret += test_xmlUCSIsGujarati();
34302 test_ret += test_xmlUCSIsGurmukhi();
34303 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
34304 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
34305 test_ret += test_xmlUCSIsHangulJamo();
34306 test_ret += test_xmlUCSIsHangulSyllables();
34307 test_ret += test_xmlUCSIsHanunoo();
34308 test_ret += test_xmlUCSIsHebrew();
34309 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
34310 test_ret += test_xmlUCSIsHighSurrogates();
34311 test_ret += test_xmlUCSIsHiragana();
34312 test_ret += test_xmlUCSIsIPAExtensions();
34313 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
34314 test_ret += test_xmlUCSIsKanbun();
34315 test_ret += test_xmlUCSIsKangxiRadicals();
34316 test_ret += test_xmlUCSIsKannada();
34317 test_ret += test_xmlUCSIsKatakana();
34318 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
34319 test_ret += test_xmlUCSIsKhmer();
34320 test_ret += test_xmlUCSIsKhmerSymbols();
34321 test_ret += test_xmlUCSIsLao();
34322 test_ret += test_xmlUCSIsLatin1Supplement();
34323 test_ret += test_xmlUCSIsLatinExtendedA();
34324 test_ret += test_xmlUCSIsLatinExtendedAdditional();
34325 test_ret += test_xmlUCSIsLatinExtendedB();
34326 test_ret += test_xmlUCSIsLetterlikeSymbols();
34327 test_ret += test_xmlUCSIsLimbu();
34328 test_ret += test_xmlUCSIsLinearBIdeograms();
34329 test_ret += test_xmlUCSIsLinearBSyllabary();
34330 test_ret += test_xmlUCSIsLowSurrogates();
34331 test_ret += test_xmlUCSIsMalayalam();
34332 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
34333 test_ret += test_xmlUCSIsMathematicalOperators();
34334 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
34335 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
34336 test_ret += test_xmlUCSIsMiscellaneousSymbols();
34337 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
34338 test_ret += test_xmlUCSIsMiscellaneousTechnical();
34339 test_ret += test_xmlUCSIsMongolian();
34340 test_ret += test_xmlUCSIsMusicalSymbols();
34341 test_ret += test_xmlUCSIsMyanmar();
34342 test_ret += test_xmlUCSIsNumberForms();
34343 test_ret += test_xmlUCSIsOgham();
34344 test_ret += test_xmlUCSIsOldItalic();
34345 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
34346 test_ret += test_xmlUCSIsOriya();
34347 test_ret += test_xmlUCSIsOsmanya();
34348 test_ret += test_xmlUCSIsPhoneticExtensions();
34349 test_ret += test_xmlUCSIsPrivateUse();
34350 test_ret += test_xmlUCSIsPrivateUseArea();
34351 test_ret += test_xmlUCSIsRunic();
34352 test_ret += test_xmlUCSIsShavian();
34353 test_ret += test_xmlUCSIsSinhala();
34354 test_ret += test_xmlUCSIsSmallFormVariants();
34355 test_ret += test_xmlUCSIsSpacingModifierLetters();
34356 test_ret += test_xmlUCSIsSpecials();
34357 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
34358 test_ret += test_xmlUCSIsSupplementalArrowsA();
34359 test_ret += test_xmlUCSIsSupplementalArrowsB();
34360 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
34361 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
34362 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
34363 test_ret += test_xmlUCSIsSyriac();
34364 test_ret += test_xmlUCSIsTagalog();
34365 test_ret += test_xmlUCSIsTagbanwa();
34366 test_ret += test_xmlUCSIsTags();
34367 test_ret += test_xmlUCSIsTaiLe();
34368 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
34369 test_ret += test_xmlUCSIsTamil();
34370 test_ret += test_xmlUCSIsTelugu();
34371 test_ret += test_xmlUCSIsThaana();
34372 test_ret += test_xmlUCSIsThai();
34373 test_ret += test_xmlUCSIsTibetan();
34374 test_ret += test_xmlUCSIsUgaritic();
34375 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
34376 test_ret += test_xmlUCSIsVariationSelectors();
34377 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
34378 test_ret += test_xmlUCSIsYiRadicals();
34379 test_ret += test_xmlUCSIsYiSyllables();
34380 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034381
Daniel Veillard42595322004-11-08 10:52:06 +000034382 if (test_ret != 0)
34383 printf("Module xmlunicode: %d errors\n", test_ret);
34384 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034385}
34386
34387static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000034388test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034390
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034391#ifdef LIBXML_WRITER_ENABLED
34392 int mem_base;
34393 xmlTextWriterPtr ret_val;
34394 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
34395 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034396
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034397 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
34398 mem_base = xmlMemBlocks();
34399 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034400
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034401 ret_val = xmlNewTextWriter(out);
34402 if (ret_val != NULL) out = NULL;
34403 desret_xmlTextWriterPtr(ret_val);
34404 call_tests++;
34405 des_xmlOutputBufferPtr(n_out, out, 0);
34406 xmlResetLastError();
34407 if (mem_base != xmlMemBlocks()) {
34408 printf("Leak of %d blocks found in xmlNewTextWriter",
34409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034410 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034411 printf(" %d", n_out);
34412 printf("\n");
34413 }
34414 }
34415#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000034416
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034417 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034418 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034419}
34420
34421
34422static int
34423test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034424 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034425
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034426#ifdef LIBXML_WRITER_ENABLED
34427 int mem_base;
34428 xmlTextWriterPtr ret_val;
34429 const char * uri; /* the URI of the resource for the output */
34430 int n_uri;
34431 int compression; /* compress the output? */
34432 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034433
Daniel Veillard42595322004-11-08 10:52:06 +000034434 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034435 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
34436 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000034437 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034438 compression = gen_int(n_compression, 1);
34439
34440 ret_val = xmlNewTextWriterFilename(uri, compression);
34441 desret_xmlTextWriterPtr(ret_val);
34442 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034443 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034444 des_int(n_compression, compression, 1);
34445 xmlResetLastError();
34446 if (mem_base != xmlMemBlocks()) {
34447 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
34448 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034449 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034450 printf(" %d", n_uri);
34451 printf(" %d", n_compression);
34452 printf("\n");
34453 }
34454 }
34455 }
34456#endif
34457
34458 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034460}
34461
34462
34463static int
34464test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034466
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034467#ifdef LIBXML_WRITER_ENABLED
34468 int mem_base;
34469 xmlTextWriterPtr ret_val;
34470 xmlBufferPtr buf; /* xmlBufferPtr */
34471 int n_buf;
34472 int compression; /* compress the output? */
34473 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034474
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034475 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
34476 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
34477 mem_base = xmlMemBlocks();
34478 buf = gen_xmlBufferPtr(n_buf, 0);
34479 compression = gen_int(n_compression, 1);
34480
34481 ret_val = xmlNewTextWriterMemory(buf, compression);
34482 desret_xmlTextWriterPtr(ret_val);
34483 call_tests++;
34484 des_xmlBufferPtr(n_buf, buf, 0);
34485 des_int(n_compression, compression, 1);
34486 xmlResetLastError();
34487 if (mem_base != xmlMemBlocks()) {
34488 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
34489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034490 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034491 printf(" %d", n_buf);
34492 printf(" %d", n_compression);
34493 printf("\n");
34494 }
34495 }
34496 }
34497#endif
34498
34499 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034500 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034501}
34502
34503
34504static int
34505test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034506 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034507
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034508#ifdef LIBXML_WRITER_ENABLED
34509 int mem_base;
34510 xmlTextWriterPtr ret_val;
34511 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
34512 int n_ctxt;
34513 int compression; /* compress the output? */
34514 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034515
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034516 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
34517 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
34518 mem_base = xmlMemBlocks();
34519 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
34520 compression = gen_int(n_compression, 1);
34521
34522 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
34523 if (ret_val != NULL) ctxt = NULL;
34524 desret_xmlTextWriterPtr(ret_val);
34525 call_tests++;
34526 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
34527 des_int(n_compression, compression, 1);
34528 xmlResetLastError();
34529 if (mem_base != xmlMemBlocks()) {
34530 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
34531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034532 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034533 printf(" %d", n_ctxt);
34534 printf(" %d", n_compression);
34535 printf("\n");
34536 }
34537 }
34538 }
34539#endif
34540
34541 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034542 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034543}
34544
34545
34546static int
34547test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034549
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034550#ifdef LIBXML_WRITER_ENABLED
34551 int mem_base;
34552 xmlTextWriterPtr ret_val;
34553 xmlDocPtr doc; /* xmlDocPtr */
34554 int n_doc;
34555 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
34556 int n_node;
34557 int compression; /* compress the output? */
34558 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034559
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034560 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
34561 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
34562 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
34563 mem_base = xmlMemBlocks();
34564 doc = gen_xmlDocPtr(n_doc, 0);
34565 node = gen_xmlNodePtr(n_node, 1);
34566 compression = gen_int(n_compression, 2);
34567
34568 ret_val = xmlNewTextWriterTree(doc, node, compression);
34569 desret_xmlTextWriterPtr(ret_val);
34570 call_tests++;
34571 des_xmlDocPtr(n_doc, doc, 0);
34572 des_xmlNodePtr(n_node, node, 1);
34573 des_int(n_compression, compression, 2);
34574 xmlResetLastError();
34575 if (mem_base != xmlMemBlocks()) {
34576 printf("Leak of %d blocks found in xmlNewTextWriterTree",
34577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034578 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000034579 printf(" %d", n_doc);
34580 printf(" %d", n_node);
34581 printf(" %d", n_compression);
34582 printf("\n");
34583 }
34584 }
34585 }
34586 }
34587#endif
34588
34589 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034590 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034591}
34592
34593
34594static int
34595test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034596 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034597
Daniel Veillarde43cc572004-11-03 11:50:29 +000034598#ifdef LIBXML_WRITER_ENABLED
34599 int mem_base;
34600 int ret_val;
34601 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
34602 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034603
Daniel Veillarde43cc572004-11-03 11:50:29 +000034604 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
34605 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034606 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034607
34608 ret_val = xmlTextWriterEndAttribute(writer);
34609 desret_int(ret_val);
34610 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000034611 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034612 xmlResetLastError();
34613 if (mem_base != xmlMemBlocks()) {
34614 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
34615 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034616 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000034617 printf(" %d", n_writer);
34618 printf("\n");
34619 }
34620 }
34621#endif
34622
Daniel Veillard3d97e662004-11-04 10:49:00 +000034623 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034625}
34626
34627
34628static int
34629test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034631
Daniel Veillarde43cc572004-11-03 11:50:29 +000034632#ifdef LIBXML_WRITER_ENABLED
34633 int mem_base;
34634 int ret_val;
34635 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
34636 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034637
Daniel Veillarde43cc572004-11-03 11:50:29 +000034638 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
34639 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034640 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034641
34642 ret_val = xmlTextWriterEndCDATA(writer);
34643 desret_int(ret_val);
34644 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000034645 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034646 xmlResetLastError();
34647 if (mem_base != xmlMemBlocks()) {
34648 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
34649 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034650 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000034651 printf(" %d", n_writer);
34652 printf("\n");
34653 }
34654 }
34655#endif
34656
Daniel Veillard3d97e662004-11-04 10:49:00 +000034657 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034659}
34660
34661
34662static int
34663test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034665
Daniel Veillarde43cc572004-11-03 11:50:29 +000034666#ifdef LIBXML_WRITER_ENABLED
34667 int mem_base;
34668 int ret_val;
34669 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
34670 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034671
Daniel Veillarde43cc572004-11-03 11:50:29 +000034672 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
34673 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034674 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034675
34676 ret_val = xmlTextWriterEndComment(writer);
34677 desret_int(ret_val);
34678 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000034679 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034680 xmlResetLastError();
34681 if (mem_base != xmlMemBlocks()) {
34682 printf("Leak of %d blocks found in xmlTextWriterEndComment",
34683 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034684 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000034685 printf(" %d", n_writer);
34686 printf("\n");
34687 }
34688 }
34689#endif
34690
Daniel Veillard3d97e662004-11-04 10:49:00 +000034691 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034693}
34694
34695
34696static int
34697test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034699
Daniel Veillarde43cc572004-11-03 11:50:29 +000034700#ifdef LIBXML_WRITER_ENABLED
34701 int mem_base;
34702 int ret_val;
34703 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
34704 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034705
Daniel Veillarde43cc572004-11-03 11:50:29 +000034706 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
34707 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034708 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034709
34710 ret_val = xmlTextWriterEndDTD(writer);
34711 desret_int(ret_val);
34712 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000034713 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034714 xmlResetLastError();
34715 if (mem_base != xmlMemBlocks()) {
34716 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
34717 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034718 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000034719 printf(" %d", n_writer);
34720 printf("\n");
34721 }
34722 }
34723#endif
34724
Daniel Veillard3d97e662004-11-04 10:49:00 +000034725 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034727}
34728
34729
34730static int
34731test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034732 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034733
Daniel Veillarde43cc572004-11-03 11:50:29 +000034734#ifdef LIBXML_WRITER_ENABLED
34735 int mem_base;
34736 int ret_val;
34737 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
34738 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034739
Daniel Veillarde43cc572004-11-03 11:50:29 +000034740 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
34741 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034742 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034743
34744 ret_val = xmlTextWriterEndDTDAttlist(writer);
34745 desret_int(ret_val);
34746 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000034747 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034748 xmlResetLastError();
34749 if (mem_base != xmlMemBlocks()) {
34750 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
34751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034752 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000034753 printf(" %d", n_writer);
34754 printf("\n");
34755 }
34756 }
34757#endif
34758
Daniel Veillard3d97e662004-11-04 10:49:00 +000034759 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034760 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034761}
34762
34763
34764static int
34765test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034766 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034767
Daniel Veillarde43cc572004-11-03 11:50:29 +000034768#ifdef LIBXML_WRITER_ENABLED
34769 int mem_base;
34770 int ret_val;
34771 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
34772 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034773
Daniel Veillarde43cc572004-11-03 11:50:29 +000034774 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
34775 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034776 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034777
34778 ret_val = xmlTextWriterEndDTDElement(writer);
34779 desret_int(ret_val);
34780 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000034781 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034782 xmlResetLastError();
34783 if (mem_base != xmlMemBlocks()) {
34784 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
34785 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034786 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000034787 printf(" %d", n_writer);
34788 printf("\n");
34789 }
34790 }
34791#endif
34792
Daniel Veillard3d97e662004-11-04 10:49:00 +000034793 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034795}
34796
34797
34798static int
34799test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034801
Daniel Veillarde43cc572004-11-03 11:50:29 +000034802#ifdef LIBXML_WRITER_ENABLED
34803 int mem_base;
34804 int ret_val;
34805 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
34806 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034807
Daniel Veillarde43cc572004-11-03 11:50:29 +000034808 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
34809 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034810 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034811
34812 ret_val = xmlTextWriterEndDTDEntity(writer);
34813 desret_int(ret_val);
34814 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000034815 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034816 xmlResetLastError();
34817 if (mem_base != xmlMemBlocks()) {
34818 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
34819 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034820 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000034821 printf(" %d", n_writer);
34822 printf("\n");
34823 }
34824 }
34825#endif
34826
Daniel Veillard3d97e662004-11-04 10:49:00 +000034827 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034829}
34830
34831
34832static int
34833test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034835
Daniel Veillarde43cc572004-11-03 11:50:29 +000034836#ifdef LIBXML_WRITER_ENABLED
34837 int mem_base;
34838 int ret_val;
34839 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
34840 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034841
Daniel Veillarde43cc572004-11-03 11:50:29 +000034842 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
34843 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034844 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034845
34846 ret_val = xmlTextWriterEndDocument(writer);
34847 desret_int(ret_val);
34848 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000034849 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034850 xmlResetLastError();
34851 if (mem_base != xmlMemBlocks()) {
34852 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
34853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034854 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000034855 printf(" %d", n_writer);
34856 printf("\n");
34857 }
34858 }
34859#endif
34860
Daniel Veillard3d97e662004-11-04 10:49:00 +000034861 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034863}
34864
34865
34866static int
34867test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034869
Daniel Veillarde43cc572004-11-03 11:50:29 +000034870#ifdef LIBXML_WRITER_ENABLED
34871 int mem_base;
34872 int ret_val;
34873 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
34874 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034875
Daniel Veillarde43cc572004-11-03 11:50:29 +000034876 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
34877 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034878 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034879
34880 ret_val = xmlTextWriterEndElement(writer);
34881 desret_int(ret_val);
34882 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000034883 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034884 xmlResetLastError();
34885 if (mem_base != xmlMemBlocks()) {
34886 printf("Leak of %d blocks found in xmlTextWriterEndElement",
34887 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034888 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000034889 printf(" %d", n_writer);
34890 printf("\n");
34891 }
34892 }
34893#endif
34894
Daniel Veillard3d97e662004-11-04 10:49:00 +000034895 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034897}
34898
34899
34900static int
34901test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034902 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034903
Daniel Veillarde43cc572004-11-03 11:50:29 +000034904#ifdef LIBXML_WRITER_ENABLED
34905 int mem_base;
34906 int ret_val;
34907 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
34908 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034909
Daniel Veillarde43cc572004-11-03 11:50:29 +000034910 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
34911 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034912 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034913
34914 ret_val = xmlTextWriterEndPI(writer);
34915 desret_int(ret_val);
34916 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000034917 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034918 xmlResetLastError();
34919 if (mem_base != xmlMemBlocks()) {
34920 printf("Leak of %d blocks found in xmlTextWriterEndPI",
34921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034922 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000034923 printf(" %d", n_writer);
34924 printf("\n");
34925 }
34926 }
34927#endif
34928
Daniel Veillard3d97e662004-11-04 10:49:00 +000034929 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034931}
34932
34933
34934static int
34935test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034937
Daniel Veillarde43cc572004-11-03 11:50:29 +000034938#ifdef LIBXML_WRITER_ENABLED
34939 int mem_base;
34940 int ret_val;
34941 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
34942 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034943
Daniel Veillarde43cc572004-11-03 11:50:29 +000034944 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
34945 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034946 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034947
34948 ret_val = xmlTextWriterFlush(writer);
34949 desret_int(ret_val);
34950 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000034951 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034952 xmlResetLastError();
34953 if (mem_base != xmlMemBlocks()) {
34954 printf("Leak of %d blocks found in xmlTextWriterFlush",
34955 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034956 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000034957 printf(" %d", n_writer);
34958 printf("\n");
34959 }
34960 }
34961#endif
34962
Daniel Veillard3d97e662004-11-04 10:49:00 +000034963 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034964 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034965}
34966
34967
34968static int
34969test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034970 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034971
Daniel Veillarde43cc572004-11-03 11:50:29 +000034972#ifdef LIBXML_WRITER_ENABLED
34973 int mem_base;
34974 int ret_val;
34975 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
34976 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034977
Daniel Veillarde43cc572004-11-03 11:50:29 +000034978 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
34979 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034980 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034981
34982 ret_val = xmlTextWriterFullEndElement(writer);
34983 desret_int(ret_val);
34984 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000034985 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000034986 xmlResetLastError();
34987 if (mem_base != xmlMemBlocks()) {
34988 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
34989 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034990 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000034991 printf(" %d", n_writer);
34992 printf("\n");
34993 }
34994 }
34995#endif
34996
Daniel Veillard3d97e662004-11-04 10:49:00 +000034997 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034999}
35000
35001
35002static int
35003test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035005
Daniel Veillarde43cc572004-11-03 11:50:29 +000035006#ifdef LIBXML_WRITER_ENABLED
35007 int mem_base;
35008 int ret_val;
35009 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35010 int n_writer;
35011 int indent; /* do indentation? */
35012 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035013
Daniel Veillarde43cc572004-11-03 11:50:29 +000035014 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35015 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
35016 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035017 writer = gen_xmlTextWriterPtr(n_writer, 0);
35018 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035019
35020 ret_val = xmlTextWriterSetIndent(writer, indent);
35021 desret_int(ret_val);
35022 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035023 des_xmlTextWriterPtr(n_writer, writer, 0);
35024 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035025 xmlResetLastError();
35026 if (mem_base != xmlMemBlocks()) {
35027 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
35028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035029 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035030 printf(" %d", n_writer);
35031 printf(" %d", n_indent);
35032 printf("\n");
35033 }
35034 }
35035 }
35036#endif
35037
Daniel Veillard3d97e662004-11-04 10:49:00 +000035038 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035039 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035040}
35041
35042
35043static int
35044test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035045 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035046
Daniel Veillarde43cc572004-11-03 11:50:29 +000035047#ifdef LIBXML_WRITER_ENABLED
35048 int mem_base;
35049 int ret_val;
35050 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35051 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035052 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035053 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035054
Daniel Veillarde43cc572004-11-03 11:50:29 +000035055 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35056 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
35057 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035058 writer = gen_xmlTextWriterPtr(n_writer, 0);
35059 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035060
35061 ret_val = xmlTextWriterSetIndentString(writer, str);
35062 desret_int(ret_val);
35063 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035064 des_xmlTextWriterPtr(n_writer, writer, 0);
35065 des_const_xmlChar_ptr(n_str, str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035066 xmlResetLastError();
35067 if (mem_base != xmlMemBlocks()) {
35068 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
35069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035070 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035071 printf(" %d", n_writer);
35072 printf(" %d", n_str);
35073 printf("\n");
35074 }
35075 }
35076 }
35077#endif
35078
Daniel Veillard3d97e662004-11-04 10:49:00 +000035079 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035080 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035081}
35082
35083
35084static int
35085test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035086 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035087
Daniel Veillarde43cc572004-11-03 11:50:29 +000035088#ifdef LIBXML_WRITER_ENABLED
35089 int mem_base;
35090 int ret_val;
35091 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35092 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035093 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035094 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035095
Daniel Veillarde43cc572004-11-03 11:50:29 +000035096 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35097 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
35098 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035099 writer = gen_xmlTextWriterPtr(n_writer, 0);
35100 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035101
35102 ret_val = xmlTextWriterStartAttribute(writer, name);
35103 desret_int(ret_val);
35104 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035105 des_xmlTextWriterPtr(n_writer, writer, 0);
35106 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035107 xmlResetLastError();
35108 if (mem_base != xmlMemBlocks()) {
35109 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
35110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035111 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035112 printf(" %d", n_writer);
35113 printf(" %d", n_name);
35114 printf("\n");
35115 }
35116 }
35117 }
35118#endif
35119
Daniel Veillard3d97e662004-11-04 10:49:00 +000035120 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035122}
35123
35124
35125static int
35126test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035128
Daniel Veillarde43cc572004-11-03 11:50:29 +000035129#ifdef LIBXML_WRITER_ENABLED
35130 int mem_base;
35131 int ret_val;
35132 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35133 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035134 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035135 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035136 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035137 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035138 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035139 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035140
Daniel Veillarde43cc572004-11-03 11:50:29 +000035141 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35142 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
35143 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
35144 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
35145 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035146 writer = gen_xmlTextWriterPtr(n_writer, 0);
35147 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
35148 name = gen_const_xmlChar_ptr(n_name, 2);
35149 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035150
35151 ret_val = xmlTextWriterStartAttributeNS(writer, prefix, name, namespaceURI);
35152 desret_int(ret_val);
35153 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035154 des_xmlTextWriterPtr(n_writer, writer, 0);
35155 des_const_xmlChar_ptr(n_prefix, prefix, 1);
35156 des_const_xmlChar_ptr(n_name, name, 2);
35157 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035158 xmlResetLastError();
35159 if (mem_base != xmlMemBlocks()) {
35160 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
35161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035162 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035163 printf(" %d", n_writer);
35164 printf(" %d", n_prefix);
35165 printf(" %d", n_name);
35166 printf(" %d", n_namespaceURI);
35167 printf("\n");
35168 }
35169 }
35170 }
35171 }
35172 }
35173#endif
35174
Daniel Veillard3d97e662004-11-04 10:49:00 +000035175 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035177}
35178
35179
35180static int
35181test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035182 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035183
Daniel Veillarde43cc572004-11-03 11:50:29 +000035184#ifdef LIBXML_WRITER_ENABLED
35185 int mem_base;
35186 int ret_val;
35187 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35188 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035189
Daniel Veillarde43cc572004-11-03 11:50:29 +000035190 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35191 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035192 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035193
35194 ret_val = xmlTextWriterStartCDATA(writer);
35195 desret_int(ret_val);
35196 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035197 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035198 xmlResetLastError();
35199 if (mem_base != xmlMemBlocks()) {
35200 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
35201 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035202 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035203 printf(" %d", n_writer);
35204 printf("\n");
35205 }
35206 }
35207#endif
35208
Daniel Veillard3d97e662004-11-04 10:49:00 +000035209 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035210 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035211}
35212
35213
35214static int
35215test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035216 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035217
Daniel Veillarde43cc572004-11-03 11:50:29 +000035218#ifdef LIBXML_WRITER_ENABLED
35219 int mem_base;
35220 int ret_val;
35221 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35222 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035223
Daniel Veillarde43cc572004-11-03 11:50:29 +000035224 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35225 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035226 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035227
35228 ret_val = xmlTextWriterStartComment(writer);
35229 desret_int(ret_val);
35230 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035231 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035232 xmlResetLastError();
35233 if (mem_base != xmlMemBlocks()) {
35234 printf("Leak of %d blocks found in xmlTextWriterStartComment",
35235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035236 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035237 printf(" %d", n_writer);
35238 printf("\n");
35239 }
35240 }
35241#endif
35242
Daniel Veillard3d97e662004-11-04 10:49:00 +000035243 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035244 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035245}
35246
35247
35248static int
35249test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035250 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035251
Daniel Veillarde43cc572004-11-03 11:50:29 +000035252#ifdef LIBXML_WRITER_ENABLED
35253 int mem_base;
35254 int ret_val;
35255 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35256 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035257 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035258 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035259 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035260 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035261 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035262 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035263
Daniel Veillarde43cc572004-11-03 11:50:29 +000035264 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35265 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
35266 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
35267 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
35268 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035269 writer = gen_xmlTextWriterPtr(n_writer, 0);
35270 name = gen_const_xmlChar_ptr(n_name, 1);
35271 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
35272 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035273
35274 ret_val = xmlTextWriterStartDTD(writer, name, pubid, sysid);
35275 desret_int(ret_val);
35276 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035277 des_xmlTextWriterPtr(n_writer, writer, 0);
35278 des_const_xmlChar_ptr(n_name, name, 1);
35279 des_const_xmlChar_ptr(n_pubid, pubid, 2);
35280 des_const_xmlChar_ptr(n_sysid, sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035281 xmlResetLastError();
35282 if (mem_base != xmlMemBlocks()) {
35283 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
35284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035285 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035286 printf(" %d", n_writer);
35287 printf(" %d", n_name);
35288 printf(" %d", n_pubid);
35289 printf(" %d", n_sysid);
35290 printf("\n");
35291 }
35292 }
35293 }
35294 }
35295 }
35296#endif
35297
Daniel Veillard3d97e662004-11-04 10:49:00 +000035298 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035300}
35301
35302
35303static int
35304test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035306
Daniel Veillarde43cc572004-11-03 11:50:29 +000035307#ifdef LIBXML_WRITER_ENABLED
35308 int mem_base;
35309 int ret_val;
35310 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35311 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035312 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035313 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035314
Daniel Veillarde43cc572004-11-03 11:50:29 +000035315 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35316 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
35317 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035318 writer = gen_xmlTextWriterPtr(n_writer, 0);
35319 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035320
35321 ret_val = xmlTextWriterStartDTDAttlist(writer, name);
35322 desret_int(ret_val);
35323 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035324 des_xmlTextWriterPtr(n_writer, writer, 0);
35325 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035326 xmlResetLastError();
35327 if (mem_base != xmlMemBlocks()) {
35328 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
35329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035330 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035331 printf(" %d", n_writer);
35332 printf(" %d", n_name);
35333 printf("\n");
35334 }
35335 }
35336 }
35337#endif
35338
Daniel Veillard3d97e662004-11-04 10:49:00 +000035339 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035340 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035341}
35342
35343
35344static int
35345test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035347
Daniel Veillarde43cc572004-11-03 11:50:29 +000035348#ifdef LIBXML_WRITER_ENABLED
35349 int mem_base;
35350 int ret_val;
35351 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35352 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035353 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035354 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035355
Daniel Veillarde43cc572004-11-03 11:50:29 +000035356 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35357 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
35358 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035359 writer = gen_xmlTextWriterPtr(n_writer, 0);
35360 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035361
35362 ret_val = xmlTextWriterStartDTDElement(writer, name);
35363 desret_int(ret_val);
35364 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035365 des_xmlTextWriterPtr(n_writer, writer, 0);
35366 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035367 xmlResetLastError();
35368 if (mem_base != xmlMemBlocks()) {
35369 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
35370 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035371 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035372 printf(" %d", n_writer);
35373 printf(" %d", n_name);
35374 printf("\n");
35375 }
35376 }
35377 }
35378#endif
35379
Daniel Veillard3d97e662004-11-04 10:49:00 +000035380 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035381 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035382}
35383
35384
35385static int
35386test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035387 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035388
Daniel Veillarde43cc572004-11-03 11:50:29 +000035389#ifdef LIBXML_WRITER_ENABLED
35390 int mem_base;
35391 int ret_val;
35392 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35393 int n_writer;
35394 int pe; /* TRUE if this is a parameter entity, FALSE if not */
35395 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035396 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035397 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035398
Daniel Veillarde43cc572004-11-03 11:50:29 +000035399 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35400 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
35401 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
35402 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035403 writer = gen_xmlTextWriterPtr(n_writer, 0);
35404 pe = gen_int(n_pe, 1);
35405 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035406
35407 ret_val = xmlTextWriterStartDTDEntity(writer, pe, name);
35408 desret_int(ret_val);
35409 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035410 des_xmlTextWriterPtr(n_writer, writer, 0);
35411 des_int(n_pe, pe, 1);
35412 des_const_xmlChar_ptr(n_name, name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035413 xmlResetLastError();
35414 if (mem_base != xmlMemBlocks()) {
35415 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
35416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035417 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035418 printf(" %d", n_writer);
35419 printf(" %d", n_pe);
35420 printf(" %d", n_name);
35421 printf("\n");
35422 }
35423 }
35424 }
35425 }
35426#endif
35427
Daniel Veillard3d97e662004-11-04 10:49:00 +000035428 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035430}
35431
35432
35433static int
35434test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035436
Daniel Veillarde43cc572004-11-03 11:50:29 +000035437#ifdef LIBXML_WRITER_ENABLED
35438 int mem_base;
35439 int ret_val;
35440 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35441 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035442 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035443 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035444 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035445 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035446 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035447 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035448
Daniel Veillarde43cc572004-11-03 11:50:29 +000035449 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35450 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
35451 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
35452 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
35453 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035454 writer = gen_xmlTextWriterPtr(n_writer, 0);
35455 version = gen_const_char_ptr(n_version, 1);
35456 encoding = gen_const_char_ptr(n_encoding, 2);
35457 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035458
35459 ret_val = xmlTextWriterStartDocument(writer, version, encoding, standalone);
35460 desret_int(ret_val);
35461 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035462 des_xmlTextWriterPtr(n_writer, writer, 0);
35463 des_const_char_ptr(n_version, version, 1);
35464 des_const_char_ptr(n_encoding, encoding, 2);
35465 des_const_char_ptr(n_standalone, standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035466 xmlResetLastError();
35467 if (mem_base != xmlMemBlocks()) {
35468 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
35469 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035470 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035471 printf(" %d", n_writer);
35472 printf(" %d", n_version);
35473 printf(" %d", n_encoding);
35474 printf(" %d", n_standalone);
35475 printf("\n");
35476 }
35477 }
35478 }
35479 }
35480 }
35481#endif
35482
Daniel Veillard3d97e662004-11-04 10:49:00 +000035483 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035485}
35486
35487
35488static int
35489test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035491
Daniel Veillarde43cc572004-11-03 11:50:29 +000035492#ifdef LIBXML_WRITER_ENABLED
35493 int mem_base;
35494 int ret_val;
35495 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35496 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035497 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035498 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035499
Daniel Veillarde43cc572004-11-03 11:50:29 +000035500 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35501 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
35502 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035503 writer = gen_xmlTextWriterPtr(n_writer, 0);
35504 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035505
35506 ret_val = xmlTextWriterStartElement(writer, name);
35507 desret_int(ret_val);
35508 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035509 des_xmlTextWriterPtr(n_writer, writer, 0);
35510 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035511 xmlResetLastError();
35512 if (mem_base != xmlMemBlocks()) {
35513 printf("Leak of %d blocks found in xmlTextWriterStartElement",
35514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035515 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035516 printf(" %d", n_writer);
35517 printf(" %d", n_name);
35518 printf("\n");
35519 }
35520 }
35521 }
35522#endif
35523
Daniel Veillard3d97e662004-11-04 10:49:00 +000035524 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035525 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035526}
35527
35528
35529static int
35530test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035531 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035532
Daniel Veillarde43cc572004-11-03 11:50:29 +000035533#ifdef LIBXML_WRITER_ENABLED
35534 int mem_base;
35535 int ret_val;
35536 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35537 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035538 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035539 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035540 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035541 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035542 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035543 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035544
Daniel Veillarde43cc572004-11-03 11:50:29 +000035545 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35546 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
35547 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
35548 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
35549 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035550 writer = gen_xmlTextWriterPtr(n_writer, 0);
35551 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
35552 name = gen_const_xmlChar_ptr(n_name, 2);
35553 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035554
35555 ret_val = xmlTextWriterStartElementNS(writer, prefix, name, namespaceURI);
35556 desret_int(ret_val);
35557 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035558 des_xmlTextWriterPtr(n_writer, writer, 0);
35559 des_const_xmlChar_ptr(n_prefix, prefix, 1);
35560 des_const_xmlChar_ptr(n_name, name, 2);
35561 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035562 xmlResetLastError();
35563 if (mem_base != xmlMemBlocks()) {
35564 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
35565 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035566 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035567 printf(" %d", n_writer);
35568 printf(" %d", n_prefix);
35569 printf(" %d", n_name);
35570 printf(" %d", n_namespaceURI);
35571 printf("\n");
35572 }
35573 }
35574 }
35575 }
35576 }
35577#endif
35578
Daniel Veillard3d97e662004-11-04 10:49:00 +000035579 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035580 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035581}
35582
35583
35584static int
35585test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035587
Daniel Veillarde43cc572004-11-03 11:50:29 +000035588#ifdef LIBXML_WRITER_ENABLED
35589 int mem_base;
35590 int ret_val;
35591 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35592 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035593 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035594 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035595
Daniel Veillarde43cc572004-11-03 11:50:29 +000035596 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35597 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
35598 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035599 writer = gen_xmlTextWriterPtr(n_writer, 0);
35600 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035601
35602 ret_val = xmlTextWriterStartPI(writer, target);
35603 desret_int(ret_val);
35604 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035605 des_xmlTextWriterPtr(n_writer, writer, 0);
35606 des_const_xmlChar_ptr(n_target, target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035607 xmlResetLastError();
35608 if (mem_base != xmlMemBlocks()) {
35609 printf("Leak of %d blocks found in xmlTextWriterStartPI",
35610 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035611 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035612 printf(" %d", n_writer);
35613 printf(" %d", n_target);
35614 printf("\n");
35615 }
35616 }
35617 }
35618#endif
35619
Daniel Veillard3d97e662004-11-04 10:49:00 +000035620 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035622}
35623
35624
35625static int
35626test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035628
Daniel Veillarde43cc572004-11-03 11:50:29 +000035629#ifdef LIBXML_WRITER_ENABLED
35630 int mem_base;
35631 int ret_val;
35632 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35633 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035634 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035635 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035636 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035637 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035638
Daniel Veillarde43cc572004-11-03 11:50:29 +000035639 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35640 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
35641 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
35642 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035643 writer = gen_xmlTextWriterPtr(n_writer, 0);
35644 name = gen_const_xmlChar_ptr(n_name, 1);
35645 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035646
35647 ret_val = xmlTextWriterWriteAttribute(writer, name, content);
35648 desret_int(ret_val);
35649 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035650 des_xmlTextWriterPtr(n_writer, writer, 0);
35651 des_const_xmlChar_ptr(n_name, name, 1);
35652 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035653 xmlResetLastError();
35654 if (mem_base != xmlMemBlocks()) {
35655 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
35656 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035657 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035658 printf(" %d", n_writer);
35659 printf(" %d", n_name);
35660 printf(" %d", n_content);
35661 printf("\n");
35662 }
35663 }
35664 }
35665 }
35666#endif
35667
Daniel Veillard3d97e662004-11-04 10:49:00 +000035668 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035669 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035670}
35671
35672
35673static int
35674test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035675 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035676
Daniel Veillarde43cc572004-11-03 11:50:29 +000035677#ifdef LIBXML_WRITER_ENABLED
35678 int mem_base;
35679 int ret_val;
35680 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35681 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035682 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035683 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035684 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035685 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035686 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035687 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035688 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035689 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035690
Daniel Veillarde43cc572004-11-03 11:50:29 +000035691 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35692 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
35693 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
35694 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
35695 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
35696 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035697 writer = gen_xmlTextWriterPtr(n_writer, 0);
35698 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
35699 name = gen_const_xmlChar_ptr(n_name, 2);
35700 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
35701 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035702
35703 ret_val = xmlTextWriterWriteAttributeNS(writer, prefix, name, namespaceURI, content);
35704 desret_int(ret_val);
35705 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035706 des_xmlTextWriterPtr(n_writer, writer, 0);
35707 des_const_xmlChar_ptr(n_prefix, prefix, 1);
35708 des_const_xmlChar_ptr(n_name, name, 2);
35709 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
35710 des_const_xmlChar_ptr(n_content, content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035711 xmlResetLastError();
35712 if (mem_base != xmlMemBlocks()) {
35713 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
35714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035715 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035716 printf(" %d", n_writer);
35717 printf(" %d", n_prefix);
35718 printf(" %d", n_name);
35719 printf(" %d", n_namespaceURI);
35720 printf(" %d", n_content);
35721 printf("\n");
35722 }
35723 }
35724 }
35725 }
35726 }
35727 }
35728#endif
35729
Daniel Veillard3d97e662004-11-04 10:49:00 +000035730 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035732}
35733
35734
35735static int
35736test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035738
Daniel Veillarde43cc572004-11-03 11:50:29 +000035739#ifdef LIBXML_WRITER_ENABLED
35740 int mem_base;
35741 int ret_val;
35742 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35743 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035744 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035745 int n_data;
35746 int start; /* the position within the data of the first byte to encode */
35747 int n_start;
35748 int len; /* the number of bytes to encode */
35749 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035750
Daniel Veillarde43cc572004-11-03 11:50:29 +000035751 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35752 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
35753 for (n_start = 0;n_start < gen_nb_int;n_start++) {
35754 for (n_len = 0;n_len < gen_nb_int;n_len++) {
35755 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035756 writer = gen_xmlTextWriterPtr(n_writer, 0);
35757 data = gen_const_char_ptr(n_data, 1);
35758 start = gen_int(n_start, 2);
35759 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035760
35761 ret_val = xmlTextWriterWriteBase64(writer, data, start, len);
35762 desret_int(ret_val);
35763 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035764 des_xmlTextWriterPtr(n_writer, writer, 0);
35765 des_const_char_ptr(n_data, data, 1);
35766 des_int(n_start, start, 2);
35767 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035768 xmlResetLastError();
35769 if (mem_base != xmlMemBlocks()) {
35770 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
35771 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035772 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035773 printf(" %d", n_writer);
35774 printf(" %d", n_data);
35775 printf(" %d", n_start);
35776 printf(" %d", n_len);
35777 printf("\n");
35778 }
35779 }
35780 }
35781 }
35782 }
35783#endif
35784
Daniel Veillard3d97e662004-11-04 10:49:00 +000035785 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035786 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035787}
35788
35789
35790static int
35791test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035792 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035793
Daniel Veillarde43cc572004-11-03 11:50:29 +000035794#ifdef LIBXML_WRITER_ENABLED
35795 int mem_base;
35796 int ret_val;
35797 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35798 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035799 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035800 int n_data;
35801 int start; /* the position within the data of the first byte to encode */
35802 int n_start;
35803 int len; /* the number of bytes to encode */
35804 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035805
Daniel Veillarde43cc572004-11-03 11:50:29 +000035806 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35807 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
35808 for (n_start = 0;n_start < gen_nb_int;n_start++) {
35809 for (n_len = 0;n_len < gen_nb_int;n_len++) {
35810 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035811 writer = gen_xmlTextWriterPtr(n_writer, 0);
35812 data = gen_const_char_ptr(n_data, 1);
35813 start = gen_int(n_start, 2);
35814 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035815
35816 ret_val = xmlTextWriterWriteBinHex(writer, data, start, len);
35817 desret_int(ret_val);
35818 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035819 des_xmlTextWriterPtr(n_writer, writer, 0);
35820 des_const_char_ptr(n_data, data, 1);
35821 des_int(n_start, start, 2);
35822 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035823 xmlResetLastError();
35824 if (mem_base != xmlMemBlocks()) {
35825 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
35826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035827 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035828 printf(" %d", n_writer);
35829 printf(" %d", n_data);
35830 printf(" %d", n_start);
35831 printf(" %d", n_len);
35832 printf("\n");
35833 }
35834 }
35835 }
35836 }
35837 }
35838#endif
35839
Daniel Veillard3d97e662004-11-04 10:49:00 +000035840 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035841 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035842}
35843
35844
35845static int
35846test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035847 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035848
Daniel Veillarde43cc572004-11-03 11:50:29 +000035849#ifdef LIBXML_WRITER_ENABLED
35850 int mem_base;
35851 int ret_val;
35852 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35853 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035854 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035855 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035856
Daniel Veillarde43cc572004-11-03 11:50:29 +000035857 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35858 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
35859 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035860 writer = gen_xmlTextWriterPtr(n_writer, 0);
35861 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035862
35863 ret_val = xmlTextWriterWriteCDATA(writer, content);
35864 desret_int(ret_val);
35865 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035866 des_xmlTextWriterPtr(n_writer, writer, 0);
35867 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035868 xmlResetLastError();
35869 if (mem_base != xmlMemBlocks()) {
35870 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
35871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035872 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035873 printf(" %d", n_writer);
35874 printf(" %d", n_content);
35875 printf("\n");
35876 }
35877 }
35878 }
35879#endif
35880
Daniel Veillard3d97e662004-11-04 10:49:00 +000035881 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035883}
35884
35885
35886static int
35887test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035889
Daniel Veillarde43cc572004-11-03 11:50:29 +000035890#ifdef LIBXML_WRITER_ENABLED
35891 int mem_base;
35892 int ret_val;
35893 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35894 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035895 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035896 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035897
Daniel Veillarde43cc572004-11-03 11:50:29 +000035898 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35899 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
35900 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035901 writer = gen_xmlTextWriterPtr(n_writer, 0);
35902 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035903
35904 ret_val = xmlTextWriterWriteComment(writer, content);
35905 desret_int(ret_val);
35906 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035907 des_xmlTextWriterPtr(n_writer, writer, 0);
35908 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035909 xmlResetLastError();
35910 if (mem_base != xmlMemBlocks()) {
35911 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
35912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035913 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035914 printf(" %d", n_writer);
35915 printf(" %d", n_content);
35916 printf("\n");
35917 }
35918 }
35919 }
35920#endif
35921
Daniel Veillard3d97e662004-11-04 10:49:00 +000035922 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035923 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035924}
35925
35926
35927static int
35928test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035929 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035930
Daniel Veillarde43cc572004-11-03 11:50:29 +000035931#ifdef LIBXML_WRITER_ENABLED
35932 int mem_base;
35933 int ret_val;
35934 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35935 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035936 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035937 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035938 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035939 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035940 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035941 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035942 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035943 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035944
Daniel Veillarde43cc572004-11-03 11:50:29 +000035945 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
35946 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
35947 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
35948 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
35949 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
35950 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000035951 writer = gen_xmlTextWriterPtr(n_writer, 0);
35952 name = gen_const_xmlChar_ptr(n_name, 1);
35953 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
35954 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
35955 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035956
35957 ret_val = xmlTextWriterWriteDTD(writer, name, pubid, sysid, subset);
35958 desret_int(ret_val);
35959 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000035960 des_xmlTextWriterPtr(n_writer, writer, 0);
35961 des_const_xmlChar_ptr(n_name, name, 1);
35962 des_const_xmlChar_ptr(n_pubid, pubid, 2);
35963 des_const_xmlChar_ptr(n_sysid, sysid, 3);
35964 des_const_xmlChar_ptr(n_subset, subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000035965 xmlResetLastError();
35966 if (mem_base != xmlMemBlocks()) {
35967 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
35968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035969 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000035970 printf(" %d", n_writer);
35971 printf(" %d", n_name);
35972 printf(" %d", n_pubid);
35973 printf(" %d", n_sysid);
35974 printf(" %d", n_subset);
35975 printf("\n");
35976 }
35977 }
35978 }
35979 }
35980 }
35981 }
35982#endif
35983
Daniel Veillard3d97e662004-11-04 10:49:00 +000035984 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035985 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000035986}
35987
35988
35989static int
35990test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035991 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000035992
Daniel Veillarde43cc572004-11-03 11:50:29 +000035993#ifdef LIBXML_WRITER_ENABLED
35994 int mem_base;
35995 int ret_val;
35996 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
35997 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035998 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000035999 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036000 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036001 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036002
Daniel Veillarde43cc572004-11-03 11:50:29 +000036003 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
36004 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
36005 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
36006 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000036007 writer = gen_xmlTextWriterPtr(n_writer, 0);
36008 name = gen_const_xmlChar_ptr(n_name, 1);
36009 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036010
36011 ret_val = xmlTextWriterWriteDTDAttlist(writer, name, content);
36012 desret_int(ret_val);
36013 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000036014 des_xmlTextWriterPtr(n_writer, writer, 0);
36015 des_const_xmlChar_ptr(n_name, name, 1);
36016 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036017 xmlResetLastError();
36018 if (mem_base != xmlMemBlocks()) {
36019 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
36020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036021 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000036022 printf(" %d", n_writer);
36023 printf(" %d", n_name);
36024 printf(" %d", n_content);
36025 printf("\n");
36026 }
36027 }
36028 }
36029 }
36030#endif
36031
Daniel Veillard3d97e662004-11-04 10:49:00 +000036032 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036033 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036034}
36035
36036
36037static int
36038test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036040
Daniel Veillarde43cc572004-11-03 11:50:29 +000036041#ifdef LIBXML_WRITER_ENABLED
36042 int mem_base;
36043 int ret_val;
36044 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
36045 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036046 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036047 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036048 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036049 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036050
Daniel Veillarde43cc572004-11-03 11:50:29 +000036051 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
36052 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
36053 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
36054 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000036055 writer = gen_xmlTextWriterPtr(n_writer, 0);
36056 name = gen_const_xmlChar_ptr(n_name, 1);
36057 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036058
36059 ret_val = xmlTextWriterWriteDTDElement(writer, name, content);
36060 desret_int(ret_val);
36061 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000036062 des_xmlTextWriterPtr(n_writer, writer, 0);
36063 des_const_xmlChar_ptr(n_name, name, 1);
36064 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036065 xmlResetLastError();
36066 if (mem_base != xmlMemBlocks()) {
36067 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
36068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036069 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000036070 printf(" %d", n_writer);
36071 printf(" %d", n_name);
36072 printf(" %d", n_content);
36073 printf("\n");
36074 }
36075 }
36076 }
36077 }
36078#endif
36079
Daniel Veillard3d97e662004-11-04 10:49:00 +000036080 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036081 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036082}
36083
36084
36085static int
36086test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036087 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036088
Daniel Veillarde43cc572004-11-03 11:50:29 +000036089#ifdef LIBXML_WRITER_ENABLED
36090 int mem_base;
36091 int ret_val;
36092 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
36093 int n_writer;
36094 int pe; /* TRUE if this is a parameter entity, FALSE if not */
36095 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036096 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036097 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036098 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036099 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036100 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036101 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036102 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036103 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036104 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036105 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036106
Daniel Veillarde43cc572004-11-03 11:50:29 +000036107 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
36108 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
36109 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
36110 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
36111 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
36112 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
36113 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
36114 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000036115 writer = gen_xmlTextWriterPtr(n_writer, 0);
36116 pe = gen_int(n_pe, 1);
36117 name = gen_const_xmlChar_ptr(n_name, 2);
36118 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
36119 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
36120 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
36121 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036122
36123 ret_val = xmlTextWriterWriteDTDEntity(writer, pe, name, pubid, sysid, ndataid, content);
36124 desret_int(ret_val);
36125 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000036126 des_xmlTextWriterPtr(n_writer, writer, 0);
36127 des_int(n_pe, pe, 1);
36128 des_const_xmlChar_ptr(n_name, name, 2);
36129 des_const_xmlChar_ptr(n_pubid, pubid, 3);
36130 des_const_xmlChar_ptr(n_sysid, sysid, 4);
36131 des_const_xmlChar_ptr(n_ndataid, ndataid, 5);
36132 des_const_xmlChar_ptr(n_content, content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036133 xmlResetLastError();
36134 if (mem_base != xmlMemBlocks()) {
36135 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
36136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036137 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000036138 printf(" %d", n_writer);
36139 printf(" %d", n_pe);
36140 printf(" %d", n_name);
36141 printf(" %d", n_pubid);
36142 printf(" %d", n_sysid);
36143 printf(" %d", n_ndataid);
36144 printf(" %d", n_content);
36145 printf("\n");
36146 }
36147 }
36148 }
36149 }
36150 }
36151 }
36152 }
36153 }
36154#endif
36155
Daniel Veillard3d97e662004-11-04 10:49:00 +000036156 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036158}
36159
36160
36161static int
36162test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036164
Daniel Veillarde43cc572004-11-03 11:50:29 +000036165#ifdef LIBXML_WRITER_ENABLED
36166 int mem_base;
36167 int ret_val;
36168 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
36169 int n_writer;
36170 int pe; /* TRUE if this is a parameter entity, FALSE if not */
36171 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036172 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036173 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036174 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036175 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036176 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036177 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036178 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036179 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036180
Daniel Veillarde43cc572004-11-03 11:50:29 +000036181 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
36182 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
36183 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
36184 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
36185 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
36186 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
36187 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000036188 writer = gen_xmlTextWriterPtr(n_writer, 0);
36189 pe = gen_int(n_pe, 1);
36190 name = gen_const_xmlChar_ptr(n_name, 2);
36191 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
36192 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
36193 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036194
36195 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, name, pubid, sysid, ndataid);
36196 desret_int(ret_val);
36197 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000036198 des_xmlTextWriterPtr(n_writer, writer, 0);
36199 des_int(n_pe, pe, 1);
36200 des_const_xmlChar_ptr(n_name, name, 2);
36201 des_const_xmlChar_ptr(n_pubid, pubid, 3);
36202 des_const_xmlChar_ptr(n_sysid, sysid, 4);
36203 des_const_xmlChar_ptr(n_ndataid, ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036204 xmlResetLastError();
36205 if (mem_base != xmlMemBlocks()) {
36206 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
36207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036208 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000036209 printf(" %d", n_writer);
36210 printf(" %d", n_pe);
36211 printf(" %d", n_name);
36212 printf(" %d", n_pubid);
36213 printf(" %d", n_sysid);
36214 printf(" %d", n_ndataid);
36215 printf("\n");
36216 }
36217 }
36218 }
36219 }
36220 }
36221 }
36222 }
36223#endif
36224
Daniel Veillard3d97e662004-11-04 10:49:00 +000036225 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036226 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036227}
36228
36229
36230static int
36231test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036232 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036233
Daniel Veillarde43cc572004-11-03 11:50:29 +000036234#ifdef LIBXML_WRITER_ENABLED
36235 int mem_base;
36236 int ret_val;
36237 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
36238 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036239 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036240 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036241 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036242 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036243 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036244 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036245
Daniel Veillarde43cc572004-11-03 11:50:29 +000036246 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
36247 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
36248 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
36249 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
36250 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000036251 writer = gen_xmlTextWriterPtr(n_writer, 0);
36252 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
36253 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
36254 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036255
36256 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, pubid, sysid, ndataid);
36257 desret_int(ret_val);
36258 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000036259 des_xmlTextWriterPtr(n_writer, writer, 0);
36260 des_const_xmlChar_ptr(n_pubid, pubid, 1);
36261 des_const_xmlChar_ptr(n_sysid, sysid, 2);
36262 des_const_xmlChar_ptr(n_ndataid, ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036263 xmlResetLastError();
36264 if (mem_base != xmlMemBlocks()) {
36265 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
36266 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036267 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000036268 printf(" %d", n_writer);
36269 printf(" %d", n_pubid);
36270 printf(" %d", n_sysid);
36271 printf(" %d", n_ndataid);
36272 printf("\n");
36273 }
36274 }
36275 }
36276 }
36277 }
36278#endif
36279
Daniel Veillard3d97e662004-11-04 10:49:00 +000036280 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036282}
36283
36284
36285static int
36286test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036288
Daniel Veillarde43cc572004-11-03 11:50:29 +000036289#ifdef LIBXML_WRITER_ENABLED
36290 int mem_base;
36291 int ret_val;
36292 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
36293 int n_writer;
36294 int pe; /* TRUE if this is a parameter entity, FALSE if not */
36295 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036296 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036297 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036298 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036299 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036300
Daniel Veillarde43cc572004-11-03 11:50:29 +000036301 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
36302 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
36303 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
36304 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
36305 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000036306 writer = gen_xmlTextWriterPtr(n_writer, 0);
36307 pe = gen_int(n_pe, 1);
36308 name = gen_const_xmlChar_ptr(n_name, 2);
36309 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036310
36311 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, name, content);
36312 desret_int(ret_val);
36313 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000036314 des_xmlTextWriterPtr(n_writer, writer, 0);
36315 des_int(n_pe, pe, 1);
36316 des_const_xmlChar_ptr(n_name, name, 2);
36317 des_const_xmlChar_ptr(n_content, content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036318 xmlResetLastError();
36319 if (mem_base != xmlMemBlocks()) {
36320 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
36321 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036322 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000036323 printf(" %d", n_writer);
36324 printf(" %d", n_pe);
36325 printf(" %d", n_name);
36326 printf(" %d", n_content);
36327 printf("\n");
36328 }
36329 }
36330 }
36331 }
36332 }
36333#endif
36334
Daniel Veillard3d97e662004-11-04 10:49:00 +000036335 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036336 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036337}
36338
36339
36340static int
36341test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036342 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036343
Daniel Veillarde43cc572004-11-03 11:50:29 +000036344#ifdef LIBXML_WRITER_ENABLED
36345 int mem_base;
36346 int ret_val;
36347 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
36348 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036349 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036350 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036351 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036352 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036353 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036354 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036355
Daniel Veillarde43cc572004-11-03 11:50:29 +000036356 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
36357 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
36358 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
36359 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
36360 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000036361 writer = gen_xmlTextWriterPtr(n_writer, 0);
36362 name = gen_const_xmlChar_ptr(n_name, 1);
36363 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
36364 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036365
36366 ret_val = xmlTextWriterWriteDTDNotation(writer, name, pubid, sysid);
36367 desret_int(ret_val);
36368 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000036369 des_xmlTextWriterPtr(n_writer, writer, 0);
36370 des_const_xmlChar_ptr(n_name, name, 1);
36371 des_const_xmlChar_ptr(n_pubid, pubid, 2);
36372 des_const_xmlChar_ptr(n_sysid, sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036373 xmlResetLastError();
36374 if (mem_base != xmlMemBlocks()) {
36375 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
36376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036377 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000036378 printf(" %d", n_writer);
36379 printf(" %d", n_name);
36380 printf(" %d", n_pubid);
36381 printf(" %d", n_sysid);
36382 printf("\n");
36383 }
36384 }
36385 }
36386 }
36387 }
36388#endif
36389
Daniel Veillard3d97e662004-11-04 10:49:00 +000036390 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036392}
36393
36394
36395static int
36396test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036397 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036398
Daniel Veillarde43cc572004-11-03 11:50:29 +000036399#ifdef LIBXML_WRITER_ENABLED
36400 int mem_base;
36401 int ret_val;
36402 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
36403 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036404 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036405 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036406 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036407 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036408
Daniel Veillarde43cc572004-11-03 11:50:29 +000036409 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
36410 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
36411 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
36412 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000036413 writer = gen_xmlTextWriterPtr(n_writer, 0);
36414 name = gen_const_xmlChar_ptr(n_name, 1);
36415 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036416
36417 ret_val = xmlTextWriterWriteElement(writer, name, content);
36418 desret_int(ret_val);
36419 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000036420 des_xmlTextWriterPtr(n_writer, writer, 0);
36421 des_const_xmlChar_ptr(n_name, name, 1);
36422 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036423 xmlResetLastError();
36424 if (mem_base != xmlMemBlocks()) {
36425 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
36426 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036427 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000036428 printf(" %d", n_writer);
36429 printf(" %d", n_name);
36430 printf(" %d", n_content);
36431 printf("\n");
36432 }
36433 }
36434 }
36435 }
36436#endif
36437
Daniel Veillard3d97e662004-11-04 10:49:00 +000036438 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036439 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036440}
36441
36442
36443static int
36444test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036446
Daniel Veillarde43cc572004-11-03 11:50:29 +000036447#ifdef LIBXML_WRITER_ENABLED
36448 int mem_base;
36449 int ret_val;
36450 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
36451 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036452 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036453 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036454 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036455 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036456 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036457 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036458 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036459 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036460
Daniel Veillarde43cc572004-11-03 11:50:29 +000036461 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
36462 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
36463 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
36464 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
36465 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
36466 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000036467 writer = gen_xmlTextWriterPtr(n_writer, 0);
36468 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
36469 name = gen_const_xmlChar_ptr(n_name, 2);
36470 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
36471 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036472
36473 ret_val = xmlTextWriterWriteElementNS(writer, prefix, name, namespaceURI, content);
36474 desret_int(ret_val);
36475 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000036476 des_xmlTextWriterPtr(n_writer, writer, 0);
36477 des_const_xmlChar_ptr(n_prefix, prefix, 1);
36478 des_const_xmlChar_ptr(n_name, name, 2);
36479 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
36480 des_const_xmlChar_ptr(n_content, content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036481 xmlResetLastError();
36482 if (mem_base != xmlMemBlocks()) {
36483 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
36484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036485 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000036486 printf(" %d", n_writer);
36487 printf(" %d", n_prefix);
36488 printf(" %d", n_name);
36489 printf(" %d", n_namespaceURI);
36490 printf(" %d", n_content);
36491 printf("\n");
36492 }
36493 }
36494 }
36495 }
36496 }
36497 }
36498#endif
36499
Daniel Veillard3d97e662004-11-04 10:49:00 +000036500 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036502}
36503
36504
36505static int
36506test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036507 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036508
36509
36510 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036511 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036512}
36513
36514
36515static int
36516test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036517 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036518
36519
36520 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036521 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036522}
36523
36524
36525static int
36526test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036527 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036528
36529
36530 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036532}
36533
36534
36535static int
36536test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036538
36539
36540 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036542}
36543
36544
36545static int
36546test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036548
36549
36550 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036551 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036552}
36553
36554
36555static int
36556test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036557 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036558
36559
36560 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036562}
36563
36564
36565static int
36566test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036568
36569
36570 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036571 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036572}
36573
36574
36575static int
36576test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036577 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036578
36579
36580 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036582}
36583
36584
36585static int
36586test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036588
36589
36590 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036591 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036592}
36593
36594
36595static int
36596test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036597 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036598
36599
36600 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036602}
36603
36604
36605static int
36606test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036607 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036608
36609
36610 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036612}
36613
36614
36615static int
36616test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036618
36619
36620 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036622}
36623
36624
36625static int
36626test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036628
36629
36630 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036632}
36633
36634
36635static int
36636test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036638
Daniel Veillarde43cc572004-11-03 11:50:29 +000036639#ifdef LIBXML_WRITER_ENABLED
36640 int mem_base;
36641 int ret_val;
36642 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
36643 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036644 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036645 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036646 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036647 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036648
Daniel Veillarde43cc572004-11-03 11:50:29 +000036649 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
36650 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
36651 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
36652 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000036653 writer = gen_xmlTextWriterPtr(n_writer, 0);
36654 target = gen_const_xmlChar_ptr(n_target, 1);
36655 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036656
36657 ret_val = xmlTextWriterWritePI(writer, target, content);
36658 desret_int(ret_val);
36659 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000036660 des_xmlTextWriterPtr(n_writer, writer, 0);
36661 des_const_xmlChar_ptr(n_target, target, 1);
36662 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036663 xmlResetLastError();
36664 if (mem_base != xmlMemBlocks()) {
36665 printf("Leak of %d blocks found in xmlTextWriterWritePI",
36666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036667 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000036668 printf(" %d", n_writer);
36669 printf(" %d", n_target);
36670 printf(" %d", n_content);
36671 printf("\n");
36672 }
36673 }
36674 }
36675 }
36676#endif
36677
Daniel Veillard3d97e662004-11-04 10:49:00 +000036678 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036679 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036680}
36681
36682
36683static int
36684test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036685 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036686
Daniel Veillarde43cc572004-11-03 11:50:29 +000036687#ifdef LIBXML_WRITER_ENABLED
36688 int mem_base;
36689 int ret_val;
36690 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
36691 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036692 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036693 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036694
Daniel Veillarde43cc572004-11-03 11:50:29 +000036695 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
36696 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
36697 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000036698 writer = gen_xmlTextWriterPtr(n_writer, 0);
36699 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036700
36701 ret_val = xmlTextWriterWriteRaw(writer, content);
36702 desret_int(ret_val);
36703 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000036704 des_xmlTextWriterPtr(n_writer, writer, 0);
36705 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036706 xmlResetLastError();
36707 if (mem_base != xmlMemBlocks()) {
36708 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
36709 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036710 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000036711 printf(" %d", n_writer);
36712 printf(" %d", n_content);
36713 printf("\n");
36714 }
36715 }
36716 }
36717#endif
36718
Daniel Veillard3d97e662004-11-04 10:49:00 +000036719 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036720 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036721}
36722
36723
36724static int
36725test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036726 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036727
Daniel Veillarde43cc572004-11-03 11:50:29 +000036728#ifdef LIBXML_WRITER_ENABLED
36729 int mem_base;
36730 int ret_val;
36731 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
36732 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036733 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036734 int n_content;
36735 int len; /* length of the text string */
36736 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036737
Daniel Veillarde43cc572004-11-03 11:50:29 +000036738 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
36739 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
36740 for (n_len = 0;n_len < gen_nb_int;n_len++) {
36741 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000036742 writer = gen_xmlTextWriterPtr(n_writer, 0);
36743 content = gen_const_xmlChar_ptr(n_content, 1);
36744 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036745
36746 ret_val = xmlTextWriterWriteRawLen(writer, content, len);
36747 desret_int(ret_val);
36748 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000036749 des_xmlTextWriterPtr(n_writer, writer, 0);
36750 des_const_xmlChar_ptr(n_content, content, 1);
36751 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036752 xmlResetLastError();
36753 if (mem_base != xmlMemBlocks()) {
36754 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
36755 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036756 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000036757 printf(" %d", n_writer);
36758 printf(" %d", n_content);
36759 printf(" %d", n_len);
36760 printf("\n");
36761 }
36762 }
36763 }
36764 }
36765#endif
36766
Daniel Veillard3d97e662004-11-04 10:49:00 +000036767 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036768 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036769}
36770
36771
36772static int
36773test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036774 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036775
Daniel Veillarde43cc572004-11-03 11:50:29 +000036776#ifdef LIBXML_WRITER_ENABLED
36777 int mem_base;
36778 int ret_val;
36779 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
36780 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000036781 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000036782 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036783
Daniel Veillarde43cc572004-11-03 11:50:29 +000036784 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
36785 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
36786 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000036787 writer = gen_xmlTextWriterPtr(n_writer, 0);
36788 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036789
36790 ret_val = xmlTextWriterWriteString(writer, content);
36791 desret_int(ret_val);
36792 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000036793 des_xmlTextWriterPtr(n_writer, writer, 0);
36794 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000036795 xmlResetLastError();
36796 if (mem_base != xmlMemBlocks()) {
36797 printf("Leak of %d blocks found in xmlTextWriterWriteString",
36798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036799 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000036800 printf(" %d", n_writer);
36801 printf(" %d", n_content);
36802 printf("\n");
36803 }
36804 }
36805 }
36806#endif
36807
Daniel Veillard3d97e662004-11-04 10:49:00 +000036808 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036809 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036810}
36811
36812
36813static int
36814test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036816
36817
36818 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036820}
36821
36822
36823static int
36824test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036825 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036826
36827
36828 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036829 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036830}
36831
36832
36833static int
36834test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036835 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036836
36837
36838 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036840}
36841
36842
36843static int
36844test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036846
36847
36848 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036850}
36851
36852
36853static int
36854test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036856
36857
36858 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036859 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036860}
36861
36862
36863static int
36864test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036866
36867
36868 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036870}
36871
36872
36873static int
36874test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036876
36877
36878 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036880}
36881
36882
36883static int
36884test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036885 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036886
36887
36888 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036889 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036890}
36891
36892
36893static int
36894test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036895 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036896
36897
36898 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036899 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036900}
36901
36902
36903static int
36904test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036905 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036906
36907
36908 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036910}
36911
36912
36913static int
36914test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036916
36917
36918 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036919 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036920}
36921
36922
36923static int
36924test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036925 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036926
36927
36928 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036930}
36931
36932
36933static int
36934test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036936
36937
36938 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000036939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000036940}
36941
36942static int
36943test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000036945
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000036946 printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000036947 test_ret += test_xmlNewTextWriter();
36948 test_ret += test_xmlNewTextWriterFilename();
36949 test_ret += test_xmlNewTextWriterMemory();
36950 test_ret += test_xmlNewTextWriterPushParser();
36951 test_ret += test_xmlNewTextWriterTree();
36952 test_ret += test_xmlTextWriterEndAttribute();
36953 test_ret += test_xmlTextWriterEndCDATA();
36954 test_ret += test_xmlTextWriterEndComment();
36955 test_ret += test_xmlTextWriterEndDTD();
36956 test_ret += test_xmlTextWriterEndDTDAttlist();
36957 test_ret += test_xmlTextWriterEndDTDElement();
36958 test_ret += test_xmlTextWriterEndDTDEntity();
36959 test_ret += test_xmlTextWriterEndDocument();
36960 test_ret += test_xmlTextWriterEndElement();
36961 test_ret += test_xmlTextWriterEndPI();
36962 test_ret += test_xmlTextWriterFlush();
36963 test_ret += test_xmlTextWriterFullEndElement();
36964 test_ret += test_xmlTextWriterSetIndent();
36965 test_ret += test_xmlTextWriterSetIndentString();
36966 test_ret += test_xmlTextWriterStartAttribute();
36967 test_ret += test_xmlTextWriterStartAttributeNS();
36968 test_ret += test_xmlTextWriterStartCDATA();
36969 test_ret += test_xmlTextWriterStartComment();
36970 test_ret += test_xmlTextWriterStartDTD();
36971 test_ret += test_xmlTextWriterStartDTDAttlist();
36972 test_ret += test_xmlTextWriterStartDTDElement();
36973 test_ret += test_xmlTextWriterStartDTDEntity();
36974 test_ret += test_xmlTextWriterStartDocument();
36975 test_ret += test_xmlTextWriterStartElement();
36976 test_ret += test_xmlTextWriterStartElementNS();
36977 test_ret += test_xmlTextWriterStartPI();
36978 test_ret += test_xmlTextWriterWriteAttribute();
36979 test_ret += test_xmlTextWriterWriteAttributeNS();
36980 test_ret += test_xmlTextWriterWriteBase64();
36981 test_ret += test_xmlTextWriterWriteBinHex();
36982 test_ret += test_xmlTextWriterWriteCDATA();
36983 test_ret += test_xmlTextWriterWriteComment();
36984 test_ret += test_xmlTextWriterWriteDTD();
36985 test_ret += test_xmlTextWriterWriteDTDAttlist();
36986 test_ret += test_xmlTextWriterWriteDTDElement();
36987 test_ret += test_xmlTextWriterWriteDTDEntity();
36988 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
36989 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
36990 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
36991 test_ret += test_xmlTextWriterWriteDTDNotation();
36992 test_ret += test_xmlTextWriterWriteElement();
36993 test_ret += test_xmlTextWriterWriteElementNS();
36994 test_ret += test_xmlTextWriterWriteFormatAttribute();
36995 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
36996 test_ret += test_xmlTextWriterWriteFormatCDATA();
36997 test_ret += test_xmlTextWriterWriteFormatComment();
36998 test_ret += test_xmlTextWriterWriteFormatDTD();
36999 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
37000 test_ret += test_xmlTextWriterWriteFormatDTDElement();
37001 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
37002 test_ret += test_xmlTextWriterWriteFormatElement();
37003 test_ret += test_xmlTextWriterWriteFormatElementNS();
37004 test_ret += test_xmlTextWriterWriteFormatPI();
37005 test_ret += test_xmlTextWriterWriteFormatRaw();
37006 test_ret += test_xmlTextWriterWriteFormatString();
37007 test_ret += test_xmlTextWriterWritePI();
37008 test_ret += test_xmlTextWriterWriteRaw();
37009 test_ret += test_xmlTextWriterWriteRawLen();
37010 test_ret += test_xmlTextWriterWriteString();
37011 test_ret += test_xmlTextWriterWriteVFormatAttribute();
37012 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
37013 test_ret += test_xmlTextWriterWriteVFormatCDATA();
37014 test_ret += test_xmlTextWriterWriteVFormatComment();
37015 test_ret += test_xmlTextWriterWriteVFormatDTD();
37016 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
37017 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
37018 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
37019 test_ret += test_xmlTextWriterWriteVFormatElement();
37020 test_ret += test_xmlTextWriterWriteVFormatElementNS();
37021 test_ret += test_xmlTextWriterWriteVFormatPI();
37022 test_ret += test_xmlTextWriterWriteVFormatRaw();
37023 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000037024
Daniel Veillard42595322004-11-08 10:52:06 +000037025 if (test_ret != 0)
37026 printf("Module xmlwriter: %d errors\n", test_ret);
37027 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037028}
37029
37030static int
37031test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037032 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037033
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000037034#ifdef LIBXML_XPATH_ENABLED
37035 int mem_base;
37036 double ret_val;
37037 int val; /* a boolean */
37038 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037039
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000037040 for (n_val = 0;n_val < gen_nb_int;n_val++) {
37041 mem_base = xmlMemBlocks();
37042 val = gen_int(n_val, 0);
37043
37044 ret_val = xmlXPathCastBooleanToNumber(val);
37045 desret_double(ret_val);
37046 call_tests++;
37047 des_int(n_val, val, 0);
37048 xmlResetLastError();
37049 if (mem_base != xmlMemBlocks()) {
37050 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
37051 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037052 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000037053 printf(" %d", n_val);
37054 printf("\n");
37055 }
37056 }
37057#endif
37058
37059 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037061}
37062
37063
37064static int
37065test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037067
Daniel Veillard8a32fe42004-11-02 22:10:16 +000037068#ifdef LIBXML_XPATH_ENABLED
37069 int mem_base;
37070 xmlChar * ret_val;
37071 int val; /* a boolean */
37072 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037073
Daniel Veillard8a32fe42004-11-02 22:10:16 +000037074 for (n_val = 0;n_val < gen_nb_int;n_val++) {
37075 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000037076 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000037077
37078 ret_val = xmlXPathCastBooleanToString(val);
37079 desret_xmlChar_ptr(ret_val);
37080 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000037081 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000037082 xmlResetLastError();
37083 if (mem_base != xmlMemBlocks()) {
37084 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
37085 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037086 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000037087 printf(" %d", n_val);
37088 printf("\n");
37089 }
37090 }
37091#endif
37092
Daniel Veillard3d97e662004-11-04 10:49:00 +000037093 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037095}
37096
37097
Daniel Veillardce682bc2004-11-05 17:22:25 +000037098#define gen_nb_xmlNodeSetPtr 1
37099static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
37100 return(NULL);
37101}
37102static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
37103}
37104
Daniel Veillardd93f6252004-11-02 15:53:51 +000037105static int
37106test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037108
Daniel Veillardce682bc2004-11-05 17:22:25 +000037109#ifdef LIBXML_XPATH_ENABLED
37110 int mem_base;
37111 int ret_val;
37112 xmlNodeSetPtr ns; /* a node-set */
37113 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037114
Daniel Veillardce682bc2004-11-05 17:22:25 +000037115 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
37116 mem_base = xmlMemBlocks();
37117 ns = gen_xmlNodeSetPtr(n_ns, 0);
37118
37119 ret_val = xmlXPathCastNodeSetToBoolean(ns);
37120 desret_int(ret_val);
37121 call_tests++;
37122 des_xmlNodeSetPtr(n_ns, ns, 0);
37123 xmlResetLastError();
37124 if (mem_base != xmlMemBlocks()) {
37125 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
37126 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037127 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000037128 printf(" %d", n_ns);
37129 printf("\n");
37130 }
37131 }
37132#endif
37133
37134 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037135 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037136}
37137
37138
37139static int
37140test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037141 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037142
Daniel Veillardce682bc2004-11-05 17:22:25 +000037143#ifdef LIBXML_XPATH_ENABLED
37144 int mem_base;
37145 double ret_val;
37146 xmlNodeSetPtr ns; /* a node-set */
37147 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037148
Daniel Veillardce682bc2004-11-05 17:22:25 +000037149 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
37150 mem_base = xmlMemBlocks();
37151 ns = gen_xmlNodeSetPtr(n_ns, 0);
37152
37153 ret_val = xmlXPathCastNodeSetToNumber(ns);
37154 desret_double(ret_val);
37155 call_tests++;
37156 des_xmlNodeSetPtr(n_ns, ns, 0);
37157 xmlResetLastError();
37158 if (mem_base != xmlMemBlocks()) {
37159 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
37160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037161 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000037162 printf(" %d", n_ns);
37163 printf("\n");
37164 }
37165 }
37166#endif
37167
37168 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037170}
37171
37172
37173static int
37174test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037176
Daniel Veillardce682bc2004-11-05 17:22:25 +000037177#ifdef LIBXML_XPATH_ENABLED
37178 int mem_base;
37179 xmlChar * ret_val;
37180 xmlNodeSetPtr ns; /* a node-set */
37181 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037182
Daniel Veillardce682bc2004-11-05 17:22:25 +000037183 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
37184 mem_base = xmlMemBlocks();
37185 ns = gen_xmlNodeSetPtr(n_ns, 0);
37186
37187 ret_val = xmlXPathCastNodeSetToString(ns);
37188 desret_xmlChar_ptr(ret_val);
37189 call_tests++;
37190 des_xmlNodeSetPtr(n_ns, ns, 0);
37191 xmlResetLastError();
37192 if (mem_base != xmlMemBlocks()) {
37193 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
37194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037195 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000037196 printf(" %d", n_ns);
37197 printf("\n");
37198 }
37199 }
37200#endif
37201
37202 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037204}
37205
37206
37207static int
37208test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037210
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000037211#ifdef LIBXML_XPATH_ENABLED
37212 int mem_base;
37213 double ret_val;
37214 xmlNodePtr node; /* a node */
37215 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037216
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000037217 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
37218 mem_base = xmlMemBlocks();
37219 node = gen_xmlNodePtr(n_node, 0);
37220
37221 ret_val = xmlXPathCastNodeToNumber(node);
37222 desret_double(ret_val);
37223 call_tests++;
37224 des_xmlNodePtr(n_node, node, 0);
37225 xmlResetLastError();
37226 if (mem_base != xmlMemBlocks()) {
37227 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
37228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037229 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000037230 printf(" %d", n_node);
37231 printf("\n");
37232 }
37233 }
37234#endif
37235
37236 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037238}
37239
37240
37241static int
37242test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037244
Daniel Veillard8a32fe42004-11-02 22:10:16 +000037245#ifdef LIBXML_XPATH_ENABLED
37246 int mem_base;
37247 xmlChar * ret_val;
37248 xmlNodePtr node; /* a node */
37249 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037250
Daniel Veillard8a32fe42004-11-02 22:10:16 +000037251 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
37252 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000037253 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000037254
37255 ret_val = xmlXPathCastNodeToString(node);
37256 desret_xmlChar_ptr(ret_val);
37257 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000037258 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000037259 xmlResetLastError();
37260 if (mem_base != xmlMemBlocks()) {
37261 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
37262 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037263 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000037264 printf(" %d", n_node);
37265 printf("\n");
37266 }
37267 }
37268#endif
37269
Daniel Veillard3d97e662004-11-04 10:49:00 +000037270 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037272}
37273
37274
37275static int
37276test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037277 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037278
Daniel Veillard3d95c732004-11-06 22:25:14 +000037279#ifdef LIBXML_XPATH_ENABLED
37280 int mem_base;
37281 int ret_val;
37282 double val; /* a number */
37283 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037284
Daniel Veillard3d95c732004-11-06 22:25:14 +000037285 for (n_val = 0;n_val < gen_nb_double;n_val++) {
37286 mem_base = xmlMemBlocks();
37287 val = gen_double(n_val, 0);
37288
37289 ret_val = xmlXPathCastNumberToBoolean(val);
37290 desret_int(ret_val);
37291 call_tests++;
37292 des_double(n_val, val, 0);
37293 xmlResetLastError();
37294 if (mem_base != xmlMemBlocks()) {
37295 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
37296 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037297 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000037298 printf(" %d", n_val);
37299 printf("\n");
37300 }
37301 }
37302#endif
37303
37304 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037305 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037306}
37307
37308
37309static int
37310test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037311 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037312
Daniel Veillard3d95c732004-11-06 22:25:14 +000037313#ifdef LIBXML_XPATH_ENABLED
37314 int mem_base;
37315 xmlChar * ret_val;
37316 double val; /* a number */
37317 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037318
Daniel Veillard3d95c732004-11-06 22:25:14 +000037319 for (n_val = 0;n_val < gen_nb_double;n_val++) {
37320 mem_base = xmlMemBlocks();
37321 val = gen_double(n_val, 0);
37322
37323 ret_val = xmlXPathCastNumberToString(val);
37324 desret_xmlChar_ptr(ret_val);
37325 call_tests++;
37326 des_double(n_val, val, 0);
37327 xmlResetLastError();
37328 if (mem_base != xmlMemBlocks()) {
37329 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
37330 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037331 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000037332 printf(" %d", n_val);
37333 printf("\n");
37334 }
37335 }
37336#endif
37337
37338 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037339 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037340}
37341
37342
37343static int
37344test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037345 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037346
37347#ifdef LIBXML_XPATH_ENABLED
37348 int mem_base;
37349 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000037350 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000037351 int n_val;
37352
37353 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
37354 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000037355 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037356
37357 ret_val = xmlXPathCastStringToBoolean(val);
37358 desret_int(ret_val);
37359 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000037360 des_const_xmlChar_ptr(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037361 xmlResetLastError();
37362 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000037363 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000037364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037365 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000037366 printf(" %d", n_val);
37367 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000037368 }
37369 }
37370#endif
37371
Daniel Veillard3d97e662004-11-04 10:49:00 +000037372 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037374}
37375
37376
37377static int
37378test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037380
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000037381#ifdef LIBXML_XPATH_ENABLED
37382 int mem_base;
37383 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000037384 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000037385 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037386
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000037387 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
37388 mem_base = xmlMemBlocks();
37389 val = gen_const_xmlChar_ptr(n_val, 0);
37390
37391 ret_val = xmlXPathCastStringToNumber(val);
37392 desret_double(ret_val);
37393 call_tests++;
37394 des_const_xmlChar_ptr(n_val, val, 0);
37395 xmlResetLastError();
37396 if (mem_base != xmlMemBlocks()) {
37397 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
37398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037399 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000037400 printf(" %d", n_val);
37401 printf("\n");
37402 }
37403 }
37404#endif
37405
37406 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037407 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037408}
37409
37410
37411static int
37412test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037414
Daniel Veillardd005b9e2004-11-03 17:07:05 +000037415#ifdef LIBXML_XPATH_ENABLED
37416 int mem_base;
37417 int ret_val;
37418 xmlXPathObjectPtr val; /* an XPath object */
37419 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037420
Daniel Veillardd005b9e2004-11-03 17:07:05 +000037421 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
37422 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000037423 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000037424
37425 ret_val = xmlXPathCastToBoolean(val);
37426 desret_int(ret_val);
37427 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000037428 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000037429 xmlResetLastError();
37430 if (mem_base != xmlMemBlocks()) {
37431 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
37432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037433 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000037434 printf(" %d", n_val);
37435 printf("\n");
37436 }
37437 }
37438#endif
37439
Daniel Veillard3d97e662004-11-04 10:49:00 +000037440 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037441 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037442}
37443
37444
37445static int
37446test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037447 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037448
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000037449#ifdef LIBXML_XPATH_ENABLED
37450 int mem_base;
37451 double ret_val;
37452 xmlXPathObjectPtr val; /* an XPath object */
37453 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037454
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000037455 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
37456 mem_base = xmlMemBlocks();
37457 val = gen_xmlXPathObjectPtr(n_val, 0);
37458
37459 ret_val = xmlXPathCastToNumber(val);
37460 desret_double(ret_val);
37461 call_tests++;
37462 des_xmlXPathObjectPtr(n_val, val, 0);
37463 xmlResetLastError();
37464 if (mem_base != xmlMemBlocks()) {
37465 printf("Leak of %d blocks found in xmlXPathCastToNumber",
37466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037467 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000037468 printf(" %d", n_val);
37469 printf("\n");
37470 }
37471 }
37472#endif
37473
37474 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037475 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037476}
37477
37478
37479static int
37480test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037481 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037482
Daniel Veillardd005b9e2004-11-03 17:07:05 +000037483#ifdef LIBXML_XPATH_ENABLED
37484 int mem_base;
37485 xmlChar * ret_val;
37486 xmlXPathObjectPtr val; /* an XPath object */
37487 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037488
Daniel Veillardd005b9e2004-11-03 17:07:05 +000037489 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
37490 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000037491 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000037492
37493 ret_val = xmlXPathCastToString(val);
37494 desret_xmlChar_ptr(ret_val);
37495 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000037496 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000037497 xmlResetLastError();
37498 if (mem_base != xmlMemBlocks()) {
37499 printf("Leak of %d blocks found in xmlXPathCastToString",
37500 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037501 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000037502 printf(" %d", n_val);
37503 printf("\n");
37504 }
37505 }
37506#endif
37507
Daniel Veillard3d97e662004-11-04 10:49:00 +000037508 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037510}
37511
37512
37513static int
37514test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037515 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037516
37517#ifdef LIBXML_XPATH_ENABLED
37518 int mem_base;
37519 int ret_val;
37520 xmlNodePtr node1; /* the first node */
37521 int n_node1;
37522 xmlNodePtr node2; /* the second node */
37523 int n_node2;
37524
37525 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
37526 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
37527 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000037528 node1 = gen_xmlNodePtr(n_node1, 0);
37529 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037530
37531 ret_val = xmlXPathCmpNodes(node1, node2);
37532 desret_int(ret_val);
37533 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000037534 des_xmlNodePtr(n_node1, node1, 0);
37535 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037536 xmlResetLastError();
37537 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000037538 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000037539 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037540 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000037541 printf(" %d", n_node1);
37542 printf(" %d", n_node2);
37543 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000037544 }
37545 }
37546 }
37547#endif
37548
Daniel Veillard3d97e662004-11-04 10:49:00 +000037549 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037551}
37552
37553
37554static int
37555test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037557
37558
37559 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000037560 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037561}
37562
37563
Daniel Veillardce682bc2004-11-05 17:22:25 +000037564#define gen_nb_xmlXPathCompExprPtr 1
37565static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
37566 return(NULL);
37567}
37568static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
37569}
37570
37571#define gen_nb_xmlXPathContextPtr 1
37572static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
37573 return(NULL);
37574}
37575static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
37576}
37577
Daniel Veillardd93f6252004-11-02 15:53:51 +000037578static int
37579test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037580 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037581
Daniel Veillardce682bc2004-11-05 17:22:25 +000037582#ifdef LIBXML_XPATH_ENABLED
37583 int mem_base;
37584 xmlXPathObjectPtr ret_val;
37585 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
37586 int n_comp;
37587 xmlXPathContextPtr ctx; /* the XPath context */
37588 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037589
Daniel Veillardce682bc2004-11-05 17:22:25 +000037590 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
37591 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
37592 mem_base = xmlMemBlocks();
37593 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
37594 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
37595
37596 ret_val = xmlXPathCompiledEval(comp, ctx);
37597 desret_xmlXPathObjectPtr(ret_val);
37598 call_tests++;
37599 des_xmlXPathCompExprPtr(n_comp, comp, 0);
37600 des_xmlXPathContextPtr(n_ctx, ctx, 1);
37601 xmlResetLastError();
37602 if (mem_base != xmlMemBlocks()) {
37603 printf("Leak of %d blocks found in xmlXPathCompiledEval",
37604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037605 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000037606 printf(" %d", n_comp);
37607 printf(" %d", n_ctx);
37608 printf("\n");
37609 }
37610 }
37611 }
37612#endif
37613
37614 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037615 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037616}
37617
37618
37619static int
37620test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037621 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037622
Daniel Veillard3d97e662004-11-04 10:49:00 +000037623#ifdef LIBXML_XPATH_ENABLED
37624 int mem_base;
37625 xmlXPathObjectPtr ret_val;
37626 xmlXPathObjectPtr val; /* an XPath object */
37627 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037628
Daniel Veillard3d97e662004-11-04 10:49:00 +000037629 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
37630 mem_base = xmlMemBlocks();
37631 val = gen_xmlXPathObjectPtr(n_val, 0);
37632
37633 ret_val = xmlXPathConvertBoolean(val);
37634 val = NULL;
37635 desret_xmlXPathObjectPtr(ret_val);
37636 call_tests++;
37637 des_xmlXPathObjectPtr(n_val, val, 0);
37638 xmlResetLastError();
37639 if (mem_base != xmlMemBlocks()) {
37640 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
37641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037642 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000037643 printf(" %d", n_val);
37644 printf("\n");
37645 }
37646 }
37647#endif
37648
37649 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037651}
37652
37653
37654static int
37655test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037657
Daniel Veillard3d97e662004-11-04 10:49:00 +000037658#ifdef LIBXML_XPATH_ENABLED
37659 int mem_base;
37660 xmlXPathObjectPtr ret_val;
37661 xmlXPathObjectPtr val; /* an XPath object */
37662 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037663
Daniel Veillard3d97e662004-11-04 10:49:00 +000037664 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
37665 mem_base = xmlMemBlocks();
37666 val = gen_xmlXPathObjectPtr(n_val, 0);
37667
37668 ret_val = xmlXPathConvertNumber(val);
37669 val = NULL;
37670 desret_xmlXPathObjectPtr(ret_val);
37671 call_tests++;
37672 des_xmlXPathObjectPtr(n_val, val, 0);
37673 xmlResetLastError();
37674 if (mem_base != xmlMemBlocks()) {
37675 printf("Leak of %d blocks found in xmlXPathConvertNumber",
37676 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037677 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000037678 printf(" %d", n_val);
37679 printf("\n");
37680 }
37681 }
37682#endif
37683
37684 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037686}
37687
37688
37689static int
37690test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037692
Daniel Veillard3d97e662004-11-04 10:49:00 +000037693#ifdef LIBXML_XPATH_ENABLED
37694 int mem_base;
37695 xmlXPathObjectPtr ret_val;
37696 xmlXPathObjectPtr val; /* an XPath object */
37697 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037698
Daniel Veillard3d97e662004-11-04 10:49:00 +000037699 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
37700 mem_base = xmlMemBlocks();
37701 val = gen_xmlXPathObjectPtr(n_val, 0);
37702
37703 ret_val = xmlXPathConvertString(val);
37704 val = NULL;
37705 desret_xmlXPathObjectPtr(ret_val);
37706 call_tests++;
37707 des_xmlXPathObjectPtr(n_val, val, 0);
37708 xmlResetLastError();
37709 if (mem_base != xmlMemBlocks()) {
37710 printf("Leak of %d blocks found in xmlXPathConvertString",
37711 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037712 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000037713 printf(" %d", n_val);
37714 printf("\n");
37715 }
37716 }
37717#endif
37718
37719 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037720 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037721}
37722
37723
37724static int
37725test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037726 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037727
37728
37729 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000037730 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037731}
37732
37733
37734static int
37735test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037736 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037737
Daniel Veillardce682bc2004-11-05 17:22:25 +000037738#ifdef LIBXML_XPATH_ENABLED
37739 int mem_base;
37740 xmlXPathObjectPtr ret_val;
37741 xmlChar * str; /* the XPath expression */
37742 int n_str;
37743 xmlXPathContextPtr ctx; /* the XPath context */
37744 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037745
Daniel Veillardce682bc2004-11-05 17:22:25 +000037746 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
37747 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
37748 mem_base = xmlMemBlocks();
37749 str = gen_const_xmlChar_ptr(n_str, 0);
37750 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
37751
37752 ret_val = xmlXPathEval(str, ctx);
37753 desret_xmlXPathObjectPtr(ret_val);
37754 call_tests++;
37755 des_const_xmlChar_ptr(n_str, str, 0);
37756 des_xmlXPathContextPtr(n_ctx, ctx, 1);
37757 xmlResetLastError();
37758 if (mem_base != xmlMemBlocks()) {
37759 printf("Leak of %d blocks found in xmlXPathEval",
37760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037761 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000037762 printf(" %d", n_str);
37763 printf(" %d", n_ctx);
37764 printf("\n");
37765 }
37766 }
37767 }
37768#endif
37769
37770 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037771 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037772}
37773
37774
37775static int
37776test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037777 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037778
Daniel Veillardce682bc2004-11-05 17:22:25 +000037779#ifdef LIBXML_XPATH_ENABLED
37780 int mem_base;
37781 xmlXPathObjectPtr ret_val;
37782 xmlChar * str; /* the XPath expression */
37783 int n_str;
37784 xmlXPathContextPtr ctxt; /* the XPath context */
37785 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037786
Daniel Veillardce682bc2004-11-05 17:22:25 +000037787 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
37788 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
37789 mem_base = xmlMemBlocks();
37790 str = gen_const_xmlChar_ptr(n_str, 0);
37791 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
37792
37793 ret_val = xmlXPathEvalExpression(str, ctxt);
37794 desret_xmlXPathObjectPtr(ret_val);
37795 call_tests++;
37796 des_const_xmlChar_ptr(n_str, str, 0);
37797 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
37798 xmlResetLastError();
37799 if (mem_base != xmlMemBlocks()) {
37800 printf("Leak of %d blocks found in xmlXPathEvalExpression",
37801 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037802 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000037803 printf(" %d", n_str);
37804 printf(" %d", n_ctxt);
37805 printf("\n");
37806 }
37807 }
37808 }
37809#endif
37810
37811 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037813}
37814
37815
37816static int
37817test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037819
Daniel Veillardce682bc2004-11-05 17:22:25 +000037820#ifdef LIBXML_XPATH_ENABLED
37821 int mem_base;
37822 int ret_val;
37823 xmlXPathContextPtr ctxt; /* the XPath context */
37824 int n_ctxt;
37825 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
37826 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037827
Daniel Veillardce682bc2004-11-05 17:22:25 +000037828 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
37829 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
37830 mem_base = xmlMemBlocks();
37831 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
37832 res = gen_xmlXPathObjectPtr(n_res, 1);
37833
37834 ret_val = xmlXPathEvalPredicate(ctxt, res);
37835 desret_int(ret_val);
37836 call_tests++;
37837 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
37838 des_xmlXPathObjectPtr(n_res, res, 1);
37839 xmlResetLastError();
37840 if (mem_base != xmlMemBlocks()) {
37841 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
37842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037843 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000037844 printf(" %d", n_ctxt);
37845 printf(" %d", n_res);
37846 printf("\n");
37847 }
37848 }
37849 }
37850#endif
37851
37852 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037853 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037854}
37855
37856
37857static int
37858test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037859 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037860
37861#ifdef LIBXML_XPATH_ENABLED
37862 int mem_base;
37863
37864 mem_base = xmlMemBlocks();
37865
37866 xmlXPathInit();
37867 call_tests++;
37868 xmlResetLastError();
37869 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000037870 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000037871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037872 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000037873 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000037874 }
37875#endif
37876
Daniel Veillard3d97e662004-11-04 10:49:00 +000037877 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037879}
37880
37881
37882static int
37883test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037885
Daniel Veillard3d95c732004-11-06 22:25:14 +000037886#ifdef LIBXML_XPATH_ENABLED
37887 int mem_base;
37888 int ret_val;
37889 double val; /* a double value */
37890 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037891
Daniel Veillard3d95c732004-11-06 22:25:14 +000037892 for (n_val = 0;n_val < gen_nb_double;n_val++) {
37893 mem_base = xmlMemBlocks();
37894 val = gen_double(n_val, 0);
37895
37896 ret_val = xmlXPathIsInf(val);
37897 desret_int(ret_val);
37898 call_tests++;
37899 des_double(n_val, val, 0);
37900 xmlResetLastError();
37901 if (mem_base != xmlMemBlocks()) {
37902 printf("Leak of %d blocks found in xmlXPathIsInf",
37903 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037904 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000037905 printf(" %d", n_val);
37906 printf("\n");
37907 }
37908 }
37909#endif
37910
37911 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037913}
37914
37915
37916static int
37917test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037919
Daniel Veillard3d95c732004-11-06 22:25:14 +000037920#ifdef LIBXML_XPATH_ENABLED
37921 int mem_base;
37922 int ret_val;
37923 double val; /* a double value */
37924 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037925
Daniel Veillard3d95c732004-11-06 22:25:14 +000037926 for (n_val = 0;n_val < gen_nb_double;n_val++) {
37927 mem_base = xmlMemBlocks();
37928 val = gen_double(n_val, 0);
37929
37930 ret_val = xmlXPathIsNaN(val);
37931 desret_int(ret_val);
37932 call_tests++;
37933 des_double(n_val, val, 0);
37934 xmlResetLastError();
37935 if (mem_base != xmlMemBlocks()) {
37936 printf("Leak of %d blocks found in xmlXPathIsNaN",
37937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037938 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000037939 printf(" %d", n_val);
37940 printf("\n");
37941 }
37942 }
37943#endif
37944
37945 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037947}
37948
37949
37950static int
37951test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037952 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037953
37954
37955 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000037956 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037957}
37958
37959
37960static int
37961test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037962 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037963
37964
37965 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000037966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000037967}
37968
37969
37970static int
37971test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037973
Daniel Veillard3d97e662004-11-04 10:49:00 +000037974#ifdef LIBXML_XPATH_ENABLED
37975 int mem_base;
37976 xmlXPathObjectPtr ret_val;
37977 xmlXPathObjectPtr val; /* the original object */
37978 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000037979
Daniel Veillard3d97e662004-11-04 10:49:00 +000037980 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
37981 mem_base = xmlMemBlocks();
37982 val = gen_xmlXPathObjectPtr(n_val, 0);
37983
37984 ret_val = xmlXPathObjectCopy(val);
37985 desret_xmlXPathObjectPtr(ret_val);
37986 call_tests++;
37987 des_xmlXPathObjectPtr(n_val, val, 0);
37988 xmlResetLastError();
37989 if (mem_base != xmlMemBlocks()) {
37990 printf("Leak of %d blocks found in xmlXPathObjectCopy",
37991 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037992 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000037993 printf(" %d", n_val);
37994 printf("\n");
37995 }
37996 }
37997#endif
37998
37999 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038000 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038001}
38002
38003
38004static int
38005test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038006 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038007
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000038008#ifdef LIBXML_XPATH_ENABLED
38009 int mem_base;
38010 long ret_val;
38011 xmlDocPtr doc; /* an input document */
38012 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038013
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000038014 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
38015 mem_base = xmlMemBlocks();
38016 doc = gen_xmlDocPtr(n_doc, 0);
38017
38018 ret_val = xmlXPathOrderDocElems(doc);
38019 desret_long(ret_val);
38020 call_tests++;
38021 des_xmlDocPtr(n_doc, doc, 0);
38022 xmlResetLastError();
38023 if (mem_base != xmlMemBlocks()) {
38024 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
38025 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038026 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000038027 printf(" %d", n_doc);
38028 printf("\n");
38029 }
38030 }
38031#endif
38032
38033 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038035}
38036
38037static int
38038test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038040
Daniel Veillard3d95c732004-11-06 22:25:14 +000038041 printf("Testing xpath : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000038042 test_ret += test_xmlXPathCastBooleanToNumber();
38043 test_ret += test_xmlXPathCastBooleanToString();
38044 test_ret += test_xmlXPathCastNodeSetToBoolean();
38045 test_ret += test_xmlXPathCastNodeSetToNumber();
38046 test_ret += test_xmlXPathCastNodeSetToString();
38047 test_ret += test_xmlXPathCastNodeToNumber();
38048 test_ret += test_xmlXPathCastNodeToString();
38049 test_ret += test_xmlXPathCastNumberToBoolean();
38050 test_ret += test_xmlXPathCastNumberToString();
38051 test_ret += test_xmlXPathCastStringToBoolean();
38052 test_ret += test_xmlXPathCastStringToNumber();
38053 test_ret += test_xmlXPathCastToBoolean();
38054 test_ret += test_xmlXPathCastToNumber();
38055 test_ret += test_xmlXPathCastToString();
38056 test_ret += test_xmlXPathCmpNodes();
38057 test_ret += test_xmlXPathCompile();
38058 test_ret += test_xmlXPathCompiledEval();
38059 test_ret += test_xmlXPathConvertBoolean();
38060 test_ret += test_xmlXPathConvertNumber();
38061 test_ret += test_xmlXPathConvertString();
38062 test_ret += test_xmlXPathCtxtCompile();
38063 test_ret += test_xmlXPathEval();
38064 test_ret += test_xmlXPathEvalExpression();
38065 test_ret += test_xmlXPathEvalPredicate();
38066 test_ret += test_xmlXPathInit();
38067 test_ret += test_xmlXPathIsInf();
38068 test_ret += test_xmlXPathIsNaN();
38069 test_ret += test_xmlXPathNewContext();
38070 test_ret += test_xmlXPathNodeSetCreate();
38071 test_ret += test_xmlXPathObjectCopy();
38072 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000038073
Daniel Veillard42595322004-11-08 10:52:06 +000038074 if (test_ret != 0)
38075 printf("Module xpath: %d errors\n", test_ret);
38076 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038077}
38078
38079static int
38080test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038081 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038082
Daniel Veillardd005b9e2004-11-03 17:07:05 +000038083#ifdef LIBXML_XPTR_ENABLED
38084 int mem_base;
38085 xmlNodePtr ret_val;
38086 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
38087 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038088
Daniel Veillardd005b9e2004-11-03 17:07:05 +000038089 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
38090 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000038091 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000038092
38093 ret_val = xmlXPtrBuildNodeList(obj);
38094 desret_xmlNodePtr(ret_val);
38095 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000038096 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000038097 xmlResetLastError();
38098 if (mem_base != xmlMemBlocks()) {
38099 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
38100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038101 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000038102 printf(" %d", n_obj);
38103 printf("\n");
38104 }
38105 }
38106#endif
38107
Daniel Veillard3d97e662004-11-04 10:49:00 +000038108 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038109 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038110}
38111
38112
38113static int
38114test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038115 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038116
Daniel Veillardce682bc2004-11-05 17:22:25 +000038117#ifdef LIBXML_XPTR_ENABLED
38118 int mem_base;
38119 xmlXPathObjectPtr ret_val;
38120 xmlChar * str; /* the XPointer expression */
38121 int n_str;
38122 xmlXPathContextPtr ctx; /* the XPointer context */
38123 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038124
Daniel Veillardce682bc2004-11-05 17:22:25 +000038125 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
38126 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
38127 mem_base = xmlMemBlocks();
38128 str = gen_const_xmlChar_ptr(n_str, 0);
38129 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
38130
38131 ret_val = xmlXPtrEval(str, ctx);
38132 desret_xmlXPathObjectPtr(ret_val);
38133 call_tests++;
38134 des_const_xmlChar_ptr(n_str, str, 0);
38135 des_xmlXPathContextPtr(n_ctx, ctx, 1);
38136 xmlResetLastError();
38137 if (mem_base != xmlMemBlocks()) {
38138 printf("Leak of %d blocks found in xmlXPtrEval",
38139 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038140 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000038141 printf(" %d", n_str);
38142 printf(" %d", n_ctx);
38143 printf("\n");
38144 }
38145 }
38146 }
38147#endif
38148
38149 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038151}
38152
38153
Daniel Veillardce682bc2004-11-05 17:22:25 +000038154#define gen_nb_xmlXPathParserContextPtr 1
38155static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
38156 return(NULL);
38157}
38158static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
38159}
38160
Daniel Veillardd93f6252004-11-02 15:53:51 +000038161static int
38162test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038164
Daniel Veillardce682bc2004-11-05 17:22:25 +000038165#ifdef LIBXML_XPTR_ENABLED
38166 int mem_base;
38167 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
38168 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038169
Daniel Veillardce682bc2004-11-05 17:22:25 +000038170 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
38171 mem_base = xmlMemBlocks();
38172 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
38173
38174 xmlXPtrEvalRangePredicate(ctxt);
38175 call_tests++;
38176 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
38177 xmlResetLastError();
38178 if (mem_base != xmlMemBlocks()) {
38179 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
38180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038181 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000038182 printf(" %d", n_ctxt);
38183 printf("\n");
38184 }
38185 }
38186#endif
38187
38188 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038189 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038190}
38191
38192
Daniel Veillardce682bc2004-11-05 17:22:25 +000038193#define gen_nb_xmlLocationSetPtr 1
38194static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
38195 return(NULL);
38196}
38197static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
38198}
38199
Daniel Veillardd93f6252004-11-02 15:53:51 +000038200static int
38201test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038203
Daniel Veillardce682bc2004-11-05 17:22:25 +000038204#ifdef LIBXML_XPTR_ENABLED
38205 int mem_base;
38206 xmlLocationSetPtr cur; /* the initial range set */
38207 int n_cur;
38208 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
38209 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038210
Daniel Veillardce682bc2004-11-05 17:22:25 +000038211 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
38212 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
38213 mem_base = xmlMemBlocks();
38214 cur = gen_xmlLocationSetPtr(n_cur, 0);
38215 val = gen_xmlXPathObjectPtr(n_val, 1);
38216
38217 xmlXPtrLocationSetAdd(cur, val);
38218 call_tests++;
38219 des_xmlLocationSetPtr(n_cur, cur, 0);
38220 des_xmlXPathObjectPtr(n_val, val, 1);
38221 xmlResetLastError();
38222 if (mem_base != xmlMemBlocks()) {
38223 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
38224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038225 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000038226 printf(" %d", n_cur);
38227 printf(" %d", n_val);
38228 printf("\n");
38229 }
38230 }
38231 }
38232#endif
38233
38234 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038236}
38237
38238
38239static int
38240test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038242
38243
38244 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000038245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038246}
38247
38248
38249static int
38250test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038252
Daniel Veillardce682bc2004-11-05 17:22:25 +000038253#ifdef LIBXML_XPTR_ENABLED
38254 int mem_base;
38255 xmlLocationSetPtr cur; /* the initial range set */
38256 int n_cur;
38257 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
38258 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038259
Daniel Veillardce682bc2004-11-05 17:22:25 +000038260 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
38261 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
38262 mem_base = xmlMemBlocks();
38263 cur = gen_xmlLocationSetPtr(n_cur, 0);
38264 val = gen_xmlXPathObjectPtr(n_val, 1);
38265
38266 xmlXPtrLocationSetDel(cur, val);
38267 call_tests++;
38268 des_xmlLocationSetPtr(n_cur, cur, 0);
38269 des_xmlXPathObjectPtr(n_val, val, 1);
38270 xmlResetLastError();
38271 if (mem_base != xmlMemBlocks()) {
38272 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
38273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038274 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000038275 printf(" %d", n_cur);
38276 printf(" %d", n_val);
38277 printf("\n");
38278 }
38279 }
38280 }
38281#endif
38282
38283 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038284 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038285}
38286
38287
38288static int
38289test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038290 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038291
38292
38293 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000038294 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038295}
38296
38297
38298static int
38299test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038300 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038301
Daniel Veillardce682bc2004-11-05 17:22:25 +000038302#ifdef LIBXML_XPTR_ENABLED
38303 int mem_base;
38304 xmlLocationSetPtr cur; /* the initial range set */
38305 int n_cur;
38306 int val; /* the index to remove */
38307 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038308
Daniel Veillardce682bc2004-11-05 17:22:25 +000038309 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
38310 for (n_val = 0;n_val < gen_nb_int;n_val++) {
38311 mem_base = xmlMemBlocks();
38312 cur = gen_xmlLocationSetPtr(n_cur, 0);
38313 val = gen_int(n_val, 1);
38314
38315 xmlXPtrLocationSetRemove(cur, val);
38316 call_tests++;
38317 des_xmlLocationSetPtr(n_cur, cur, 0);
38318 des_int(n_val, val, 1);
38319 xmlResetLastError();
38320 if (mem_base != xmlMemBlocks()) {
38321 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
38322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038323 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000038324 printf(" %d", n_cur);
38325 printf(" %d", n_val);
38326 printf("\n");
38327 }
38328 }
38329 }
38330#endif
38331
38332 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038334}
38335
38336
38337static int
38338test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038340
Daniel Veillard3d97e662004-11-04 10:49:00 +000038341#ifdef LIBXML_XPTR_ENABLED
38342 int mem_base;
38343 xmlXPathObjectPtr ret_val;
38344 xmlNodePtr start; /* the starting and ending node */
38345 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038346
Daniel Veillard3d97e662004-11-04 10:49:00 +000038347 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
38348 mem_base = xmlMemBlocks();
38349 start = gen_xmlNodePtr(n_start, 0);
38350
38351 ret_val = xmlXPtrNewCollapsedRange(start);
38352 desret_xmlXPathObjectPtr(ret_val);
38353 call_tests++;
38354 des_xmlNodePtr(n_start, start, 0);
38355 xmlResetLastError();
38356 if (mem_base != xmlMemBlocks()) {
38357 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
38358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038359 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000038360 printf(" %d", n_start);
38361 printf("\n");
38362 }
38363 }
38364#endif
38365
38366 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038368}
38369
38370
38371static int
38372test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038373 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038374
38375
38376 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000038377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038378}
38379
38380
38381static int
38382test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038384
Daniel Veillardce682bc2004-11-05 17:22:25 +000038385#ifdef LIBXML_XPTR_ENABLED
38386 int mem_base;
38387 xmlXPathObjectPtr ret_val;
38388 xmlNodeSetPtr set; /* a node set */
38389 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038390
Daniel Veillardce682bc2004-11-05 17:22:25 +000038391 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
38392 mem_base = xmlMemBlocks();
38393 set = gen_xmlNodeSetPtr(n_set, 0);
38394
38395 ret_val = xmlXPtrNewLocationSetNodeSet(set);
38396 desret_xmlXPathObjectPtr(ret_val);
38397 call_tests++;
38398 des_xmlNodeSetPtr(n_set, set, 0);
38399 xmlResetLastError();
38400 if (mem_base != xmlMemBlocks()) {
38401 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
38402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038403 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000038404 printf(" %d", n_set);
38405 printf("\n");
38406 }
38407 }
38408#endif
38409
38410 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038412}
38413
38414
38415static int
38416test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038418
Daniel Veillard3d97e662004-11-04 10:49:00 +000038419#ifdef LIBXML_XPTR_ENABLED
38420 int mem_base;
38421 xmlXPathObjectPtr ret_val;
38422 xmlNodePtr start; /* the start NodePtr value */
38423 int n_start;
38424 xmlNodePtr end; /* the end NodePtr value or NULL */
38425 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038426
Daniel Veillard3d97e662004-11-04 10:49:00 +000038427 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
38428 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
38429 mem_base = xmlMemBlocks();
38430 start = gen_xmlNodePtr(n_start, 0);
38431 end = gen_xmlNodePtr(n_end, 1);
38432
38433 ret_val = xmlXPtrNewLocationSetNodes(start, end);
38434 desret_xmlXPathObjectPtr(ret_val);
38435 call_tests++;
38436 des_xmlNodePtr(n_start, start, 0);
38437 des_xmlNodePtr(n_end, end, 1);
38438 xmlResetLastError();
38439 if (mem_base != xmlMemBlocks()) {
38440 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
38441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038442 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000038443 printf(" %d", n_start);
38444 printf(" %d", n_end);
38445 printf("\n");
38446 }
38447 }
38448 }
38449#endif
38450
38451 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038453}
38454
38455
38456static int
38457test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038459
Daniel Veillard3d97e662004-11-04 10:49:00 +000038460#ifdef LIBXML_XPTR_ENABLED
38461 int mem_base;
38462 xmlXPathObjectPtr ret_val;
38463 xmlNodePtr start; /* the starting node */
38464 int n_start;
38465 int startindex; /* the start index */
38466 int n_startindex;
38467 xmlNodePtr end; /* the ending point */
38468 int n_end;
38469 int endindex; /* the ending index */
38470 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038471
Daniel Veillard3d97e662004-11-04 10:49:00 +000038472 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
38473 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
38474 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
38475 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
38476 mem_base = xmlMemBlocks();
38477 start = gen_xmlNodePtr(n_start, 0);
38478 startindex = gen_int(n_startindex, 1);
38479 end = gen_xmlNodePtr(n_end, 2);
38480 endindex = gen_int(n_endindex, 3);
38481
38482 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
38483 desret_xmlXPathObjectPtr(ret_val);
38484 call_tests++;
38485 des_xmlNodePtr(n_start, start, 0);
38486 des_int(n_startindex, startindex, 1);
38487 des_xmlNodePtr(n_end, end, 2);
38488 des_int(n_endindex, endindex, 3);
38489 xmlResetLastError();
38490 if (mem_base != xmlMemBlocks()) {
38491 printf("Leak of %d blocks found in xmlXPtrNewRange",
38492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038493 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000038494 printf(" %d", n_start);
38495 printf(" %d", n_startindex);
38496 printf(" %d", n_end);
38497 printf(" %d", n_endindex);
38498 printf("\n");
38499 }
38500 }
38501 }
38502 }
38503 }
38504#endif
38505
38506 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038508}
38509
38510
38511static int
38512test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038514
Daniel Veillard3d97e662004-11-04 10:49:00 +000038515#ifdef LIBXML_XPTR_ENABLED
38516 int mem_base;
38517 xmlXPathObjectPtr ret_val;
38518 xmlNodePtr start; /* the starting node */
38519 int n_start;
38520 xmlXPathObjectPtr end; /* the ending object */
38521 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038522
Daniel Veillard3d97e662004-11-04 10:49:00 +000038523 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
38524 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
38525 mem_base = xmlMemBlocks();
38526 start = gen_xmlNodePtr(n_start, 0);
38527 end = gen_xmlXPathObjectPtr(n_end, 1);
38528
38529 ret_val = xmlXPtrNewRangeNodeObject(start, end);
38530 desret_xmlXPathObjectPtr(ret_val);
38531 call_tests++;
38532 des_xmlNodePtr(n_start, start, 0);
38533 des_xmlXPathObjectPtr(n_end, end, 1);
38534 xmlResetLastError();
38535 if (mem_base != xmlMemBlocks()) {
38536 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
38537 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038538 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000038539 printf(" %d", n_start);
38540 printf(" %d", n_end);
38541 printf("\n");
38542 }
38543 }
38544 }
38545#endif
38546
38547 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038549}
38550
38551
38552static int
38553test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038555
Daniel Veillard3d97e662004-11-04 10:49:00 +000038556#ifdef LIBXML_XPTR_ENABLED
38557 int mem_base;
38558 xmlXPathObjectPtr ret_val;
38559 xmlNodePtr start; /* the starting node */
38560 int n_start;
38561 xmlXPathObjectPtr end; /* the ending point */
38562 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038563
Daniel Veillard3d97e662004-11-04 10:49:00 +000038564 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
38565 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
38566 mem_base = xmlMemBlocks();
38567 start = gen_xmlNodePtr(n_start, 0);
38568 end = gen_xmlXPathObjectPtr(n_end, 1);
38569
38570 ret_val = xmlXPtrNewRangeNodePoint(start, end);
38571 desret_xmlXPathObjectPtr(ret_val);
38572 call_tests++;
38573 des_xmlNodePtr(n_start, start, 0);
38574 des_xmlXPathObjectPtr(n_end, end, 1);
38575 xmlResetLastError();
38576 if (mem_base != xmlMemBlocks()) {
38577 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
38578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038579 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000038580 printf(" %d", n_start);
38581 printf(" %d", n_end);
38582 printf("\n");
38583 }
38584 }
38585 }
38586#endif
38587
38588 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038589 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038590}
38591
38592
38593static int
38594test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038596
Daniel Veillard3d97e662004-11-04 10:49:00 +000038597#ifdef LIBXML_XPTR_ENABLED
38598 int mem_base;
38599 xmlXPathObjectPtr ret_val;
38600 xmlNodePtr start; /* the starting node */
38601 int n_start;
38602 xmlNodePtr end; /* the ending node */
38603 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038604
Daniel Veillard3d97e662004-11-04 10:49:00 +000038605 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
38606 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
38607 mem_base = xmlMemBlocks();
38608 start = gen_xmlNodePtr(n_start, 0);
38609 end = gen_xmlNodePtr(n_end, 1);
38610
38611 ret_val = xmlXPtrNewRangeNodes(start, end);
38612 desret_xmlXPathObjectPtr(ret_val);
38613 call_tests++;
38614 des_xmlNodePtr(n_start, start, 0);
38615 des_xmlNodePtr(n_end, end, 1);
38616 xmlResetLastError();
38617 if (mem_base != xmlMemBlocks()) {
38618 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
38619 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038620 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000038621 printf(" %d", n_start);
38622 printf(" %d", n_end);
38623 printf("\n");
38624 }
38625 }
38626 }
38627#endif
38628
38629 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038631}
38632
38633
38634static int
38635test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038637
Daniel Veillard3d97e662004-11-04 10:49:00 +000038638#ifdef LIBXML_XPTR_ENABLED
38639 int mem_base;
38640 xmlXPathObjectPtr ret_val;
38641 xmlXPathObjectPtr start; /* the starting point */
38642 int n_start;
38643 xmlNodePtr end; /* the ending node */
38644 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038645
Daniel Veillard3d97e662004-11-04 10:49:00 +000038646 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
38647 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
38648 mem_base = xmlMemBlocks();
38649 start = gen_xmlXPathObjectPtr(n_start, 0);
38650 end = gen_xmlNodePtr(n_end, 1);
38651
38652 ret_val = xmlXPtrNewRangePointNode(start, end);
38653 desret_xmlXPathObjectPtr(ret_val);
38654 call_tests++;
38655 des_xmlXPathObjectPtr(n_start, start, 0);
38656 des_xmlNodePtr(n_end, end, 1);
38657 xmlResetLastError();
38658 if (mem_base != xmlMemBlocks()) {
38659 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
38660 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038661 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000038662 printf(" %d", n_start);
38663 printf(" %d", n_end);
38664 printf("\n");
38665 }
38666 }
38667 }
38668#endif
38669
38670 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038671 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038672}
38673
38674
38675static int
38676test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038677 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038678
Daniel Veillard3d97e662004-11-04 10:49:00 +000038679#ifdef LIBXML_XPTR_ENABLED
38680 int mem_base;
38681 xmlXPathObjectPtr ret_val;
38682 xmlXPathObjectPtr start; /* the starting point */
38683 int n_start;
38684 xmlXPathObjectPtr end; /* the ending point */
38685 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038686
Daniel Veillard3d97e662004-11-04 10:49:00 +000038687 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
38688 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
38689 mem_base = xmlMemBlocks();
38690 start = gen_xmlXPathObjectPtr(n_start, 0);
38691 end = gen_xmlXPathObjectPtr(n_end, 1);
38692
38693 ret_val = xmlXPtrNewRangePoints(start, end);
38694 desret_xmlXPathObjectPtr(ret_val);
38695 call_tests++;
38696 des_xmlXPathObjectPtr(n_start, start, 0);
38697 des_xmlXPathObjectPtr(n_end, end, 1);
38698 xmlResetLastError();
38699 if (mem_base != xmlMemBlocks()) {
38700 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
38701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038702 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000038703 printf(" %d", n_start);
38704 printf(" %d", n_end);
38705 printf("\n");
38706 }
38707 }
38708 }
38709#endif
38710
38711 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038713}
38714
38715
38716static int
38717test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038719
Daniel Veillardce682bc2004-11-05 17:22:25 +000038720#ifdef LIBXML_XPTR_ENABLED
38721 int mem_base;
38722 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
38723 int n_ctxt;
38724 int nargs; /* the number of args */
38725 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038726
Daniel Veillardce682bc2004-11-05 17:22:25 +000038727 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
38728 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
38729 mem_base = xmlMemBlocks();
38730 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
38731 nargs = gen_int(n_nargs, 1);
38732
38733 xmlXPtrRangeToFunction(ctxt, nargs);
38734 call_tests++;
38735 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
38736 des_int(n_nargs, nargs, 1);
38737 xmlResetLastError();
38738 if (mem_base != xmlMemBlocks()) {
38739 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
38740 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038741 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000038742 printf(" %d", n_ctxt);
38743 printf(" %d", n_nargs);
38744 printf("\n");
38745 }
38746 }
38747 }
38748#endif
38749
38750 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038751 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038752}
38753
38754
38755static int
38756test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038757 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038758
Daniel Veillardce682bc2004-11-05 17:22:25 +000038759#ifdef LIBXML_XPTR_ENABLED
38760 int mem_base;
38761 xmlXPathObjectPtr ret_val;
38762 xmlLocationSetPtr val; /* the LocationSet value */
38763 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038764
Daniel Veillardce682bc2004-11-05 17:22:25 +000038765 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
38766 mem_base = xmlMemBlocks();
38767 val = gen_xmlLocationSetPtr(n_val, 0);
38768
38769 ret_val = xmlXPtrWrapLocationSet(val);
38770 desret_xmlXPathObjectPtr(ret_val);
38771 call_tests++;
38772 des_xmlLocationSetPtr(n_val, val, 0);
38773 xmlResetLastError();
38774 if (mem_base != xmlMemBlocks()) {
38775 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
38776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038777 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000038778 printf(" %d", n_val);
38779 printf("\n");
38780 }
38781 }
38782#endif
38783
38784 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038785 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038786}
38787
38788static int
38789test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038790 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000038791
Daniel Veillardce682bc2004-11-05 17:22:25 +000038792 printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000038793 test_ret += test_xmlXPtrBuildNodeList();
38794 test_ret += test_xmlXPtrEval();
38795 test_ret += test_xmlXPtrEvalRangePredicate();
38796 test_ret += test_xmlXPtrLocationSetAdd();
38797 test_ret += test_xmlXPtrLocationSetCreate();
38798 test_ret += test_xmlXPtrLocationSetDel();
38799 test_ret += test_xmlXPtrLocationSetMerge();
38800 test_ret += test_xmlXPtrLocationSetRemove();
38801 test_ret += test_xmlXPtrNewCollapsedRange();
38802 test_ret += test_xmlXPtrNewContext();
38803 test_ret += test_xmlXPtrNewLocationSetNodeSet();
38804 test_ret += test_xmlXPtrNewLocationSetNodes();
38805 test_ret += test_xmlXPtrNewRange();
38806 test_ret += test_xmlXPtrNewRangeNodeObject();
38807 test_ret += test_xmlXPtrNewRangeNodePoint();
38808 test_ret += test_xmlXPtrNewRangeNodes();
38809 test_ret += test_xmlXPtrNewRangePointNode();
38810 test_ret += test_xmlXPtrNewRangePoints();
38811 test_ret += test_xmlXPtrRangeToFunction();
38812 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000038813
Daniel Veillard42595322004-11-08 10:52:06 +000038814 if (test_ret != 0)
38815 printf("Module xpointer: %d errors\n", test_ret);
38816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000038817}
Daniel Veillardce244ad2004-11-05 10:03:46 +000038818static int
38819test_module(const char *module) {
38820 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
38821 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
38822 if (!strcmp(module, "catalog")) return(test_catalog());
38823 if (!strcmp(module, "chvalid")) return(test_chvalid());
38824 if (!strcmp(module, "dict")) return(test_dict());
38825 if (!strcmp(module, "encoding")) return(test_encoding());
38826 if (!strcmp(module, "entities")) return(test_entities());
38827 if (!strcmp(module, "hash")) return(test_hash());
38828 if (!strcmp(module, "list")) return(test_list());
38829 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
38830 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
38831 if (!strcmp(module, "parser")) return(test_parser());
38832 if (!strcmp(module, "pattern")) return(test_pattern());
38833 if (!strcmp(module, "relaxng")) return(test_relaxng());
38834 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
38835 if (!strcmp(module, "tree")) return(test_tree());
38836 if (!strcmp(module, "uri")) return(test_uri());
38837 if (!strcmp(module, "valid")) return(test_valid());
38838 if (!strcmp(module, "xinclude")) return(test_xinclude());
38839 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
38840 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
38841 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
38842 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
38843 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
38844 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
38845 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038846 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000038847 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
38848 if (!strcmp(module, "xpath")) return(test_xpath());
38849 if (!strcmp(module, "xpointer")) return(test_xpointer());
38850 return(0);
38851}