blob: 22c845dd7206e0aafffc2c72d41148327f35c1ca [file] [log] [blame]
Daniel Veillardd93f6252004-11-02 15:53:51 +00001/*
2 * testapi.c: libxml2 API tester program.
3 *
4 * Automatically generated by gentest.py from libxml2-api.xml
5 *
6 * See Copyright for the status of this software.
7 *
8 * daniel@veillard.com
9 */
10
11#include <stdio.h>
Daniel Veillardce244ad2004-11-05 10:03:46 +000012#include <string.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000013#include <libxml/xmlerror.h>
Daniel Veillard3d97e662004-11-04 10:49:00 +000014#include <libxml/relaxng.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000015
16static int testlibxml2(void);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017static int test_module(const char *module);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018
19static int generic_errors = 0;
20static int call_tests = 0;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021static int function_tests = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022
Daniel Veillard5ea30d72004-11-08 11:54:28 +000023static xmlChar chartab[1024];
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000024static int inttab[1024];
25static unsigned long longtab[1024];
Daniel Veillardce244ad2004-11-05 10:03:46 +000026
27static xmlDocPtr api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000028static xmlDtdPtr api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000029static xmlNodePtr api_root = NULL;
30static xmlAttrPtr api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000031static xmlNsPtr api_ns = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032
Daniel Veillardd93f6252004-11-02 15:53:51 +000033static void
34structured_errors(void *userData ATTRIBUTE_UNUSED,
35 xmlErrorPtr error ATTRIBUTE_UNUSED) {
36 generic_errors++;
37}
38
Daniel Veillardce244ad2004-11-05 10:03:46 +000039static void
40free_api_doc(void) {
41 xmlFreeDoc(api_doc);
42 api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000043 api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000044 api_root = NULL;
45 api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000046 api_ns = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000047}
48
49static xmlDocPtr
50get_api_doc(void) {
51 if (api_doc == NULL) {
Daniel Veillard27f20102004-11-05 11:50:11 +000052 api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0);
Daniel Veillardce244ad2004-11-05 10:03:46 +000053 api_root = NULL;
54 api_attr = NULL;
55 }
56 return(api_doc);
57}
58
Daniel Veillard27f20102004-11-05 11:50:11 +000059static xmlDtdPtr
60get_api_dtd(void) {
61 if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) {
62 get_api_doc();
63 if ((api_doc != NULL) && (api_doc->children != NULL) &&
64 (api_doc->children->type == XML_DTD_NODE))
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000065 api_dtd = (xmlDtdPtr) api_doc->children;
Daniel Veillard27f20102004-11-05 11:50:11 +000066 }
67 return(api_dtd);
68}
69
Daniel Veillardce244ad2004-11-05 10:03:46 +000070static xmlNodePtr
71get_api_root(void) {
72 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
73 get_api_doc();
74 if ((api_doc != NULL) && (api_doc->children != NULL) &&
Daniel Veillard27f20102004-11-05 11:50:11 +000075 (api_doc->children->next != NULL) &&
76 (api_doc->children->next->type == XML_ELEMENT_NODE))
77 api_root = api_doc->children->next;
Daniel Veillardce244ad2004-11-05 10:03:46 +000078 }
79 return(api_root);
80}
81
Daniel Veillard27f20102004-11-05 11:50:11 +000082static xmlNsPtr
83get_api_ns(void) {
84 get_api_root();
85 if (api_root != NULL)
86 api_ns = api_root->nsDef;
87 return(api_ns);
88}
89
Daniel Veillardce244ad2004-11-05 10:03:46 +000090static xmlAttrPtr
91get_api_attr(void) {
Daniel Veillardc8311492004-11-08 16:51:13 +000092#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000093 static int nr = 0;
94 xmlChar name[20];
Daniel Veillardc8311492004-11-08 16:51:13 +000095#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000096
97 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
98 get_api_root();
99 }
100 if (api_root == NULL)
101 return(NULL);
102 if (api_root->properties != NULL) {
103 api_attr = api_root->properties;
104 return(api_root->properties);
105 }
Daniel Veillardc8311492004-11-08 16:51:13 +0000106 api_attr = NULL;
107#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +0000108 snprintf((char *) name, 20, "foo%d", nr++);
109 api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar");
Daniel Veillardc8311492004-11-08 16:51:13 +0000110#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +0000111 return(api_attr);
112}
113
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000114static int quiet = 0;
115
Daniel Veillardce244ad2004-11-05 10:03:46 +0000116int main(int argc, char **argv) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000117 int ret;
118 int blocks, mem;
119
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000120 memset(chartab, 0, sizeof(chartab));
Daniel Veillardc8311492004-11-08 16:51:13 +0000121 strncpy((char *) chartab, " chartab\n", 20);
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000122 memset(inttab, 0, sizeof(inttab));
123 memset(longtab, 0, sizeof(longtab));
124
Daniel Veillarda03e3652004-11-02 18:45:30 +0000125 xmlInitParser();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000126#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000127 xmlRelaxNGInitTypes();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000128#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +0000129
Daniel Veillardd93f6252004-11-02 15:53:51 +0000130 LIBXML_TEST_VERSION
131
132 xmlSetStructuredErrorFunc(NULL, structured_errors);
133
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000134 if (argc >= 2) {
135 if (!strcmp(argv[1], "-q")) {
136 quiet = 1;
137 if (argc >= 3)
138 ret = test_module(argv[2]);
139 else
140 ret = testlibxml2();
141 } else {
142 ret = test_module(argv[1]);
143 }
144 } else
Daniel Veillardce244ad2004-11-05 10:03:46 +0000145 ret = testlibxml2();
Daniel Veillardd93f6252004-11-02 15:53:51 +0000146
147 xmlCleanupParser();
148 blocks = xmlMemBlocks();
149 mem = xmlMemUsed();
150 if ((blocks != 0) || (mem != 0)) {
151 printf("testapi leaked %d bytes in %d blocks\n", mem, blocks);
152 }
153 xmlMemoryDump();
154
155 return (ret != 0);
156}
157
158#include <libxml/HTMLparser.h>
159#include <libxml/HTMLtree.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000160#include <libxml/catalog.h>
161#include <libxml/chvalid.h>
162#include <libxml/dict.h>
163#include <libxml/encoding.h>
164#include <libxml/entities.h>
165#include <libxml/hash.h>
166#include <libxml/list.h>
167#include <libxml/nanoftp.h>
168#include <libxml/nanohttp.h>
169#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +0000170#include <libxml/parserInternals.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000171#include <libxml/pattern.h>
172#include <libxml/relaxng.h>
173#include <libxml/schemasInternals.h>
174#include <libxml/tree.h>
175#include <libxml/uri.h>
176#include <libxml/valid.h>
177#include <libxml/xinclude.h>
178#include <libxml/xmlIO.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000179#include <libxml/xmlerror.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000180#include <libxml/xmlreader.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000181#include <libxml/xmlsave.h>
182#include <libxml/xmlschemas.h>
183#include <libxml/xmlschemastypes.h>
184#include <libxml/xmlstring.h>
185#include <libxml/xmlwriter.h>
186#include <libxml/xpath.h>
187#include <libxml/xpointer.h>
Daniel Veillarda521d282004-11-09 14:59:59 +0000188#include <libxml/debugXML.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000189
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000190#define gen_nb_void_ptr 2
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000191
Daniel Veillard3d97e662004-11-04 10:49:00 +0000192static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000193 return(NULL);
194}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000195static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000196}
197
Daniel Veillardce244ad2004-11-05 10:03:46 +0000198#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000199#define gen_nb_const_void_ptr 2
200
201static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) {
202 if (no == 0) return((const void *) "immutable string");
203 return(NULL);
204}
205static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
206}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000207#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000208
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000209#define gen_nb_userdata 3
210
Daniel Veillard3d97e662004-11-04 10:49:00 +0000211static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000212 if (no == 0) return((void *) &call_tests);
213 if (no == 1) return((void *) -1);
214 return(NULL);
215}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000216static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000217}
218
219
Daniel Veillardd93f6252004-11-02 15:53:51 +0000220#define gen_nb_int 4
221
Daniel Veillard3d97e662004-11-04 10:49:00 +0000222static int gen_int(int no, int nr ATTRIBUTE_UNUSED) {
223 if (no == 0) return(0);
224 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000225 if (no == 2) return(-1);
226 if (no == 3) return(122);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000227 return(-1);
228}
229
230static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
231}
232
Daniel Veillard6128c012004-11-08 17:16:15 +0000233#define gen_nb_parseroptions 5
234
235static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) {
236 if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER);
237 if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA);
238 if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN);
239 if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT);
240 return(XML_PARSE_SAX1);
241}
242
243static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
244}
245
Daniel Veillardce244ad2004-11-05 10:03:46 +0000246#if 0
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000247#define gen_nb_long 5
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000248
249static long gen_long(int no, int nr ATTRIBUTE_UNUSED) {
250 if (no == 0) return(0);
251 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000252 if (no == 2) return(-1);
253 if (no == 3) return(122);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000254 return(-1);
255}
256
257static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
258}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000259#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000260
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000261#define gen_nb_xmlChar 4
262
263static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) {
264 if (no == 0) return('a');
265 if (no == 1) return(' ');
266 if (no == 2) return('ø');
267 return(0);
268}
269
270static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
271}
272
Daniel Veillard3d97e662004-11-04 10:49:00 +0000273#define gen_nb_unsigned_int 3
274
275static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000276 if (no == 0) return(0);
277 if (no == 1) return(1);
278 if (no == 2) return(122);
279 return(-1);
280}
281
Daniel Veillard3d97e662004-11-04 10:49:00 +0000282static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000283}
284
Daniel Veillard3d95c732004-11-06 22:25:14 +0000285#define gen_nb_unsigned_long 4
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000286
287static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
288 if (no == 0) return(0);
289 if (no == 1) return(1);
290 if (no == 2) return(122);
291 return(-1);
292}
293
294static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
295}
296
Daniel Veillard3d95c732004-11-06 22:25:14 +0000297#define gen_nb_double 4
298
299static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
300 if (no == 0) return(0);
301 if (no == 1) return(-1.1);
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000302#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +0000303 if (no == 2) return(xmlXPathNAN);
Daniel Veillardc8311492004-11-08 16:51:13 +0000304#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000305 return(-1);
306}
307
308static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
309}
310
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000311#define gen_nb_unsigned_long_ptr 2
312
313static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
314 if (no == 0) return(&longtab[nr]);
315 return(NULL);
316}
317
318static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
319}
320
321#define gen_nb_int_ptr 2
322
323static int *gen_int_ptr(int no, int nr) {
324 if (no == 0) return(&inttab[nr]);
325 return(NULL);
326}
327
328static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
329}
330
Daniel Veillardd93f6252004-11-02 15:53:51 +0000331#define gen_nb_const_char_ptr 4
332
Daniel Veillardce682bc2004-11-05 17:22:25 +0000333static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) {
334 if (no == 0) return((char *) "foo");
335 if (no == 1) return((char *) "<foo/>");
336 if (no == 2) return((char *) "test/ent2");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000337 return(NULL);
338}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000339static 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 +0000340}
341
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000342#define gen_nb_xmlChar_ptr 2
343
Daniel Veillard3d97e662004-11-04 10:49:00 +0000344static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000345 if (no == 0) return(&chartab[0]);
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000346 return(NULL);
347}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000348static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000349}
350
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000351#define gen_nb_FILE_ptr 2
352
353static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) {
354 if (no == 0) return(fopen("test.out", "a+"));
355 return(NULL);
356}
357static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
358 if (val != NULL) fclose(val);
359}
360
Daniel Veillarda82b1822004-11-08 16:24:57 +0000361#define gen_nb_debug_FILE_ptr 2
362static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
363 return(fopen("test.out", "a+"));
364}
365static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
366 if (val != NULL) fclose(val);
367}
368
Daniel Veillardd93f6252004-11-02 15:53:51 +0000369#define gen_nb_const_xmlChar_ptr 5
370
Daniel Veillardce682bc2004-11-05 17:22:25 +0000371static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
372 if (no == 0) return((xmlChar *) "foo");
373 if (no == 1) return((xmlChar *) "<foo/>");
374 if (no == 2) return((xmlChar *) "nøne");
375 if (no == 3) return((xmlChar *) " 2ab ");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000376 return(NULL);
377}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000378static 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 +0000379}
380
381#define gen_nb_filepath 8
382
Daniel Veillard3d97e662004-11-04 10:49:00 +0000383static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000384 if (no == 0) return("missing.xml");
385 if (no == 1) return("<foo/>");
386 if (no == 2) return("test/ent2");
387 if (no == 3) return("test/valid/REC-xml-19980210.xml");
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000388 if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000389 if (no == 5) return("http://missing.example.org/");
390 if (no == 6) return("http://missing. example.org/");
391 return(NULL);
392}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000393static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000394}
395
Daniel Veillard27f20102004-11-05 11:50:11 +0000396#define gen_nb_eaten_name 2
397
398static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000399 if (no == 0) return(xmlStrdup(BAD_CAST "eaten"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000400 return(NULL);
401}
402static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
403}
404
Daniel Veillardd93f6252004-11-02 15:53:51 +0000405#define gen_nb_fileoutput 6
406
Daniel Veillard3d97e662004-11-04 10:49:00 +0000407static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000408 if (no == 0) return("/missing.xml");
409 if (no == 1) return("<foo/>");
410 if (no == 2) return("ftp://missing.example.org/foo");
411 if (no == 3) return("http://missing.example.org/");
412 if (no == 4) return("http://missing. example.org/");
413 return(NULL);
414}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000415static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000416}
417
Daniel Veillarda521d282004-11-09 14:59:59 +0000418#define gen_nb_xmlParserCtxtPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000419static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000420 if (no == 0) return(xmlNewParserCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000421 if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6));
Daniel Veillardd93f6252004-11-02 15:53:51 +0000422 return(NULL);
423}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000424static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000425 if (val != NULL)
426 xmlFreeParserCtxt(val);
427}
428
Daniel Veillard34099b42004-11-04 17:34:35 +0000429#define gen_nb_xmlSAXHandlerPtr 2
430static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000431#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +0000432 if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
Daniel Veillarda521d282004-11-09 14:59:59 +0000433#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000434 return(NULL);
435}
436static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
437}
438
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000439#define gen_nb_xmlValidCtxtPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000440static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000441#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000442 if (no == 0) return(xmlNewValidCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000443#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000444 return(NULL);
445}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000446static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000447#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000448 if (val != NULL)
449 xmlFreeValidCtxt(val);
Daniel Veillarda521d282004-11-09 14:59:59 +0000450#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000451}
452
Daniel Veillard34099b42004-11-04 17:34:35 +0000453#define gen_nb_xmlParserInputBufferPtr 8
454
455static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
456 if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE));
457 if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE));
458 if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE));
459 if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE));
460 if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE));
461 if (no == 5) return(xmlParserInputBufferCreateFilename("http://missing.example.org/", XML_CHAR_ENCODING_NONE));
462 if (no == 6) return(xmlParserInputBufferCreateFilename("http://missing. example.org/", XML_CHAR_ENCODING_NONE));
463 return(NULL);
464}
465static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
466 xmlFreeParserInputBuffer(val);
467}
468
Daniel Veillardd93f6252004-11-02 15:53:51 +0000469#define gen_nb_xmlDocPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000470static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000471 if (no == 0) return(xmlNewDoc(BAD_CAST "1.0"));
472 if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0));
473 return(NULL);
474}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000475static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000476 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
Daniel Veillardd93f6252004-11-02 15:53:51 +0000477 xmlFreeDoc(val);
478}
479
Daniel Veillardce244ad2004-11-05 10:03:46 +0000480#define gen_nb_xmlAttrPtr 2
481static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) {
482 if (no == 0) return(get_api_attr());
483 return(NULL);
484}
485static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
486 if (no == 0) free_api_doc();
487}
488
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000489#define gen_nb_xmlDictPtr 2
490static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) {
491 if (no == 0) return(xmlDictCreate());
492 return(NULL);
493}
494static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) {
495 if (val != NULL)
496 xmlDictFree(val);
497}
498
Daniel Veillardce244ad2004-11-05 10:03:46 +0000499#define gen_nb_xmlNodePtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000500static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000501 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
Daniel Veillardce244ad2004-11-05 10:03:46 +0000502 if (no == 1) return(get_api_root());
Daniel Veillardd93f6252004-11-02 15:53:51 +0000503 return(NULL);
Daniel Veillardce244ad2004-11-05 10:03:46 +0000504/* if (no == 2) return((xmlNodePtr) get_api_doc()); */
Daniel Veillardd93f6252004-11-02 15:53:51 +0000505}
Daniel Veillard27f20102004-11-05 11:50:11 +0000506static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000507 if (no == 1) free_api_doc();
508 else if (val != NULL) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000509 xmlUnlinkNode(val);
510 xmlFreeNode(val);
511 }
512}
513
Daniel Veillard27f20102004-11-05 11:50:11 +0000514#define gen_nb_xmlDtdPtr 3
515static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000516 if (no == 0)
517 return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000518 if (no == 1) return(get_api_dtd());
519 return(NULL);
520}
521static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) {
522 if (no == 1) free_api_doc();
523 else if (val != NULL) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000524 xmlUnlinkNode((xmlNodePtr) val);
525 xmlFreeNode((xmlNodePtr) val);
Daniel Veillard27f20102004-11-05 11:50:11 +0000526 }
527}
528
529#define gen_nb_xmlNsPtr 2
530static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) {
531 if (no == 0) return(get_api_ns());
532 return(NULL);
533}
534static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
535 if (no == 0) free_api_doc();
536}
537
Daniel Veillardd93f6252004-11-02 15:53:51 +0000538#define gen_nb_xmlNodePtr_in 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000539static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000540 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
541 if (no == 0) return(xmlNewText(BAD_CAST "text"));
542 return(NULL);
543}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000544static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000545}
546
Daniel Veillardc8311492004-11-08 16:51:13 +0000547#ifdef LIBXML_WRITER_ENABLED
Daniel Veillarde43cc572004-11-03 11:50:29 +0000548#define gen_nb_xmlTextWriterPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000549static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000550 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
551 return(NULL);
552}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000553static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000554 if (val != NULL) xmlFreeTextWriter(val);
555}
Daniel Veillardc8311492004-11-08 16:51:13 +0000556#endif
Daniel Veillarde43cc572004-11-03 11:50:29 +0000557
Daniel Veillardc8311492004-11-08 16:51:13 +0000558#ifdef LIBXML_READER_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000559#define gen_nb_xmlTextReaderPtr 4
Daniel Veillard3d97e662004-11-04 10:49:00 +0000560static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000561 if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
562 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
563 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
564 return(NULL);
565}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000566static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000567 if (val != NULL) xmlFreeTextReader(val);
568}
Daniel Veillardc8311492004-11-08 16:51:13 +0000569#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000570
Daniel Veillard34099b42004-11-04 17:34:35 +0000571#define gen_nb_xmlBufferPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000572static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000573 if (no == 0) return(xmlBufferCreate());
Daniel Veillardce244ad2004-11-05 10:03:46 +0000574 if (no == 1) return(xmlBufferCreateStatic((void *)"a static buffer", 13));
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000575 return(NULL);
576}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000577static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000578 if (val != NULL) {
579 xmlBufferFree(val);
580 }
581}
582
583#define gen_nb_xmlListPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000584static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000585 if (no == 0) return(xmlListCreate(NULL, NULL));
586 return(NULL);
587}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000588static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000589 if (val != NULL) {
590 xmlListDelete(val);
591 }
592}
593
594#define gen_nb_xmlHashTablePtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000595static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000596 if (no == 0) return(xmlHashCreate(10));
597 return(NULL);
598}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000599static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000600 if (val != NULL) {
601 xmlHashFree(val, NULL);
602 }
603}
604
605#include <libxml/xpathInternals.h>
606
Daniel Veillardc8311492004-11-08 16:51:13 +0000607#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000608#define gen_nb_xmlXPathObjectPtr 5
Daniel Veillard3d97e662004-11-04 10:49:00 +0000609static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000610 if (no == 0) return(xmlXPathNewString(BAD_CAST "string object"));
611 if (no == 1) return(xmlXPathNewFloat(1.1));
612 if (no == 2) return(xmlXPathNewBoolean(1));
613 if (no == 3) return(xmlXPathNewNodeSet(NULL));
614 return(NULL);
615}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000616static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000617 if (val != NULL) {
618 xmlXPathFreeObject(val);
619 }
620}
Daniel Veillardc8311492004-11-08 16:51:13 +0000621#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000622
Daniel Veillardc8311492004-11-08 16:51:13 +0000623#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000624#define gen_nb_xmlOutputBufferPtr 2
625static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
626 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0));
627 return(NULL);
628}
629static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
630 if (val != NULL) {
631 xmlOutputBufferClose(val);
632 }
633}
Daniel Veillardc8311492004-11-08 16:51:13 +0000634#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +0000635
Daniel Veillardc8311492004-11-08 16:51:13 +0000636#ifdef LIBXML_FTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000637#define gen_nb_xmlNanoFTPCtxtPtr 4
638static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
639 if (no == 0) return(xmlNanoFTPNewCtxt("ftp://example.com/"));
640 if (no == 1) return(xmlNanoFTPNewCtxt("http://example.com/"));
641 if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
642 return(NULL);
643}
644static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
645 if (val != NULL) {
646 xmlNanoFTPFreeCtxt(val);
647 }
648}
Daniel Veillardc8311492004-11-08 16:51:13 +0000649#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000650
Daniel Veillardc8311492004-11-08 16:51:13 +0000651#ifdef LIBXML_HTTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000652#define gen_nb_xmlNanoHTTPCtxtPtr 1
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000653static void *gen_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard27f20102004-11-05 11:50:11 +0000654 return(NULL);
655}
656static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
657}
Daniel Veillardc8311492004-11-08 16:51:13 +0000658#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000659
Daniel Veillard3d97e662004-11-04 10:49:00 +0000660#define gen_nb_xmlCharEncoding 4
661static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) {
662 if (no == 0) return(XML_CHAR_ENCODING_UTF8);
663 if (no == 1) return(XML_CHAR_ENCODING_NONE);
664 if (no == 0) return(XML_CHAR_ENCODING_8859_1);
665 return(XML_CHAR_ENCODING_ERROR);
666}
667static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
668}
669
Daniel Veillard42595322004-11-08 10:52:06 +0000670#define gen_nb_xmlHashDeallocator 2
671static void
672test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) {
673}
674
675static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
676 if (no == 0) return(test_xmlHashDeallocator);
677 return(NULL);
678}
679static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
680}
681
Daniel Veillardd93f6252004-11-02 15:53:51 +0000682
683static void desret_int(int val ATTRIBUTE_UNUSED) {
684}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000685static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) {
686}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000687static void desret_long(long val ATTRIBUTE_UNUSED) {
688}
689static void desret_double(double val ATTRIBUTE_UNUSED) {
690}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000691static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
692}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000693#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000694static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
695}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000696#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000697static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
698}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000699static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
700}
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000701static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
702}
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000703static void desret_xmlChar_ptr(xmlChar *val) {
704 if (val != NULL)
705 xmlFree(val);
706}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000707static void desret_xmlDocPtr(xmlDocPtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000708 if (val != api_doc)
709 xmlFreeDoc(val);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000710}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000711static void desret_xmlDictPtr(xmlDictPtr val) {
712 xmlDictFree(val);
713}
Daniel Veillardc8311492004-11-08 16:51:13 +0000714#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d95c732004-11-06 22:25:14 +0000715static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
716 xmlOutputBufferClose(val);
717}
Daniel Veillardc8311492004-11-08 16:51:13 +0000718#endif
719#ifdef LIBXML_READER_ENABLED
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000720static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
721 xmlFreeTextReader(val);
722}
Daniel Veillardc8311492004-11-08 16:51:13 +0000723#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +0000724static void desret_xmlNodePtr(xmlNodePtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000725 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
726 xmlUnlinkNode(val);
727 xmlFreeNode(val);
728 }
Daniel Veillardd93f6252004-11-02 15:53:51 +0000729}
Daniel Veillard57b25162004-11-06 14:50:18 +0000730static void desret_xmlAttrPtr(xmlAttrPtr val) {
731 if (val != NULL) {
732 xmlUnlinkNode((xmlNodePtr) val);
733 xmlFreeNode((xmlNodePtr) val);
734 }
735}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000736static void desret_xmlEntityPtr(xmlEntityPtr val) {
737 if (val != NULL) {
738 xmlUnlinkNode((xmlNodePtr) val);
739 xmlFreeNode((xmlNodePtr) val);
740 }
741}
Daniel Veillard42595322004-11-08 10:52:06 +0000742static void desret_xmlElementPtr(xmlElementPtr val) {
743 if (val != NULL) {
744 xmlUnlinkNode((xmlNodePtr) val);
745 }
746}
747static void desret_xmlAttributePtr(xmlAttributePtr val) {
748 if (val != NULL) {
749 xmlUnlinkNode((xmlNodePtr) val);
750 }
751}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000752static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
753}
Daniel Veillard34099b42004-11-04 17:34:35 +0000754static void desret_xmlDtdPtr(xmlDtdPtr val) {
755 desret_xmlNodePtr((xmlNodePtr)val);
756}
Daniel Veillardc8311492004-11-08 16:51:13 +0000757#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000758static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000759 xmlXPathFreeObject(val);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000760}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000761static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) {
762 xmlXPathFreeNodeSet(val);
763}
Daniel Veillardc8311492004-11-08 16:51:13 +0000764#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000765static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
766 xmlFreeParserCtxt(val);
767}
768
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000769static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
770 xmlFreeParserInputBuffer(val);
771}
Daniel Veillard42595322004-11-08 10:52:06 +0000772static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
773 xmlFreeInputStream(val);
774}
Daniel Veillardc8311492004-11-08 16:51:13 +0000775#ifdef LIBXML_WRITER_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000776static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
777 xmlFreeTextWriter(val);
778}
Daniel Veillardc8311492004-11-08 16:51:13 +0000779#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000780static void desret_xmlBufferPtr(xmlBufferPtr val) {
781 xmlBufferFree(val);
782}
Daniel Veillardc8311492004-11-08 16:51:13 +0000783#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000784static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
785 xmlSchemaFreeParserCtxt(val);
786}
787static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
788}
789static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
790 xmlRelaxNGFreeParserCtxt(val);
791}
Daniel Veillardc8311492004-11-08 16:51:13 +0000792#endif
793#ifdef LIBXML_HTML_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000794static void desret_const_htmlEntityDesc_ptr(const htmlEntityDescPtr val ATTRIBUTE_UNUSED) {
795}
Daniel Veillardc8311492004-11-08 16:51:13 +0000796#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000797
Daniel Veillarda521d282004-11-09 14:59:59 +0000798/* cut and pasted from autogenerated to avoid troubles */
799#define gen_nb_const_xmlChar_ptr_ptr 1
800static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
801 return(NULL);
802}
803static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
804}
805
806#define gen_nb_unsigned_char_ptr 1
807static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
808 return(NULL);
809}
810static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
811}
812
813#define gen_nb_const_unsigned_char_ptr 1
814static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
815 return(NULL);
816}
817static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
818}
819
820#ifdef LIBXML_HTML_ENABLED
821#define gen_nb_const_htmlNodePtr 1
822static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
823 return(NULL);
824}
825static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
826}
827#endif
828
829#ifdef LIBXML_HTML_ENABLED
830#define gen_nb_htmlDocPtr 3
831static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
832 if (no == 0) return(htmlNewDoc(NULL, NULL));
833 if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0));
834 return(NULL);
835}
836static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
837 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
838 xmlFreeDoc(val);
839}
840static void desret_htmlDocPtr(htmlDocPtr val) {
841 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
842 xmlFreeDoc(val);
843}
844#define gen_nb_htmlParserCtxtPtr 3
845static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
846 if (no == 0) return(xmlNewParserCtxt());
847 if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7));
848 return(NULL);
849}
850static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
851 if (val != NULL)
852 htmlFreeParserCtxt(val);
853}
854static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) {
855 if (val != NULL)
856 htmlFreeParserCtxt(val);
857}
858#endif
859
860#ifdef LIBXML_XPATH_ENABLED
861#define gen_nb_xmlNodeSetPtr 1
862static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
863 return(NULL);
864}
865static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
866}
867#endif
868
869#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000870#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda521d282004-11-09 14:59:59 +0000871#define gen_nb_xmlShellCtxtPtr 1
872static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
873 return(NULL);
874}
875static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
876}
877#endif
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000878#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000879
880#ifdef LIBXML_PATTERN_ENABLED
881#define gen_nb_xmlPatternPtr 1
882static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
883 return(NULL);
884}
885static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
886}
887#endif
888
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000889/************************************************************************
890 * *
891 * WARNING: end of the manually maintained part of the test code *
892 * do not remove or alter the CUT HERE line *
893 * *
894 ************************************************************************/
895
Daniel Veillard34099b42004-11-04 17:34:35 +0000896/* CUT HERE: everything below that line is generated */
Daniel Veillarda521d282004-11-09 14:59:59 +0000897#ifdef LIBXML_HTML_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000898#define gen_nb_htmlParserOption 4
899static htmlParserOption gen_htmlParserOption(int no, int nr ATTRIBUTE_UNUSED) {
900 if (no == 1) return(HTML_PARSE_NOBLANKS);
901 if (no == 2) return(HTML_PARSE_NOERROR);
902 if (no == 3) return(HTML_PARSE_NONET);
903 if (no == 4) return(HTML_PARSE_NOWARNING);
904 return(0);
905}
906static void des_htmlParserOption(int no ATTRIBUTE_UNUSED, htmlParserOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
907}
908static void desret_htmlParserOption(htmlParserOption val ATTRIBUTE_UNUSED) {
909}
910
Daniel Veillarda521d282004-11-09 14:59:59 +0000911#endif
912
913#ifdef LIBXML_HTML_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000914#define gen_nb_htmlStatus 4
915static htmlStatus gen_htmlStatus(int no, int nr ATTRIBUTE_UNUSED) {
916 if (no == 1) return(HTML_DEPRECATED);
917 if (no == 2) return(HTML_INVALID);
918 if (no == 3) return(HTML_NA);
919 if (no == 4) return(HTML_REQUIRED);
920 return(0);
921}
922static void des_htmlStatus(int no ATTRIBUTE_UNUSED, htmlStatus val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
923}
924static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
925}
926
Daniel Veillarda521d282004-11-09 14:59:59 +0000927#endif
928
Daniel Veillard57b25162004-11-06 14:50:18 +0000929#define gen_nb_xlinkActuate 3
930static xlinkActuate gen_xlinkActuate(int no, int nr ATTRIBUTE_UNUSED) {
931 if (no == 1) return(XLINK_ACTUATE_AUTO);
932 if (no == 2) return(XLINK_ACTUATE_NONE);
933 if (no == 3) return(XLINK_ACTUATE_ONREQUEST);
934 return(0);
935}
936static void des_xlinkActuate(int no ATTRIBUTE_UNUSED, xlinkActuate val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
937}
938static void desret_xlinkActuate(xlinkActuate val ATTRIBUTE_UNUSED) {
939}
940
941#define gen_nb_xlinkShow 4
942static xlinkShow gen_xlinkShow(int no, int nr ATTRIBUTE_UNUSED) {
943 if (no == 1) return(XLINK_SHOW_EMBED);
944 if (no == 2) return(XLINK_SHOW_NEW);
945 if (no == 3) return(XLINK_SHOW_NONE);
946 if (no == 4) return(XLINK_SHOW_REPLACE);
947 return(0);
948}
949static void des_xlinkShow(int no ATTRIBUTE_UNUSED, xlinkShow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
950}
951static void desret_xlinkShow(xlinkShow val ATTRIBUTE_UNUSED) {
952}
953
954#define gen_nb_xlinkType 4
955static xlinkType gen_xlinkType(int no, int nr ATTRIBUTE_UNUSED) {
956 if (no == 1) return(XLINK_TYPE_EXTENDED);
957 if (no == 2) return(XLINK_TYPE_EXTENDED_SET);
958 if (no == 3) return(XLINK_TYPE_NONE);
959 if (no == 4) return(XLINK_TYPE_SIMPLE);
960 return(0);
961}
962static void des_xlinkType(int no ATTRIBUTE_UNUSED, xlinkType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
963}
964static void desret_xlinkType(xlinkType val ATTRIBUTE_UNUSED) {
965}
966
967#define gen_nb_xmlAttributeDefault 4
968static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
969 if (no == 1) return(XML_ATTRIBUTE_FIXED);
970 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
971 if (no == 3) return(XML_ATTRIBUTE_NONE);
972 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
973 return(0);
974}
975static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
976}
977static void desret_xmlAttributeDefault(xmlAttributeDefault val ATTRIBUTE_UNUSED) {
978}
979
980#define gen_nb_xmlAttributeType 4
981static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
982 if (no == 1) return(XML_ATTRIBUTE_CDATA);
983 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
984 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
985 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
986 return(0);
987}
988static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
989}
990static void desret_xmlAttributeType(xmlAttributeType val ATTRIBUTE_UNUSED) {
991}
992
993#define gen_nb_xmlBufferAllocationScheme 3
994static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
995 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
996 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
997 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
998 return(0);
999}
1000static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1001}
1002static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
1003}
1004
Daniel Veillarda521d282004-11-09 14:59:59 +00001005#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001006#define gen_nb_xmlCatalogAllow 4
1007static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
1008 if (no == 1) return(XML_CATA_ALLOW_ALL);
1009 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
1010 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
1011 if (no == 4) return(XML_CATA_ALLOW_NONE);
1012 return(0);
1013}
1014static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1015}
1016static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
1017}
1018
Daniel Veillarda521d282004-11-09 14:59:59 +00001019#endif
1020
1021#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001022#define gen_nb_xmlCatalogPrefer 3
1023static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
1024 if (no == 1) return(XML_CATA_PREFER_NONE);
1025 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
1026 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
1027 return(0);
1028}
1029static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1030}
1031static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
1032}
1033
Daniel Veillarda521d282004-11-09 14:59:59 +00001034#endif
1035
Daniel Veillard57b25162004-11-06 14:50:18 +00001036#define gen_nb_xmlElementContentOccur 4
1037static xmlElementContentOccur gen_xmlElementContentOccur(int no, int nr ATTRIBUTE_UNUSED) {
1038 if (no == 1) return(XML_ELEMENT_CONTENT_MULT);
1039 if (no == 2) return(XML_ELEMENT_CONTENT_ONCE);
1040 if (no == 3) return(XML_ELEMENT_CONTENT_OPT);
1041 if (no == 4) return(XML_ELEMENT_CONTENT_PLUS);
1042 return(0);
1043}
1044static void des_xmlElementContentOccur(int no ATTRIBUTE_UNUSED, xmlElementContentOccur val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1045}
1046static void desret_xmlElementContentOccur(xmlElementContentOccur val ATTRIBUTE_UNUSED) {
1047}
1048
1049#define gen_nb_xmlElementContentType 4
1050static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
1051 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
1052 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
1053 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
1054 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
1055 return(0);
1056}
1057static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1058}
1059static void desret_xmlElementContentType(xmlElementContentType val ATTRIBUTE_UNUSED) {
1060}
1061
1062#define gen_nb_xmlElementType 4
1063static xmlElementType gen_xmlElementType(int no, int nr ATTRIBUTE_UNUSED) {
1064 if (no == 1) return(XML_ATTRIBUTE_DECL);
1065 if (no == 2) return(XML_ATTRIBUTE_NODE);
1066 if (no == 3) return(XML_CDATA_SECTION_NODE);
1067 if (no == 4) return(XML_COMMENT_NODE);
1068 return(0);
1069}
1070static void des_xmlElementType(int no ATTRIBUTE_UNUSED, xmlElementType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1071}
1072static void desret_xmlElementType(xmlElementType val ATTRIBUTE_UNUSED) {
1073}
1074
1075#define gen_nb_xmlElementTypeVal 4
1076static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
1077 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
1078 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
1079 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
1080 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
1081 return(0);
1082}
1083static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1084}
1085static void desret_xmlElementTypeVal(xmlElementTypeVal val ATTRIBUTE_UNUSED) {
1086}
1087
1088#define gen_nb_xmlEntityType 4
1089static xmlEntityType gen_xmlEntityType(int no, int nr ATTRIBUTE_UNUSED) {
1090 if (no == 1) return(XML_EXTERNAL_GENERAL_PARSED_ENTITY);
1091 if (no == 2) return(XML_EXTERNAL_GENERAL_UNPARSED_ENTITY);
1092 if (no == 3) return(XML_EXTERNAL_PARAMETER_ENTITY);
1093 if (no == 4) return(XML_INTERNAL_GENERAL_ENTITY);
1094 return(0);
1095}
1096static void des_xmlEntityType(int no ATTRIBUTE_UNUSED, xmlEntityType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1097}
1098static void desret_xmlEntityType(xmlEntityType val ATTRIBUTE_UNUSED) {
1099}
1100
1101#define gen_nb_xmlErrorDomain 4
1102static xmlErrorDomain gen_xmlErrorDomain(int no, int nr ATTRIBUTE_UNUSED) {
1103 if (no == 1) return(XML_FROM_C14N);
1104 if (no == 2) return(XML_FROM_CATALOG);
1105 if (no == 3) return(XML_FROM_CHECK);
1106 if (no == 4) return(XML_FROM_DATATYPE);
1107 return(0);
1108}
1109static void des_xmlErrorDomain(int no ATTRIBUTE_UNUSED, xmlErrorDomain val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1110}
1111static void desret_xmlErrorDomain(xmlErrorDomain val ATTRIBUTE_UNUSED) {
1112}
1113
1114#define gen_nb_xmlErrorLevel 4
1115static xmlErrorLevel gen_xmlErrorLevel(int no, int nr ATTRIBUTE_UNUSED) {
1116 if (no == 1) return(XML_ERR_ERROR);
1117 if (no == 2) return(XML_ERR_FATAL);
1118 if (no == 3) return(XML_ERR_NONE);
1119 if (no == 4) return(XML_ERR_WARNING);
1120 return(0);
1121}
1122static void des_xmlErrorLevel(int no ATTRIBUTE_UNUSED, xmlErrorLevel val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1123}
1124static void desret_xmlErrorLevel(xmlErrorLevel val ATTRIBUTE_UNUSED) {
1125}
1126
1127#define gen_nb_xmlParserErrors 4
1128static xmlParserErrors gen_xmlParserErrors(int no, int nr ATTRIBUTE_UNUSED) {
1129 if (no == 1) return(XML_C14N_CREATE_CTXT);
1130 if (no == 2) return(XML_C14N_CREATE_STACK);
1131 if (no == 3) return(XML_C14N_INVALID_NODE);
1132 if (no == 4) return(XML_C14N_REQUIRES_UTF8);
1133 return(0);
1134}
1135static void des_xmlParserErrors(int no ATTRIBUTE_UNUSED, xmlParserErrors val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1136}
1137static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
1138}
1139
1140#define gen_nb_xmlParserInputState 4
1141static xmlParserInputState gen_xmlParserInputState(int no, int nr ATTRIBUTE_UNUSED) {
1142 if (no == 1) return(XML_PARSER_ATTRIBUTE_VALUE);
1143 if (no == 2) return(XML_PARSER_CDATA_SECTION);
1144 if (no == 3) return(XML_PARSER_COMMENT);
1145 if (no == 4) return(XML_PARSER_CONTENT);
1146 return(0);
1147}
1148static void des_xmlParserInputState(int no ATTRIBUTE_UNUSED, xmlParserInputState val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1149}
1150static void desret_xmlParserInputState(xmlParserInputState val ATTRIBUTE_UNUSED) {
1151}
1152
1153#define gen_nb_xmlParserMode 4
1154static xmlParserMode gen_xmlParserMode(int no, int nr ATTRIBUTE_UNUSED) {
1155 if (no == 1) return(XML_PARSE_DOM);
1156 if (no == 2) return(XML_PARSE_PUSH_DOM);
1157 if (no == 3) return(XML_PARSE_PUSH_SAX);
1158 if (no == 4) return(XML_PARSE_READER);
1159 return(0);
1160}
1161static void des_xmlParserMode(int no ATTRIBUTE_UNUSED, xmlParserMode val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1162}
1163static void desret_xmlParserMode(xmlParserMode val ATTRIBUTE_UNUSED) {
1164}
1165
1166#define gen_nb_xmlParserOption 4
1167static xmlParserOption gen_xmlParserOption(int no, int nr ATTRIBUTE_UNUSED) {
1168 if (no == 1) return(XML_PARSE_DTDATTR);
1169 if (no == 2) return(XML_PARSE_DTDLOAD);
1170 if (no == 3) return(XML_PARSE_DTDVALID);
1171 if (no == 4) return(XML_PARSE_NOBLANKS);
1172 return(0);
1173}
1174static void des_xmlParserOption(int no ATTRIBUTE_UNUSED, xmlParserOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1175}
1176static void desret_xmlParserOption(xmlParserOption val ATTRIBUTE_UNUSED) {
1177}
1178
Daniel Veillarda521d282004-11-09 14:59:59 +00001179#ifdef LIBXML_READER_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001180#define gen_nb_xmlParserProperties 4
1181static xmlParserProperties gen_xmlParserProperties(int no, int nr ATTRIBUTE_UNUSED) {
1182 if (no == 1) return(XML_PARSER_DEFAULTATTRS);
1183 if (no == 2) return(XML_PARSER_LOADDTD);
1184 if (no == 3) return(XML_PARSER_SUBST_ENTITIES);
1185 if (no == 4) return(XML_PARSER_VALIDATE);
1186 return(0);
1187}
1188static void des_xmlParserProperties(int no ATTRIBUTE_UNUSED, xmlParserProperties val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1189}
1190static void desret_xmlParserProperties(xmlParserProperties val ATTRIBUTE_UNUSED) {
1191}
1192
Daniel Veillarda521d282004-11-09 14:59:59 +00001193#endif
1194
1195#ifdef LIBXML_READER_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001196#define gen_nb_xmlParserSeverities 4
1197static xmlParserSeverities gen_xmlParserSeverities(int no, int nr ATTRIBUTE_UNUSED) {
1198 if (no == 1) return(XML_PARSER_SEVERITY_ERROR);
1199 if (no == 2) return(XML_PARSER_SEVERITY_VALIDITY_ERROR);
1200 if (no == 3) return(XML_PARSER_SEVERITY_VALIDITY_WARNING);
1201 if (no == 4) return(XML_PARSER_SEVERITY_WARNING);
1202 return(0);
1203}
1204static void des_xmlParserSeverities(int no ATTRIBUTE_UNUSED, xmlParserSeverities val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1205}
1206static void desret_xmlParserSeverities(xmlParserSeverities val ATTRIBUTE_UNUSED) {
1207}
1208
Daniel Veillarda521d282004-11-09 14:59:59 +00001209#endif
1210
1211#ifdef LIBXML_READER_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001212#define gen_nb_xmlReaderTypes 4
1213static xmlReaderTypes gen_xmlReaderTypes(int no, int nr ATTRIBUTE_UNUSED) {
1214 if (no == 1) return(XML_READER_TYPE_ATTRIBUTE);
1215 if (no == 2) return(XML_READER_TYPE_CDATA);
1216 if (no == 3) return(XML_READER_TYPE_COMMENT);
1217 if (no == 4) return(XML_READER_TYPE_DOCUMENT);
1218 return(0);
1219}
1220static void des_xmlReaderTypes(int no ATTRIBUTE_UNUSED, xmlReaderTypes val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1221}
1222static void desret_xmlReaderTypes(xmlReaderTypes val ATTRIBUTE_UNUSED) {
1223}
1224
Daniel Veillarda521d282004-11-09 14:59:59 +00001225#endif
1226
1227#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001228#define gen_nb_xmlRelaxNGParserFlag 3
1229static xmlRelaxNGParserFlag gen_xmlRelaxNGParserFlag(int no, int nr ATTRIBUTE_UNUSED) {
1230 if (no == 1) return(XML_RELAXNGP_CRNG);
1231 if (no == 2) return(XML_RELAXNGP_FREE_DOC);
1232 if (no == 3) return(XML_RELAXNGP_NONE);
1233 return(0);
1234}
1235static void des_xmlRelaxNGParserFlag(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserFlag val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1236}
1237static void desret_xmlRelaxNGParserFlag(xmlRelaxNGParserFlag val ATTRIBUTE_UNUSED) {
1238}
1239
Daniel Veillarda521d282004-11-09 14:59:59 +00001240#endif
1241
1242#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001243#define gen_nb_xmlRelaxNGValidErr 4
1244static xmlRelaxNGValidErr gen_xmlRelaxNGValidErr(int no, int nr ATTRIBUTE_UNUSED) {
1245 if (no == 1) return(XML_RELAXNG_ERR_ATTREXTRANS);
1246 if (no == 2) return(XML_RELAXNG_ERR_ATTRNAME);
1247 if (no == 3) return(XML_RELAXNG_ERR_ATTRNONS);
1248 if (no == 4) return(XML_RELAXNG_ERR_ATTRVALID);
1249 return(0);
1250}
1251static void des_xmlRelaxNGValidErr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidErr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1252}
1253static void desret_xmlRelaxNGValidErr(xmlRelaxNGValidErr val ATTRIBUTE_UNUSED) {
1254}
1255
Daniel Veillarda521d282004-11-09 14:59:59 +00001256#endif
1257
1258#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001259#define gen_nb_xmlSchemaContentType 4
1260static xmlSchemaContentType gen_xmlSchemaContentType(int no, int nr ATTRIBUTE_UNUSED) {
1261 if (no == 1) return(XML_SCHEMA_CONTENT_ANY);
1262 if (no == 2) return(XML_SCHEMA_CONTENT_BASIC);
1263 if (no == 3) return(XML_SCHEMA_CONTENT_ELEMENTS);
1264 if (no == 4) return(XML_SCHEMA_CONTENT_EMPTY);
1265 return(0);
1266}
1267static void des_xmlSchemaContentType(int no ATTRIBUTE_UNUSED, xmlSchemaContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1268}
1269static void desret_xmlSchemaContentType(xmlSchemaContentType val ATTRIBUTE_UNUSED) {
1270}
1271
Daniel Veillarda521d282004-11-09 14:59:59 +00001272#endif
1273
1274#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001275#define gen_nb_xmlSchemaTypeType 4
1276static xmlSchemaTypeType gen_xmlSchemaTypeType(int no, int nr ATTRIBUTE_UNUSED) {
1277 if (no == 1) return(XML_SCHEMA_FACET_ENUMERATION);
1278 if (no == 2) return(XML_SCHEMA_FACET_FRACTIONDIGITS);
1279 if (no == 3) return(XML_SCHEMA_FACET_LENGTH);
1280 if (no == 4) return(XML_SCHEMA_FACET_MAXEXCLUSIVE);
1281 return(0);
1282}
1283static void des_xmlSchemaTypeType(int no ATTRIBUTE_UNUSED, xmlSchemaTypeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1284}
1285static void desret_xmlSchemaTypeType(xmlSchemaTypeType val ATTRIBUTE_UNUSED) {
1286}
1287
Daniel Veillarda521d282004-11-09 14:59:59 +00001288#endif
1289
1290#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001291#define gen_nb_xmlSchemaValType 4
1292static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1293 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1294 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1295 if (no == 3) return(XML_SCHEMAS_ANYURI);
1296 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1297 return(0);
1298}
1299static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1300}
1301static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED) {
1302}
1303
Daniel Veillarda521d282004-11-09 14:59:59 +00001304#endif
1305
1306#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001307#define gen_nb_xmlSchemaValidError 4
1308static xmlSchemaValidError gen_xmlSchemaValidError(int no, int nr ATTRIBUTE_UNUSED) {
1309 if (no == 1) return(XML_SCHEMAS_ERR_);
1310 if (no == 2) return(XML_SCHEMAS_ERR_ATTRINVALID);
1311 if (no == 3) return(XML_SCHEMAS_ERR_ATTRUNKNOWN);
1312 if (no == 4) return(XML_SCHEMAS_ERR_CONSTRUCT);
1313 return(0);
1314}
1315static void des_xmlSchemaValidError(int no ATTRIBUTE_UNUSED, xmlSchemaValidError val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1316}
1317static void desret_xmlSchemaValidError(xmlSchemaValidError val ATTRIBUTE_UNUSED) {
1318}
1319
Daniel Veillarda521d282004-11-09 14:59:59 +00001320#endif
1321
1322#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001323#define gen_nb_xmlSchemaValidOption 1
1324static xmlSchemaValidOption gen_xmlSchemaValidOption(int no, int nr ATTRIBUTE_UNUSED) {
1325 if (no == 1) return(XML_SCHEMA_VAL_VC_I_CREATE);
1326 return(0);
1327}
1328static void des_xmlSchemaValidOption(int no ATTRIBUTE_UNUSED, xmlSchemaValidOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1329}
1330static void desret_xmlSchemaValidOption(xmlSchemaValidOption val ATTRIBUTE_UNUSED) {
1331}
1332
Daniel Veillarda521d282004-11-09 14:59:59 +00001333#endif
1334
1335#ifdef LIBXML_READER_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001336#define gen_nb_xmlTextReaderMode 4
1337static xmlTextReaderMode gen_xmlTextReaderMode(int no, int nr ATTRIBUTE_UNUSED) {
1338 if (no == 1) return(XML_TEXTREADER_MODE_CLOSED);
1339 if (no == 2) return(XML_TEXTREADER_MODE_EOF);
1340 if (no == 3) return(XML_TEXTREADER_MODE_ERROR);
1341 if (no == 4) return(XML_TEXTREADER_MODE_INITIAL);
1342 return(0);
1343}
1344static void des_xmlTextReaderMode(int no ATTRIBUTE_UNUSED, xmlTextReaderMode val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1345}
1346static void desret_xmlTextReaderMode(xmlTextReaderMode val ATTRIBUTE_UNUSED) {
1347}
1348
Daniel Veillarda521d282004-11-09 14:59:59 +00001349#endif
1350
1351#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001352#define gen_nb_xmlXPathError 4
1353static xmlXPathError gen_xmlXPathError(int no, int nr ATTRIBUTE_UNUSED) {
1354 if (no == 1) return(XPATH_ENCODING_ERROR);
1355 if (no == 2) return(XPATH_EXPRESSION_OK);
1356 if (no == 3) return(XPATH_EXPR_ERROR);
1357 if (no == 4) return(XPATH_INVALID_ARITY);
1358 return(0);
1359}
1360static void des_xmlXPathError(int no ATTRIBUTE_UNUSED, xmlXPathError val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1361}
1362static void desret_xmlXPathError(xmlXPathError val ATTRIBUTE_UNUSED) {
1363}
1364
Daniel Veillarda521d282004-11-09 14:59:59 +00001365#endif
1366
1367#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001368#define gen_nb_xmlXPathObjectType 4
1369static xmlXPathObjectType gen_xmlXPathObjectType(int no, int nr ATTRIBUTE_UNUSED) {
1370 if (no == 1) return(XPATH_BOOLEAN);
1371 if (no == 2) return(XPATH_LOCATIONSET);
1372 if (no == 3) return(XPATH_NODESET);
1373 if (no == 4) return(XPATH_NUMBER);
1374 return(0);
1375}
1376static void des_xmlXPathObjectType(int no ATTRIBUTE_UNUSED, xmlXPathObjectType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1377}
1378static void desret_xmlXPathObjectType(xmlXPathObjectType val ATTRIBUTE_UNUSED) {
1379}
1380
Daniel Veillarda521d282004-11-09 14:59:59 +00001381#endif
1382
Daniel Veillard34099b42004-11-04 17:34:35 +00001383#include <libxml/HTMLparser.h>
1384#include <libxml/HTMLtree.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001385#include <libxml/SAX2.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001386#include <libxml/c14n.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001387#include <libxml/catalog.h>
1388#include <libxml/chvalid.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001389#include <libxml/debugXML.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001390#include <libxml/dict.h>
1391#include <libxml/encoding.h>
1392#include <libxml/entities.h>
1393#include <libxml/hash.h>
1394#include <libxml/list.h>
1395#include <libxml/nanoftp.h>
1396#include <libxml/nanohttp.h>
1397#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001398#include <libxml/parserInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001399#include <libxml/pattern.h>
1400#include <libxml/relaxng.h>
1401#include <libxml/schemasInternals.h>
1402#include <libxml/tree.h>
1403#include <libxml/uri.h>
1404#include <libxml/valid.h>
1405#include <libxml/xinclude.h>
1406#include <libxml/xmlIO.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001407#include <libxml/xmlautomata.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001408#include <libxml/xmlerror.h>
1409#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001410#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001411#include <libxml/xmlsave.h>
1412#include <libxml/xmlschemas.h>
1413#include <libxml/xmlschemastypes.h>
1414#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001415#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001416#include <libxml/xmlwriter.h>
1417#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001418#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001419#include <libxml/xpointer.h>
1420static int test_HTMLparser(void);
1421static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001422static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001423static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001424static int test_catalog(void);
1425static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001426static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001427static int test_dict(void);
1428static int test_encoding(void);
1429static int test_entities(void);
1430static int test_hash(void);
1431static int test_list(void);
1432static int test_nanoftp(void);
1433static int test_nanohttp(void);
1434static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001435static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001436static int test_pattern(void);
1437static int test_relaxng(void);
1438static int test_schemasInternals(void);
1439static int test_tree(void);
1440static int test_uri(void);
1441static int test_valid(void);
1442static int test_xinclude(void);
1443static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001444static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001445static int test_xmlerror(void);
1446static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001447static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001448static int test_xmlsave(void);
1449static int test_xmlschemas(void);
1450static int test_xmlschemastypes(void);
1451static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001452static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001453static int test_xmlwriter(void);
1454static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001455static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001456static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001457
1458/**
1459 * testlibxml2:
1460 *
1461 * Main entry point of the tester for the full libxml2 module,
1462 * it calls all the tester entry point for each module.
1463 *
1464 * Returns the number of error found
1465 */
1466static int
1467testlibxml2(void)
1468{
Daniel Veillard42595322004-11-08 10:52:06 +00001469 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001470
Daniel Veillard42595322004-11-08 10:52:06 +00001471 test_ret += test_HTMLparser();
1472 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001473 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001474 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001475 test_ret += test_catalog();
1476 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001477 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001478 test_ret += test_dict();
1479 test_ret += test_encoding();
1480 test_ret += test_entities();
1481 test_ret += test_hash();
1482 test_ret += test_list();
1483 test_ret += test_nanoftp();
1484 test_ret += test_nanohttp();
1485 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001486 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001487 test_ret += test_pattern();
1488 test_ret += test_relaxng();
1489 test_ret += test_schemasInternals();
1490 test_ret += test_tree();
1491 test_ret += test_uri();
1492 test_ret += test_valid();
1493 test_ret += test_xinclude();
1494 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001495 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001496 test_ret += test_xmlerror();
1497 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001498 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001499 test_ret += test_xmlsave();
1500 test_ret += test_xmlschemas();
1501 test_ret += test_xmlschemastypes();
1502 test_ret += test_xmlstring();
1503 test_ret += test_xmlunicode();
1504 test_ret += test_xmlwriter();
1505 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001506 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001507 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001508
Daniel Veillard3d97e662004-11-04 10:49:00 +00001509 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001510 function_tests, call_tests, test_ret);
1511 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001512}
1513
1514
1515static int
1516test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001517 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001518
Daniel Veillardce682bc2004-11-05 17:22:25 +00001519#ifdef LIBXML_HTML_ENABLED
1520 int mem_base;
1521 int ret_val;
1522 unsigned char * out; /* a pointer to an array of bytes to store the result */
1523 int n_out;
1524 int * outlen; /* the length of @out */
1525 int n_outlen;
1526 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1527 int n_in;
1528 int * inlen; /* the length of @in */
1529 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001530
Daniel Veillardce682bc2004-11-05 17:22:25 +00001531 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1532 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1533 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1534 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1535 mem_base = xmlMemBlocks();
1536 out = gen_unsigned_char_ptr(n_out, 0);
1537 outlen = gen_int_ptr(n_outlen, 1);
1538 in = gen_const_unsigned_char_ptr(n_in, 2);
1539 inlen = gen_int_ptr(n_inlen, 3);
1540
1541 ret_val = UTF8ToHtml(out, outlen, in, inlen);
1542 desret_int(ret_val);
1543 call_tests++;
1544 des_unsigned_char_ptr(n_out, out, 0);
1545 des_int_ptr(n_outlen, outlen, 1);
1546 des_const_unsigned_char_ptr(n_in, in, 2);
1547 des_int_ptr(n_inlen, inlen, 3);
1548 xmlResetLastError();
1549 if (mem_base != xmlMemBlocks()) {
1550 printf("Leak of %d blocks found in UTF8ToHtml",
1551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001552 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001553 printf(" %d", n_out);
1554 printf(" %d", n_outlen);
1555 printf(" %d", n_in);
1556 printf(" %d", n_inlen);
1557 printf("\n");
1558 }
1559 }
1560 }
1561 }
1562 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001563 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001564#endif
1565
Daniel Veillard42595322004-11-08 10:52:06 +00001566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001567}
1568
Daniel Veillarda521d282004-11-09 14:59:59 +00001569#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001570
Daniel Veillardce682bc2004-11-05 17:22:25 +00001571#define gen_nb_const_htmlElemDesc_ptr 1
1572static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1573 return(NULL);
1574}
1575static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1576}
Daniel Veillarda521d282004-11-09 14:59:59 +00001577#endif
1578
Daniel Veillardce682bc2004-11-05 17:22:25 +00001579
Daniel Veillardd93f6252004-11-02 15:53:51 +00001580static int
1581test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001583
Daniel Veillard57b25162004-11-06 14:50:18 +00001584#ifdef LIBXML_HTML_ENABLED
1585 int mem_base;
1586 htmlStatus ret_val;
1587 htmlElemDesc * elt; /* HTML element */
1588 int n_elt;
1589 xmlChar * attr; /* HTML attribute */
1590 int n_attr;
1591 int legacy; /* whether to allow deprecated attributes */
1592 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001593
Daniel Veillard57b25162004-11-06 14:50:18 +00001594 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1595 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1596 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1597 mem_base = xmlMemBlocks();
1598 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1599 attr = gen_const_xmlChar_ptr(n_attr, 1);
1600 legacy = gen_int(n_legacy, 2);
1601
1602 ret_val = htmlAttrAllowed(elt, attr, legacy);
1603 desret_htmlStatus(ret_val);
1604 call_tests++;
1605 des_const_htmlElemDesc_ptr(n_elt, elt, 0);
1606 des_const_xmlChar_ptr(n_attr, attr, 1);
1607 des_int(n_legacy, legacy, 2);
1608 xmlResetLastError();
1609 if (mem_base != xmlMemBlocks()) {
1610 printf("Leak of %d blocks found in htmlAttrAllowed",
1611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001612 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001613 printf(" %d", n_elt);
1614 printf(" %d", n_attr);
1615 printf(" %d", n_legacy);
1616 printf("\n");
1617 }
1618 }
1619 }
1620 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001621 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001622#endif
1623
Daniel Veillard42595322004-11-08 10:52:06 +00001624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001625}
1626
Daniel Veillarda521d282004-11-09 14:59:59 +00001627#ifdef LIBXML_HTML_ENABLED
1628
1629#define gen_nb_htmlNodePtr 1
1630static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1631 return(NULL);
1632}
1633static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1634}
1635#endif
1636
Daniel Veillardd93f6252004-11-02 15:53:51 +00001637
1638static int
1639test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001641
Daniel Veillarda03e3652004-11-02 18:45:30 +00001642#ifdef LIBXML_HTML_ENABLED
1643 int mem_base;
1644 int ret_val;
1645 htmlDocPtr doc; /* the HTML document */
1646 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001647 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001648 int n_name;
1649 htmlNodePtr elem; /* the HTML element */
1650 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001651
Daniel Veillarda521d282004-11-09 14:59:59 +00001652 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001653 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001654 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001655 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001656 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001657 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001658 elem = gen_htmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001659
1660 ret_val = htmlAutoCloseTag(doc, name, elem);
1661 desret_int(ret_val);
1662 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001663 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001664 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001665 des_htmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001666 xmlResetLastError();
1667 if (mem_base != xmlMemBlocks()) {
1668 printf("Leak of %d blocks found in htmlAutoCloseTag",
1669 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001670 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001671 printf(" %d", n_doc);
1672 printf(" %d", n_name);
1673 printf(" %d", n_elem);
1674 printf("\n");
1675 }
1676 }
1677 }
1678 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001679 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001680#endif
1681
Daniel Veillard42595322004-11-08 10:52:06 +00001682 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001683}
1684
1685
1686static int
1687test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001688 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001689
Daniel Veillard34099b42004-11-04 17:34:35 +00001690#ifdef LIBXML_HTML_ENABLED
1691 int mem_base;
1692 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001693 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001694 int n_buffer;
1695 int size; /* the size of the array */
1696 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001697
Daniel Veillard34099b42004-11-04 17:34:35 +00001698 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1699 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1700 mem_base = xmlMemBlocks();
1701 buffer = gen_const_char_ptr(n_buffer, 0);
1702 size = gen_int(n_size, 1);
1703
1704 ret_val = htmlCreateMemoryParserCtxt(buffer, size);
Daniel Veillarda521d282004-11-09 14:59:59 +00001705 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard34099b42004-11-04 17:34:35 +00001706 call_tests++;
1707 des_const_char_ptr(n_buffer, buffer, 0);
1708 des_int(n_size, size, 1);
1709 xmlResetLastError();
1710 if (mem_base != xmlMemBlocks()) {
1711 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1712 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001713 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001714 printf(" %d", n_buffer);
1715 printf(" %d", n_size);
1716 printf("\n");
1717 }
1718 }
1719 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001720 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001721#endif
1722
Daniel Veillard42595322004-11-08 10:52:06 +00001723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001724}
1725
Daniel Veillarda521d282004-11-09 14:59:59 +00001726#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001727
Daniel Veillardce682bc2004-11-05 17:22:25 +00001728#define gen_nb_htmlSAXHandlerPtr 1
1729static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1730 return(NULL);
1731}
1732static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1733}
Daniel Veillarda521d282004-11-09 14:59:59 +00001734#endif
1735
Daniel Veillardce682bc2004-11-05 17:22:25 +00001736
Daniel Veillardd93f6252004-11-02 15:53:51 +00001737static int
1738test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001740
Daniel Veillardce682bc2004-11-05 17:22:25 +00001741#ifdef LIBXML_HTML_ENABLED
1742#ifdef LIBXML_PUSH_ENABLED
1743 int mem_base;
1744 htmlParserCtxtPtr ret_val;
1745 htmlSAXHandlerPtr sax; /* a SAX handler */
1746 int n_sax;
1747 void * user_data; /* The user data returned on SAX callbacks */
1748 int n_user_data;
1749 char * chunk; /* a pointer to an array of chars */
1750 int n_chunk;
1751 int size; /* number of chars in the array */
1752 int n_size;
1753 const char * filename; /* an optional file name or URI */
1754 int n_filename;
1755 xmlCharEncoding enc; /* an optional encoding */
1756 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001757
Daniel Veillardce682bc2004-11-05 17:22:25 +00001758 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1759 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1760 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1761 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001762 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001763 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1764 mem_base = xmlMemBlocks();
1765 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1766 user_data = gen_userdata(n_user_data, 1);
1767 chunk = gen_const_char_ptr(n_chunk, 2);
1768 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001769 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001770 enc = gen_xmlCharEncoding(n_enc, 5);
1771
1772 ret_val = htmlCreatePushParserCtxt(sax, user_data, chunk, size, filename, enc);
Daniel Veillarda521d282004-11-09 14:59:59 +00001773 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001774 call_tests++;
1775 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1776 des_userdata(n_user_data, user_data, 1);
1777 des_const_char_ptr(n_chunk, chunk, 2);
1778 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001779 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001780 des_xmlCharEncoding(n_enc, enc, 5);
1781 xmlResetLastError();
1782 if (mem_base != xmlMemBlocks()) {
1783 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001785 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001786 printf(" %d", n_sax);
1787 printf(" %d", n_user_data);
1788 printf(" %d", n_chunk);
1789 printf(" %d", n_size);
1790 printf(" %d", n_filename);
1791 printf(" %d", n_enc);
1792 printf("\n");
1793 }
1794 }
1795 }
1796 }
1797 }
1798 }
1799 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001800 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001801#endif
1802#endif
1803
Daniel Veillard42595322004-11-08 10:52:06 +00001804 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001805}
1806
1807
1808static int
1809test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001810 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001811
Daniel Veillarda03e3652004-11-02 18:45:30 +00001812#ifdef LIBXML_HTML_ENABLED
1813 int mem_base;
1814 htmlDocPtr ret_val;
1815 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1816 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001817 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001818 int n_cur;
1819 const char * URL; /* the base URL to use for the document */
1820 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001821 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001822 int n_encoding;
1823 int options; /* a combination of htmlParserOption(s) */
1824 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001825
Daniel Veillarda521d282004-11-09 14:59:59 +00001826 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001827 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1828 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1829 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1830 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1831 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001832 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001833 cur = gen_const_xmlChar_ptr(n_cur, 1);
1834 URL = gen_filepath(n_URL, 2);
1835 encoding = gen_const_char_ptr(n_encoding, 3);
1836 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001837
Daniel Veillarda03e3652004-11-02 18:45:30 +00001838 ret_val = htmlCtxtReadDoc(ctxt, cur, URL, encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001839 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001840 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001841 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001842 des_const_xmlChar_ptr(n_cur, cur, 1);
1843 des_filepath(n_URL, URL, 2);
1844 des_const_char_ptr(n_encoding, encoding, 3);
1845 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001846 xmlResetLastError();
1847 if (mem_base != xmlMemBlocks()) {
1848 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001850 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001851 printf(" %d", n_ctxt);
1852 printf(" %d", n_cur);
1853 printf(" %d", n_URL);
1854 printf(" %d", n_encoding);
1855 printf(" %d", n_options);
1856 printf("\n");
1857 }
1858 }
1859 }
1860 }
1861 }
1862 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001863 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001864#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001865
Daniel Veillard42595322004-11-08 10:52:06 +00001866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001867}
1868
1869
1870static int
1871test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001872 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001873
Daniel Veillarda03e3652004-11-02 18:45:30 +00001874#ifdef LIBXML_HTML_ENABLED
1875 int mem_base;
1876 htmlDocPtr ret_val;
1877 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1878 int n_ctxt;
1879 const char * filename; /* a file or URL */
1880 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001881 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001882 int n_encoding;
1883 int options; /* a combination of htmlParserOption(s) */
1884 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001885
Daniel Veillarda521d282004-11-09 14:59:59 +00001886 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001887 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1888 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1889 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1890 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001891 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001892 filename = gen_filepath(n_filename, 1);
1893 encoding = gen_const_char_ptr(n_encoding, 2);
1894 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001895
1896 ret_val = htmlCtxtReadFile(ctxt, filename, encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001897 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001898 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001899 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001900 des_filepath(n_filename, filename, 1);
1901 des_const_char_ptr(n_encoding, encoding, 2);
1902 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001903 xmlResetLastError();
1904 if (mem_base != xmlMemBlocks()) {
1905 printf("Leak of %d blocks found in htmlCtxtReadFile",
1906 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001907 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001908 printf(" %d", n_ctxt);
1909 printf(" %d", n_filename);
1910 printf(" %d", n_encoding);
1911 printf(" %d", n_options);
1912 printf("\n");
1913 }
1914 }
1915 }
1916 }
1917 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001918 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001919#endif
1920
Daniel Veillard42595322004-11-08 10:52:06 +00001921 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001922}
1923
1924
1925static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001926test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001927 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001928
Daniel Veillarda03e3652004-11-02 18:45:30 +00001929#ifdef LIBXML_HTML_ENABLED
1930 int mem_base;
1931 htmlDocPtr ret_val;
1932 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1933 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001934 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001935 int n_buffer;
1936 int size; /* the size of the array */
1937 int n_size;
1938 const char * URL; /* the base URL to use for the document */
1939 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001940 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001941 int n_encoding;
1942 int options; /* a combination of htmlParserOption(s) */
1943 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001944
Daniel Veillarda521d282004-11-09 14:59:59 +00001945 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001946 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1947 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1948 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1949 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1950 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1951 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001952 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001953 buffer = gen_const_char_ptr(n_buffer, 1);
1954 size = gen_int(n_size, 2);
1955 URL = gen_filepath(n_URL, 3);
1956 encoding = gen_const_char_ptr(n_encoding, 4);
1957 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001958
1959 ret_val = htmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001960 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001961 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001962 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001963 des_const_char_ptr(n_buffer, buffer, 1);
1964 des_int(n_size, size, 2);
1965 des_filepath(n_URL, URL, 3);
1966 des_const_char_ptr(n_encoding, encoding, 4);
1967 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001968 xmlResetLastError();
1969 if (mem_base != xmlMemBlocks()) {
1970 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1971 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001972 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001973 printf(" %d", n_ctxt);
1974 printf(" %d", n_buffer);
1975 printf(" %d", n_size);
1976 printf(" %d", n_URL);
1977 printf(" %d", n_encoding);
1978 printf(" %d", n_options);
1979 printf("\n");
1980 }
1981 }
1982 }
1983 }
1984 }
1985 }
1986 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001987 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001988#endif
1989
Daniel Veillard42595322004-11-08 10:52:06 +00001990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001991}
1992
1993
1994static int
1995test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001997
Daniel Veillarda03e3652004-11-02 18:45:30 +00001998#ifdef LIBXML_HTML_ENABLED
1999 int mem_base;
2000 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2001 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002002
Daniel Veillarda521d282004-11-09 14:59:59 +00002003 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002004 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002005 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002006
2007 htmlCtxtReset(ctxt);
2008 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002009 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002010 xmlResetLastError();
2011 if (mem_base != xmlMemBlocks()) {
2012 printf("Leak of %d blocks found in htmlCtxtReset",
2013 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002014 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002015 printf(" %d", n_ctxt);
2016 printf("\n");
2017 }
2018 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002019 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002020#endif
2021
Daniel Veillard42595322004-11-08 10:52:06 +00002022 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002023}
2024
2025
2026static int
2027test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002028 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002029
Daniel Veillarda03e3652004-11-02 18:45:30 +00002030#ifdef LIBXML_HTML_ENABLED
2031 int mem_base;
2032 int ret_val;
2033 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2034 int n_ctxt;
2035 int options; /* a combination of htmlParserOption(s) */
2036 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002037
Daniel Veillarda521d282004-11-09 14:59:59 +00002038 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002039 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2040 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002041 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002042 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002043
2044 ret_val = htmlCtxtUseOptions(ctxt, options);
2045 desret_int(ret_val);
2046 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002047 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002048 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002049 xmlResetLastError();
2050 if (mem_base != xmlMemBlocks()) {
2051 printf("Leak of %d blocks found in htmlCtxtUseOptions",
2052 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002053 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002054 printf(" %d", n_ctxt);
2055 printf(" %d", n_options);
2056 printf("\n");
2057 }
2058 }
2059 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002060 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002061#endif
2062
Daniel Veillard42595322004-11-08 10:52:06 +00002063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002064}
2065
2066
2067static int
2068test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002070
Daniel Veillardce682bc2004-11-05 17:22:25 +00002071#ifdef LIBXML_HTML_ENABLED
2072 int mem_base;
2073 int ret_val;
2074 htmlElemDesc * parent; /* HTML parent element */
2075 int n_parent;
2076 xmlChar * elt; /* HTML element */
2077 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002078
Daniel Veillardce682bc2004-11-05 17:22:25 +00002079 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
2080 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
2081 mem_base = xmlMemBlocks();
2082 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
2083 elt = gen_const_xmlChar_ptr(n_elt, 1);
2084
2085 ret_val = htmlElementAllowedHere(parent, elt);
2086 desret_int(ret_val);
2087 call_tests++;
2088 des_const_htmlElemDesc_ptr(n_parent, parent, 0);
2089 des_const_xmlChar_ptr(n_elt, elt, 1);
2090 xmlResetLastError();
2091 if (mem_base != xmlMemBlocks()) {
2092 printf("Leak of %d blocks found in htmlElementAllowedHere",
2093 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002094 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002095 printf(" %d", n_parent);
2096 printf(" %d", n_elt);
2097 printf("\n");
2098 }
2099 }
2100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002101 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002102#endif
2103
Daniel Veillard42595322004-11-08 10:52:06 +00002104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002105}
2106
2107
2108static int
2109test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002111
Daniel Veillard57b25162004-11-06 14:50:18 +00002112#ifdef LIBXML_HTML_ENABLED
2113 int mem_base;
2114 htmlStatus ret_val;
2115 htmlElemDesc * parent; /* HTML parent element */
2116 int n_parent;
2117 htmlElemDesc * elt; /* HTML element */
2118 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002119
Daniel Veillard57b25162004-11-06 14:50:18 +00002120 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
2121 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
2122 mem_base = xmlMemBlocks();
2123 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
2124 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
2125
2126 ret_val = htmlElementStatusHere(parent, elt);
2127 desret_htmlStatus(ret_val);
2128 call_tests++;
2129 des_const_htmlElemDesc_ptr(n_parent, parent, 0);
2130 des_const_htmlElemDesc_ptr(n_elt, elt, 1);
2131 xmlResetLastError();
2132 if (mem_base != xmlMemBlocks()) {
2133 printf("Leak of %d blocks found in htmlElementStatusHere",
2134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002135 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002136 printf(" %d", n_parent);
2137 printf(" %d", n_elt);
2138 printf("\n");
2139 }
2140 }
2141 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002142 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002143#endif
2144
Daniel Veillard42595322004-11-08 10:52:06 +00002145 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002146}
2147
2148
2149static int
2150test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002151 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002152
Daniel Veillardce682bc2004-11-05 17:22:25 +00002153#ifdef LIBXML_HTML_ENABLED
2154 int mem_base;
2155 int ret_val;
2156 unsigned char * out; /* a pointer to an array of bytes to store the result */
2157 int n_out;
2158 int * outlen; /* the length of @out */
2159 int n_outlen;
2160 unsigned char * in; /* a pointer to an array of UTF-8 chars */
2161 int n_in;
2162 int * inlen; /* the length of @in */
2163 int n_inlen;
2164 int quoteChar; /* the quote character to escape (' or ") or zero. */
2165 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002166
Daniel Veillardce682bc2004-11-05 17:22:25 +00002167 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
2168 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
2169 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
2170 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
2171 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
2172 mem_base = xmlMemBlocks();
2173 out = gen_unsigned_char_ptr(n_out, 0);
2174 outlen = gen_int_ptr(n_outlen, 1);
2175 in = gen_const_unsigned_char_ptr(n_in, 2);
2176 inlen = gen_int_ptr(n_inlen, 3);
2177 quoteChar = gen_int(n_quoteChar, 4);
2178
2179 ret_val = htmlEncodeEntities(out, outlen, in, inlen, quoteChar);
2180 desret_int(ret_val);
2181 call_tests++;
2182 des_unsigned_char_ptr(n_out, out, 0);
2183 des_int_ptr(n_outlen, outlen, 1);
2184 des_const_unsigned_char_ptr(n_in, in, 2);
2185 des_int_ptr(n_inlen, inlen, 3);
2186 des_int(n_quoteChar, quoteChar, 4);
2187 xmlResetLastError();
2188 if (mem_base != xmlMemBlocks()) {
2189 printf("Leak of %d blocks found in htmlEncodeEntities",
2190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002191 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002192 printf(" %d", n_out);
2193 printf(" %d", n_outlen);
2194 printf(" %d", n_in);
2195 printf(" %d", n_inlen);
2196 printf(" %d", n_quoteChar);
2197 printf("\n");
2198 }
2199 }
2200 }
2201 }
2202 }
2203 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002204 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002205#endif
2206
Daniel Veillard42595322004-11-08 10:52:06 +00002207 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002208}
2209
2210
2211static int
2212test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002213 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002214
Daniel Veillard42595322004-11-08 10:52:06 +00002215#ifdef LIBXML_HTML_ENABLED
2216 int mem_base;
2217 const htmlEntityDesc * ret_val;
2218 xmlChar * name; /* the entity name */
2219 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002220
Daniel Veillard42595322004-11-08 10:52:06 +00002221 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2222 mem_base = xmlMemBlocks();
2223 name = gen_const_xmlChar_ptr(n_name, 0);
2224
2225 ret_val = htmlEntityLookup(name);
2226 desret_const_htmlEntityDesc_ptr(ret_val);
2227 call_tests++;
2228 des_const_xmlChar_ptr(n_name, name, 0);
2229 xmlResetLastError();
2230 if (mem_base != xmlMemBlocks()) {
2231 printf("Leak of %d blocks found in htmlEntityLookup",
2232 xmlMemBlocks() - mem_base);
2233 test_ret++;
2234 printf(" %d", n_name);
2235 printf("\n");
2236 }
2237 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002238 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002239#endif
2240
Daniel Veillard42595322004-11-08 10:52:06 +00002241 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002242}
2243
2244
2245static int
2246test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002247 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002248
Daniel Veillard42595322004-11-08 10:52:06 +00002249#ifdef LIBXML_HTML_ENABLED
2250 int mem_base;
2251 const htmlEntityDesc * ret_val;
2252 unsigned int value; /* the entity's unicode value */
2253 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002254
Daniel Veillard42595322004-11-08 10:52:06 +00002255 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
2256 mem_base = xmlMemBlocks();
2257 value = gen_unsigned_int(n_value, 0);
2258
2259 ret_val = htmlEntityValueLookup(value);
2260 desret_const_htmlEntityDesc_ptr(ret_val);
2261 call_tests++;
2262 des_unsigned_int(n_value, value, 0);
2263 xmlResetLastError();
2264 if (mem_base != xmlMemBlocks()) {
2265 printf("Leak of %d blocks found in htmlEntityValueLookup",
2266 xmlMemBlocks() - mem_base);
2267 test_ret++;
2268 printf(" %d", n_value);
2269 printf("\n");
2270 }
2271 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002272 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002273#endif
2274
Daniel Veillard42595322004-11-08 10:52:06 +00002275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002276}
2277
2278
2279static int
2280test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002282
2283#ifdef LIBXML_HTML_ENABLED
2284 int mem_base;
2285 int ret_val;
2286 int val; /* int 0 or 1 */
2287 int n_val;
2288
2289 for (n_val = 0;n_val < gen_nb_int;n_val++) {
2290 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002291 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002292
2293 ret_val = htmlHandleOmittedElem(val);
2294 desret_int(ret_val);
2295 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002296 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002297 xmlResetLastError();
2298 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002299 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002300 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002301 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002302 printf(" %d", n_val);
2303 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002304 }
2305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002306 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002307#endif
2308
Daniel Veillard42595322004-11-08 10:52:06 +00002309 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002310}
2311
2312
2313static int
2314test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002315 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002316
Daniel Veillarda03e3652004-11-02 18:45:30 +00002317#ifdef LIBXML_HTML_ENABLED
2318 int mem_base;
2319 int ret_val;
2320 htmlDocPtr doc; /* the HTML document */
2321 int n_doc;
2322 htmlNodePtr elem; /* the HTML element */
2323 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002324
Daniel Veillarda521d282004-11-09 14:59:59 +00002325 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
2326 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002327 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002328 doc = gen_htmlDocPtr(n_doc, 0);
2329 elem = gen_htmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002330
2331 ret_val = htmlIsAutoClosed(doc, elem);
2332 desret_int(ret_val);
2333 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002334 des_htmlDocPtr(n_doc, doc, 0);
2335 des_htmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002336 xmlResetLastError();
2337 if (mem_base != xmlMemBlocks()) {
2338 printf("Leak of %d blocks found in htmlIsAutoClosed",
2339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002340 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002341 printf(" %d", n_doc);
2342 printf(" %d", n_elem);
2343 printf("\n");
2344 }
2345 }
2346 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002347 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002348#endif
2349
Daniel Veillard42595322004-11-08 10:52:06 +00002350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002351}
2352
2353
2354static int
2355test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002357
2358#ifdef LIBXML_HTML_ENABLED
2359 int mem_base;
2360 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002361 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002362 int n_name;
2363
2364 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2365 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002366 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002367
2368 ret_val = htmlIsScriptAttribute(name);
2369 desret_int(ret_val);
2370 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002371 des_const_xmlChar_ptr(n_name, name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002372 xmlResetLastError();
2373 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002374 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002375 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002376 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002377 printf(" %d", n_name);
2378 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002379 }
2380 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002381 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002382#endif
2383
Daniel Veillard42595322004-11-08 10:52:06 +00002384 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002385}
2386
2387
2388static int
2389test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002390 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002391
Daniel Veillard57b25162004-11-06 14:50:18 +00002392#ifdef LIBXML_HTML_ENABLED
2393 int mem_base;
2394 htmlStatus ret_val;
2395 htmlNodePtr node; /* an htmlNodePtr in a tree */
2396 int n_node;
2397 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2398 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002399
Daniel Veillarda521d282004-11-09 14:59:59 +00002400 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) {
Daniel Veillard57b25162004-11-06 14:50:18 +00002401 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2402 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002403 node = gen_const_htmlNodePtr(n_node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002404 legacy = gen_int(n_legacy, 1);
2405
2406 ret_val = htmlNodeStatus(node, legacy);
2407 desret_htmlStatus(ret_val);
2408 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002409 des_const_htmlNodePtr(n_node, node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002410 des_int(n_legacy, legacy, 1);
2411 xmlResetLastError();
2412 if (mem_base != xmlMemBlocks()) {
2413 printf("Leak of %d blocks found in htmlNodeStatus",
2414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002415 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002416 printf(" %d", n_node);
2417 printf(" %d", n_legacy);
2418 printf("\n");
2419 }
2420 }
2421 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002422 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002423#endif
2424
Daniel Veillard42595322004-11-08 10:52:06 +00002425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002426}
2427
2428
2429static int
2430test_htmlParseCharRef(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 int mem_base;
2435 int ret_val;
2436 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2437 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002438
Daniel Veillarda521d282004-11-09 14:59:59 +00002439 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002440 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002441 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002442
2443 ret_val = htmlParseCharRef(ctxt);
2444 desret_int(ret_val);
2445 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002446 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002447 xmlResetLastError();
2448 if (mem_base != xmlMemBlocks()) {
2449 printf("Leak of %d blocks found in htmlParseCharRef",
2450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002451 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002452 printf(" %d", n_ctxt);
2453 printf("\n");
2454 }
2455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002456 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002457#endif
2458
Daniel Veillard42595322004-11-08 10:52:06 +00002459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002460}
2461
2462
2463static int
2464test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002466
Daniel Veillarda03e3652004-11-02 18:45:30 +00002467#ifdef LIBXML_HTML_ENABLED
2468#ifdef LIBXML_PUSH_ENABLED
2469 int mem_base;
2470 int ret_val;
2471 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2472 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002473 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002474 int n_chunk;
2475 int size; /* the size in byte of the chunk */
2476 int n_size;
2477 int terminate; /* last chunk indicator */
2478 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002479
Daniel Veillarda521d282004-11-09 14:59:59 +00002480 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002481 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2482 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2483 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2484 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002485 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002486 chunk = gen_const_char_ptr(n_chunk, 1);
2487 size = gen_int(n_size, 2);
2488 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002489
2490 ret_val = htmlParseChunk(ctxt, chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +00002491 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002492 desret_int(ret_val);
2493 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002494 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002495 des_const_char_ptr(n_chunk, chunk, 1);
2496 des_int(n_size, size, 2);
2497 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002498 xmlResetLastError();
2499 if (mem_base != xmlMemBlocks()) {
2500 printf("Leak of %d blocks found in htmlParseChunk",
2501 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002502 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002503 printf(" %d", n_ctxt);
2504 printf(" %d", n_chunk);
2505 printf(" %d", n_size);
2506 printf(" %d", n_terminate);
2507 printf("\n");
2508 }
2509 }
2510 }
2511 }
2512 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002513 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002514#endif
2515#endif
2516
Daniel Veillard42595322004-11-08 10:52:06 +00002517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002518}
2519
2520
2521static int
2522test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002524
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002525#ifdef LIBXML_HTML_ENABLED
2526 int mem_base;
2527 htmlDocPtr ret_val;
2528 xmlChar * cur; /* a pointer to an array of xmlChar */
2529 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002530 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002531 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002532
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002533 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2534 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2535 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002536 cur = gen_xmlChar_ptr(n_cur, 0);
2537 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002538
2539 ret_val = htmlParseDoc(cur, encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002540 desret_htmlDocPtr(ret_val);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002541 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002542 des_xmlChar_ptr(n_cur, cur, 0);
2543 des_const_char_ptr(n_encoding, encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002544 xmlResetLastError();
2545 if (mem_base != xmlMemBlocks()) {
2546 printf("Leak of %d blocks found in htmlParseDoc",
2547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002548 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002549 printf(" %d", n_cur);
2550 printf(" %d", n_encoding);
2551 printf("\n");
2552 }
2553 }
2554 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002555 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002556#endif
2557
Daniel Veillard42595322004-11-08 10:52:06 +00002558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002559}
2560
2561
2562static int
2563test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002565
Daniel Veillarda03e3652004-11-02 18:45:30 +00002566#ifdef LIBXML_HTML_ENABLED
2567 int mem_base;
2568 int ret_val;
2569 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2570 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002571
Daniel Veillarda521d282004-11-09 14:59:59 +00002572 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002573 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002574 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002575
2576 ret_val = htmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +00002577 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002578 desret_int(ret_val);
2579 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002580 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002581 xmlResetLastError();
2582 if (mem_base != xmlMemBlocks()) {
2583 printf("Leak of %d blocks found in htmlParseDocument",
2584 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002585 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002586 printf(" %d", n_ctxt);
2587 printf("\n");
2588 }
2589 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002590 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002591#endif
2592
Daniel Veillard42595322004-11-08 10:52:06 +00002593 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002594}
2595
2596
2597static int
2598test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002599 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002600
Daniel Veillarda03e3652004-11-02 18:45:30 +00002601#ifdef LIBXML_HTML_ENABLED
2602 int mem_base;
2603 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2604 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002605
Daniel Veillarda521d282004-11-09 14:59:59 +00002606 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002607 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002608 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002609
2610 htmlParseElement(ctxt);
2611 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002612 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002613 xmlResetLastError();
2614 if (mem_base != xmlMemBlocks()) {
2615 printf("Leak of %d blocks found in htmlParseElement",
2616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002617 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002618 printf(" %d", n_ctxt);
2619 printf("\n");
2620 }
2621 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002622 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002623#endif
2624
Daniel Veillard42595322004-11-08 10:52:06 +00002625 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002626}
2627
2628
2629static int
2630test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002631 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002632
Daniel Veillard42595322004-11-08 10:52:06 +00002633#ifdef LIBXML_HTML_ENABLED
2634 int mem_base;
2635 const htmlEntityDesc * ret_val;
2636 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2637 int n_ctxt;
2638 xmlChar ** str; /* location to store the entity name */
2639 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002640
Daniel Veillarda521d282004-11-09 14:59:59 +00002641 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard42595322004-11-08 10:52:06 +00002642 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2643 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002644 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002645 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2646
2647 ret_val = htmlParseEntityRef(ctxt, str);
2648 desret_const_htmlEntityDesc_ptr(ret_val);
2649 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002650 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002651 des_const_xmlChar_ptr_ptr(n_str, str, 1);
2652 xmlResetLastError();
2653 if (mem_base != xmlMemBlocks()) {
2654 printf("Leak of %d blocks found in htmlParseEntityRef",
2655 xmlMemBlocks() - mem_base);
2656 test_ret++;
2657 printf(" %d", n_ctxt);
2658 printf(" %d", n_str);
2659 printf("\n");
2660 }
2661 }
2662 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002663 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002664#endif
2665
Daniel Veillard42595322004-11-08 10:52:06 +00002666 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002667}
2668
2669
2670static int
2671test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002672 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002673
Daniel Veillarda03e3652004-11-02 18:45:30 +00002674#ifdef LIBXML_HTML_ENABLED
2675 htmlDocPtr ret_val;
2676 const char * filename; /* the filename */
2677 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002678 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002679 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002680
Daniel Veillarda03e3652004-11-02 18:45:30 +00002681 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2682 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002683 filename = gen_filepath(n_filename, 0);
2684 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002685
2686 ret_val = htmlParseFile(filename, encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002687 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002688 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002689 des_filepath(n_filename, filename, 0);
2690 des_const_char_ptr(n_encoding, encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002691 xmlResetLastError();
2692 }
2693 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002694 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002695#endif
2696
Daniel Veillard42595322004-11-08 10:52:06 +00002697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002698}
2699
2700
2701static int
2702test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002704
Daniel Veillarda03e3652004-11-02 18:45:30 +00002705#ifdef LIBXML_HTML_ENABLED
2706 int mem_base;
2707 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002708 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002709 int n_cur;
2710 const char * URL; /* the base URL to use for the document */
2711 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002712 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002713 int n_encoding;
2714 int options; /* a combination of htmlParserOption(s) */
2715 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002716
Daniel Veillarda03e3652004-11-02 18:45:30 +00002717 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2718 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2719 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2720 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2721 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002722 cur = gen_const_xmlChar_ptr(n_cur, 0);
2723 URL = gen_filepath(n_URL, 1);
2724 encoding = gen_const_char_ptr(n_encoding, 2);
2725 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002726
Daniel Veillarda03e3652004-11-02 18:45:30 +00002727 ret_val = htmlReadDoc(cur, URL, encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002728 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002729 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002730 des_const_xmlChar_ptr(n_cur, cur, 0);
2731 des_filepath(n_URL, URL, 1);
2732 des_const_char_ptr(n_encoding, encoding, 2);
2733 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002734 xmlResetLastError();
2735 if (mem_base != xmlMemBlocks()) {
2736 printf("Leak of %d blocks found in htmlReadDoc",
2737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002738 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002739 printf(" %d", n_cur);
2740 printf(" %d", n_URL);
2741 printf(" %d", n_encoding);
2742 printf(" %d", n_options);
2743 printf("\n");
2744 }
2745 }
2746 }
2747 }
2748 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002749 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002750#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002751
Daniel Veillard42595322004-11-08 10:52:06 +00002752 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002753}
2754
2755
2756static int
2757test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002759
Daniel Veillarda03e3652004-11-02 18:45:30 +00002760#ifdef LIBXML_HTML_ENABLED
2761 int mem_base;
2762 htmlDocPtr ret_val;
2763 const char * filename; /* a file or URL */
2764 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002765 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002766 int n_encoding;
2767 int options; /* a combination of htmlParserOption(s) */
2768 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002769
Daniel Veillarda03e3652004-11-02 18:45:30 +00002770 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2771 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2772 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2773 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002774 filename = gen_filepath(n_filename, 0);
2775 encoding = gen_const_char_ptr(n_encoding, 1);
2776 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002777
2778 ret_val = htmlReadFile(filename, encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002779 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002780 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002781 des_filepath(n_filename, filename, 0);
2782 des_const_char_ptr(n_encoding, encoding, 1);
2783 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002784 xmlResetLastError();
2785 if (mem_base != xmlMemBlocks()) {
2786 printf("Leak of %d blocks found in htmlReadFile",
2787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002788 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002789 printf(" %d", n_filename);
2790 printf(" %d", n_encoding);
2791 printf(" %d", n_options);
2792 printf("\n");
2793 }
2794 }
2795 }
2796 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002797 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002798#endif
2799
Daniel Veillard42595322004-11-08 10:52:06 +00002800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002801}
2802
2803
2804static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002805test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002807
Daniel Veillarda03e3652004-11-02 18:45:30 +00002808#ifdef LIBXML_HTML_ENABLED
2809 int mem_base;
2810 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002811 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002812 int n_buffer;
2813 int size; /* the size of the array */
2814 int n_size;
2815 const char * URL; /* the base URL to use for the document */
2816 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002817 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002818 int n_encoding;
2819 int options; /* a combination of htmlParserOption(s) */
2820 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002821
Daniel Veillarda03e3652004-11-02 18:45:30 +00002822 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2823 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2824 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2825 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2826 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2827 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002828 buffer = gen_const_char_ptr(n_buffer, 0);
2829 size = gen_int(n_size, 1);
2830 URL = gen_filepath(n_URL, 2);
2831 encoding = gen_const_char_ptr(n_encoding, 3);
2832 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002833
2834 ret_val = htmlReadMemory(buffer, size, URL, encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002835 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002836 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002837 des_const_char_ptr(n_buffer, buffer, 0);
2838 des_int(n_size, size, 1);
2839 des_filepath(n_URL, URL, 2);
2840 des_const_char_ptr(n_encoding, encoding, 3);
2841 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002842 xmlResetLastError();
2843 if (mem_base != xmlMemBlocks()) {
2844 printf("Leak of %d blocks found in htmlReadMemory",
2845 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002846 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002847 printf(" %d", n_buffer);
2848 printf(" %d", n_size);
2849 printf(" %d", n_URL);
2850 printf(" %d", n_encoding);
2851 printf(" %d", n_options);
2852 printf("\n");
2853 }
2854 }
2855 }
2856 }
2857 }
2858 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002859 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002860#endif
2861
Daniel Veillard42595322004-11-08 10:52:06 +00002862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002863}
2864
2865
2866static int
2867test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002869
Daniel Veillardce682bc2004-11-05 17:22:25 +00002870#ifdef LIBXML_HTML_ENABLED
2871 int mem_base;
2872 htmlDocPtr ret_val;
2873 xmlChar * cur; /* a pointer to an array of xmlChar */
2874 int n_cur;
2875 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2876 int n_encoding;
2877 htmlSAXHandlerPtr sax; /* the SAX handler block */
2878 int n_sax;
2879 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2880 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002881
Daniel Veillardce682bc2004-11-05 17:22:25 +00002882 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2883 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2884 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2885 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2886 mem_base = xmlMemBlocks();
2887 cur = gen_xmlChar_ptr(n_cur, 0);
2888 encoding = gen_const_char_ptr(n_encoding, 1);
2889 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2890 userData = gen_userdata(n_userData, 3);
2891
2892 ret_val = htmlSAXParseDoc(cur, encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002893 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002894 call_tests++;
2895 des_xmlChar_ptr(n_cur, cur, 0);
2896 des_const_char_ptr(n_encoding, encoding, 1);
2897 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2898 des_userdata(n_userData, userData, 3);
2899 xmlResetLastError();
2900 if (mem_base != xmlMemBlocks()) {
2901 printf("Leak of %d blocks found in htmlSAXParseDoc",
2902 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002903 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002904 printf(" %d", n_cur);
2905 printf(" %d", n_encoding);
2906 printf(" %d", n_sax);
2907 printf(" %d", n_userData);
2908 printf("\n");
2909 }
2910 }
2911 }
2912 }
2913 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002914 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002915#endif
2916
Daniel Veillard42595322004-11-08 10:52:06 +00002917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002918}
2919
2920
2921static int
2922test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002924
Daniel Veillardce682bc2004-11-05 17:22:25 +00002925#ifdef LIBXML_HTML_ENABLED
2926 int mem_base;
2927 htmlDocPtr ret_val;
2928 const char * filename; /* the filename */
2929 int n_filename;
2930 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2931 int n_encoding;
2932 htmlSAXHandlerPtr sax; /* the SAX handler block */
2933 int n_sax;
2934 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2935 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002936
Daniel Veillardce682bc2004-11-05 17:22:25 +00002937 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2938 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2939 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2940 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2941 mem_base = xmlMemBlocks();
2942 filename = gen_filepath(n_filename, 0);
2943 encoding = gen_const_char_ptr(n_encoding, 1);
2944 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2945 userData = gen_userdata(n_userData, 3);
2946
2947 ret_val = htmlSAXParseFile(filename, encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002948 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002949 call_tests++;
2950 des_filepath(n_filename, filename, 0);
2951 des_const_char_ptr(n_encoding, encoding, 1);
2952 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2953 des_userdata(n_userData, userData, 3);
2954 xmlResetLastError();
2955 if (mem_base != xmlMemBlocks()) {
2956 printf("Leak of %d blocks found in htmlSAXParseFile",
2957 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002958 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002959 printf(" %d", n_filename);
2960 printf(" %d", n_encoding);
2961 printf(" %d", n_sax);
2962 printf(" %d", n_userData);
2963 printf("\n");
2964 }
2965 }
2966 }
2967 }
2968 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002969 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002970#endif
2971
Daniel Veillard42595322004-11-08 10:52:06 +00002972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002973}
2974
2975
2976static int
2977test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002978 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002979
2980
2981 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002982 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002983}
2984
2985static int
2986test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002987 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002988
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002989 if (quiet == 0) printf("Testing HTMLparser : 31 of 37 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00002990 test_ret += test_UTF8ToHtml();
2991 test_ret += test_htmlAttrAllowed();
2992 test_ret += test_htmlAutoCloseTag();
2993 test_ret += test_htmlCreateMemoryParserCtxt();
2994 test_ret += test_htmlCreatePushParserCtxt();
2995 test_ret += test_htmlCtxtReadDoc();
2996 test_ret += test_htmlCtxtReadFile();
2997 test_ret += test_htmlCtxtReadMemory();
2998 test_ret += test_htmlCtxtReset();
2999 test_ret += test_htmlCtxtUseOptions();
3000 test_ret += test_htmlElementAllowedHere();
3001 test_ret += test_htmlElementStatusHere();
3002 test_ret += test_htmlEncodeEntities();
3003 test_ret += test_htmlEntityLookup();
3004 test_ret += test_htmlEntityValueLookup();
3005 test_ret += test_htmlHandleOmittedElem();
3006 test_ret += test_htmlIsAutoClosed();
3007 test_ret += test_htmlIsScriptAttribute();
3008 test_ret += test_htmlNodeStatus();
3009 test_ret += test_htmlParseCharRef();
3010 test_ret += test_htmlParseChunk();
3011 test_ret += test_htmlParseDoc();
3012 test_ret += test_htmlParseDocument();
3013 test_ret += test_htmlParseElement();
3014 test_ret += test_htmlParseEntityRef();
3015 test_ret += test_htmlParseFile();
3016 test_ret += test_htmlReadDoc();
3017 test_ret += test_htmlReadFile();
3018 test_ret += test_htmlReadMemory();
3019 test_ret += test_htmlSAXParseDoc();
3020 test_ret += test_htmlSAXParseFile();
3021 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003022
Daniel Veillard42595322004-11-08 10:52:06 +00003023 if (test_ret != 0)
3024 printf("Module HTMLparser: %d errors\n", test_ret);
3025 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003026}
3027
3028static int
3029test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003031
Daniel Veillard3d97e662004-11-04 10:49:00 +00003032#ifdef LIBXML_HTML_ENABLED
3033#ifdef LIBXML_OUTPUT_ENABLED
3034 int mem_base;
3035 xmlOutputBufferPtr buf; /* the HTML buffer output */
3036 int n_buf;
3037 xmlDocPtr cur; /* the document */
3038 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003039 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003040 int n_encoding;
3041 int format; /* should formatting spaces been added */
3042 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003043
Daniel Veillard3d97e662004-11-04 10:49:00 +00003044 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3045 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3046 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3047 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3048 mem_base = xmlMemBlocks();
3049 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3050 cur = gen_xmlDocPtr(n_cur, 1);
3051 encoding = gen_const_char_ptr(n_encoding, 2);
3052 format = gen_int(n_format, 3);
3053
3054 htmlDocContentDumpFormatOutput(buf, cur, encoding, format);
3055 call_tests++;
3056 des_xmlOutputBufferPtr(n_buf, buf, 0);
3057 des_xmlDocPtr(n_cur, cur, 1);
3058 des_const_char_ptr(n_encoding, encoding, 2);
3059 des_int(n_format, format, 3);
3060 xmlResetLastError();
3061 if (mem_base != xmlMemBlocks()) {
3062 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
3063 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003064 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003065 printf(" %d", n_buf);
3066 printf(" %d", n_cur);
3067 printf(" %d", n_encoding);
3068 printf(" %d", n_format);
3069 printf("\n");
3070 }
3071 }
3072 }
3073 }
3074 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003075 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003076#endif
3077#endif
3078
Daniel Veillard42595322004-11-08 10:52:06 +00003079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003080}
3081
3082
3083static int
3084test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003086
Daniel Veillard3d97e662004-11-04 10:49:00 +00003087#ifdef LIBXML_HTML_ENABLED
3088#ifdef LIBXML_OUTPUT_ENABLED
3089 int mem_base;
3090 xmlOutputBufferPtr buf; /* the HTML buffer output */
3091 int n_buf;
3092 xmlDocPtr cur; /* the document */
3093 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003094 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003095 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003096
Daniel Veillard3d97e662004-11-04 10:49:00 +00003097 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3098 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3099 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3100 mem_base = xmlMemBlocks();
3101 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3102 cur = gen_xmlDocPtr(n_cur, 1);
3103 encoding = gen_const_char_ptr(n_encoding, 2);
3104
3105 htmlDocContentDumpOutput(buf, cur, encoding);
3106 call_tests++;
3107 des_xmlOutputBufferPtr(n_buf, buf, 0);
3108 des_xmlDocPtr(n_cur, cur, 1);
3109 des_const_char_ptr(n_encoding, encoding, 2);
3110 xmlResetLastError();
3111 if (mem_base != xmlMemBlocks()) {
3112 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
3113 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003114 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003115 printf(" %d", n_buf);
3116 printf(" %d", n_cur);
3117 printf(" %d", n_encoding);
3118 printf("\n");
3119 }
3120 }
3121 }
3122 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003123 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003124#endif
3125#endif
3126
Daniel Veillard42595322004-11-08 10:52:06 +00003127 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003128}
3129
3130
3131static int
3132test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003133 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003134
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003135#ifdef LIBXML_HTML_ENABLED
3136#ifdef LIBXML_OUTPUT_ENABLED
3137 int mem_base;
3138 int ret_val;
3139 FILE * f; /* the FILE* */
3140 int n_f;
3141 xmlDocPtr cur; /* the document */
3142 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003143
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003144 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
3145 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3146 mem_base = xmlMemBlocks();
3147 f = gen_FILE_ptr(n_f, 0);
3148 cur = gen_xmlDocPtr(n_cur, 1);
3149
3150 ret_val = htmlDocDump(f, cur);
3151 desret_int(ret_val);
3152 call_tests++;
3153 des_FILE_ptr(n_f, f, 0);
3154 des_xmlDocPtr(n_cur, cur, 1);
3155 xmlResetLastError();
3156 if (mem_base != xmlMemBlocks()) {
3157 printf("Leak of %d blocks found in htmlDocDump",
3158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003159 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003160 printf(" %d", n_f);
3161 printf(" %d", n_cur);
3162 printf("\n");
3163 }
3164 }
3165 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003166 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003167#endif
3168#endif
3169
Daniel Veillard42595322004-11-08 10:52:06 +00003170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003171}
3172
3173
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003174#define gen_nb_xmlChar_ptr_ptr 1
3175static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3176 return(NULL);
3177}
3178static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3179}
3180
Daniel Veillardd93f6252004-11-02 15:53:51 +00003181static int
3182test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003184
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003185#ifdef LIBXML_HTML_ENABLED
3186#ifdef LIBXML_OUTPUT_ENABLED
3187 int mem_base;
3188 xmlDocPtr cur; /* the document */
3189 int n_cur;
3190 xmlChar ** mem; /* OUT: the memory pointer */
3191 int n_mem;
3192 int * size; /* OUT: the memory length */
3193 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003194
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003195 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3196 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
3197 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
3198 mem_base = xmlMemBlocks();
3199 cur = gen_xmlDocPtr(n_cur, 0);
3200 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
3201 size = gen_int_ptr(n_size, 2);
3202
3203 htmlDocDumpMemory(cur, mem, size);
3204 call_tests++;
3205 des_xmlDocPtr(n_cur, cur, 0);
3206 des_xmlChar_ptr_ptr(n_mem, mem, 1);
3207 des_int_ptr(n_size, size, 2);
3208 xmlResetLastError();
3209 if (mem_base != xmlMemBlocks()) {
3210 printf("Leak of %d blocks found in htmlDocDumpMemory",
3211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003212 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003213 printf(" %d", n_cur);
3214 printf(" %d", n_mem);
3215 printf(" %d", n_size);
3216 printf("\n");
3217 }
3218 }
3219 }
3220 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003221 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003222#endif
3223#endif
3224
Daniel Veillard42595322004-11-08 10:52:06 +00003225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003226}
3227
3228
3229static int
3230test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003232
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003233#ifdef LIBXML_HTML_ENABLED
3234 int mem_base;
3235 const xmlChar * ret_val;
3236 htmlDocPtr doc; /* the document */
3237 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003238
Daniel Veillarda521d282004-11-09 14:59:59 +00003239 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003240 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003241 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003242
3243 ret_val = htmlGetMetaEncoding(doc);
3244 desret_const_xmlChar_ptr(ret_val);
3245 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003246 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003247 xmlResetLastError();
3248 if (mem_base != xmlMemBlocks()) {
3249 printf("Leak of %d blocks found in htmlGetMetaEncoding",
3250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003251 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003252 printf(" %d", n_doc);
3253 printf("\n");
3254 }
3255 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003256 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003257#endif
3258
Daniel Veillard42595322004-11-08 10:52:06 +00003259 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003260}
3261
3262
3263static int
3264test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003265 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003266
3267#ifdef LIBXML_HTML_ENABLED
3268 int mem_base;
3269 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003270 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003271 int n_name;
3272
3273 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3274 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003275 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003276
3277 ret_val = htmlIsBooleanAttr(name);
3278 desret_int(ret_val);
3279 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003280 des_const_xmlChar_ptr(n_name, name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003281 xmlResetLastError();
3282 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003283 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003285 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003286 printf(" %d", n_name);
3287 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003288 }
3289 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003290 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003291#endif
3292
Daniel Veillard42595322004-11-08 10:52:06 +00003293 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003294}
3295
3296
3297static int
3298test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003300
Daniel Veillarda03e3652004-11-02 18:45:30 +00003301#ifdef LIBXML_HTML_ENABLED
3302 int mem_base;
3303 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003304 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003305 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003306 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003307 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003308
Daniel Veillarda03e3652004-11-02 18:45:30 +00003309 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3310 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3311 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003312 URI = gen_const_xmlChar_ptr(n_URI, 0);
3313 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003314
3315 ret_val = htmlNewDoc(URI, ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003316 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003317 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003318 des_const_xmlChar_ptr(n_URI, URI, 0);
3319 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003320 xmlResetLastError();
3321 if (mem_base != xmlMemBlocks()) {
3322 printf("Leak of %d blocks found in htmlNewDoc",
3323 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003324 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003325 printf(" %d", n_URI);
3326 printf(" %d", n_ExternalID);
3327 printf("\n");
3328 }
3329 }
3330 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003331 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003332#endif
3333
Daniel Veillard42595322004-11-08 10:52:06 +00003334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003335}
3336
3337
3338static int
3339test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003341
Daniel Veillarda03e3652004-11-02 18:45:30 +00003342#ifdef LIBXML_HTML_ENABLED
3343 int mem_base;
3344 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003345 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003346 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003347 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003348 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003349
Daniel Veillarda03e3652004-11-02 18:45:30 +00003350 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3351 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3352 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003353 URI = gen_const_xmlChar_ptr(n_URI, 0);
3354 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003355
3356 ret_val = htmlNewDocNoDtD(URI, ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003357 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003358 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003359 des_const_xmlChar_ptr(n_URI, URI, 0);
3360 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003361 xmlResetLastError();
3362 if (mem_base != xmlMemBlocks()) {
3363 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003365 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003366 printf(" %d", n_URI);
3367 printf(" %d", n_ExternalID);
3368 printf("\n");
3369 }
3370 }
3371 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003372 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003373#endif
3374
Daniel Veillard42595322004-11-08 10:52:06 +00003375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003376}
3377
3378
3379static int
3380test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003382
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003383#ifdef LIBXML_HTML_ENABLED
3384#ifdef LIBXML_OUTPUT_ENABLED
3385 int mem_base;
3386 int ret_val;
3387 xmlBufferPtr buf; /* the HTML buffer output */
3388 int n_buf;
3389 xmlDocPtr doc; /* the document */
3390 int n_doc;
3391 xmlNodePtr cur; /* the current node */
3392 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003393
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003394 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3395 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3396 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3397 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003398 buf = gen_xmlBufferPtr(n_buf, 0);
3399 doc = gen_xmlDocPtr(n_doc, 1);
3400 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003401
3402 ret_val = htmlNodeDump(buf, doc, cur);
3403 desret_int(ret_val);
3404 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003405 des_xmlBufferPtr(n_buf, buf, 0);
3406 des_xmlDocPtr(n_doc, doc, 1);
3407 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003408 xmlResetLastError();
3409 if (mem_base != xmlMemBlocks()) {
3410 printf("Leak of %d blocks found in htmlNodeDump",
3411 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003412 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003413 printf(" %d", n_buf);
3414 printf(" %d", n_doc);
3415 printf(" %d", n_cur);
3416 printf("\n");
3417 }
3418 }
3419 }
3420 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003421 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003422#endif
3423#endif
3424
Daniel Veillard42595322004-11-08 10:52:06 +00003425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003426}
3427
3428
3429static int
3430test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003432
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003433#ifdef LIBXML_HTML_ENABLED
3434#ifdef LIBXML_OUTPUT_ENABLED
3435 int mem_base;
3436 FILE * out; /* the FILE pointer */
3437 int n_out;
3438 xmlDocPtr doc; /* the document */
3439 int n_doc;
3440 xmlNodePtr cur; /* the current node */
3441 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003442
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003443 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3444 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3445 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3446 mem_base = xmlMemBlocks();
3447 out = gen_FILE_ptr(n_out, 0);
3448 doc = gen_xmlDocPtr(n_doc, 1);
3449 cur = gen_xmlNodePtr(n_cur, 2);
3450
3451 htmlNodeDumpFile(out, doc, cur);
3452 call_tests++;
3453 des_FILE_ptr(n_out, out, 0);
3454 des_xmlDocPtr(n_doc, doc, 1);
3455 des_xmlNodePtr(n_cur, cur, 2);
3456 xmlResetLastError();
3457 if (mem_base != xmlMemBlocks()) {
3458 printf("Leak of %d blocks found in htmlNodeDumpFile",
3459 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003460 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003461 printf(" %d", n_out);
3462 printf(" %d", n_doc);
3463 printf(" %d", n_cur);
3464 printf("\n");
3465 }
3466 }
3467 }
3468 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003469 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003470#endif
3471#endif
3472
Daniel Veillard42595322004-11-08 10:52:06 +00003473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003474}
3475
3476
3477static int
3478test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003479 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003480
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003481#ifdef LIBXML_HTML_ENABLED
3482#ifdef LIBXML_OUTPUT_ENABLED
3483 int mem_base;
3484 int ret_val;
3485 FILE * out; /* the FILE pointer */
3486 int n_out;
3487 xmlDocPtr doc; /* the document */
3488 int n_doc;
3489 xmlNodePtr cur; /* the current node */
3490 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003491 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003492 int n_encoding;
3493 int format; /* should formatting spaces been added */
3494 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003495
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003496 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3497 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3498 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3499 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3500 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3501 mem_base = xmlMemBlocks();
3502 out = gen_FILE_ptr(n_out, 0);
3503 doc = gen_xmlDocPtr(n_doc, 1);
3504 cur = gen_xmlNodePtr(n_cur, 2);
3505 encoding = gen_const_char_ptr(n_encoding, 3);
3506 format = gen_int(n_format, 4);
3507
3508 ret_val = htmlNodeDumpFileFormat(out, doc, cur, encoding, format);
3509 desret_int(ret_val);
3510 call_tests++;
3511 des_FILE_ptr(n_out, out, 0);
3512 des_xmlDocPtr(n_doc, doc, 1);
3513 des_xmlNodePtr(n_cur, cur, 2);
3514 des_const_char_ptr(n_encoding, encoding, 3);
3515 des_int(n_format, format, 4);
3516 xmlResetLastError();
3517 if (mem_base != xmlMemBlocks()) {
3518 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003520 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003521 printf(" %d", n_out);
3522 printf(" %d", n_doc);
3523 printf(" %d", n_cur);
3524 printf(" %d", n_encoding);
3525 printf(" %d", n_format);
3526 printf("\n");
3527 }
3528 }
3529 }
3530 }
3531 }
3532 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003533 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003534#endif
3535#endif
3536
Daniel Veillard42595322004-11-08 10:52:06 +00003537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003538}
3539
3540
3541static int
3542test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003544
Daniel Veillard3d97e662004-11-04 10:49:00 +00003545#ifdef LIBXML_HTML_ENABLED
3546#ifdef LIBXML_OUTPUT_ENABLED
3547 int mem_base;
3548 xmlOutputBufferPtr buf; /* the HTML buffer output */
3549 int n_buf;
3550 xmlDocPtr doc; /* the document */
3551 int n_doc;
3552 xmlNodePtr cur; /* the current node */
3553 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003554 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003555 int n_encoding;
3556 int format; /* should formatting spaces been added */
3557 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003558
Daniel Veillard3d97e662004-11-04 10:49:00 +00003559 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3560 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3561 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3562 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3563 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3564 mem_base = xmlMemBlocks();
3565 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3566 doc = gen_xmlDocPtr(n_doc, 1);
3567 cur = gen_xmlNodePtr(n_cur, 2);
3568 encoding = gen_const_char_ptr(n_encoding, 3);
3569 format = gen_int(n_format, 4);
3570
3571 htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format);
3572 call_tests++;
3573 des_xmlOutputBufferPtr(n_buf, buf, 0);
3574 des_xmlDocPtr(n_doc, doc, 1);
3575 des_xmlNodePtr(n_cur, cur, 2);
3576 des_const_char_ptr(n_encoding, encoding, 3);
3577 des_int(n_format, format, 4);
3578 xmlResetLastError();
3579 if (mem_base != xmlMemBlocks()) {
3580 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003582 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003583 printf(" %d", n_buf);
3584 printf(" %d", n_doc);
3585 printf(" %d", n_cur);
3586 printf(" %d", n_encoding);
3587 printf(" %d", n_format);
3588 printf("\n");
3589 }
3590 }
3591 }
3592 }
3593 }
3594 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003595 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003596#endif
3597#endif
3598
Daniel Veillard42595322004-11-08 10:52:06 +00003599 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003600}
3601
3602
3603static int
3604test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003605 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003606
Daniel Veillard3d97e662004-11-04 10:49:00 +00003607#ifdef LIBXML_HTML_ENABLED
3608#ifdef LIBXML_OUTPUT_ENABLED
3609 int mem_base;
3610 xmlOutputBufferPtr buf; /* the HTML buffer output */
3611 int n_buf;
3612 xmlDocPtr doc; /* the document */
3613 int n_doc;
3614 xmlNodePtr cur; /* the current node */
3615 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003616 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003617 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003618
Daniel Veillard3d97e662004-11-04 10:49:00 +00003619 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3620 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3621 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3622 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3623 mem_base = xmlMemBlocks();
3624 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3625 doc = gen_xmlDocPtr(n_doc, 1);
3626 cur = gen_xmlNodePtr(n_cur, 2);
3627 encoding = gen_const_char_ptr(n_encoding, 3);
3628
3629 htmlNodeDumpOutput(buf, doc, cur, encoding);
3630 call_tests++;
3631 des_xmlOutputBufferPtr(n_buf, buf, 0);
3632 des_xmlDocPtr(n_doc, doc, 1);
3633 des_xmlNodePtr(n_cur, cur, 2);
3634 des_const_char_ptr(n_encoding, encoding, 3);
3635 xmlResetLastError();
3636 if (mem_base != xmlMemBlocks()) {
3637 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003639 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003640 printf(" %d", n_buf);
3641 printf(" %d", n_doc);
3642 printf(" %d", n_cur);
3643 printf(" %d", n_encoding);
3644 printf("\n");
3645 }
3646 }
3647 }
3648 }
3649 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003650 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003651#endif
3652#endif
3653
Daniel Veillard42595322004-11-08 10:52:06 +00003654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003655}
3656
3657
3658static int
3659test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003661
3662#ifdef LIBXML_HTML_ENABLED
3663#ifdef LIBXML_OUTPUT_ENABLED
3664 int mem_base;
3665 int ret_val;
3666 const char * filename; /* the filename (or URL) */
3667 int n_filename;
3668 xmlDocPtr cur; /* the document */
3669 int n_cur;
3670
3671 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3672 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3673 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003674 filename = gen_fileoutput(n_filename, 0);
3675 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003676
3677 ret_val = htmlSaveFile(filename, cur);
3678 desret_int(ret_val);
3679 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003680 des_fileoutput(n_filename, filename, 0);
3681 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003682 xmlResetLastError();
3683 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003684 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003686 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003687 printf(" %d", n_filename);
3688 printf(" %d", n_cur);
3689 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003690 }
3691 }
3692 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003693 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003694#endif
3695#endif
3696
Daniel Veillard42595322004-11-08 10:52:06 +00003697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003698}
3699
3700
3701static int
3702test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003704
3705#ifdef LIBXML_HTML_ENABLED
3706#ifdef LIBXML_OUTPUT_ENABLED
3707 int mem_base;
3708 int ret_val;
3709 const char * filename; /* the filename */
3710 int n_filename;
3711 xmlDocPtr cur; /* the document */
3712 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003713 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003714 int n_encoding;
3715
3716 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3717 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3718 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3719 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003720 filename = gen_fileoutput(n_filename, 0);
3721 cur = gen_xmlDocPtr(n_cur, 1);
3722 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003723
3724 ret_val = htmlSaveFileEnc(filename, cur, encoding);
3725 desret_int(ret_val);
3726 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003727 des_fileoutput(n_filename, filename, 0);
3728 des_xmlDocPtr(n_cur, cur, 1);
3729 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003730 xmlResetLastError();
3731 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003732 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003733 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003734 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003735 printf(" %d", n_filename);
3736 printf(" %d", n_cur);
3737 printf(" %d", n_encoding);
3738 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003739 }
3740 }
3741 }
3742 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003743 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003744#endif
3745#endif
3746
Daniel Veillard42595322004-11-08 10:52:06 +00003747 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003748}
3749
3750
3751static int
3752test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003753 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003754
3755#ifdef LIBXML_HTML_ENABLED
3756#ifdef LIBXML_OUTPUT_ENABLED
3757 int mem_base;
3758 int ret_val;
3759 const char * filename; /* the filename */
3760 int n_filename;
3761 xmlDocPtr cur; /* the document */
3762 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003763 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003764 int n_encoding;
3765 int format; /* should formatting spaces been added */
3766 int n_format;
3767
3768 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3769 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3770 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3771 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3772 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003773 filename = gen_fileoutput(n_filename, 0);
3774 cur = gen_xmlDocPtr(n_cur, 1);
3775 encoding = gen_const_char_ptr(n_encoding, 2);
3776 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003777
3778 ret_val = htmlSaveFileFormat(filename, cur, encoding, format);
3779 desret_int(ret_val);
3780 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003781 des_fileoutput(n_filename, filename, 0);
3782 des_xmlDocPtr(n_cur, cur, 1);
3783 des_const_char_ptr(n_encoding, encoding, 2);
3784 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003785 xmlResetLastError();
3786 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003787 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003789 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003790 printf(" %d", n_filename);
3791 printf(" %d", n_cur);
3792 printf(" %d", n_encoding);
3793 printf(" %d", n_format);
3794 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003795 }
3796 }
3797 }
3798 }
3799 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003800 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003801#endif
3802#endif
3803
Daniel Veillard42595322004-11-08 10:52:06 +00003804 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003805}
3806
3807
3808static int
3809test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003810 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003811
Daniel Veillarda03e3652004-11-02 18:45:30 +00003812#ifdef LIBXML_HTML_ENABLED
3813 int mem_base;
3814 int ret_val;
3815 htmlDocPtr doc; /* the document */
3816 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003817 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003818 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003819
Daniel Veillarda521d282004-11-09 14:59:59 +00003820 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003821 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3822 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003823 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003824 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003825
3826 ret_val = htmlSetMetaEncoding(doc, encoding);
3827 desret_int(ret_val);
3828 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003829 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003830 des_const_xmlChar_ptr(n_encoding, encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003831 xmlResetLastError();
3832 if (mem_base != xmlMemBlocks()) {
3833 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3834 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003835 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003836 printf(" %d", n_doc);
3837 printf(" %d", n_encoding);
3838 printf("\n");
3839 }
3840 }
3841 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003842 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003843#endif
3844
Daniel Veillard42595322004-11-08 10:52:06 +00003845 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003846}
3847
3848static int
3849test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003851
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003852 if (quiet == 0) printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003853 test_ret += test_htmlDocContentDumpFormatOutput();
3854 test_ret += test_htmlDocContentDumpOutput();
3855 test_ret += test_htmlDocDump();
3856 test_ret += test_htmlDocDumpMemory();
3857 test_ret += test_htmlGetMetaEncoding();
3858 test_ret += test_htmlIsBooleanAttr();
3859 test_ret += test_htmlNewDoc();
3860 test_ret += test_htmlNewDocNoDtD();
3861 test_ret += test_htmlNodeDump();
3862 test_ret += test_htmlNodeDumpFile();
3863 test_ret += test_htmlNodeDumpFileFormat();
3864 test_ret += test_htmlNodeDumpFormatOutput();
3865 test_ret += test_htmlNodeDumpOutput();
3866 test_ret += test_htmlSaveFile();
3867 test_ret += test_htmlSaveFileEnc();
3868 test_ret += test_htmlSaveFileFormat();
3869 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003870
Daniel Veillard42595322004-11-08 10:52:06 +00003871 if (test_ret != 0)
3872 printf("Module HTMLtree: %d errors\n", test_ret);
3873 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003874}
3875
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003876static int
3877test_docbDefaultSAXHandlerInit(void) {
3878 int test_ret = 0;
3879
Daniel Veillarda521d282004-11-09 14:59:59 +00003880#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003881 int mem_base;
3882
3883 mem_base = xmlMemBlocks();
3884
3885 docbDefaultSAXHandlerInit();
3886 call_tests++;
3887 xmlResetLastError();
3888 if (mem_base != xmlMemBlocks()) {
3889 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3890 xmlMemBlocks() - mem_base);
3891 test_ret++;
3892 printf("\n");
3893 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003894 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003895#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003896
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003897 return(test_ret);
3898}
3899
3900
3901static int
3902test_htmlDefaultSAXHandlerInit(void) {
3903 int test_ret = 0;
3904
Daniel Veillarda521d282004-11-09 14:59:59 +00003905#ifdef LIBXML_HTML_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003906 int mem_base;
3907
3908 mem_base = xmlMemBlocks();
3909
3910 htmlDefaultSAXHandlerInit();
3911 call_tests++;
3912 xmlResetLastError();
3913 if (mem_base != xmlMemBlocks()) {
3914 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3915 xmlMemBlocks() - mem_base);
3916 test_ret++;
3917 printf("\n");
3918 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003919 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003920#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003921
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003922 return(test_ret);
3923}
3924
3925
3926static int
3927test_xmlDefaultSAXHandlerInit(void) {
3928 int test_ret = 0;
3929
3930 int mem_base;
3931
3932 mem_base = xmlMemBlocks();
3933
3934 xmlDefaultSAXHandlerInit();
3935 call_tests++;
3936 xmlResetLastError();
3937 if (mem_base != xmlMemBlocks()) {
3938 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3939 xmlMemBlocks() - mem_base);
3940 test_ret++;
3941 printf("\n");
3942 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003943 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003944
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003945 return(test_ret);
3946}
3947
3948
3949#define gen_nb_xmlEnumerationPtr 1
3950static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3951 return(NULL);
3952}
3953static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3954}
3955
3956static int
3957test_xmlSAX2AttributeDecl(void) {
3958 int test_ret = 0;
3959
3960 int mem_base;
3961 void * ctx; /* the user data (XML parser context) */
3962 int n_ctx;
3963 xmlChar * elem; /* the name of the element */
3964 int n_elem;
3965 xmlChar * fullname; /* the attribute name */
3966 int n_fullname;
3967 int type; /* the attribute type */
3968 int n_type;
3969 int def; /* the type of default value */
3970 int n_def;
3971 xmlChar * defaultValue; /* the attribute default value */
3972 int n_defaultValue;
3973 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3974 int n_tree;
3975
3976 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3977 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3978 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3979 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3980 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3981 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3982 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3983 mem_base = xmlMemBlocks();
3984 ctx = gen_void_ptr(n_ctx, 0);
3985 elem = gen_const_xmlChar_ptr(n_elem, 1);
3986 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3987 type = gen_int(n_type, 3);
3988 def = gen_int(n_def, 4);
3989 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3990 tree = gen_xmlEnumerationPtr(n_tree, 6);
3991
3992 xmlSAX2AttributeDecl(ctx, elem, fullname, type, def, defaultValue, tree);
3993 call_tests++;
3994 des_void_ptr(n_ctx, ctx, 0);
3995 des_const_xmlChar_ptr(n_elem, elem, 1);
3996 des_const_xmlChar_ptr(n_fullname, fullname, 2);
3997 des_int(n_type, type, 3);
3998 des_int(n_def, def, 4);
3999 des_const_xmlChar_ptr(n_defaultValue, defaultValue, 5);
4000 des_xmlEnumerationPtr(n_tree, tree, 6);
4001 xmlResetLastError();
4002 if (mem_base != xmlMemBlocks()) {
4003 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
4004 xmlMemBlocks() - mem_base);
4005 test_ret++;
4006 printf(" %d", n_ctx);
4007 printf(" %d", n_elem);
4008 printf(" %d", n_fullname);
4009 printf(" %d", n_type);
4010 printf(" %d", n_def);
4011 printf(" %d", n_defaultValue);
4012 printf(" %d", n_tree);
4013 printf("\n");
4014 }
4015 }
4016 }
4017 }
4018 }
4019 }
4020 }
4021 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004022 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004023
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004024 return(test_ret);
4025}
4026
4027
4028static int
4029test_xmlSAX2CDataBlock(void) {
4030 int test_ret = 0;
4031
4032 int mem_base;
4033 void * ctx; /* the user data (XML parser context) */
4034 int n_ctx;
4035 xmlChar * value; /* The pcdata content */
4036 int n_value;
4037 int len; /* the block length */
4038 int n_len;
4039
4040 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4041 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
4042 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4043 mem_base = xmlMemBlocks();
4044 ctx = gen_void_ptr(n_ctx, 0);
4045 value = gen_const_xmlChar_ptr(n_value, 1);
4046 len = gen_int(n_len, 2);
4047
4048 xmlSAX2CDataBlock(ctx, value, len);
4049 call_tests++;
4050 des_void_ptr(n_ctx, ctx, 0);
4051 des_const_xmlChar_ptr(n_value, value, 1);
4052 des_int(n_len, len, 2);
4053 xmlResetLastError();
4054 if (mem_base != xmlMemBlocks()) {
4055 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
4056 xmlMemBlocks() - mem_base);
4057 test_ret++;
4058 printf(" %d", n_ctx);
4059 printf(" %d", n_value);
4060 printf(" %d", n_len);
4061 printf("\n");
4062 }
4063 }
4064 }
4065 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004066 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004067
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004068 return(test_ret);
4069}
4070
4071
4072static int
4073test_xmlSAX2Characters(void) {
4074 int test_ret = 0;
4075
4076 int mem_base;
4077 void * ctx; /* the user data (XML parser context) */
4078 int n_ctx;
4079 xmlChar * ch; /* a xmlChar string */
4080 int n_ch;
4081 int len; /* the number of xmlChar */
4082 int n_len;
4083
4084 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4085 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4086 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4087 mem_base = xmlMemBlocks();
4088 ctx = gen_void_ptr(n_ctx, 0);
4089 ch = gen_const_xmlChar_ptr(n_ch, 1);
4090 len = gen_int(n_len, 2);
4091
4092 xmlSAX2Characters(ctx, ch, len);
4093 call_tests++;
4094 des_void_ptr(n_ctx, ctx, 0);
4095 des_const_xmlChar_ptr(n_ch, ch, 1);
4096 des_int(n_len, len, 2);
4097 xmlResetLastError();
4098 if (mem_base != xmlMemBlocks()) {
4099 printf("Leak of %d blocks found in xmlSAX2Characters",
4100 xmlMemBlocks() - mem_base);
4101 test_ret++;
4102 printf(" %d", n_ctx);
4103 printf(" %d", n_ch);
4104 printf(" %d", n_len);
4105 printf("\n");
4106 }
4107 }
4108 }
4109 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004110 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004111
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004112 return(test_ret);
4113}
4114
4115
4116static int
4117test_xmlSAX2Comment(void) {
4118 int test_ret = 0;
4119
4120 int mem_base;
4121 void * ctx; /* the user data (XML parser context) */
4122 int n_ctx;
4123 xmlChar * value; /* the xmlSAX2Comment content */
4124 int n_value;
4125
4126 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4127 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
4128 mem_base = xmlMemBlocks();
4129 ctx = gen_void_ptr(n_ctx, 0);
4130 value = gen_const_xmlChar_ptr(n_value, 1);
4131
4132 xmlSAX2Comment(ctx, value);
4133 call_tests++;
4134 des_void_ptr(n_ctx, ctx, 0);
4135 des_const_xmlChar_ptr(n_value, value, 1);
4136 xmlResetLastError();
4137 if (mem_base != xmlMemBlocks()) {
4138 printf("Leak of %d blocks found in xmlSAX2Comment",
4139 xmlMemBlocks() - mem_base);
4140 test_ret++;
4141 printf(" %d", n_ctx);
4142 printf(" %d", n_value);
4143 printf("\n");
4144 }
4145 }
4146 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004147 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004148
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004149 return(test_ret);
4150}
4151
4152
4153#define gen_nb_xmlElementContentPtr 1
4154static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4155 return(NULL);
4156}
4157static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4158}
4159
4160static int
4161test_xmlSAX2ElementDecl(void) {
4162 int test_ret = 0;
4163
4164 int mem_base;
4165 void * ctx; /* the user data (XML parser context) */
4166 int n_ctx;
4167 xmlChar * name; /* the element name */
4168 int n_name;
4169 int type; /* the element type */
4170 int n_type;
4171 xmlElementContentPtr content; /* the element value tree */
4172 int n_content;
4173
4174 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4175 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4176 for (n_type = 0;n_type < gen_nb_int;n_type++) {
4177 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
4178 mem_base = xmlMemBlocks();
4179 ctx = gen_void_ptr(n_ctx, 0);
4180 name = gen_const_xmlChar_ptr(n_name, 1);
4181 type = gen_int(n_type, 2);
4182 content = gen_xmlElementContentPtr(n_content, 3);
4183
4184 xmlSAX2ElementDecl(ctx, name, type, content);
4185 call_tests++;
4186 des_void_ptr(n_ctx, ctx, 0);
4187 des_const_xmlChar_ptr(n_name, name, 1);
4188 des_int(n_type, type, 2);
4189 des_xmlElementContentPtr(n_content, content, 3);
4190 xmlResetLastError();
4191 if (mem_base != xmlMemBlocks()) {
4192 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
4193 xmlMemBlocks() - mem_base);
4194 test_ret++;
4195 printf(" %d", n_ctx);
4196 printf(" %d", n_name);
4197 printf(" %d", n_type);
4198 printf(" %d", n_content);
4199 printf("\n");
4200 }
4201 }
4202 }
4203 }
4204 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004205 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004206
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004207 return(test_ret);
4208}
4209
4210
4211static int
4212test_xmlSAX2EndDocument(void) {
4213 int test_ret = 0;
4214
4215 int mem_base;
4216 void * ctx; /* the user data (XML parser context) */
4217 int n_ctx;
4218
4219 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4220 mem_base = xmlMemBlocks();
4221 ctx = gen_void_ptr(n_ctx, 0);
4222
4223 xmlSAX2EndDocument(ctx);
4224 call_tests++;
4225 des_void_ptr(n_ctx, ctx, 0);
4226 xmlResetLastError();
4227 if (mem_base != xmlMemBlocks()) {
4228 printf("Leak of %d blocks found in xmlSAX2EndDocument",
4229 xmlMemBlocks() - mem_base);
4230 test_ret++;
4231 printf(" %d", n_ctx);
4232 printf("\n");
4233 }
4234 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004235 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004236
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004237 return(test_ret);
4238}
4239
4240
4241static int
4242test_xmlSAX2EndElement(void) {
4243 int test_ret = 0;
4244
Daniel Veillarda521d282004-11-09 14:59:59 +00004245#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004246 int mem_base;
4247 void * ctx; /* the user data (XML parser context) */
4248 int n_ctx;
4249 xmlChar * name; /* The element name */
4250 int n_name;
4251
4252 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4253 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4254 mem_base = xmlMemBlocks();
4255 ctx = gen_void_ptr(n_ctx, 0);
4256 name = gen_const_xmlChar_ptr(n_name, 1);
4257
4258 xmlSAX2EndElement(ctx, name);
4259 call_tests++;
4260 des_void_ptr(n_ctx, ctx, 0);
4261 des_const_xmlChar_ptr(n_name, name, 1);
4262 xmlResetLastError();
4263 if (mem_base != xmlMemBlocks()) {
4264 printf("Leak of %d blocks found in xmlSAX2EndElement",
4265 xmlMemBlocks() - mem_base);
4266 test_ret++;
4267 printf(" %d", n_ctx);
4268 printf(" %d", n_name);
4269 printf("\n");
4270 }
4271 }
4272 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004273 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00004274#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004275
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004276 return(test_ret);
4277}
4278
4279
4280static int
4281test_xmlSAX2EndElementNs(void) {
4282 int test_ret = 0;
4283
4284 int mem_base;
4285 void * ctx; /* the user data (XML parser context) */
4286 int n_ctx;
4287 xmlChar * localname; /* the local name of the element */
4288 int n_localname;
4289 xmlChar * prefix; /* the element namespace prefix if available */
4290 int n_prefix;
4291 xmlChar * URI; /* the element namespace name if available */
4292 int n_URI;
4293
4294 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4295 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4296 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4297 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4298 mem_base = xmlMemBlocks();
4299 ctx = gen_void_ptr(n_ctx, 0);
4300 localname = gen_const_xmlChar_ptr(n_localname, 1);
4301 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4302 URI = gen_const_xmlChar_ptr(n_URI, 3);
4303
4304 xmlSAX2EndElementNs(ctx, localname, prefix, URI);
4305 call_tests++;
4306 des_void_ptr(n_ctx, ctx, 0);
4307 des_const_xmlChar_ptr(n_localname, localname, 1);
4308 des_const_xmlChar_ptr(n_prefix, prefix, 2);
4309 des_const_xmlChar_ptr(n_URI, URI, 3);
4310 xmlResetLastError();
4311 if (mem_base != xmlMemBlocks()) {
4312 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
4313 xmlMemBlocks() - mem_base);
4314 test_ret++;
4315 printf(" %d", n_ctx);
4316 printf(" %d", n_localname);
4317 printf(" %d", n_prefix);
4318 printf(" %d", n_URI);
4319 printf("\n");
4320 }
4321 }
4322 }
4323 }
4324 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004325 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004326
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004327 return(test_ret);
4328}
4329
4330
4331static int
4332test_xmlSAX2EntityDecl(void) {
4333 int test_ret = 0;
4334
4335 int mem_base;
4336 void * ctx; /* the user data (XML parser context) */
4337 int n_ctx;
4338 xmlChar * name; /* the entity name */
4339 int n_name;
4340 int type; /* the entity type */
4341 int n_type;
4342 xmlChar * publicId; /* The public ID of the entity */
4343 int n_publicId;
4344 xmlChar * systemId; /* The system ID of the entity */
4345 int n_systemId;
4346 xmlChar * content; /* the entity value (without processing). */
4347 int n_content;
4348
4349 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4350 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4351 for (n_type = 0;n_type < gen_nb_int;n_type++) {
4352 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4353 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4354 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
4355 mem_base = xmlMemBlocks();
4356 ctx = gen_void_ptr(n_ctx, 0);
4357 name = gen_const_xmlChar_ptr(n_name, 1);
4358 type = gen_int(n_type, 2);
4359 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
4360 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
4361 content = gen_xmlChar_ptr(n_content, 5);
4362
4363 xmlSAX2EntityDecl(ctx, name, type, publicId, systemId, content);
4364 call_tests++;
4365 des_void_ptr(n_ctx, ctx, 0);
4366 des_const_xmlChar_ptr(n_name, name, 1);
4367 des_int(n_type, type, 2);
4368 des_const_xmlChar_ptr(n_publicId, publicId, 3);
4369 des_const_xmlChar_ptr(n_systemId, systemId, 4);
4370 des_xmlChar_ptr(n_content, content, 5);
4371 xmlResetLastError();
4372 if (mem_base != xmlMemBlocks()) {
4373 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4374 xmlMemBlocks() - mem_base);
4375 test_ret++;
4376 printf(" %d", n_ctx);
4377 printf(" %d", n_name);
4378 printf(" %d", n_type);
4379 printf(" %d", n_publicId);
4380 printf(" %d", n_systemId);
4381 printf(" %d", n_content);
4382 printf("\n");
4383 }
4384 }
4385 }
4386 }
4387 }
4388 }
4389 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004390 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004391
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004392 return(test_ret);
4393}
4394
4395
4396static int
4397test_xmlSAX2ExternalSubset(void) {
4398 int test_ret = 0;
4399
4400 int mem_base;
4401 void * ctx; /* the user data (XML parser context) */
4402 int n_ctx;
4403 xmlChar * name; /* the root element name */
4404 int n_name;
4405 xmlChar * ExternalID; /* the external ID */
4406 int n_ExternalID;
4407 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4408 int n_SystemID;
4409
4410 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4411 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4412 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4413 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4414 mem_base = xmlMemBlocks();
4415 ctx = gen_void_ptr(n_ctx, 0);
4416 name = gen_const_xmlChar_ptr(n_name, 1);
4417 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4418 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4419
4420 xmlSAX2ExternalSubset(ctx, name, ExternalID, SystemID);
4421 call_tests++;
4422 des_void_ptr(n_ctx, ctx, 0);
4423 des_const_xmlChar_ptr(n_name, name, 1);
4424 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
4425 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
4426 xmlResetLastError();
4427 if (mem_base != xmlMemBlocks()) {
4428 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4429 xmlMemBlocks() - mem_base);
4430 test_ret++;
4431 printf(" %d", n_ctx);
4432 printf(" %d", n_name);
4433 printf(" %d", n_ExternalID);
4434 printf(" %d", n_SystemID);
4435 printf("\n");
4436 }
4437 }
4438 }
4439 }
4440 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004441 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004442
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004443 return(test_ret);
4444}
4445
4446
4447static int
4448test_xmlSAX2GetColumnNumber(void) {
4449 int test_ret = 0;
4450
4451 int mem_base;
4452 int ret_val;
4453 void * ctx; /* the user data (XML parser context) */
4454 int n_ctx;
4455
4456 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4457 mem_base = xmlMemBlocks();
4458 ctx = gen_void_ptr(n_ctx, 0);
4459
4460 ret_val = xmlSAX2GetColumnNumber(ctx);
4461 desret_int(ret_val);
4462 call_tests++;
4463 des_void_ptr(n_ctx, ctx, 0);
4464 xmlResetLastError();
4465 if (mem_base != xmlMemBlocks()) {
4466 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4467 xmlMemBlocks() - mem_base);
4468 test_ret++;
4469 printf(" %d", n_ctx);
4470 printf("\n");
4471 }
4472 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004473 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004474
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004475 return(test_ret);
4476}
4477
4478
4479static int
4480test_xmlSAX2GetEntity(void) {
4481 int test_ret = 0;
4482
4483 int mem_base;
4484 xmlEntityPtr ret_val;
4485 void * ctx; /* the user data (XML parser context) */
4486 int n_ctx;
4487 xmlChar * name; /* The entity name */
4488 int n_name;
4489
4490 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4491 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4492 mem_base = xmlMemBlocks();
4493 ctx = gen_void_ptr(n_ctx, 0);
4494 name = gen_const_xmlChar_ptr(n_name, 1);
4495
4496 ret_val = xmlSAX2GetEntity(ctx, name);
4497 desret_xmlEntityPtr(ret_val);
4498 call_tests++;
4499 des_void_ptr(n_ctx, ctx, 0);
4500 des_const_xmlChar_ptr(n_name, name, 1);
4501 xmlResetLastError();
4502 if (mem_base != xmlMemBlocks()) {
4503 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4504 xmlMemBlocks() - mem_base);
4505 test_ret++;
4506 printf(" %d", n_ctx);
4507 printf(" %d", n_name);
4508 printf("\n");
4509 }
4510 }
4511 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004512 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004513
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004514 return(test_ret);
4515}
4516
4517
4518static int
4519test_xmlSAX2GetLineNumber(void) {
4520 int test_ret = 0;
4521
4522 int mem_base;
4523 int ret_val;
4524 void * ctx; /* the user data (XML parser context) */
4525 int n_ctx;
4526
4527 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4528 mem_base = xmlMemBlocks();
4529 ctx = gen_void_ptr(n_ctx, 0);
4530
4531 ret_val = xmlSAX2GetLineNumber(ctx);
4532 desret_int(ret_val);
4533 call_tests++;
4534 des_void_ptr(n_ctx, ctx, 0);
4535 xmlResetLastError();
4536 if (mem_base != xmlMemBlocks()) {
4537 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4538 xmlMemBlocks() - mem_base);
4539 test_ret++;
4540 printf(" %d", n_ctx);
4541 printf("\n");
4542 }
4543 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004544 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004545
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004546 return(test_ret);
4547}
4548
4549
4550static int
4551test_xmlSAX2GetParameterEntity(void) {
4552 int test_ret = 0;
4553
4554 int mem_base;
4555 xmlEntityPtr ret_val;
4556 void * ctx; /* the user data (XML parser context) */
4557 int n_ctx;
4558 xmlChar * name; /* The entity name */
4559 int n_name;
4560
4561 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4562 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4563 mem_base = xmlMemBlocks();
4564 ctx = gen_void_ptr(n_ctx, 0);
4565 name = gen_const_xmlChar_ptr(n_name, 1);
4566
4567 ret_val = xmlSAX2GetParameterEntity(ctx, name);
4568 desret_xmlEntityPtr(ret_val);
4569 call_tests++;
4570 des_void_ptr(n_ctx, ctx, 0);
4571 des_const_xmlChar_ptr(n_name, name, 1);
4572 xmlResetLastError();
4573 if (mem_base != xmlMemBlocks()) {
4574 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4575 xmlMemBlocks() - mem_base);
4576 test_ret++;
4577 printf(" %d", n_ctx);
4578 printf(" %d", n_name);
4579 printf("\n");
4580 }
4581 }
4582 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004583 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004584
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004585 return(test_ret);
4586}
4587
4588
4589static int
4590test_xmlSAX2GetPublicId(void) {
4591 int test_ret = 0;
4592
4593 int mem_base;
4594 const xmlChar * ret_val;
4595 void * ctx; /* the user data (XML parser context) */
4596 int n_ctx;
4597
4598 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4599 mem_base = xmlMemBlocks();
4600 ctx = gen_void_ptr(n_ctx, 0);
4601
4602 ret_val = xmlSAX2GetPublicId(ctx);
4603 desret_const_xmlChar_ptr(ret_val);
4604 call_tests++;
4605 des_void_ptr(n_ctx, ctx, 0);
4606 xmlResetLastError();
4607 if (mem_base != xmlMemBlocks()) {
4608 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4609 xmlMemBlocks() - mem_base);
4610 test_ret++;
4611 printf(" %d", n_ctx);
4612 printf("\n");
4613 }
4614 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004615 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004616
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004617 return(test_ret);
4618}
4619
4620
4621static int
4622test_xmlSAX2GetSystemId(void) {
4623 int test_ret = 0;
4624
4625 int mem_base;
4626 const xmlChar * ret_val;
4627 void * ctx; /* the user data (XML parser context) */
4628 int n_ctx;
4629
4630 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4631 mem_base = xmlMemBlocks();
4632 ctx = gen_void_ptr(n_ctx, 0);
4633
4634 ret_val = xmlSAX2GetSystemId(ctx);
4635 desret_const_xmlChar_ptr(ret_val);
4636 call_tests++;
4637 des_void_ptr(n_ctx, ctx, 0);
4638 xmlResetLastError();
4639 if (mem_base != xmlMemBlocks()) {
4640 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4641 xmlMemBlocks() - mem_base);
4642 test_ret++;
4643 printf(" %d", n_ctx);
4644 printf("\n");
4645 }
4646 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004647 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004648
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004649 return(test_ret);
4650}
4651
4652
4653static int
4654test_xmlSAX2HasExternalSubset(void) {
4655 int test_ret = 0;
4656
4657 int mem_base;
4658 int ret_val;
4659 void * ctx; /* the user data (XML parser context) */
4660 int n_ctx;
4661
4662 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4663 mem_base = xmlMemBlocks();
4664 ctx = gen_void_ptr(n_ctx, 0);
4665
4666 ret_val = xmlSAX2HasExternalSubset(ctx);
4667 desret_int(ret_val);
4668 call_tests++;
4669 des_void_ptr(n_ctx, ctx, 0);
4670 xmlResetLastError();
4671 if (mem_base != xmlMemBlocks()) {
4672 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4673 xmlMemBlocks() - mem_base);
4674 test_ret++;
4675 printf(" %d", n_ctx);
4676 printf("\n");
4677 }
4678 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004679 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004680
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004681 return(test_ret);
4682}
4683
4684
4685static int
4686test_xmlSAX2HasInternalSubset(void) {
4687 int test_ret = 0;
4688
4689 int mem_base;
4690 int ret_val;
4691 void * ctx; /* the user data (XML parser context) */
4692 int n_ctx;
4693
4694 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4695 mem_base = xmlMemBlocks();
4696 ctx = gen_void_ptr(n_ctx, 0);
4697
4698 ret_val = xmlSAX2HasInternalSubset(ctx);
4699 desret_int(ret_val);
4700 call_tests++;
4701 des_void_ptr(n_ctx, ctx, 0);
4702 xmlResetLastError();
4703 if (mem_base != xmlMemBlocks()) {
4704 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4705 xmlMemBlocks() - mem_base);
4706 test_ret++;
4707 printf(" %d", n_ctx);
4708 printf("\n");
4709 }
4710 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004711 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004712
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004713 return(test_ret);
4714}
4715
4716
4717static int
4718test_xmlSAX2IgnorableWhitespace(void) {
4719 int test_ret = 0;
4720
4721 int mem_base;
4722 void * ctx; /* the user data (XML parser context) */
4723 int n_ctx;
4724 xmlChar * ch; /* a xmlChar string */
4725 int n_ch;
4726 int len; /* the number of xmlChar */
4727 int n_len;
4728
4729 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4730 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4731 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4732 mem_base = xmlMemBlocks();
4733 ctx = gen_void_ptr(n_ctx, 0);
4734 ch = gen_const_xmlChar_ptr(n_ch, 1);
4735 len = gen_int(n_len, 2);
4736
4737 xmlSAX2IgnorableWhitespace(ctx, ch, len);
4738 call_tests++;
4739 des_void_ptr(n_ctx, ctx, 0);
4740 des_const_xmlChar_ptr(n_ch, ch, 1);
4741 des_int(n_len, len, 2);
4742 xmlResetLastError();
4743 if (mem_base != xmlMemBlocks()) {
4744 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4745 xmlMemBlocks() - mem_base);
4746 test_ret++;
4747 printf(" %d", n_ctx);
4748 printf(" %d", n_ch);
4749 printf(" %d", n_len);
4750 printf("\n");
4751 }
4752 }
4753 }
4754 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004755 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004756
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004757 return(test_ret);
4758}
4759
4760
4761#define gen_nb_xmlSAXHandler_ptr 1
4762static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4763 return(NULL);
4764}
4765static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4766}
4767
4768static int
4769test_xmlSAX2InitDefaultSAXHandler(void) {
4770 int test_ret = 0;
4771
4772 int mem_base;
4773 xmlSAXHandler * hdlr; /* the SAX handler */
4774 int n_hdlr;
4775 int warning; /* flag if non-zero sets the handler warning procedure */
4776 int n_warning;
4777
4778 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4779 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4780 mem_base = xmlMemBlocks();
4781 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4782 warning = gen_int(n_warning, 1);
4783
4784 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4785 call_tests++;
4786 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4787 des_int(n_warning, warning, 1);
4788 xmlResetLastError();
4789 if (mem_base != xmlMemBlocks()) {
4790 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4791 xmlMemBlocks() - mem_base);
4792 test_ret++;
4793 printf(" %d", n_hdlr);
4794 printf(" %d", n_warning);
4795 printf("\n");
4796 }
4797 }
4798 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004799 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004800
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004801 return(test_ret);
4802}
4803
4804
4805static int
4806test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4807 int test_ret = 0;
4808
4809#ifdef LIBXML_DOCB_ENABLED
4810 int mem_base;
4811 xmlSAXHandler * hdlr; /* the SAX handler */
4812 int n_hdlr;
4813
4814 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4815 mem_base = xmlMemBlocks();
4816 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4817
4818 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4819 call_tests++;
4820 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4821 xmlResetLastError();
4822 if (mem_base != xmlMemBlocks()) {
4823 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4824 xmlMemBlocks() - mem_base);
4825 test_ret++;
4826 printf(" %d", n_hdlr);
4827 printf("\n");
4828 }
4829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004830 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004831#endif
4832
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004833 return(test_ret);
4834}
4835
4836
4837static int
4838test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4839 int test_ret = 0;
4840
4841#ifdef LIBXML_HTML_ENABLED
4842 int mem_base;
4843 xmlSAXHandler * hdlr; /* the SAX handler */
4844 int n_hdlr;
4845
4846 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4847 mem_base = xmlMemBlocks();
4848 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4849
4850 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4851 call_tests++;
4852 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4853 xmlResetLastError();
4854 if (mem_base != xmlMemBlocks()) {
4855 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4856 xmlMemBlocks() - mem_base);
4857 test_ret++;
4858 printf(" %d", n_hdlr);
4859 printf("\n");
4860 }
4861 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004862 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004863#endif
4864
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004865 return(test_ret);
4866}
4867
4868
4869static int
4870test_xmlSAX2InternalSubset(void) {
4871 int test_ret = 0;
4872
4873 int mem_base;
4874 void * ctx; /* the user data (XML parser context) */
4875 int n_ctx;
4876 xmlChar * name; /* the root element name */
4877 int n_name;
4878 xmlChar * ExternalID; /* the external ID */
4879 int n_ExternalID;
4880 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4881 int n_SystemID;
4882
4883 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4884 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4885 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4886 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4887 mem_base = xmlMemBlocks();
4888 ctx = gen_void_ptr(n_ctx, 0);
4889 name = gen_const_xmlChar_ptr(n_name, 1);
4890 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4891 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4892
4893 xmlSAX2InternalSubset(ctx, name, ExternalID, SystemID);
4894 call_tests++;
4895 des_void_ptr(n_ctx, ctx, 0);
4896 des_const_xmlChar_ptr(n_name, name, 1);
4897 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
4898 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
4899 xmlResetLastError();
4900 if (mem_base != xmlMemBlocks()) {
4901 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4902 xmlMemBlocks() - mem_base);
4903 test_ret++;
4904 printf(" %d", n_ctx);
4905 printf(" %d", n_name);
4906 printf(" %d", n_ExternalID);
4907 printf(" %d", n_SystemID);
4908 printf("\n");
4909 }
4910 }
4911 }
4912 }
4913 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004914 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004915
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004916 return(test_ret);
4917}
4918
4919
4920static int
4921test_xmlSAX2IsStandalone(void) {
4922 int test_ret = 0;
4923
4924 int mem_base;
4925 int ret_val;
4926 void * ctx; /* the user data (XML parser context) */
4927 int n_ctx;
4928
4929 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4930 mem_base = xmlMemBlocks();
4931 ctx = gen_void_ptr(n_ctx, 0);
4932
4933 ret_val = xmlSAX2IsStandalone(ctx);
4934 desret_int(ret_val);
4935 call_tests++;
4936 des_void_ptr(n_ctx, ctx, 0);
4937 xmlResetLastError();
4938 if (mem_base != xmlMemBlocks()) {
4939 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4940 xmlMemBlocks() - mem_base);
4941 test_ret++;
4942 printf(" %d", n_ctx);
4943 printf("\n");
4944 }
4945 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004946 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004947
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004948 return(test_ret);
4949}
4950
4951
4952static int
4953test_xmlSAX2NotationDecl(void) {
4954 int test_ret = 0;
4955
4956 int mem_base;
4957 void * ctx; /* the user data (XML parser context) */
4958 int n_ctx;
4959 xmlChar * name; /* The name of the notation */
4960 int n_name;
4961 xmlChar * publicId; /* The public ID of the entity */
4962 int n_publicId;
4963 xmlChar * systemId; /* The system ID of the entity */
4964 int n_systemId;
4965
4966 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4967 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4968 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4969 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4970 mem_base = xmlMemBlocks();
4971 ctx = gen_void_ptr(n_ctx, 0);
4972 name = gen_const_xmlChar_ptr(n_name, 1);
4973 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4974 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4975
4976 xmlSAX2NotationDecl(ctx, name, publicId, systemId);
4977 call_tests++;
4978 des_void_ptr(n_ctx, ctx, 0);
4979 des_const_xmlChar_ptr(n_name, name, 1);
4980 des_const_xmlChar_ptr(n_publicId, publicId, 2);
4981 des_const_xmlChar_ptr(n_systemId, systemId, 3);
4982 xmlResetLastError();
4983 if (mem_base != xmlMemBlocks()) {
4984 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4985 xmlMemBlocks() - mem_base);
4986 test_ret++;
4987 printf(" %d", n_ctx);
4988 printf(" %d", n_name);
4989 printf(" %d", n_publicId);
4990 printf(" %d", n_systemId);
4991 printf("\n");
4992 }
4993 }
4994 }
4995 }
4996 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004997 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004998
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004999 return(test_ret);
5000}
5001
5002
5003static int
5004test_xmlSAX2ProcessingInstruction(void) {
5005 int test_ret = 0;
5006
5007 int mem_base;
5008 void * ctx; /* the user data (XML parser context) */
5009 int n_ctx;
5010 xmlChar * target; /* the target name */
5011 int n_target;
5012 xmlChar * data; /* the PI data's */
5013 int n_data;
5014
5015 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5016 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
5017 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
5018 mem_base = xmlMemBlocks();
5019 ctx = gen_void_ptr(n_ctx, 0);
5020 target = gen_const_xmlChar_ptr(n_target, 1);
5021 data = gen_const_xmlChar_ptr(n_data, 2);
5022
5023 xmlSAX2ProcessingInstruction(ctx, target, data);
5024 call_tests++;
5025 des_void_ptr(n_ctx, ctx, 0);
5026 des_const_xmlChar_ptr(n_target, target, 1);
5027 des_const_xmlChar_ptr(n_data, data, 2);
5028 xmlResetLastError();
5029 if (mem_base != xmlMemBlocks()) {
5030 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
5031 xmlMemBlocks() - mem_base);
5032 test_ret++;
5033 printf(" %d", n_ctx);
5034 printf(" %d", n_target);
5035 printf(" %d", n_data);
5036 printf("\n");
5037 }
5038 }
5039 }
5040 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005041 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005042
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005043 return(test_ret);
5044}
5045
5046
5047static int
5048test_xmlSAX2Reference(void) {
5049 int test_ret = 0;
5050
5051 int mem_base;
5052 void * ctx; /* the user data (XML parser context) */
5053 int n_ctx;
5054 xmlChar * name; /* The entity name */
5055 int n_name;
5056
5057 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5058 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5059 mem_base = xmlMemBlocks();
5060 ctx = gen_void_ptr(n_ctx, 0);
5061 name = gen_const_xmlChar_ptr(n_name, 1);
5062
5063 xmlSAX2Reference(ctx, name);
5064 call_tests++;
5065 des_void_ptr(n_ctx, ctx, 0);
5066 des_const_xmlChar_ptr(n_name, name, 1);
5067 xmlResetLastError();
5068 if (mem_base != xmlMemBlocks()) {
5069 printf("Leak of %d blocks found in xmlSAX2Reference",
5070 xmlMemBlocks() - mem_base);
5071 test_ret++;
5072 printf(" %d", n_ctx);
5073 printf(" %d", n_name);
5074 printf("\n");
5075 }
5076 }
5077 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005078 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005079
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005080 return(test_ret);
5081}
5082
5083
5084static int
5085test_xmlSAX2ResolveEntity(void) {
5086 int test_ret = 0;
5087
5088 int mem_base;
5089 xmlParserInputPtr ret_val;
5090 void * ctx; /* the user data (XML parser context) */
5091 int n_ctx;
5092 xmlChar * publicId; /* The public ID of the entity */
5093 int n_publicId;
5094 xmlChar * systemId; /* The system ID of the entity */
5095 int n_systemId;
5096
5097 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5098 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5099 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5100 mem_base = xmlMemBlocks();
5101 ctx = gen_void_ptr(n_ctx, 0);
5102 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
5103 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
5104
5105 ret_val = xmlSAX2ResolveEntity(ctx, publicId, systemId);
5106 desret_xmlParserInputPtr(ret_val);
5107 call_tests++;
5108 des_void_ptr(n_ctx, ctx, 0);
5109 des_const_xmlChar_ptr(n_publicId, publicId, 1);
5110 des_const_xmlChar_ptr(n_systemId, systemId, 2);
5111 xmlResetLastError();
5112 if (mem_base != xmlMemBlocks()) {
5113 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
5114 xmlMemBlocks() - mem_base);
5115 test_ret++;
5116 printf(" %d", n_ctx);
5117 printf(" %d", n_publicId);
5118 printf(" %d", n_systemId);
5119 printf("\n");
5120 }
5121 }
5122 }
5123 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005124 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005125
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005126 return(test_ret);
5127}
5128
5129
5130#define gen_nb_xmlSAXLocatorPtr 1
5131static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5132 return(NULL);
5133}
5134static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5135}
5136
5137static int
5138test_xmlSAX2SetDocumentLocator(void) {
5139 int test_ret = 0;
5140
5141 int mem_base;
5142 void * ctx; /* the user data (XML parser context) */
5143 int n_ctx;
5144 xmlSAXLocatorPtr loc; /* A SAX Locator */
5145 int n_loc;
5146
5147 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5148 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
5149 mem_base = xmlMemBlocks();
5150 ctx = gen_void_ptr(n_ctx, 0);
5151 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
5152
5153 xmlSAX2SetDocumentLocator(ctx, loc);
5154 call_tests++;
5155 des_void_ptr(n_ctx, ctx, 0);
5156 des_xmlSAXLocatorPtr(n_loc, loc, 1);
5157 xmlResetLastError();
5158 if (mem_base != xmlMemBlocks()) {
5159 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
5160 xmlMemBlocks() - mem_base);
5161 test_ret++;
5162 printf(" %d", n_ctx);
5163 printf(" %d", n_loc);
5164 printf("\n");
5165 }
5166 }
5167 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005168 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005169
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005170 return(test_ret);
5171}
5172
5173
5174static int
5175test_xmlSAX2StartDocument(void) {
5176 int test_ret = 0;
5177
5178 int mem_base;
5179 void * ctx; /* the user data (XML parser context) */
5180 int n_ctx;
5181
5182 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5183 mem_base = xmlMemBlocks();
5184 ctx = gen_void_ptr(n_ctx, 0);
5185
5186 xmlSAX2StartDocument(ctx);
5187 call_tests++;
5188 des_void_ptr(n_ctx, ctx, 0);
5189 xmlResetLastError();
5190 if (mem_base != xmlMemBlocks()) {
5191 printf("Leak of %d blocks found in xmlSAX2StartDocument",
5192 xmlMemBlocks() - mem_base);
5193 test_ret++;
5194 printf(" %d", n_ctx);
5195 printf("\n");
5196 }
5197 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005198 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005199
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005200 return(test_ret);
5201}
5202
5203
5204static int
5205test_xmlSAX2StartElement(void) {
5206 int test_ret = 0;
5207
Daniel Veillarda521d282004-11-09 14:59:59 +00005208#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005209 int mem_base;
5210 void * ctx; /* the user data (XML parser context) */
5211 int n_ctx;
5212 xmlChar * fullname; /* The element name, including namespace prefix */
5213 int n_fullname;
5214 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
5215 int n_atts;
5216
5217 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5218 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
5219 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
5220 mem_base = xmlMemBlocks();
5221 ctx = gen_void_ptr(n_ctx, 0);
5222 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
5223 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
5224
5225 xmlSAX2StartElement(ctx, fullname, atts);
5226 call_tests++;
5227 des_void_ptr(n_ctx, ctx, 0);
5228 des_const_xmlChar_ptr(n_fullname, fullname, 1);
5229 des_const_xmlChar_ptr_ptr(n_atts, atts, 2);
5230 xmlResetLastError();
5231 if (mem_base != xmlMemBlocks()) {
5232 printf("Leak of %d blocks found in xmlSAX2StartElement",
5233 xmlMemBlocks() - mem_base);
5234 test_ret++;
5235 printf(" %d", n_ctx);
5236 printf(" %d", n_fullname);
5237 printf(" %d", n_atts);
5238 printf("\n");
5239 }
5240 }
5241 }
5242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005243 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00005244#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005245
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005246 return(test_ret);
5247}
5248
5249
5250static int
5251test_xmlSAX2StartElementNs(void) {
5252 int test_ret = 0;
5253
5254 int mem_base;
5255 void * ctx; /* the user data (XML parser context) */
5256 int n_ctx;
5257 xmlChar * localname; /* the local name of the element */
5258 int n_localname;
5259 xmlChar * prefix; /* the element namespace prefix if available */
5260 int n_prefix;
5261 xmlChar * URI; /* the element namespace name if available */
5262 int n_URI;
5263 int nb_namespaces; /* number of namespace definitions on that node */
5264 int n_nb_namespaces;
5265 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
5266 int n_namespaces;
5267 int nb_attributes; /* the number of attributes on that node */
5268 int n_nb_attributes;
5269 int nb_defaulted; /* the number of defaulted attributes. */
5270 int n_nb_defaulted;
5271 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
5272 int n_attributes;
5273
5274 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5275 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
5276 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
5277 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5278 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
5279 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
5280 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
5281 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
5282 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
5283 mem_base = xmlMemBlocks();
5284 ctx = gen_void_ptr(n_ctx, 0);
5285 localname = gen_const_xmlChar_ptr(n_localname, 1);
5286 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
5287 URI = gen_const_xmlChar_ptr(n_URI, 3);
5288 nb_namespaces = gen_int(n_nb_namespaces, 4);
5289 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
5290 nb_attributes = gen_int(n_nb_attributes, 6);
5291 nb_defaulted = gen_int(n_nb_defaulted, 7);
5292 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
5293
5294 xmlSAX2StartElementNs(ctx, localname, prefix, URI, nb_namespaces, namespaces, nb_attributes, nb_defaulted, attributes);
5295 call_tests++;
5296 des_void_ptr(n_ctx, ctx, 0);
5297 des_const_xmlChar_ptr(n_localname, localname, 1);
5298 des_const_xmlChar_ptr(n_prefix, prefix, 2);
5299 des_const_xmlChar_ptr(n_URI, URI, 3);
5300 des_int(n_nb_namespaces, nb_namespaces, 4);
5301 des_const_xmlChar_ptr_ptr(n_namespaces, namespaces, 5);
5302 des_int(n_nb_attributes, nb_attributes, 6);
5303 des_int(n_nb_defaulted, nb_defaulted, 7);
5304 des_const_xmlChar_ptr_ptr(n_attributes, attributes, 8);
5305 xmlResetLastError();
5306 if (mem_base != xmlMemBlocks()) {
5307 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
5308 xmlMemBlocks() - mem_base);
5309 test_ret++;
5310 printf(" %d", n_ctx);
5311 printf(" %d", n_localname);
5312 printf(" %d", n_prefix);
5313 printf(" %d", n_URI);
5314 printf(" %d", n_nb_namespaces);
5315 printf(" %d", n_namespaces);
5316 printf(" %d", n_nb_attributes);
5317 printf(" %d", n_nb_defaulted);
5318 printf(" %d", n_attributes);
5319 printf("\n");
5320 }
5321 }
5322 }
5323 }
5324 }
5325 }
5326 }
5327 }
5328 }
5329 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005330 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005331
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005332 return(test_ret);
5333}
5334
5335
5336static int
5337test_xmlSAX2UnparsedEntityDecl(void) {
5338 int test_ret = 0;
5339
5340 int mem_base;
5341 void * ctx; /* the user data (XML parser context) */
5342 int n_ctx;
5343 xmlChar * name; /* The name of the entity */
5344 int n_name;
5345 xmlChar * publicId; /* The public ID of the entity */
5346 int n_publicId;
5347 xmlChar * systemId; /* The system ID of the entity */
5348 int n_systemId;
5349 xmlChar * notationName; /* the name of the notation */
5350 int n_notationName;
5351
5352 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5353 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5354 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5355 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5356 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
5357 mem_base = xmlMemBlocks();
5358 ctx = gen_void_ptr(n_ctx, 0);
5359 name = gen_const_xmlChar_ptr(n_name, 1);
5360 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
5361 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
5362 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
5363
5364 xmlSAX2UnparsedEntityDecl(ctx, name, publicId, systemId, notationName);
5365 call_tests++;
5366 des_void_ptr(n_ctx, ctx, 0);
5367 des_const_xmlChar_ptr(n_name, name, 1);
5368 des_const_xmlChar_ptr(n_publicId, publicId, 2);
5369 des_const_xmlChar_ptr(n_systemId, systemId, 3);
5370 des_const_xmlChar_ptr(n_notationName, notationName, 4);
5371 xmlResetLastError();
5372 if (mem_base != xmlMemBlocks()) {
5373 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5374 xmlMemBlocks() - mem_base);
5375 test_ret++;
5376 printf(" %d", n_ctx);
5377 printf(" %d", n_name);
5378 printf(" %d", n_publicId);
5379 printf(" %d", n_systemId);
5380 printf(" %d", n_notationName);
5381 printf("\n");
5382 }
5383 }
5384 }
5385 }
5386 }
5387 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005388 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005389
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005390 return(test_ret);
5391}
5392
5393
5394static int
5395test_xmlSAXDefaultVersion(void) {
5396 int test_ret = 0;
5397
Daniel Veillarda521d282004-11-09 14:59:59 +00005398#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005399 int mem_base;
5400 int ret_val;
5401 int version; /* the version, 1 or 2 */
5402 int n_version;
5403
5404 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5405 mem_base = xmlMemBlocks();
5406 version = gen_int(n_version, 0);
5407
5408 ret_val = xmlSAXDefaultVersion(version);
5409 desret_int(ret_val);
5410 call_tests++;
5411 des_int(n_version, version, 0);
5412 xmlResetLastError();
5413 if (mem_base != xmlMemBlocks()) {
5414 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5415 xmlMemBlocks() - mem_base);
5416 test_ret++;
5417 printf(" %d", n_version);
5418 printf("\n");
5419 }
5420 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005421 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00005422#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005423
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005424 return(test_ret);
5425}
5426
5427
5428static int
5429test_xmlSAXVersion(void) {
5430 int test_ret = 0;
5431
5432 int mem_base;
5433 int ret_val;
5434 xmlSAXHandler * hdlr; /* the SAX handler */
5435 int n_hdlr;
5436 int version; /* the version, 1 or 2 */
5437 int n_version;
5438
5439 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5440 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5441 mem_base = xmlMemBlocks();
5442 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5443 version = gen_int(n_version, 1);
5444
5445 ret_val = xmlSAXVersion(hdlr, version);
5446 desret_int(ret_val);
5447 call_tests++;
5448 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5449 des_int(n_version, version, 1);
5450 xmlResetLastError();
5451 if (mem_base != xmlMemBlocks()) {
5452 printf("Leak of %d blocks found in xmlSAXVersion",
5453 xmlMemBlocks() - mem_base);
5454 test_ret++;
5455 printf(" %d", n_hdlr);
5456 printf(" %d", n_version);
5457 printf("\n");
5458 }
5459 }
5460 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005461 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005462
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005463 return(test_ret);
5464}
5465
5466static int
5467test_SAX2(void) {
5468 int test_ret = 0;
5469
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005470 if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005471 test_ret += test_docbDefaultSAXHandlerInit();
5472 test_ret += test_htmlDefaultSAXHandlerInit();
5473 test_ret += test_xmlDefaultSAXHandlerInit();
5474 test_ret += test_xmlSAX2AttributeDecl();
5475 test_ret += test_xmlSAX2CDataBlock();
5476 test_ret += test_xmlSAX2Characters();
5477 test_ret += test_xmlSAX2Comment();
5478 test_ret += test_xmlSAX2ElementDecl();
5479 test_ret += test_xmlSAX2EndDocument();
5480 test_ret += test_xmlSAX2EndElement();
5481 test_ret += test_xmlSAX2EndElementNs();
5482 test_ret += test_xmlSAX2EntityDecl();
5483 test_ret += test_xmlSAX2ExternalSubset();
5484 test_ret += test_xmlSAX2GetColumnNumber();
5485 test_ret += test_xmlSAX2GetEntity();
5486 test_ret += test_xmlSAX2GetLineNumber();
5487 test_ret += test_xmlSAX2GetParameterEntity();
5488 test_ret += test_xmlSAX2GetPublicId();
5489 test_ret += test_xmlSAX2GetSystemId();
5490 test_ret += test_xmlSAX2HasExternalSubset();
5491 test_ret += test_xmlSAX2HasInternalSubset();
5492 test_ret += test_xmlSAX2IgnorableWhitespace();
5493 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5494 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5495 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5496 test_ret += test_xmlSAX2InternalSubset();
5497 test_ret += test_xmlSAX2IsStandalone();
5498 test_ret += test_xmlSAX2NotationDecl();
5499 test_ret += test_xmlSAX2ProcessingInstruction();
5500 test_ret += test_xmlSAX2Reference();
5501 test_ret += test_xmlSAX2ResolveEntity();
5502 test_ret += test_xmlSAX2SetDocumentLocator();
5503 test_ret += test_xmlSAX2StartDocument();
5504 test_ret += test_xmlSAX2StartElement();
5505 test_ret += test_xmlSAX2StartElementNs();
5506 test_ret += test_xmlSAX2UnparsedEntityDecl();
5507 test_ret += test_xmlSAXDefaultVersion();
5508 test_ret += test_xmlSAXVersion();
5509
5510 if (test_ret != 0)
5511 printf("Module SAX2: %d errors\n", test_ret);
5512 return(test_ret);
5513}
5514
Daniel Veillarda82b1822004-11-08 16:24:57 +00005515static int
5516test_xmlC14NDocDumpMemory(void) {
5517 int test_ret = 0;
5518
5519#ifdef LIBXML_C14N_ENABLED
5520#ifdef LIBXML_OUTPUT_ENABLED
5521 int mem_base;
5522 int ret_val;
5523 xmlDocPtr doc; /* the XML document for canonization */
5524 int n_doc;
5525 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5526 int n_nodes;
5527 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5528 int n_exclusive;
5529 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
5530 int n_inclusive_ns_prefixes;
5531 int with_comments; /* include comments in the result (!=0) or not (==0) */
5532 int n_with_comments;
5533 xmlChar ** doc_txt_ptr; /* the memory pointer for allocated canonical XML text; the caller of this functions is responsible for calling xmlFree() to free allocated memory */
5534 int n_doc_txt_ptr;
5535
5536 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5537 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5538 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5539 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5540 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5541 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5542 mem_base = xmlMemBlocks();
5543 doc = gen_xmlDocPtr(n_doc, 0);
5544 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5545 exclusive = gen_int(n_exclusive, 2);
5546 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5547 with_comments = gen_int(n_with_comments, 4);
5548 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5549
5550 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5551 desret_int(ret_val);
5552 call_tests++;
5553 des_xmlDocPtr(n_doc, doc, 0);
5554 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5555 des_int(n_exclusive, exclusive, 2);
5556 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5557 des_int(n_with_comments, with_comments, 4);
5558 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5559 xmlResetLastError();
5560 if (mem_base != xmlMemBlocks()) {
5561 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5562 xmlMemBlocks() - mem_base);
5563 test_ret++;
5564 printf(" %d", n_doc);
5565 printf(" %d", n_nodes);
5566 printf(" %d", n_exclusive);
5567 printf(" %d", n_inclusive_ns_prefixes);
5568 printf(" %d", n_with_comments);
5569 printf(" %d", n_doc_txt_ptr);
5570 printf("\n");
5571 }
5572 }
5573 }
5574 }
5575 }
5576 }
5577 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005578 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005579#endif
5580#endif
5581
Daniel Veillarda82b1822004-11-08 16:24:57 +00005582 return(test_ret);
5583}
5584
5585
5586static int
5587test_xmlC14NDocSave(void) {
5588 int test_ret = 0;
5589
5590#ifdef LIBXML_C14N_ENABLED
5591#ifdef LIBXML_OUTPUT_ENABLED
5592 int mem_base;
5593 int ret_val;
5594 xmlDocPtr doc; /* the XML document for canonization */
5595 int n_doc;
5596 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5597 int n_nodes;
5598 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5599 int n_exclusive;
5600 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
5601 int n_inclusive_ns_prefixes;
5602 int with_comments; /* include comments in the result (!=0) or not (==0) */
5603 int n_with_comments;
5604 const char * filename; /* the filename to store canonical XML image */
5605 int n_filename;
5606 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5607 int n_compression;
5608
5609 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5610 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5611 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5612 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5613 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5614 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5615 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5616 mem_base = xmlMemBlocks();
5617 doc = gen_xmlDocPtr(n_doc, 0);
5618 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5619 exclusive = gen_int(n_exclusive, 2);
5620 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5621 with_comments = gen_int(n_with_comments, 4);
5622 filename = gen_fileoutput(n_filename, 5);
5623 compression = gen_int(n_compression, 6);
5624
5625 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5626 desret_int(ret_val);
5627 call_tests++;
5628 des_xmlDocPtr(n_doc, doc, 0);
5629 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5630 des_int(n_exclusive, exclusive, 2);
5631 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5632 des_int(n_with_comments, with_comments, 4);
5633 des_fileoutput(n_filename, filename, 5);
5634 des_int(n_compression, compression, 6);
5635 xmlResetLastError();
5636 if (mem_base != xmlMemBlocks()) {
5637 printf("Leak of %d blocks found in xmlC14NDocSave",
5638 xmlMemBlocks() - mem_base);
5639 test_ret++;
5640 printf(" %d", n_doc);
5641 printf(" %d", n_nodes);
5642 printf(" %d", n_exclusive);
5643 printf(" %d", n_inclusive_ns_prefixes);
5644 printf(" %d", n_with_comments);
5645 printf(" %d", n_filename);
5646 printf(" %d", n_compression);
5647 printf("\n");
5648 }
5649 }
5650 }
5651 }
5652 }
5653 }
5654 }
5655 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005656 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005657#endif
5658#endif
5659
Daniel Veillarda82b1822004-11-08 16:24:57 +00005660 return(test_ret);
5661}
5662
5663
5664static int
5665test_xmlC14NDocSaveTo(void) {
5666 int test_ret = 0;
5667
5668#ifdef LIBXML_C14N_ENABLED
5669#ifdef LIBXML_OUTPUT_ENABLED
5670 int mem_base;
5671 int ret_val;
5672 xmlDocPtr doc; /* the XML document for canonization */
5673 int n_doc;
5674 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5675 int n_nodes;
5676 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5677 int n_exclusive;
5678 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
5679 int n_inclusive_ns_prefixes;
5680 int with_comments; /* include comments in the result (!=0) or not (==0) */
5681 int n_with_comments;
5682 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5683 int n_buf;
5684
5685 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5686 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5687 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5688 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5689 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5690 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5691 mem_base = xmlMemBlocks();
5692 doc = gen_xmlDocPtr(n_doc, 0);
5693 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5694 exclusive = gen_int(n_exclusive, 2);
5695 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5696 with_comments = gen_int(n_with_comments, 4);
5697 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5698
5699 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5700 desret_int(ret_val);
5701 call_tests++;
5702 des_xmlDocPtr(n_doc, doc, 0);
5703 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5704 des_int(n_exclusive, exclusive, 2);
5705 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5706 des_int(n_with_comments, with_comments, 4);
5707 des_xmlOutputBufferPtr(n_buf, buf, 5);
5708 xmlResetLastError();
5709 if (mem_base != xmlMemBlocks()) {
5710 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5711 xmlMemBlocks() - mem_base);
5712 test_ret++;
5713 printf(" %d", n_doc);
5714 printf(" %d", n_nodes);
5715 printf(" %d", n_exclusive);
5716 printf(" %d", n_inclusive_ns_prefixes);
5717 printf(" %d", n_with_comments);
5718 printf(" %d", n_buf);
5719 printf("\n");
5720 }
5721 }
5722 }
5723 }
5724 }
5725 }
5726 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005727 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005728#endif
5729#endif
5730
Daniel Veillarda82b1822004-11-08 16:24:57 +00005731 return(test_ret);
5732}
5733
5734
5735static int
5736test_xmlC14NExecute(void) {
5737 int test_ret = 0;
5738
5739
5740 /* missing type support */
5741 return(test_ret);
5742}
5743
5744static int
5745test_c14n(void) {
5746 int test_ret = 0;
5747
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005748 if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00005749 test_ret += test_xmlC14NDocDumpMemory();
5750 test_ret += test_xmlC14NDocSave();
5751 test_ret += test_xmlC14NDocSaveTo();
5752 test_ret += test_xmlC14NExecute();
5753
5754 if (test_ret != 0)
5755 printf("Module c14n: %d errors\n", test_ret);
5756 return(test_ret);
5757}
Daniel Veillarda521d282004-11-09 14:59:59 +00005758#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00005759
Daniel Veillardce682bc2004-11-05 17:22:25 +00005760#define gen_nb_xmlCatalogPtr 1
5761static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5762 return(NULL);
5763}
5764static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5765}
Daniel Veillarda521d282004-11-09 14:59:59 +00005766#endif
5767
Daniel Veillardce682bc2004-11-05 17:22:25 +00005768
Daniel Veillardd93f6252004-11-02 15:53:51 +00005769static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005770test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005772
Daniel Veillardce682bc2004-11-05 17:22:25 +00005773#ifdef LIBXML_CATALOG_ENABLED
5774 int mem_base;
5775 int ret_val;
5776 xmlCatalogPtr catal; /* a Catalog */
5777 int n_catal;
5778 xmlChar * type; /* the type of record to add to the catalog */
5779 int n_type;
5780 xmlChar * orig; /* the system, public or prefix to match */
5781 int n_orig;
5782 xmlChar * replace; /* the replacement value for the match */
5783 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005784
Daniel Veillardce682bc2004-11-05 17:22:25 +00005785 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5786 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5787 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5788 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5789 mem_base = xmlMemBlocks();
5790 catal = gen_xmlCatalogPtr(n_catal, 0);
5791 type = gen_const_xmlChar_ptr(n_type, 1);
5792 orig = gen_const_xmlChar_ptr(n_orig, 2);
5793 replace = gen_const_xmlChar_ptr(n_replace, 3);
5794
5795 ret_val = xmlACatalogAdd(catal, type, orig, replace);
5796 desret_int(ret_val);
5797 call_tests++;
5798 des_xmlCatalogPtr(n_catal, catal, 0);
5799 des_const_xmlChar_ptr(n_type, type, 1);
5800 des_const_xmlChar_ptr(n_orig, orig, 2);
5801 des_const_xmlChar_ptr(n_replace, replace, 3);
5802 xmlResetLastError();
5803 if (mem_base != xmlMemBlocks()) {
5804 printf("Leak of %d blocks found in xmlACatalogAdd",
5805 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005806 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005807 printf(" %d", n_catal);
5808 printf(" %d", n_type);
5809 printf(" %d", n_orig);
5810 printf(" %d", n_replace);
5811 printf("\n");
5812 }
5813 }
5814 }
5815 }
5816 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005817 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005818#endif
5819
Daniel Veillard42595322004-11-08 10:52:06 +00005820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005821}
5822
5823
5824static int
5825test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005827
Daniel Veillardce682bc2004-11-05 17:22:25 +00005828#ifdef LIBXML_CATALOG_ENABLED
5829#ifdef LIBXML_OUTPUT_ENABLED
5830 int mem_base;
5831 xmlCatalogPtr catal; /* a Catalog */
5832 int n_catal;
5833 FILE * out; /* the file. */
5834 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005835
Daniel Veillardce682bc2004-11-05 17:22:25 +00005836 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5837 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5838 mem_base = xmlMemBlocks();
5839 catal = gen_xmlCatalogPtr(n_catal, 0);
5840 out = gen_FILE_ptr(n_out, 1);
5841
5842 xmlACatalogDump(catal, out);
5843 call_tests++;
5844 des_xmlCatalogPtr(n_catal, catal, 0);
5845 des_FILE_ptr(n_out, out, 1);
5846 xmlResetLastError();
5847 if (mem_base != xmlMemBlocks()) {
5848 printf("Leak of %d blocks found in xmlACatalogDump",
5849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005850 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005851 printf(" %d", n_catal);
5852 printf(" %d", n_out);
5853 printf("\n");
5854 }
5855 }
5856 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005857 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005858#endif
5859#endif
5860
Daniel Veillard42595322004-11-08 10:52:06 +00005861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005862}
5863
5864
5865static int
5866test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005868
Daniel Veillardce682bc2004-11-05 17:22:25 +00005869#ifdef LIBXML_CATALOG_ENABLED
5870 int mem_base;
5871 int ret_val;
5872 xmlCatalogPtr catal; /* a Catalog */
5873 int n_catal;
5874 xmlChar * value; /* the value to remove */
5875 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005876
Daniel Veillardce682bc2004-11-05 17:22:25 +00005877 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5878 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5879 mem_base = xmlMemBlocks();
5880 catal = gen_xmlCatalogPtr(n_catal, 0);
5881 value = gen_const_xmlChar_ptr(n_value, 1);
5882
5883 ret_val = xmlACatalogRemove(catal, value);
5884 desret_int(ret_val);
5885 call_tests++;
5886 des_xmlCatalogPtr(n_catal, catal, 0);
5887 des_const_xmlChar_ptr(n_value, value, 1);
5888 xmlResetLastError();
5889 if (mem_base != xmlMemBlocks()) {
5890 printf("Leak of %d blocks found in xmlACatalogRemove",
5891 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005892 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005893 printf(" %d", n_catal);
5894 printf(" %d", n_value);
5895 printf("\n");
5896 }
5897 }
5898 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005899 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005900#endif
5901
Daniel Veillard42595322004-11-08 10:52:06 +00005902 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005903}
5904
5905
5906static int
5907test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005908 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005909
Daniel Veillardce682bc2004-11-05 17:22:25 +00005910#ifdef LIBXML_CATALOG_ENABLED
5911 int mem_base;
5912 xmlChar * ret_val;
5913 xmlCatalogPtr catal; /* a Catalog */
5914 int n_catal;
5915 xmlChar * pubID; /* the public ID string */
5916 int n_pubID;
5917 xmlChar * sysID; /* the system ID string */
5918 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005919
Daniel Veillardce682bc2004-11-05 17:22:25 +00005920 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5921 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5922 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5923 mem_base = xmlMemBlocks();
5924 catal = gen_xmlCatalogPtr(n_catal, 0);
5925 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5926 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5927
5928 ret_val = xmlACatalogResolve(catal, pubID, sysID);
5929 desret_xmlChar_ptr(ret_val);
5930 call_tests++;
5931 des_xmlCatalogPtr(n_catal, catal, 0);
5932 des_const_xmlChar_ptr(n_pubID, pubID, 1);
5933 des_const_xmlChar_ptr(n_sysID, sysID, 2);
5934 xmlResetLastError();
5935 if (mem_base != xmlMemBlocks()) {
5936 printf("Leak of %d blocks found in xmlACatalogResolve",
5937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005938 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005939 printf(" %d", n_catal);
5940 printf(" %d", n_pubID);
5941 printf(" %d", n_sysID);
5942 printf("\n");
5943 }
5944 }
5945 }
5946 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005947 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005948#endif
5949
Daniel Veillard42595322004-11-08 10:52:06 +00005950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005951}
5952
5953
5954static int
5955test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005957
Daniel Veillardce682bc2004-11-05 17:22:25 +00005958#ifdef LIBXML_CATALOG_ENABLED
5959 int mem_base;
5960 xmlChar * ret_val;
5961 xmlCatalogPtr catal; /* a Catalog */
5962 int n_catal;
5963 xmlChar * pubID; /* the public ID string */
5964 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005965
Daniel Veillardce682bc2004-11-05 17:22:25 +00005966 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5967 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5968 mem_base = xmlMemBlocks();
5969 catal = gen_xmlCatalogPtr(n_catal, 0);
5970 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5971
5972 ret_val = xmlACatalogResolvePublic(catal, pubID);
5973 desret_xmlChar_ptr(ret_val);
5974 call_tests++;
5975 des_xmlCatalogPtr(n_catal, catal, 0);
5976 des_const_xmlChar_ptr(n_pubID, pubID, 1);
5977 xmlResetLastError();
5978 if (mem_base != xmlMemBlocks()) {
5979 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5980 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005981 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005982 printf(" %d", n_catal);
5983 printf(" %d", n_pubID);
5984 printf("\n");
5985 }
5986 }
5987 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005988 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005989#endif
5990
Daniel Veillard42595322004-11-08 10:52:06 +00005991 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005992}
5993
5994
5995static int
5996test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005997 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005998
Daniel Veillardce682bc2004-11-05 17:22:25 +00005999#ifdef LIBXML_CATALOG_ENABLED
6000 int mem_base;
6001 xmlChar * ret_val;
6002 xmlCatalogPtr catal; /* a Catalog */
6003 int n_catal;
6004 xmlChar * sysID; /* the system ID string */
6005 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006006
Daniel Veillardce682bc2004-11-05 17:22:25 +00006007 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6008 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6009 mem_base = xmlMemBlocks();
6010 catal = gen_xmlCatalogPtr(n_catal, 0);
6011 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
6012
6013 ret_val = xmlACatalogResolveSystem(catal, sysID);
6014 desret_xmlChar_ptr(ret_val);
6015 call_tests++;
6016 des_xmlCatalogPtr(n_catal, catal, 0);
6017 des_const_xmlChar_ptr(n_sysID, sysID, 1);
6018 xmlResetLastError();
6019 if (mem_base != xmlMemBlocks()) {
6020 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
6021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006022 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006023 printf(" %d", n_catal);
6024 printf(" %d", n_sysID);
6025 printf("\n");
6026 }
6027 }
6028 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006029 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006030#endif
6031
Daniel Veillard42595322004-11-08 10:52:06 +00006032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006033}
6034
6035
6036static int
6037test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006039
Daniel Veillardce682bc2004-11-05 17:22:25 +00006040#ifdef LIBXML_CATALOG_ENABLED
6041 int mem_base;
6042 xmlChar * ret_val;
6043 xmlCatalogPtr catal; /* a Catalog */
6044 int n_catal;
6045 xmlChar * URI; /* the URI */
6046 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006047
Daniel Veillardce682bc2004-11-05 17:22:25 +00006048 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6049 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6050 mem_base = xmlMemBlocks();
6051 catal = gen_xmlCatalogPtr(n_catal, 0);
6052 URI = gen_const_xmlChar_ptr(n_URI, 1);
6053
6054 ret_val = xmlACatalogResolveURI(catal, URI);
6055 desret_xmlChar_ptr(ret_val);
6056 call_tests++;
6057 des_xmlCatalogPtr(n_catal, catal, 0);
6058 des_const_xmlChar_ptr(n_URI, URI, 1);
6059 xmlResetLastError();
6060 if (mem_base != xmlMemBlocks()) {
6061 printf("Leak of %d blocks found in xmlACatalogResolveURI",
6062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006063 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006064 printf(" %d", n_catal);
6065 printf(" %d", n_URI);
6066 printf("\n");
6067 }
6068 }
6069 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006070 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006071#endif
6072
Daniel Veillard42595322004-11-08 10:52:06 +00006073 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006074}
6075
6076
6077static int
6078test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006079 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006080
6081#ifdef LIBXML_CATALOG_ENABLED
6082 int mem_base;
6083 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006084 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006085 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006086 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006087 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006088 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006089 int n_replace;
6090
6091 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
6092 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
6093 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
6094 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006095 type = gen_const_xmlChar_ptr(n_type, 0);
6096 orig = gen_const_xmlChar_ptr(n_orig, 1);
6097 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006098
6099 ret_val = xmlCatalogAdd(type, orig, replace);
6100 desret_int(ret_val);
6101 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006102 des_const_xmlChar_ptr(n_type, type, 0);
6103 des_const_xmlChar_ptr(n_orig, orig, 1);
6104 des_const_xmlChar_ptr(n_replace, replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006105 xmlResetLastError();
6106 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006107 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006108 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006109 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006110 printf(" %d", n_type);
6111 printf(" %d", n_orig);
6112 printf(" %d", n_replace);
6113 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006114 }
6115 }
6116 }
6117 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006118 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006119#endif
6120
Daniel Veillard42595322004-11-08 10:52:06 +00006121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006122}
6123
6124
6125static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006126test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006128
6129#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00006130
Daniel Veillardd93f6252004-11-02 15:53:51 +00006131
6132 xmlCatalogCleanup();
6133 call_tests++;
6134 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006135 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006136#endif
6137
Daniel Veillard42595322004-11-08 10:52:06 +00006138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006139}
6140
6141
6142static int
6143test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006145
6146#ifdef LIBXML_CATALOG_ENABLED
6147 int ret_val;
6148
6149
6150 ret_val = xmlCatalogConvert();
6151 desret_int(ret_val);
6152 call_tests++;
6153 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006154 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006155#endif
6156
Daniel Veillard42595322004-11-08 10:52:06 +00006157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006158}
6159
6160
6161static int
6162test_xmlCatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006164
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00006165#ifdef LIBXML_CATALOG_ENABLED
6166#ifdef LIBXML_OUTPUT_ENABLED
6167 int mem_base;
6168 FILE * out; /* the file. */
6169 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006170
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00006171 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
6172 mem_base = xmlMemBlocks();
6173 out = gen_FILE_ptr(n_out, 0);
6174
6175 xmlCatalogDump(out);
6176 call_tests++;
6177 des_FILE_ptr(n_out, out, 0);
6178 xmlResetLastError();
6179 if (mem_base != xmlMemBlocks()) {
6180 printf("Leak of %d blocks found in xmlCatalogDump",
6181 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006182 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00006183 printf(" %d", n_out);
6184 printf("\n");
6185 }
6186 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006187 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00006188#endif
6189#endif
6190
Daniel Veillard42595322004-11-08 10:52:06 +00006191 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006192}
6193
6194
6195static int
6196test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006197 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006198
Daniel Veillard57b25162004-11-06 14:50:18 +00006199#ifdef LIBXML_CATALOG_ENABLED
6200 int mem_base;
6201 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006202
Daniel Veillard57b25162004-11-06 14:50:18 +00006203 mem_base = xmlMemBlocks();
6204
6205 ret_val = xmlCatalogGetDefaults();
6206 desret_xmlCatalogAllow(ret_val);
6207 call_tests++;
6208 xmlResetLastError();
6209 if (mem_base != xmlMemBlocks()) {
6210 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
6211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006212 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006213 printf("\n");
6214 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006215 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006216#endif
6217
Daniel Veillard42595322004-11-08 10:52:06 +00006218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006219}
6220
6221
6222static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006223test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006225
Daniel Veillardce682bc2004-11-05 17:22:25 +00006226#ifdef LIBXML_CATALOG_ENABLED
6227 int mem_base;
6228 int ret_val;
6229 xmlCatalogPtr catal; /* should this create an SGML catalog */
6230 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006231
Daniel Veillardce682bc2004-11-05 17:22:25 +00006232 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6233 mem_base = xmlMemBlocks();
6234 catal = gen_xmlCatalogPtr(n_catal, 0);
6235
6236 ret_val = xmlCatalogIsEmpty(catal);
6237 desret_int(ret_val);
6238 call_tests++;
6239 des_xmlCatalogPtr(n_catal, catal, 0);
6240 xmlResetLastError();
6241 if (mem_base != xmlMemBlocks()) {
6242 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
6243 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006244 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006245 printf(" %d", n_catal);
6246 printf("\n");
6247 }
6248 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006249 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006250#endif
6251
Daniel Veillard42595322004-11-08 10:52:06 +00006252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006253}
6254
6255
6256static int
6257test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006259
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006260#ifdef LIBXML_CATALOG_ENABLED
6261 int mem_base;
6262 xmlChar * ret_val;
6263 void * catalogs; /* a document's list of catalogs */
6264 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006265 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006266 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006267 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006268 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006269
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006270 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
6271 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6272 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6273 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006274 catalogs = gen_void_ptr(n_catalogs, 0);
6275 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
6276 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006277
6278 ret_val = xmlCatalogLocalResolve(catalogs, pubID, sysID);
6279 desret_xmlChar_ptr(ret_val);
6280 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006281 des_void_ptr(n_catalogs, catalogs, 0);
6282 des_const_xmlChar_ptr(n_pubID, pubID, 1);
6283 des_const_xmlChar_ptr(n_sysID, sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006284 xmlResetLastError();
6285 if (mem_base != xmlMemBlocks()) {
6286 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
6287 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006288 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006289 printf(" %d", n_catalogs);
6290 printf(" %d", n_pubID);
6291 printf(" %d", n_sysID);
6292 printf("\n");
6293 }
6294 }
6295 }
6296 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006297 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006298#endif
6299
Daniel Veillard42595322004-11-08 10:52:06 +00006300 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006301}
6302
6303
6304static int
6305test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006307
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006308#ifdef LIBXML_CATALOG_ENABLED
6309 int mem_base;
6310 xmlChar * ret_val;
6311 void * catalogs; /* a document's list of catalogs */
6312 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006313 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006314 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006315
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006316 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
6317 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6318 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006319 catalogs = gen_void_ptr(n_catalogs, 0);
6320 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006321
6322 ret_val = xmlCatalogLocalResolveURI(catalogs, URI);
6323 desret_xmlChar_ptr(ret_val);
6324 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006325 des_void_ptr(n_catalogs, catalogs, 0);
6326 des_const_xmlChar_ptr(n_URI, URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006327 xmlResetLastError();
6328 if (mem_base != xmlMemBlocks()) {
6329 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
6330 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006331 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006332 printf(" %d", n_catalogs);
6333 printf(" %d", n_URI);
6334 printf("\n");
6335 }
6336 }
6337 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006338 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006339#endif
6340
Daniel Veillard42595322004-11-08 10:52:06 +00006341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006342}
6343
6344
6345static int
6346test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006348
6349#ifdef LIBXML_CATALOG_ENABLED
6350 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006351 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006352 int n_value;
6353
6354 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006355 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006356
6357 ret_val = xmlCatalogRemove(value);
6358 desret_int(ret_val);
6359 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006360 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006361 xmlResetLastError();
6362 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006363 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006364#endif
6365
Daniel Veillard42595322004-11-08 10:52:06 +00006366 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006367}
6368
6369
6370static int
6371test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006373
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006374#ifdef LIBXML_CATALOG_ENABLED
6375 int mem_base;
6376 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006377 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006378 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006379 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006380 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006381
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006382 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6383 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6384 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006385 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6386 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006387
6388 ret_val = xmlCatalogResolve(pubID, sysID);
6389 desret_xmlChar_ptr(ret_val);
6390 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006391 des_const_xmlChar_ptr(n_pubID, pubID, 0);
6392 des_const_xmlChar_ptr(n_sysID, sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006393 xmlResetLastError();
6394 if (mem_base != xmlMemBlocks()) {
6395 printf("Leak of %d blocks found in xmlCatalogResolve",
6396 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006397 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006398 printf(" %d", n_pubID);
6399 printf(" %d", n_sysID);
6400 printf("\n");
6401 }
6402 }
6403 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006404 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006405#endif
6406
Daniel Veillard42595322004-11-08 10:52:06 +00006407 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006408}
6409
6410
6411static int
6412test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006414
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006415#ifdef LIBXML_CATALOG_ENABLED
6416 int mem_base;
6417 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006418 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006419 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006420
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006421 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6422 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006423 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006424
6425 ret_val = xmlCatalogResolvePublic(pubID);
6426 desret_xmlChar_ptr(ret_val);
6427 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006428 des_const_xmlChar_ptr(n_pubID, pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006429 xmlResetLastError();
6430 if (mem_base != xmlMemBlocks()) {
6431 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
6432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006433 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006434 printf(" %d", n_pubID);
6435 printf("\n");
6436 }
6437 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006438 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006439#endif
6440
Daniel Veillard42595322004-11-08 10:52:06 +00006441 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006442}
6443
6444
6445static int
6446test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006447 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006448
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006449#ifdef LIBXML_CATALOG_ENABLED
6450 int mem_base;
6451 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006452 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006453 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006454
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006455 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6456 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006457 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006458
6459 ret_val = xmlCatalogResolveSystem(sysID);
6460 desret_xmlChar_ptr(ret_val);
6461 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006462 des_const_xmlChar_ptr(n_sysID, sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006463 xmlResetLastError();
6464 if (mem_base != xmlMemBlocks()) {
6465 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006467 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006468 printf(" %d", n_sysID);
6469 printf("\n");
6470 }
6471 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006472 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006473#endif
6474
Daniel Veillard42595322004-11-08 10:52:06 +00006475 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006476}
6477
6478
6479static int
6480test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006481 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006482
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006483#ifdef LIBXML_CATALOG_ENABLED
6484 int mem_base;
6485 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006486 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006487 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006488
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006489 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6490 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006491 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006492
6493 ret_val = xmlCatalogResolveURI(URI);
6494 desret_xmlChar_ptr(ret_val);
6495 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006496 des_const_xmlChar_ptr(n_URI, URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006497 xmlResetLastError();
6498 if (mem_base != xmlMemBlocks()) {
6499 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6500 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006501 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006502 printf(" %d", n_URI);
6503 printf("\n");
6504 }
6505 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006506 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006507#endif
6508
Daniel Veillard42595322004-11-08 10:52:06 +00006509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006510}
6511
6512
6513static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006514test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006515 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006516
Daniel Veillard57b25162004-11-06 14:50:18 +00006517#ifdef LIBXML_CATALOG_ENABLED
6518 int mem_base;
6519 xmlCatalogPrefer ret_val;
6520 xmlCatalogPrefer prefer; /* the default preference for delegation */
6521 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006522
Daniel Veillard57b25162004-11-06 14:50:18 +00006523 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6524 mem_base = xmlMemBlocks();
6525 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6526
6527 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6528 desret_xmlCatalogPrefer(ret_val);
6529 call_tests++;
6530 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6531 xmlResetLastError();
6532 if (mem_base != xmlMemBlocks()) {
6533 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6534 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006535 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006536 printf(" %d", n_prefer);
6537 printf("\n");
6538 }
6539 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006540 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006541#endif
6542
Daniel Veillard42595322004-11-08 10:52:06 +00006543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006544}
6545
6546
6547static int
6548test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006549 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006550
Daniel Veillard57b25162004-11-06 14:50:18 +00006551#ifdef LIBXML_CATALOG_ENABLED
6552 int mem_base;
6553 xmlCatalogAllow allow; /* what catalogs should be accepted */
6554 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006555
Daniel Veillard57b25162004-11-06 14:50:18 +00006556 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6557 mem_base = xmlMemBlocks();
6558 allow = gen_xmlCatalogAllow(n_allow, 0);
6559
6560 xmlCatalogSetDefaults(allow);
6561 call_tests++;
6562 des_xmlCatalogAllow(n_allow, allow, 0);
6563 xmlResetLastError();
6564 if (mem_base != xmlMemBlocks()) {
6565 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006567 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006568 printf(" %d", n_allow);
6569 printf("\n");
6570 }
6571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006572 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006573#endif
6574
Daniel Veillard42595322004-11-08 10:52:06 +00006575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006576}
6577
6578
6579static int
6580test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006582
Daniel Veillardce682bc2004-11-05 17:22:25 +00006583#ifdef LIBXML_CATALOG_ENABLED
6584 int mem_base;
6585 int ret_val;
6586 xmlCatalogPtr catal; /* the catalog */
6587 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006588
Daniel Veillardce682bc2004-11-05 17:22:25 +00006589 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6590 mem_base = xmlMemBlocks();
6591 catal = gen_xmlCatalogPtr(n_catal, 0);
6592
6593 ret_val = xmlConvertSGMLCatalog(catal);
6594 desret_int(ret_val);
6595 call_tests++;
6596 des_xmlCatalogPtr(n_catal, catal, 0);
6597 xmlResetLastError();
6598 if (mem_base != xmlMemBlocks()) {
6599 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006601 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006602 printf(" %d", n_catal);
6603 printf("\n");
6604 }
6605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006606 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006607#endif
6608
Daniel Veillard42595322004-11-08 10:52:06 +00006609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006610}
6611
6612
6613static int
6614test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006616
6617#ifdef LIBXML_CATALOG_ENABLED
6618 int mem_base;
6619
6620 mem_base = xmlMemBlocks();
6621
6622 xmlInitializeCatalog();
6623 call_tests++;
6624 xmlResetLastError();
6625 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006626 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006627 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006628 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006629 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006630 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006631 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006632#endif
6633
Daniel Veillard42595322004-11-08 10:52:06 +00006634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006635}
6636
6637
6638static int
6639test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006641
6642
6643 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006645}
6646
6647
6648static int
6649test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006651
6652#ifdef LIBXML_CATALOG_ENABLED
6653 int ret_val;
6654 const char * filename; /* a file path */
6655 int n_filename;
6656
6657 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006658 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006659
6660 ret_val = xmlLoadCatalog(filename);
6661 desret_int(ret_val);
6662 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006663 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006664 xmlResetLastError();
6665 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006666 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006667#endif
6668
Daniel Veillard42595322004-11-08 10:52:06 +00006669 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006670}
6671
6672
6673static int
6674test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006675 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006676
6677#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00006678 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006679 int n_pathss;
6680
6681 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006682 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006683
6684 xmlLoadCatalogs(pathss);
6685 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006686 des_const_char_ptr(n_pathss, pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006687 xmlResetLastError();
6688 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006689 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006690#endif
6691
Daniel Veillard42595322004-11-08 10:52:06 +00006692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006693}
6694
6695
6696static int
6697test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006699
6700
6701 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006703}
6704
6705
6706static int
6707test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006709
6710
6711 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006713}
6714
6715
6716static int
6717test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006719
6720#ifdef LIBXML_CATALOG_ENABLED
6721 int mem_base;
6722 xmlDocPtr ret_val;
6723 const char * filename; /* the filename */
6724 int n_filename;
6725
6726 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6727 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006728 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006729
6730 ret_val = xmlParseCatalogFile(filename);
6731 desret_xmlDocPtr(ret_val);
6732 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006733 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006734 xmlResetLastError();
6735 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006736 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006738 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006739 printf(" %d", n_filename);
6740 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006741 }
6742 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006743 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006744#endif
6745
Daniel Veillard42595322004-11-08 10:52:06 +00006746 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006747}
6748
6749static int
6750test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006751 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006752
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006753 if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006754 test_ret += test_xmlACatalogAdd();
6755 test_ret += test_xmlACatalogDump();
6756 test_ret += test_xmlACatalogRemove();
6757 test_ret += test_xmlACatalogResolve();
6758 test_ret += test_xmlACatalogResolvePublic();
6759 test_ret += test_xmlACatalogResolveSystem();
6760 test_ret += test_xmlACatalogResolveURI();
6761 test_ret += test_xmlCatalogAdd();
6762 test_ret += test_xmlCatalogCleanup();
6763 test_ret += test_xmlCatalogConvert();
6764 test_ret += test_xmlCatalogDump();
6765 test_ret += test_xmlCatalogGetDefaults();
6766 test_ret += test_xmlCatalogIsEmpty();
6767 test_ret += test_xmlCatalogLocalResolve();
6768 test_ret += test_xmlCatalogLocalResolveURI();
6769 test_ret += test_xmlCatalogRemove();
6770 test_ret += test_xmlCatalogResolve();
6771 test_ret += test_xmlCatalogResolvePublic();
6772 test_ret += test_xmlCatalogResolveSystem();
6773 test_ret += test_xmlCatalogResolveURI();
6774 test_ret += test_xmlCatalogSetDefaultPrefer();
6775 test_ret += test_xmlCatalogSetDefaults();
6776 test_ret += test_xmlConvertSGMLCatalog();
6777 test_ret += test_xmlInitializeCatalog();
6778 test_ret += test_xmlLoadACatalog();
6779 test_ret += test_xmlLoadCatalog();
6780 test_ret += test_xmlLoadCatalogs();
6781 test_ret += test_xmlLoadSGMLSuperCatalog();
6782 test_ret += test_xmlNewCatalog();
6783 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006784
Daniel Veillard42595322004-11-08 10:52:06 +00006785 if (test_ret != 0)
6786 printf("Module catalog: %d errors\n", test_ret);
6787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006788}
6789
Daniel Veillardce682bc2004-11-05 17:22:25 +00006790#define gen_nb_const_xmlChRangeGroupPtr 1
6791static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6792 return(NULL);
6793}
6794static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6795}
6796
Daniel Veillardd93f6252004-11-02 15:53:51 +00006797static int
6798test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006799 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006800
Daniel Veillardce682bc2004-11-05 17:22:25 +00006801 int mem_base;
6802 int ret_val;
6803 unsigned int val; /* character to be validated */
6804 int n_val;
6805 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6806 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006807
Daniel Veillardce682bc2004-11-05 17:22:25 +00006808 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6809 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6810 mem_base = xmlMemBlocks();
6811 val = gen_unsigned_int(n_val, 0);
6812 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6813
6814 ret_val = xmlCharInRange(val, rptr);
6815 desret_int(ret_val);
6816 call_tests++;
6817 des_unsigned_int(n_val, val, 0);
6818 des_const_xmlChRangeGroupPtr(n_rptr, rptr, 1);
6819 xmlResetLastError();
6820 if (mem_base != xmlMemBlocks()) {
6821 printf("Leak of %d blocks found in xmlCharInRange",
6822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006823 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006824 printf(" %d", n_val);
6825 printf(" %d", n_rptr);
6826 printf("\n");
6827 }
6828 }
6829 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00006830 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006831
Daniel Veillard42595322004-11-08 10:52:06 +00006832 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006833}
6834
6835
6836static int
6837test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006838 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006839
Daniel Veillard3d97e662004-11-04 10:49:00 +00006840 int mem_base;
6841 int ret_val;
6842 unsigned int ch; /* character to validate */
6843 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006844
Daniel Veillard3d97e662004-11-04 10:49:00 +00006845 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6846 mem_base = xmlMemBlocks();
6847 ch = gen_unsigned_int(n_ch, 0);
6848
6849 ret_val = xmlIsBaseChar(ch);
6850 desret_int(ret_val);
6851 call_tests++;
6852 des_unsigned_int(n_ch, ch, 0);
6853 xmlResetLastError();
6854 if (mem_base != xmlMemBlocks()) {
6855 printf("Leak of %d blocks found in xmlIsBaseChar",
6856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006857 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006858 printf(" %d", n_ch);
6859 printf("\n");
6860 }
6861 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006862 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006863
Daniel Veillard42595322004-11-08 10:52:06 +00006864 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006865}
6866
6867
6868static int
6869test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006870 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006871
Daniel Veillard3d97e662004-11-04 10:49:00 +00006872 int mem_base;
6873 int ret_val;
6874 unsigned int ch; /* character to validate */
6875 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006876
Daniel Veillard3d97e662004-11-04 10:49:00 +00006877 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6878 mem_base = xmlMemBlocks();
6879 ch = gen_unsigned_int(n_ch, 0);
6880
6881 ret_val = xmlIsBlank(ch);
6882 desret_int(ret_val);
6883 call_tests++;
6884 des_unsigned_int(n_ch, ch, 0);
6885 xmlResetLastError();
6886 if (mem_base != xmlMemBlocks()) {
6887 printf("Leak of %d blocks found in xmlIsBlank",
6888 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006889 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006890 printf(" %d", n_ch);
6891 printf("\n");
6892 }
6893 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006894 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006895
Daniel Veillard42595322004-11-08 10:52:06 +00006896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006897}
6898
6899
6900static int
6901test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006902 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006903
Daniel Veillard3d97e662004-11-04 10:49:00 +00006904 int mem_base;
6905 int ret_val;
6906 unsigned int ch; /* character to validate */
6907 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006908
Daniel Veillard3d97e662004-11-04 10:49:00 +00006909 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6910 mem_base = xmlMemBlocks();
6911 ch = gen_unsigned_int(n_ch, 0);
6912
6913 ret_val = xmlIsChar(ch);
6914 desret_int(ret_val);
6915 call_tests++;
6916 des_unsigned_int(n_ch, ch, 0);
6917 xmlResetLastError();
6918 if (mem_base != xmlMemBlocks()) {
6919 printf("Leak of %d blocks found in xmlIsChar",
6920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006921 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006922 printf(" %d", n_ch);
6923 printf("\n");
6924 }
6925 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006926 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006927
Daniel Veillard42595322004-11-08 10:52:06 +00006928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006929}
6930
6931
6932static int
6933test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006935
Daniel Veillard3d97e662004-11-04 10:49:00 +00006936 int mem_base;
6937 int ret_val;
6938 unsigned int ch; /* character to validate */
6939 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006940
Daniel Veillard3d97e662004-11-04 10:49:00 +00006941 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6942 mem_base = xmlMemBlocks();
6943 ch = gen_unsigned_int(n_ch, 0);
6944
6945 ret_val = xmlIsCombining(ch);
6946 desret_int(ret_val);
6947 call_tests++;
6948 des_unsigned_int(n_ch, ch, 0);
6949 xmlResetLastError();
6950 if (mem_base != xmlMemBlocks()) {
6951 printf("Leak of %d blocks found in xmlIsCombining",
6952 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006953 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006954 printf(" %d", n_ch);
6955 printf("\n");
6956 }
6957 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006958 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006959
Daniel Veillard42595322004-11-08 10:52:06 +00006960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006961}
6962
6963
6964static int
6965test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006967
Daniel Veillard3d97e662004-11-04 10:49:00 +00006968 int mem_base;
6969 int ret_val;
6970 unsigned int ch; /* character to validate */
6971 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006972
Daniel Veillard3d97e662004-11-04 10:49:00 +00006973 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6974 mem_base = xmlMemBlocks();
6975 ch = gen_unsigned_int(n_ch, 0);
6976
6977 ret_val = xmlIsDigit(ch);
6978 desret_int(ret_val);
6979 call_tests++;
6980 des_unsigned_int(n_ch, ch, 0);
6981 xmlResetLastError();
6982 if (mem_base != xmlMemBlocks()) {
6983 printf("Leak of %d blocks found in xmlIsDigit",
6984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006985 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006986 printf(" %d", n_ch);
6987 printf("\n");
6988 }
6989 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006990 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006991
Daniel Veillard42595322004-11-08 10:52:06 +00006992 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006993}
6994
6995
6996static int
6997test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006998 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006999
Daniel Veillard3d97e662004-11-04 10:49:00 +00007000 int mem_base;
7001 int ret_val;
7002 unsigned int ch; /* character to validate */
7003 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007004
Daniel Veillard3d97e662004-11-04 10:49:00 +00007005 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
7006 mem_base = xmlMemBlocks();
7007 ch = gen_unsigned_int(n_ch, 0);
7008
7009 ret_val = xmlIsExtender(ch);
7010 desret_int(ret_val);
7011 call_tests++;
7012 des_unsigned_int(n_ch, ch, 0);
7013 xmlResetLastError();
7014 if (mem_base != xmlMemBlocks()) {
7015 printf("Leak of %d blocks found in xmlIsExtender",
7016 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007017 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007018 printf(" %d", n_ch);
7019 printf("\n");
7020 }
7021 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00007022 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007023
Daniel Veillard42595322004-11-08 10:52:06 +00007024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007025}
7026
7027
7028static int
7029test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007031
Daniel Veillard3d97e662004-11-04 10:49:00 +00007032 int mem_base;
7033 int ret_val;
7034 unsigned int ch; /* character to validate */
7035 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007036
Daniel Veillard3d97e662004-11-04 10:49:00 +00007037 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
7038 mem_base = xmlMemBlocks();
7039 ch = gen_unsigned_int(n_ch, 0);
7040
7041 ret_val = xmlIsIdeographic(ch);
7042 desret_int(ret_val);
7043 call_tests++;
7044 des_unsigned_int(n_ch, ch, 0);
7045 xmlResetLastError();
7046 if (mem_base != xmlMemBlocks()) {
7047 printf("Leak of %d blocks found in xmlIsIdeographic",
7048 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007049 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007050 printf(" %d", n_ch);
7051 printf("\n");
7052 }
7053 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00007054 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007055
Daniel Veillard42595322004-11-08 10:52:06 +00007056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007057}
7058
7059
7060static int
7061test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007062 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007063
Daniel Veillard3d97e662004-11-04 10:49:00 +00007064 int mem_base;
7065 int ret_val;
7066 unsigned int ch; /* character to validate */
7067 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007068
Daniel Veillard3d97e662004-11-04 10:49:00 +00007069 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
7070 mem_base = xmlMemBlocks();
7071 ch = gen_unsigned_int(n_ch, 0);
7072
7073 ret_val = xmlIsPubidChar(ch);
7074 desret_int(ret_val);
7075 call_tests++;
7076 des_unsigned_int(n_ch, ch, 0);
7077 xmlResetLastError();
7078 if (mem_base != xmlMemBlocks()) {
7079 printf("Leak of %d blocks found in xmlIsPubidChar",
7080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007081 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00007082 printf(" %d", n_ch);
7083 printf("\n");
7084 }
7085 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00007086 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007087
Daniel Veillard42595322004-11-08 10:52:06 +00007088 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007089}
7090
7091static int
7092test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007093 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007094
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007095 if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00007096 test_ret += test_xmlCharInRange();
7097 test_ret += test_xmlIsBaseChar();
7098 test_ret += test_xmlIsBlank();
7099 test_ret += test_xmlIsChar();
7100 test_ret += test_xmlIsCombining();
7101 test_ret += test_xmlIsDigit();
7102 test_ret += test_xmlIsExtender();
7103 test_ret += test_xmlIsIdeographic();
7104 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00007105
Daniel Veillard42595322004-11-08 10:52:06 +00007106 if (test_ret != 0)
7107 printf("Module chvalid: %d errors\n", test_ret);
7108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007109}
7110
7111static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00007112test_xmlBoolToText(void) {
7113 int test_ret = 0;
7114
7115#ifdef LIBXML_DEBUG_ENABLED
7116 int mem_base;
7117 const char * ret_val;
7118 int boolval; /* a bool to turn into text */
7119 int n_boolval;
7120
7121 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
7122 mem_base = xmlMemBlocks();
7123 boolval = gen_int(n_boolval, 0);
7124
7125 ret_val = xmlBoolToText(boolval);
7126 desret_const_char_ptr(ret_val);
7127 call_tests++;
7128 des_int(n_boolval, boolval, 0);
7129 xmlResetLastError();
7130 if (mem_base != xmlMemBlocks()) {
7131 printf("Leak of %d blocks found in xmlBoolToText",
7132 xmlMemBlocks() - mem_base);
7133 test_ret++;
7134 printf(" %d", n_boolval);
7135 printf("\n");
7136 }
7137 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007138 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007139#endif
7140
Daniel Veillarda82b1822004-11-08 16:24:57 +00007141 return(test_ret);
7142}
7143
7144
7145static int
7146test_xmlDebugCheckDocument(void) {
7147 int test_ret = 0;
7148
7149#ifdef LIBXML_DEBUG_ENABLED
7150 int mem_base;
7151 int ret_val;
7152 FILE * output; /* the FILE * for the output */
7153 int n_output;
7154 xmlDocPtr doc; /* the document */
7155 int n_doc;
7156
7157 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7158 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7159 mem_base = xmlMemBlocks();
7160 output = gen_debug_FILE_ptr(n_output, 0);
7161 doc = gen_xmlDocPtr(n_doc, 1);
7162
7163 ret_val = xmlDebugCheckDocument(output, doc);
7164 desret_int(ret_val);
7165 call_tests++;
7166 des_debug_FILE_ptr(n_output, output, 0);
7167 des_xmlDocPtr(n_doc, doc, 1);
7168 xmlResetLastError();
7169 if (mem_base != xmlMemBlocks()) {
7170 printf("Leak of %d blocks found in xmlDebugCheckDocument",
7171 xmlMemBlocks() - mem_base);
7172 test_ret++;
7173 printf(" %d", n_output);
7174 printf(" %d", n_doc);
7175 printf("\n");
7176 }
7177 }
7178 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007179 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007180#endif
7181
Daniel Veillarda82b1822004-11-08 16:24:57 +00007182 return(test_ret);
7183}
7184
7185
7186static int
7187test_xmlDebugDumpAttr(void) {
7188 int test_ret = 0;
7189
7190#ifdef LIBXML_DEBUG_ENABLED
7191 int mem_base;
7192 FILE * output; /* the FILE * for the output */
7193 int n_output;
7194 xmlAttrPtr attr; /* the attribute */
7195 int n_attr;
7196 int depth; /* the indentation level. */
7197 int n_depth;
7198
7199 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7200 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
7201 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7202 mem_base = xmlMemBlocks();
7203 output = gen_debug_FILE_ptr(n_output, 0);
7204 attr = gen_xmlAttrPtr(n_attr, 1);
7205 depth = gen_int(n_depth, 2);
7206
7207 xmlDebugDumpAttr(output, attr, depth);
7208 call_tests++;
7209 des_debug_FILE_ptr(n_output, output, 0);
7210 des_xmlAttrPtr(n_attr, attr, 1);
7211 des_int(n_depth, depth, 2);
7212 xmlResetLastError();
7213 if (mem_base != xmlMemBlocks()) {
7214 printf("Leak of %d blocks found in xmlDebugDumpAttr",
7215 xmlMemBlocks() - mem_base);
7216 test_ret++;
7217 printf(" %d", n_output);
7218 printf(" %d", n_attr);
7219 printf(" %d", n_depth);
7220 printf("\n");
7221 }
7222 }
7223 }
7224 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007225 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007226#endif
7227
Daniel Veillarda82b1822004-11-08 16:24:57 +00007228 return(test_ret);
7229}
7230
7231
7232static int
7233test_xmlDebugDumpAttrList(void) {
7234 int test_ret = 0;
7235
7236#ifdef LIBXML_DEBUG_ENABLED
7237 int mem_base;
7238 FILE * output; /* the FILE * for the output */
7239 int n_output;
7240 xmlAttrPtr attr; /* the attribute list */
7241 int n_attr;
7242 int depth; /* the indentation level. */
7243 int n_depth;
7244
7245 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7246 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
7247 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7248 mem_base = xmlMemBlocks();
7249 output = gen_debug_FILE_ptr(n_output, 0);
7250 attr = gen_xmlAttrPtr(n_attr, 1);
7251 depth = gen_int(n_depth, 2);
7252
7253 xmlDebugDumpAttrList(output, attr, depth);
7254 call_tests++;
7255 des_debug_FILE_ptr(n_output, output, 0);
7256 des_xmlAttrPtr(n_attr, attr, 1);
7257 des_int(n_depth, depth, 2);
7258 xmlResetLastError();
7259 if (mem_base != xmlMemBlocks()) {
7260 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
7261 xmlMemBlocks() - mem_base);
7262 test_ret++;
7263 printf(" %d", n_output);
7264 printf(" %d", n_attr);
7265 printf(" %d", n_depth);
7266 printf("\n");
7267 }
7268 }
7269 }
7270 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007271 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007272#endif
7273
Daniel Veillarda82b1822004-11-08 16:24:57 +00007274 return(test_ret);
7275}
7276
7277
7278static int
7279test_xmlDebugDumpDTD(void) {
7280 int test_ret = 0;
7281
7282#ifdef LIBXML_DEBUG_ENABLED
7283 int mem_base;
7284 FILE * output; /* the FILE * for the output */
7285 int n_output;
7286 xmlDtdPtr dtd; /* the DTD */
7287 int n_dtd;
7288
7289 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7290 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
7291 mem_base = xmlMemBlocks();
7292 output = gen_debug_FILE_ptr(n_output, 0);
7293 dtd = gen_xmlDtdPtr(n_dtd, 1);
7294
7295 xmlDebugDumpDTD(output, dtd);
7296 call_tests++;
7297 des_debug_FILE_ptr(n_output, output, 0);
7298 des_xmlDtdPtr(n_dtd, dtd, 1);
7299 xmlResetLastError();
7300 if (mem_base != xmlMemBlocks()) {
7301 printf("Leak of %d blocks found in xmlDebugDumpDTD",
7302 xmlMemBlocks() - mem_base);
7303 test_ret++;
7304 printf(" %d", n_output);
7305 printf(" %d", n_dtd);
7306 printf("\n");
7307 }
7308 }
7309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007310 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007311#endif
7312
Daniel Veillarda82b1822004-11-08 16:24:57 +00007313 return(test_ret);
7314}
7315
7316
7317static int
7318test_xmlDebugDumpDocument(void) {
7319 int test_ret = 0;
7320
7321#ifdef LIBXML_DEBUG_ENABLED
7322 int mem_base;
7323 FILE * output; /* the FILE * for the output */
7324 int n_output;
7325 xmlDocPtr doc; /* the document */
7326 int n_doc;
7327
7328 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7329 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7330 mem_base = xmlMemBlocks();
7331 output = gen_debug_FILE_ptr(n_output, 0);
7332 doc = gen_xmlDocPtr(n_doc, 1);
7333
7334 xmlDebugDumpDocument(output, doc);
7335 call_tests++;
7336 des_debug_FILE_ptr(n_output, output, 0);
7337 des_xmlDocPtr(n_doc, doc, 1);
7338 xmlResetLastError();
7339 if (mem_base != xmlMemBlocks()) {
7340 printf("Leak of %d blocks found in xmlDebugDumpDocument",
7341 xmlMemBlocks() - mem_base);
7342 test_ret++;
7343 printf(" %d", n_output);
7344 printf(" %d", n_doc);
7345 printf("\n");
7346 }
7347 }
7348 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007349 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007350#endif
7351
Daniel Veillarda82b1822004-11-08 16:24:57 +00007352 return(test_ret);
7353}
7354
7355
7356static int
7357test_xmlDebugDumpDocumentHead(void) {
7358 int test_ret = 0;
7359
7360#ifdef LIBXML_DEBUG_ENABLED
7361 int mem_base;
7362 FILE * output; /* the FILE * for the output */
7363 int n_output;
7364 xmlDocPtr doc; /* the document */
7365 int n_doc;
7366
7367 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7368 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7369 mem_base = xmlMemBlocks();
7370 output = gen_debug_FILE_ptr(n_output, 0);
7371 doc = gen_xmlDocPtr(n_doc, 1);
7372
7373 xmlDebugDumpDocumentHead(output, doc);
7374 call_tests++;
7375 des_debug_FILE_ptr(n_output, output, 0);
7376 des_xmlDocPtr(n_doc, doc, 1);
7377 xmlResetLastError();
7378 if (mem_base != xmlMemBlocks()) {
7379 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7380 xmlMemBlocks() - mem_base);
7381 test_ret++;
7382 printf(" %d", n_output);
7383 printf(" %d", n_doc);
7384 printf("\n");
7385 }
7386 }
7387 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007388 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007389#endif
7390
Daniel Veillarda82b1822004-11-08 16:24:57 +00007391 return(test_ret);
7392}
7393
7394
7395static int
7396test_xmlDebugDumpEntities(void) {
7397 int test_ret = 0;
7398
7399#ifdef LIBXML_DEBUG_ENABLED
7400 int mem_base;
7401 FILE * output; /* the FILE * for the output */
7402 int n_output;
7403 xmlDocPtr doc; /* the document */
7404 int n_doc;
7405
7406 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7407 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7408 mem_base = xmlMemBlocks();
7409 output = gen_debug_FILE_ptr(n_output, 0);
7410 doc = gen_xmlDocPtr(n_doc, 1);
7411
7412 xmlDebugDumpEntities(output, doc);
7413 call_tests++;
7414 des_debug_FILE_ptr(n_output, output, 0);
7415 des_xmlDocPtr(n_doc, doc, 1);
7416 xmlResetLastError();
7417 if (mem_base != xmlMemBlocks()) {
7418 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7419 xmlMemBlocks() - mem_base);
7420 test_ret++;
7421 printf(" %d", n_output);
7422 printf(" %d", n_doc);
7423 printf("\n");
7424 }
7425 }
7426 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007427 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007428#endif
7429
Daniel Veillarda82b1822004-11-08 16:24:57 +00007430 return(test_ret);
7431}
7432
7433
7434static int
7435test_xmlDebugDumpNode(void) {
7436 int test_ret = 0;
7437
7438#ifdef LIBXML_DEBUG_ENABLED
7439 int mem_base;
7440 FILE * output; /* the FILE * for the output */
7441 int n_output;
7442 xmlNodePtr node; /* the node */
7443 int n_node;
7444 int depth; /* the indentation level. */
7445 int n_depth;
7446
7447 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7448 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7449 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7450 mem_base = xmlMemBlocks();
7451 output = gen_debug_FILE_ptr(n_output, 0);
7452 node = gen_xmlNodePtr(n_node, 1);
7453 depth = gen_int(n_depth, 2);
7454
7455 xmlDebugDumpNode(output, node, depth);
7456 call_tests++;
7457 des_debug_FILE_ptr(n_output, output, 0);
7458 des_xmlNodePtr(n_node, node, 1);
7459 des_int(n_depth, depth, 2);
7460 xmlResetLastError();
7461 if (mem_base != xmlMemBlocks()) {
7462 printf("Leak of %d blocks found in xmlDebugDumpNode",
7463 xmlMemBlocks() - mem_base);
7464 test_ret++;
7465 printf(" %d", n_output);
7466 printf(" %d", n_node);
7467 printf(" %d", n_depth);
7468 printf("\n");
7469 }
7470 }
7471 }
7472 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007473 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007474#endif
7475
Daniel Veillarda82b1822004-11-08 16:24:57 +00007476 return(test_ret);
7477}
7478
7479
7480static int
7481test_xmlDebugDumpNodeList(void) {
7482 int test_ret = 0;
7483
7484#ifdef LIBXML_DEBUG_ENABLED
7485 int mem_base;
7486 FILE * output; /* the FILE * for the output */
7487 int n_output;
7488 xmlNodePtr node; /* the node list */
7489 int n_node;
7490 int depth; /* the indentation level. */
7491 int n_depth;
7492
7493 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7494 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7495 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7496 mem_base = xmlMemBlocks();
7497 output = gen_debug_FILE_ptr(n_output, 0);
7498 node = gen_xmlNodePtr(n_node, 1);
7499 depth = gen_int(n_depth, 2);
7500
7501 xmlDebugDumpNodeList(output, node, depth);
7502 call_tests++;
7503 des_debug_FILE_ptr(n_output, output, 0);
7504 des_xmlNodePtr(n_node, node, 1);
7505 des_int(n_depth, depth, 2);
7506 xmlResetLastError();
7507 if (mem_base != xmlMemBlocks()) {
7508 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7509 xmlMemBlocks() - mem_base);
7510 test_ret++;
7511 printf(" %d", n_output);
7512 printf(" %d", n_node);
7513 printf(" %d", n_depth);
7514 printf("\n");
7515 }
7516 }
7517 }
7518 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007519 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007520#endif
7521
Daniel Veillarda82b1822004-11-08 16:24:57 +00007522 return(test_ret);
7523}
7524
7525
7526static int
7527test_xmlDebugDumpOneNode(void) {
7528 int test_ret = 0;
7529
7530#ifdef LIBXML_DEBUG_ENABLED
7531 int mem_base;
7532 FILE * output; /* the FILE * for the output */
7533 int n_output;
7534 xmlNodePtr node; /* the node */
7535 int n_node;
7536 int depth; /* the indentation level. */
7537 int n_depth;
7538
7539 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7540 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7541 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7542 mem_base = xmlMemBlocks();
7543 output = gen_debug_FILE_ptr(n_output, 0);
7544 node = gen_xmlNodePtr(n_node, 1);
7545 depth = gen_int(n_depth, 2);
7546
7547 xmlDebugDumpOneNode(output, node, depth);
7548 call_tests++;
7549 des_debug_FILE_ptr(n_output, output, 0);
7550 des_xmlNodePtr(n_node, node, 1);
7551 des_int(n_depth, depth, 2);
7552 xmlResetLastError();
7553 if (mem_base != xmlMemBlocks()) {
7554 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7555 xmlMemBlocks() - mem_base);
7556 test_ret++;
7557 printf(" %d", n_output);
7558 printf(" %d", n_node);
7559 printf(" %d", n_depth);
7560 printf("\n");
7561 }
7562 }
7563 }
7564 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007565 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007566#endif
7567
Daniel Veillarda82b1822004-11-08 16:24:57 +00007568 return(test_ret);
7569}
7570
7571
7572static int
7573test_xmlDebugDumpString(void) {
7574 int test_ret = 0;
7575
7576#ifdef LIBXML_DEBUG_ENABLED
7577 int mem_base;
7578 FILE * output; /* the FILE * for the output */
7579 int n_output;
7580 xmlChar * str; /* the string */
7581 int n_str;
7582
7583 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7584 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7585 mem_base = xmlMemBlocks();
7586 output = gen_debug_FILE_ptr(n_output, 0);
7587 str = gen_const_xmlChar_ptr(n_str, 1);
7588
7589 xmlDebugDumpString(output, str);
7590 call_tests++;
7591 des_debug_FILE_ptr(n_output, output, 0);
7592 des_const_xmlChar_ptr(n_str, str, 1);
7593 xmlResetLastError();
7594 if (mem_base != xmlMemBlocks()) {
7595 printf("Leak of %d blocks found in xmlDebugDumpString",
7596 xmlMemBlocks() - mem_base);
7597 test_ret++;
7598 printf(" %d", n_output);
7599 printf(" %d", n_str);
7600 printf("\n");
7601 }
7602 }
7603 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007604 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007605#endif
7606
Daniel Veillarda82b1822004-11-08 16:24:57 +00007607 return(test_ret);
7608}
7609
7610
7611static int
7612test_xmlLsCountNode(void) {
7613 int test_ret = 0;
7614
7615#ifdef LIBXML_DEBUG_ENABLED
7616 int mem_base;
7617 int ret_val;
7618 xmlNodePtr node; /* the node to count */
7619 int n_node;
7620
7621 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7622 mem_base = xmlMemBlocks();
7623 node = gen_xmlNodePtr(n_node, 0);
7624
7625 ret_val = xmlLsCountNode(node);
7626 desret_int(ret_val);
7627 call_tests++;
7628 des_xmlNodePtr(n_node, node, 0);
7629 xmlResetLastError();
7630 if (mem_base != xmlMemBlocks()) {
7631 printf("Leak of %d blocks found in xmlLsCountNode",
7632 xmlMemBlocks() - mem_base);
7633 test_ret++;
7634 printf(" %d", n_node);
7635 printf("\n");
7636 }
7637 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007638 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007639#endif
7640
Daniel Veillarda82b1822004-11-08 16:24:57 +00007641 return(test_ret);
7642}
7643
7644
7645static int
7646test_xmlLsOneNode(void) {
7647 int test_ret = 0;
7648
7649#ifdef LIBXML_DEBUG_ENABLED
7650 int mem_base;
7651 FILE * output; /* the FILE * for the output */
7652 int n_output;
7653 xmlNodePtr node; /* the node to dump */
7654 int n_node;
7655
7656 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7657 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7658 mem_base = xmlMemBlocks();
7659 output = gen_debug_FILE_ptr(n_output, 0);
7660 node = gen_xmlNodePtr(n_node, 1);
7661
7662 xmlLsOneNode(output, node);
7663 call_tests++;
7664 des_debug_FILE_ptr(n_output, output, 0);
7665 des_xmlNodePtr(n_node, node, 1);
7666 xmlResetLastError();
7667 if (mem_base != xmlMemBlocks()) {
7668 printf("Leak of %d blocks found in xmlLsOneNode",
7669 xmlMemBlocks() - mem_base);
7670 test_ret++;
7671 printf(" %d", n_output);
7672 printf(" %d", n_node);
7673 printf("\n");
7674 }
7675 }
7676 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007677 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007678#endif
7679
Daniel Veillarda82b1822004-11-08 16:24:57 +00007680 return(test_ret);
7681}
7682
7683
7684#define gen_nb_char_ptr 1
7685static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7686 return(NULL);
7687}
7688static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7689}
7690
7691static int
7692test_xmlShell(void) {
7693 int test_ret = 0;
7694
7695
7696 /* missing type support */
7697 return(test_ret);
7698}
7699
7700
Daniel Veillarda82b1822004-11-08 16:24:57 +00007701static int
7702test_xmlShellBase(void) {
7703 int test_ret = 0;
7704
7705#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007706#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007707 int mem_base;
7708 int ret_val;
7709 xmlShellCtxtPtr ctxt; /* the shell context */
7710 int n_ctxt;
7711 char * arg; /* unused */
7712 int n_arg;
7713 xmlNodePtr node; /* a node */
7714 int n_node;
7715 xmlNodePtr node2; /* unused */
7716 int n_node2;
7717
7718 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7719 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7720 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7721 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7722 mem_base = xmlMemBlocks();
7723 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7724 arg = gen_char_ptr(n_arg, 1);
7725 node = gen_xmlNodePtr(n_node, 2);
7726 node2 = gen_xmlNodePtr(n_node2, 3);
7727
7728 ret_val = xmlShellBase(ctxt, arg, node, node2);
7729 desret_int(ret_val);
7730 call_tests++;
7731 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7732 des_char_ptr(n_arg, arg, 1);
7733 des_xmlNodePtr(n_node, node, 2);
7734 des_xmlNodePtr(n_node2, node2, 3);
7735 xmlResetLastError();
7736 if (mem_base != xmlMemBlocks()) {
7737 printf("Leak of %d blocks found in xmlShellBase",
7738 xmlMemBlocks() - mem_base);
7739 test_ret++;
7740 printf(" %d", n_ctxt);
7741 printf(" %d", n_arg);
7742 printf(" %d", n_node);
7743 printf(" %d", n_node2);
7744 printf("\n");
7745 }
7746 }
7747 }
7748 }
7749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007750 function_tests++;
7751#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007752#endif
7753
Daniel Veillarda82b1822004-11-08 16:24:57 +00007754 return(test_ret);
7755}
7756
7757
7758static int
7759test_xmlShellCat(void) {
7760 int test_ret = 0;
7761
7762#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007763#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007764 int mem_base;
7765 int ret_val;
7766 xmlShellCtxtPtr ctxt; /* the shell context */
7767 int n_ctxt;
7768 char * arg; /* unused */
7769 int n_arg;
7770 xmlNodePtr node; /* a node */
7771 int n_node;
7772 xmlNodePtr node2; /* unused */
7773 int n_node2;
7774
7775 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7776 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7777 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7778 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7779 mem_base = xmlMemBlocks();
7780 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7781 arg = gen_char_ptr(n_arg, 1);
7782 node = gen_xmlNodePtr(n_node, 2);
7783 node2 = gen_xmlNodePtr(n_node2, 3);
7784
7785 ret_val = xmlShellCat(ctxt, arg, node, node2);
7786 desret_int(ret_val);
7787 call_tests++;
7788 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7789 des_char_ptr(n_arg, arg, 1);
7790 des_xmlNodePtr(n_node, node, 2);
7791 des_xmlNodePtr(n_node2, node2, 3);
7792 xmlResetLastError();
7793 if (mem_base != xmlMemBlocks()) {
7794 printf("Leak of %d blocks found in xmlShellCat",
7795 xmlMemBlocks() - mem_base);
7796 test_ret++;
7797 printf(" %d", n_ctxt);
7798 printf(" %d", n_arg);
7799 printf(" %d", n_node);
7800 printf(" %d", n_node2);
7801 printf("\n");
7802 }
7803 }
7804 }
7805 }
7806 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007807 function_tests++;
7808#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007809#endif
7810
Daniel Veillarda82b1822004-11-08 16:24:57 +00007811 return(test_ret);
7812}
7813
7814
7815static int
7816test_xmlShellDir(void) {
7817 int test_ret = 0;
7818
7819#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007820#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007821 int mem_base;
7822 int ret_val;
7823 xmlShellCtxtPtr ctxt; /* the shell context */
7824 int n_ctxt;
7825 char * arg; /* unused */
7826 int n_arg;
7827 xmlNodePtr node; /* a node */
7828 int n_node;
7829 xmlNodePtr node2; /* unused */
7830 int n_node2;
7831
7832 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7833 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7834 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7835 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7836 mem_base = xmlMemBlocks();
7837 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7838 arg = gen_char_ptr(n_arg, 1);
7839 node = gen_xmlNodePtr(n_node, 2);
7840 node2 = gen_xmlNodePtr(n_node2, 3);
7841
7842 ret_val = xmlShellDir(ctxt, arg, node, node2);
7843 desret_int(ret_val);
7844 call_tests++;
7845 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7846 des_char_ptr(n_arg, arg, 1);
7847 des_xmlNodePtr(n_node, node, 2);
7848 des_xmlNodePtr(n_node2, node2, 3);
7849 xmlResetLastError();
7850 if (mem_base != xmlMemBlocks()) {
7851 printf("Leak of %d blocks found in xmlShellDir",
7852 xmlMemBlocks() - mem_base);
7853 test_ret++;
7854 printf(" %d", n_ctxt);
7855 printf(" %d", n_arg);
7856 printf(" %d", n_node);
7857 printf(" %d", n_node2);
7858 printf("\n");
7859 }
7860 }
7861 }
7862 }
7863 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007864 function_tests++;
7865#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007866#endif
7867
Daniel Veillarda82b1822004-11-08 16:24:57 +00007868 return(test_ret);
7869}
7870
7871
7872static int
7873test_xmlShellDu(void) {
7874 int test_ret = 0;
7875
7876#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007877#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007878 int mem_base;
7879 int ret_val;
7880 xmlShellCtxtPtr ctxt; /* the shell context */
7881 int n_ctxt;
7882 char * arg; /* unused */
7883 int n_arg;
7884 xmlNodePtr tree; /* a node defining a subtree */
7885 int n_tree;
7886 xmlNodePtr node2; /* unused */
7887 int n_node2;
7888
7889 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7890 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7891 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7892 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7893 mem_base = xmlMemBlocks();
7894 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7895 arg = gen_char_ptr(n_arg, 1);
7896 tree = gen_xmlNodePtr(n_tree, 2);
7897 node2 = gen_xmlNodePtr(n_node2, 3);
7898
7899 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7900 desret_int(ret_val);
7901 call_tests++;
7902 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7903 des_char_ptr(n_arg, arg, 1);
7904 des_xmlNodePtr(n_tree, tree, 2);
7905 des_xmlNodePtr(n_node2, node2, 3);
7906 xmlResetLastError();
7907 if (mem_base != xmlMemBlocks()) {
7908 printf("Leak of %d blocks found in xmlShellDu",
7909 xmlMemBlocks() - mem_base);
7910 test_ret++;
7911 printf(" %d", n_ctxt);
7912 printf(" %d", n_arg);
7913 printf(" %d", n_tree);
7914 printf(" %d", n_node2);
7915 printf("\n");
7916 }
7917 }
7918 }
7919 }
7920 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007921 function_tests++;
7922#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007923#endif
7924
Daniel Veillarda82b1822004-11-08 16:24:57 +00007925 return(test_ret);
7926}
7927
7928
7929static int
7930test_xmlShellList(void) {
7931 int test_ret = 0;
7932
7933#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007934#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007935 int mem_base;
7936 int ret_val;
7937 xmlShellCtxtPtr ctxt; /* the shell context */
7938 int n_ctxt;
7939 char * arg; /* unused */
7940 int n_arg;
7941 xmlNodePtr node; /* a node */
7942 int n_node;
7943 xmlNodePtr node2; /* unused */
7944 int n_node2;
7945
7946 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7947 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7948 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7949 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7950 mem_base = xmlMemBlocks();
7951 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7952 arg = gen_char_ptr(n_arg, 1);
7953 node = gen_xmlNodePtr(n_node, 2);
7954 node2 = gen_xmlNodePtr(n_node2, 3);
7955
7956 ret_val = xmlShellList(ctxt, arg, node, node2);
7957 desret_int(ret_val);
7958 call_tests++;
7959 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7960 des_char_ptr(n_arg, arg, 1);
7961 des_xmlNodePtr(n_node, node, 2);
7962 des_xmlNodePtr(n_node2, node2, 3);
7963 xmlResetLastError();
7964 if (mem_base != xmlMemBlocks()) {
7965 printf("Leak of %d blocks found in xmlShellList",
7966 xmlMemBlocks() - mem_base);
7967 test_ret++;
7968 printf(" %d", n_ctxt);
7969 printf(" %d", n_arg);
7970 printf(" %d", n_node);
7971 printf(" %d", n_node2);
7972 printf("\n");
7973 }
7974 }
7975 }
7976 }
7977 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007978 function_tests++;
7979#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007980#endif
7981
Daniel Veillarda82b1822004-11-08 16:24:57 +00007982 return(test_ret);
7983}
7984
7985
7986static int
7987test_xmlShellLoad(void) {
7988 int test_ret = 0;
7989
7990#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007991#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00007992 int mem_base;
7993 int ret_val;
7994 xmlShellCtxtPtr ctxt; /* the shell context */
7995 int n_ctxt;
7996 char * filename; /* the file name */
7997 int n_filename;
7998 xmlNodePtr node; /* unused */
7999 int n_node;
8000 xmlNodePtr node2; /* unused */
8001 int n_node2;
8002
8003 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8004 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
8005 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8006 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8007 mem_base = xmlMemBlocks();
8008 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8009 filename = gen_char_ptr(n_filename, 1);
8010 node = gen_xmlNodePtr(n_node, 2);
8011 node2 = gen_xmlNodePtr(n_node2, 3);
8012
8013 ret_val = xmlShellLoad(ctxt, filename, node, node2);
8014 desret_int(ret_val);
8015 call_tests++;
8016 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8017 des_char_ptr(n_filename, filename, 1);
8018 des_xmlNodePtr(n_node, node, 2);
8019 des_xmlNodePtr(n_node2, node2, 3);
8020 xmlResetLastError();
8021 if (mem_base != xmlMemBlocks()) {
8022 printf("Leak of %d blocks found in xmlShellLoad",
8023 xmlMemBlocks() - mem_base);
8024 test_ret++;
8025 printf(" %d", n_ctxt);
8026 printf(" %d", n_filename);
8027 printf(" %d", n_node);
8028 printf(" %d", n_node2);
8029 printf("\n");
8030 }
8031 }
8032 }
8033 }
8034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008035 function_tests++;
8036#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00008037#endif
8038
Daniel Veillarda82b1822004-11-08 16:24:57 +00008039 return(test_ret);
8040}
8041
8042
8043static int
8044test_xmlShellPrintXPathResult(void) {
8045 int test_ret = 0;
8046
8047#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008048#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00008049 int mem_base;
8050 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
8051 int n_list;
8052
8053 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
8054 mem_base = xmlMemBlocks();
8055 list = gen_xmlXPathObjectPtr(n_list, 0);
8056
8057 xmlShellPrintXPathResult(list);
8058 call_tests++;
8059 des_xmlXPathObjectPtr(n_list, list, 0);
8060 xmlResetLastError();
8061 if (mem_base != xmlMemBlocks()) {
8062 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
8063 xmlMemBlocks() - mem_base);
8064 test_ret++;
8065 printf(" %d", n_list);
8066 printf("\n");
8067 }
8068 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008069 function_tests++;
8070#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00008071#endif
8072
Daniel Veillarda82b1822004-11-08 16:24:57 +00008073 return(test_ret);
8074}
8075
8076
8077static int
8078test_xmlShellPwd(void) {
8079 int test_ret = 0;
8080
8081#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008082#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00008083 int mem_base;
8084 int ret_val;
8085 xmlShellCtxtPtr ctxt; /* the shell context */
8086 int n_ctxt;
8087 char * buffer; /* the output buffer */
8088 int n_buffer;
8089 xmlNodePtr node; /* a node */
8090 int n_node;
8091 xmlNodePtr node2; /* unused */
8092 int n_node2;
8093
8094 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8095 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
8096 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8097 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8098 mem_base = xmlMemBlocks();
8099 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8100 buffer = gen_char_ptr(n_buffer, 1);
8101 node = gen_xmlNodePtr(n_node, 2);
8102 node2 = gen_xmlNodePtr(n_node2, 3);
8103
8104 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
8105 desret_int(ret_val);
8106 call_tests++;
8107 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8108 des_char_ptr(n_buffer, buffer, 1);
8109 des_xmlNodePtr(n_node, node, 2);
8110 des_xmlNodePtr(n_node2, node2, 3);
8111 xmlResetLastError();
8112 if (mem_base != xmlMemBlocks()) {
8113 printf("Leak of %d blocks found in xmlShellPwd",
8114 xmlMemBlocks() - mem_base);
8115 test_ret++;
8116 printf(" %d", n_ctxt);
8117 printf(" %d", n_buffer);
8118 printf(" %d", n_node);
8119 printf(" %d", n_node2);
8120 printf("\n");
8121 }
8122 }
8123 }
8124 }
8125 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008126 function_tests++;
8127#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00008128#endif
8129
Daniel Veillarda82b1822004-11-08 16:24:57 +00008130 return(test_ret);
8131}
8132
8133
8134static int
8135test_xmlShellSave(void) {
8136 int test_ret = 0;
8137
8138#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008139#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00008140#ifdef LIBXML_OUTPUT_ENABLED
8141 int mem_base;
8142 int ret_val;
8143 xmlShellCtxtPtr ctxt; /* the shell context */
8144 int n_ctxt;
8145 char * filename; /* the file name (optional) */
8146 int n_filename;
8147 xmlNodePtr node; /* unused */
8148 int n_node;
8149 xmlNodePtr node2; /* unused */
8150 int n_node2;
8151
8152 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8153 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
8154 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8155 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8156 mem_base = xmlMemBlocks();
8157 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8158 filename = gen_char_ptr(n_filename, 1);
8159 node = gen_xmlNodePtr(n_node, 2);
8160 node2 = gen_xmlNodePtr(n_node2, 3);
8161
8162 ret_val = xmlShellSave(ctxt, filename, node, node2);
8163 desret_int(ret_val);
8164 call_tests++;
8165 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8166 des_char_ptr(n_filename, filename, 1);
8167 des_xmlNodePtr(n_node, node, 2);
8168 des_xmlNodePtr(n_node2, node2, 3);
8169 xmlResetLastError();
8170 if (mem_base != xmlMemBlocks()) {
8171 printf("Leak of %d blocks found in xmlShellSave",
8172 xmlMemBlocks() - mem_base);
8173 test_ret++;
8174 printf(" %d", n_ctxt);
8175 printf(" %d", n_filename);
8176 printf(" %d", n_node);
8177 printf(" %d", n_node2);
8178 printf("\n");
8179 }
8180 }
8181 }
8182 }
8183 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008184 function_tests++;
8185#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00008186#endif
8187#endif
8188
Daniel Veillarda82b1822004-11-08 16:24:57 +00008189 return(test_ret);
8190}
8191
8192
8193static int
8194test_xmlShellValidate(void) {
8195 int test_ret = 0;
8196
8197#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008198#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00008199 int mem_base;
8200 int ret_val;
8201 xmlShellCtxtPtr ctxt; /* the shell context */
8202 int n_ctxt;
8203 char * dtd; /* the DTD URI (optional) */
8204 int n_dtd;
8205 xmlNodePtr node; /* unused */
8206 int n_node;
8207 xmlNodePtr node2; /* unused */
8208 int n_node2;
8209
8210 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8211 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
8212 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8213 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8214 mem_base = xmlMemBlocks();
8215 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8216 dtd = gen_char_ptr(n_dtd, 1);
8217 node = gen_xmlNodePtr(n_node, 2);
8218 node2 = gen_xmlNodePtr(n_node2, 3);
8219
8220 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
8221 desret_int(ret_val);
8222 call_tests++;
8223 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8224 des_char_ptr(n_dtd, dtd, 1);
8225 des_xmlNodePtr(n_node, node, 2);
8226 des_xmlNodePtr(n_node2, node2, 3);
8227 xmlResetLastError();
8228 if (mem_base != xmlMemBlocks()) {
8229 printf("Leak of %d blocks found in xmlShellValidate",
8230 xmlMemBlocks() - mem_base);
8231 test_ret++;
8232 printf(" %d", n_ctxt);
8233 printf(" %d", n_dtd);
8234 printf(" %d", n_node);
8235 printf(" %d", n_node2);
8236 printf("\n");
8237 }
8238 }
8239 }
8240 }
8241 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008242 function_tests++;
8243#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00008244#endif
8245
Daniel Veillarda82b1822004-11-08 16:24:57 +00008246 return(test_ret);
8247}
8248
8249
8250static int
8251test_xmlShellWrite(void) {
8252 int test_ret = 0;
8253
8254#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008255#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00008256#ifdef LIBXML_OUTPUT_ENABLED
8257 int mem_base;
8258 int ret_val;
8259 xmlShellCtxtPtr ctxt; /* the shell context */
8260 int n_ctxt;
8261 char * filename; /* the file name */
8262 int n_filename;
8263 xmlNodePtr node; /* a node in the tree */
8264 int n_node;
8265 xmlNodePtr node2; /* unused */
8266 int n_node2;
8267
8268 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8269 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
8270 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8271 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8272 mem_base = xmlMemBlocks();
8273 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8274 filename = gen_char_ptr(n_filename, 1);
8275 node = gen_xmlNodePtr(n_node, 2);
8276 node2 = gen_xmlNodePtr(n_node2, 3);
8277
8278 ret_val = xmlShellWrite(ctxt, filename, node, node2);
8279 desret_int(ret_val);
8280 call_tests++;
8281 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8282 des_char_ptr(n_filename, filename, 1);
8283 des_xmlNodePtr(n_node, node, 2);
8284 des_xmlNodePtr(n_node2, node2, 3);
8285 xmlResetLastError();
8286 if (mem_base != xmlMemBlocks()) {
8287 printf("Leak of %d blocks found in xmlShellWrite",
8288 xmlMemBlocks() - mem_base);
8289 test_ret++;
8290 printf(" %d", n_ctxt);
8291 printf(" %d", n_filename);
8292 printf(" %d", n_node);
8293 printf(" %d", n_node2);
8294 printf("\n");
8295 }
8296 }
8297 }
8298 }
8299 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008300 function_tests++;
8301#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00008302#endif
8303#endif
8304
Daniel Veillarda82b1822004-11-08 16:24:57 +00008305 return(test_ret);
8306}
8307
8308static int
8309test_debugXML(void) {
8310 int test_ret = 0;
8311
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008312 if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00008313 test_ret += test_xmlBoolToText();
8314 test_ret += test_xmlDebugCheckDocument();
8315 test_ret += test_xmlDebugDumpAttr();
8316 test_ret += test_xmlDebugDumpAttrList();
8317 test_ret += test_xmlDebugDumpDTD();
8318 test_ret += test_xmlDebugDumpDocument();
8319 test_ret += test_xmlDebugDumpDocumentHead();
8320 test_ret += test_xmlDebugDumpEntities();
8321 test_ret += test_xmlDebugDumpNode();
8322 test_ret += test_xmlDebugDumpNodeList();
8323 test_ret += test_xmlDebugDumpOneNode();
8324 test_ret += test_xmlDebugDumpString();
8325 test_ret += test_xmlLsCountNode();
8326 test_ret += test_xmlLsOneNode();
8327 test_ret += test_xmlShell();
8328 test_ret += test_xmlShellBase();
8329 test_ret += test_xmlShellCat();
8330 test_ret += test_xmlShellDir();
8331 test_ret += test_xmlShellDu();
8332 test_ret += test_xmlShellList();
8333 test_ret += test_xmlShellLoad();
8334 test_ret += test_xmlShellPrintXPathResult();
8335 test_ret += test_xmlShellPwd();
8336 test_ret += test_xmlShellSave();
8337 test_ret += test_xmlShellValidate();
8338 test_ret += test_xmlShellWrite();
8339
8340 if (test_ret != 0)
8341 printf("Module debugXML: %d errors\n", test_ret);
8342 return(test_ret);
8343}
8344
8345static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008346test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008348
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008349 int mem_base;
8350 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008351
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008352 mem_base = xmlMemBlocks();
8353
8354 ret_val = xmlDictCreate();
8355 desret_xmlDictPtr(ret_val);
8356 call_tests++;
8357 xmlResetLastError();
8358 if (mem_base != xmlMemBlocks()) {
8359 printf("Leak of %d blocks found in xmlDictCreate",
8360 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008361 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008362 printf("\n");
8363 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008364 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008365
Daniel Veillard42595322004-11-08 10:52:06 +00008366 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008367}
8368
8369
8370static int
8371test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008373
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008374 int mem_base;
8375 xmlDictPtr ret_val;
8376 xmlDictPtr sub; /* an existing dictionnary */
8377 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008378
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008379 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
8380 mem_base = xmlMemBlocks();
8381 sub = gen_xmlDictPtr(n_sub, 0);
8382
8383 ret_val = xmlDictCreateSub(sub);
8384 desret_xmlDictPtr(ret_val);
8385 call_tests++;
8386 des_xmlDictPtr(n_sub, sub, 0);
8387 xmlResetLastError();
8388 if (mem_base != xmlMemBlocks()) {
8389 printf("Leak of %d blocks found in xmlDictCreateSub",
8390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008391 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008392 printf(" %d", n_sub);
8393 printf("\n");
8394 }
8395 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008396 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008397
Daniel Veillard42595322004-11-08 10:52:06 +00008398 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008399}
8400
8401
8402static int
8403test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008405
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008406 int mem_base;
8407 const xmlChar * ret_val;
8408 xmlDictPtr dict; /* the dictionnary */
8409 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008410 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008411 int n_name;
8412 int len; /* the length of the name, if -1 it is recomputed */
8413 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008414
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008415 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8416 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8417 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8418 mem_base = xmlMemBlocks();
8419 dict = gen_xmlDictPtr(n_dict, 0);
8420 name = gen_const_xmlChar_ptr(n_name, 1);
8421 len = gen_int(n_len, 2);
8422
8423 ret_val = xmlDictLookup(dict, name, len);
8424 desret_const_xmlChar_ptr(ret_val);
8425 call_tests++;
8426 des_xmlDictPtr(n_dict, dict, 0);
8427 des_const_xmlChar_ptr(n_name, name, 1);
8428 des_int(n_len, len, 2);
8429 xmlResetLastError();
8430 if (mem_base != xmlMemBlocks()) {
8431 printf("Leak of %d blocks found in xmlDictLookup",
8432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008433 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008434 printf(" %d", n_dict);
8435 printf(" %d", n_name);
8436 printf(" %d", n_len);
8437 printf("\n");
8438 }
8439 }
8440 }
8441 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008442 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008443
Daniel Veillard42595322004-11-08 10:52:06 +00008444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008445}
8446
8447
8448static int
8449test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008451
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008452 int mem_base;
8453 int ret_val;
8454 xmlDictPtr dict; /* the dictionnary */
8455 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008456 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008457 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008458
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008459 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8460 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8461 mem_base = xmlMemBlocks();
8462 dict = gen_xmlDictPtr(n_dict, 0);
8463 str = gen_const_xmlChar_ptr(n_str, 1);
8464
8465 ret_val = xmlDictOwns(dict, str);
8466 desret_int(ret_val);
8467 call_tests++;
8468 des_xmlDictPtr(n_dict, dict, 0);
8469 des_const_xmlChar_ptr(n_str, str, 1);
8470 xmlResetLastError();
8471 if (mem_base != xmlMemBlocks()) {
8472 printf("Leak of %d blocks found in xmlDictOwns",
8473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008474 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008475 printf(" %d", n_dict);
8476 printf(" %d", n_str);
8477 printf("\n");
8478 }
8479 }
8480 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008481 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008482
Daniel Veillard42595322004-11-08 10:52:06 +00008483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008484}
8485
8486
8487static int
8488test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008490
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008491 int mem_base;
8492 const xmlChar * ret_val;
8493 xmlDictPtr dict; /* the dictionnary */
8494 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008495 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008496 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008497 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008498 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008499
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008500 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8501 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8502 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8503 mem_base = xmlMemBlocks();
8504 dict = gen_xmlDictPtr(n_dict, 0);
8505 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8506 name = gen_const_xmlChar_ptr(n_name, 2);
8507
8508 ret_val = xmlDictQLookup(dict, prefix, name);
8509 desret_const_xmlChar_ptr(ret_val);
8510 call_tests++;
8511 des_xmlDictPtr(n_dict, dict, 0);
8512 des_const_xmlChar_ptr(n_prefix, prefix, 1);
8513 des_const_xmlChar_ptr(n_name, name, 2);
8514 xmlResetLastError();
8515 if (mem_base != xmlMemBlocks()) {
8516 printf("Leak of %d blocks found in xmlDictQLookup",
8517 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008518 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008519 printf(" %d", n_dict);
8520 printf(" %d", n_prefix);
8521 printf(" %d", n_name);
8522 printf("\n");
8523 }
8524 }
8525 }
8526 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008527 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008528
Daniel Veillard42595322004-11-08 10:52:06 +00008529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008530}
8531
8532
8533static int
8534test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008536
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008537 int mem_base;
8538 int ret_val;
8539 xmlDictPtr dict; /* the dictionnary */
8540 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008541
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008542 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8543 mem_base = xmlMemBlocks();
8544 dict = gen_xmlDictPtr(n_dict, 0);
8545
8546 ret_val = xmlDictReference(dict);
8547 xmlDictFree(dict);
8548 desret_int(ret_val);
8549 call_tests++;
8550 des_xmlDictPtr(n_dict, dict, 0);
8551 xmlResetLastError();
8552 if (mem_base != xmlMemBlocks()) {
8553 printf("Leak of %d blocks found in xmlDictReference",
8554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008555 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008556 printf(" %d", n_dict);
8557 printf("\n");
8558 }
8559 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008560 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008561
Daniel Veillard42595322004-11-08 10:52:06 +00008562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008563}
8564
8565
8566static int
8567test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008569
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008570 int mem_base;
8571 int ret_val;
8572 xmlDictPtr dict; /* the dictionnary */
8573 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008574
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008575 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8576 mem_base = xmlMemBlocks();
8577 dict = gen_xmlDictPtr(n_dict, 0);
8578
8579 ret_val = xmlDictSize(dict);
8580 desret_int(ret_val);
8581 call_tests++;
8582 des_xmlDictPtr(n_dict, dict, 0);
8583 xmlResetLastError();
8584 if (mem_base != xmlMemBlocks()) {
8585 printf("Leak of %d blocks found in xmlDictSize",
8586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008587 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008588 printf(" %d", n_dict);
8589 printf("\n");
8590 }
8591 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008592 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008593
Daniel Veillard42595322004-11-08 10:52:06 +00008594 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008595}
8596
8597static int
8598test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008599 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008600
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008601 if (quiet == 0) printf("Testing dict : 7 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008602 test_ret += test_xmlDictCreate();
8603 test_ret += test_xmlDictCreateSub();
8604 test_ret += test_xmlDictLookup();
8605 test_ret += test_xmlDictOwns();
8606 test_ret += test_xmlDictQLookup();
8607 test_ret += test_xmlDictReference();
8608 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008609
Daniel Veillard42595322004-11-08 10:52:06 +00008610 if (test_ret != 0)
8611 printf("Module dict: %d errors\n", test_ret);
8612 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008613}
8614
8615static int
8616test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008618
Daniel Veillarda521d282004-11-09 14:59:59 +00008619#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008620 int mem_base;
8621 int ret_val;
8622 unsigned char * out; /* a pointer to an array of bytes to store the result */
8623 int n_out;
8624 int * outlen; /* the length of @out */
8625 int n_outlen;
8626 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8627 int n_in;
8628 int * inlen; /* the length of @in */
8629 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008630
Daniel Veillardce682bc2004-11-05 17:22:25 +00008631 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8632 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8633 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8634 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8635 mem_base = xmlMemBlocks();
8636 out = gen_unsigned_char_ptr(n_out, 0);
8637 outlen = gen_int_ptr(n_outlen, 1);
8638 in = gen_const_unsigned_char_ptr(n_in, 2);
8639 inlen = gen_int_ptr(n_inlen, 3);
8640
8641 ret_val = UTF8Toisolat1(out, outlen, in, inlen);
8642 desret_int(ret_val);
8643 call_tests++;
8644 des_unsigned_char_ptr(n_out, out, 0);
8645 des_int_ptr(n_outlen, outlen, 1);
8646 des_const_unsigned_char_ptr(n_in, in, 2);
8647 des_int_ptr(n_inlen, inlen, 3);
8648 xmlResetLastError();
8649 if (mem_base != xmlMemBlocks()) {
8650 printf("Leak of %d blocks found in UTF8Toisolat1",
8651 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008652 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008653 printf(" %d", n_out);
8654 printf(" %d", n_outlen);
8655 printf(" %d", n_in);
8656 printf(" %d", n_inlen);
8657 printf("\n");
8658 }
8659 }
8660 }
8661 }
8662 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008663 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00008664#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00008665
Daniel Veillard42595322004-11-08 10:52:06 +00008666 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008667}
8668
8669
8670static int
8671test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008672 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008673
Daniel Veillardce682bc2004-11-05 17:22:25 +00008674 int mem_base;
8675 int ret_val;
8676 unsigned char * out; /* a pointer to an array of bytes to store the result */
8677 int n_out;
8678 int * outlen; /* the length of @out */
8679 int n_outlen;
8680 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8681 int n_in;
8682 int * inlen; /* the length of @in */
8683 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008684
Daniel Veillardce682bc2004-11-05 17:22:25 +00008685 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8686 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8687 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8688 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8689 mem_base = xmlMemBlocks();
8690 out = gen_unsigned_char_ptr(n_out, 0);
8691 outlen = gen_int_ptr(n_outlen, 1);
8692 in = gen_const_unsigned_char_ptr(n_in, 2);
8693 inlen = gen_int_ptr(n_inlen, 3);
8694
8695 ret_val = isolat1ToUTF8(out, outlen, in, inlen);
8696 desret_int(ret_val);
8697 call_tests++;
8698 des_unsigned_char_ptr(n_out, out, 0);
8699 des_int_ptr(n_outlen, outlen, 1);
8700 des_const_unsigned_char_ptr(n_in, in, 2);
8701 des_int_ptr(n_inlen, inlen, 3);
8702 xmlResetLastError();
8703 if (mem_base != xmlMemBlocks()) {
8704 printf("Leak of %d blocks found in isolat1ToUTF8",
8705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008706 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008707 printf(" %d", n_out);
8708 printf(" %d", n_outlen);
8709 printf(" %d", n_in);
8710 printf(" %d", n_inlen);
8711 printf("\n");
8712 }
8713 }
8714 }
8715 }
8716 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008717 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008718
Daniel Veillard42595322004-11-08 10:52:06 +00008719 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008720}
8721
8722
8723static int
8724test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008725 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008726
8727 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008728 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008729 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008730 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008731 int n_alias;
8732
8733 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8734 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008735 name = gen_const_char_ptr(n_name, 0);
8736 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008737
8738 ret_val = xmlAddEncodingAlias(name, alias);
8739 desret_int(ret_val);
8740 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008741 des_const_char_ptr(n_name, name, 0);
8742 des_const_char_ptr(n_alias, alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008743 xmlResetLastError();
8744 }
8745 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008746 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008747
Daniel Veillard42595322004-11-08 10:52:06 +00008748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008749}
8750
8751
Daniel Veillardce682bc2004-11-05 17:22:25 +00008752#define gen_nb_xmlCharEncodingHandler_ptr 1
8753static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8754 return(NULL);
8755}
8756static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8757}
8758
Daniel Veillardd93f6252004-11-02 15:53:51 +00008759static int
8760test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008762
Daniel Veillardce682bc2004-11-05 17:22:25 +00008763 int mem_base;
8764 int ret_val;
8765 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8766 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008767
Daniel Veillardce682bc2004-11-05 17:22:25 +00008768 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8769 mem_base = xmlMemBlocks();
8770 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8771
8772 ret_val = xmlCharEncCloseFunc(handler);
8773 desret_int(ret_val);
8774 call_tests++;
8775 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8776 xmlResetLastError();
8777 if (mem_base != xmlMemBlocks()) {
8778 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8779 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008780 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008781 printf(" %d", n_handler);
8782 printf("\n");
8783 }
8784 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008785 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008786
Daniel Veillard42595322004-11-08 10:52:06 +00008787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008788}
8789
8790
8791static int
8792test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008794
Daniel Veillardce682bc2004-11-05 17:22:25 +00008795 int mem_base;
8796 int ret_val;
8797 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8798 int n_handler;
8799 xmlBufferPtr out; /* an xmlBuffer for the output. */
8800 int n_out;
8801 xmlBufferPtr in; /* an xmlBuffer for the input */
8802 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008803
Daniel Veillardce682bc2004-11-05 17:22:25 +00008804 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8805 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8806 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8807 mem_base = xmlMemBlocks();
8808 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8809 out = gen_xmlBufferPtr(n_out, 1);
8810 in = gen_xmlBufferPtr(n_in, 2);
8811
8812 ret_val = xmlCharEncFirstLine(handler, out, in);
8813 desret_int(ret_val);
8814 call_tests++;
8815 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8816 des_xmlBufferPtr(n_out, out, 1);
8817 des_xmlBufferPtr(n_in, in, 2);
8818 xmlResetLastError();
8819 if (mem_base != xmlMemBlocks()) {
8820 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8821 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008822 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008823 printf(" %d", n_handler);
8824 printf(" %d", n_out);
8825 printf(" %d", n_in);
8826 printf("\n");
8827 }
8828 }
8829 }
8830 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008831 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008832
Daniel Veillard42595322004-11-08 10:52:06 +00008833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008834}
8835
8836
8837static int
8838test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008840
Daniel Veillardce682bc2004-11-05 17:22:25 +00008841 int mem_base;
8842 int ret_val;
8843 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8844 int n_handler;
8845 xmlBufferPtr out; /* an xmlBuffer for the output. */
8846 int n_out;
8847 xmlBufferPtr in; /* an xmlBuffer for the input */
8848 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008849
Daniel Veillardce682bc2004-11-05 17:22:25 +00008850 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8851 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8852 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8853 mem_base = xmlMemBlocks();
8854 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8855 out = gen_xmlBufferPtr(n_out, 1);
8856 in = gen_xmlBufferPtr(n_in, 2);
8857
8858 ret_val = xmlCharEncInFunc(handler, out, in);
8859 desret_int(ret_val);
8860 call_tests++;
8861 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8862 des_xmlBufferPtr(n_out, out, 1);
8863 des_xmlBufferPtr(n_in, in, 2);
8864 xmlResetLastError();
8865 if (mem_base != xmlMemBlocks()) {
8866 printf("Leak of %d blocks found in xmlCharEncInFunc",
8867 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008868 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008869 printf(" %d", n_handler);
8870 printf(" %d", n_out);
8871 printf(" %d", n_in);
8872 printf("\n");
8873 }
8874 }
8875 }
8876 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008877 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008878
Daniel Veillard42595322004-11-08 10:52:06 +00008879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008880}
8881
8882
8883static int
8884test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008885 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008886
Daniel Veillardce682bc2004-11-05 17:22:25 +00008887 int mem_base;
8888 int ret_val;
8889 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8890 int n_handler;
8891 xmlBufferPtr out; /* an xmlBuffer for the output. */
8892 int n_out;
8893 xmlBufferPtr in; /* an xmlBuffer for the input */
8894 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008895
Daniel Veillardce682bc2004-11-05 17:22:25 +00008896 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8897 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8898 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8899 mem_base = xmlMemBlocks();
8900 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8901 out = gen_xmlBufferPtr(n_out, 1);
8902 in = gen_xmlBufferPtr(n_in, 2);
8903
8904 ret_val = xmlCharEncOutFunc(handler, out, in);
8905 desret_int(ret_val);
8906 call_tests++;
8907 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8908 des_xmlBufferPtr(n_out, out, 1);
8909 des_xmlBufferPtr(n_in, in, 2);
8910 xmlResetLastError();
8911 if (mem_base != xmlMemBlocks()) {
8912 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8913 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008914 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008915 printf(" %d", n_handler);
8916 printf(" %d", n_out);
8917 printf(" %d", n_in);
8918 printf("\n");
8919 }
8920 }
8921 }
8922 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008923 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008924
Daniel Veillard42595322004-11-08 10:52:06 +00008925 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008926}
8927
8928
8929static int
8930test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008931 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008932
8933
8934
8935 xmlCleanupCharEncodingHandlers();
8936 call_tests++;
8937 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008938 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008939
Daniel Veillard42595322004-11-08 10:52:06 +00008940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008941}
8942
8943
8944static int
8945test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008947
8948 int mem_base;
8949
8950 mem_base = xmlMemBlocks();
8951
8952 xmlCleanupEncodingAliases();
8953 call_tests++;
8954 xmlResetLastError();
8955 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008956 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008957 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008958 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008959 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008960 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008961 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008962
Daniel Veillard42595322004-11-08 10:52:06 +00008963 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008964}
8965
8966
8967static int
8968test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008970
8971 int mem_base;
8972 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008973 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008974 int n_alias;
8975
8976 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8977 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008978 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008979
8980 ret_val = xmlDelEncodingAlias(alias);
8981 desret_int(ret_val);
8982 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008983 des_const_char_ptr(n_alias, alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008984 xmlResetLastError();
8985 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008986 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008988 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008989 printf(" %d", n_alias);
8990 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008991 }
8992 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008993 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008994
Daniel Veillard42595322004-11-08 10:52:06 +00008995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008996}
8997
8998
8999static int
9000test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009002
Daniel Veillardce682bc2004-11-05 17:22:25 +00009003 int mem_base;
9004 xmlCharEncoding ret_val;
9005 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). */
9006 int n_in;
9007 int len; /* pointer to the length of the buffer */
9008 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009009
Daniel Veillardce682bc2004-11-05 17:22:25 +00009010 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
9011 for (n_len = 0;n_len < gen_nb_int;n_len++) {
9012 mem_base = xmlMemBlocks();
9013 in = gen_const_unsigned_char_ptr(n_in, 0);
9014 len = gen_int(n_len, 1);
9015
9016 ret_val = xmlDetectCharEncoding(in, len);
9017 desret_xmlCharEncoding(ret_val);
9018 call_tests++;
9019 des_const_unsigned_char_ptr(n_in, in, 0);
9020 des_int(n_len, len, 1);
9021 xmlResetLastError();
9022 if (mem_base != xmlMemBlocks()) {
9023 printf("Leak of %d blocks found in xmlDetectCharEncoding",
9024 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009025 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009026 printf(" %d", n_in);
9027 printf(" %d", n_len);
9028 printf("\n");
9029 }
9030 }
9031 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00009032 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009033
Daniel Veillard42595322004-11-08 10:52:06 +00009034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009035}
9036
9037
9038static int
9039test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009041
9042
9043 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009044 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009045}
9046
9047
9048static int
9049test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009050 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009051
9052
9053 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009054 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009055}
9056
9057
9058static int
9059test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009060 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009061
Daniel Veillard3d97e662004-11-04 10:49:00 +00009062 int mem_base;
9063 const char * ret_val;
9064 xmlCharEncoding enc; /* the encoding */
9065 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009066
Daniel Veillard3d97e662004-11-04 10:49:00 +00009067 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
9068 mem_base = xmlMemBlocks();
9069 enc = gen_xmlCharEncoding(n_enc, 0);
9070
9071 ret_val = xmlGetCharEncodingName(enc);
9072 desret_const_char_ptr(ret_val);
9073 call_tests++;
9074 des_xmlCharEncoding(n_enc, enc, 0);
9075 xmlResetLastError();
9076 if (mem_base != xmlMemBlocks()) {
9077 printf("Leak of %d blocks found in xmlGetCharEncodingName",
9078 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009079 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009080 printf(" %d", n_enc);
9081 printf("\n");
9082 }
9083 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009084 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009085
Daniel Veillard42595322004-11-08 10:52:06 +00009086 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009087}
9088
9089
9090static int
9091test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009092 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009093
9094 int mem_base;
9095 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009096 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00009097 int n_alias;
9098
9099 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
9100 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009101 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009102
9103 ret_val = xmlGetEncodingAlias(alias);
9104 desret_const_char_ptr(ret_val);
9105 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009106 des_const_char_ptr(n_alias, alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009107 xmlResetLastError();
9108 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009109 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009111 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009112 printf(" %d", n_alias);
9113 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009114 }
9115 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009116 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009117
Daniel Veillard42595322004-11-08 10:52:06 +00009118 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009119}
9120
9121
9122static int
9123test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009124 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009125
9126
9127
9128 xmlInitCharEncodingHandlers();
9129 call_tests++;
9130 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009131 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009132
Daniel Veillard42595322004-11-08 10:52:06 +00009133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009134}
9135
9136
9137static int
9138test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009140
9141
9142 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009143 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009144}
9145
9146
9147static int
9148test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009149 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009150
Daniel Veillard3d97e662004-11-04 10:49:00 +00009151 int mem_base;
9152 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009153 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00009154 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009155
Daniel Veillard3d97e662004-11-04 10:49:00 +00009156 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
9157 mem_base = xmlMemBlocks();
9158 name = gen_const_char_ptr(n_name, 0);
9159
9160 ret_val = xmlParseCharEncoding(name);
9161 desret_xmlCharEncoding(ret_val);
9162 call_tests++;
9163 des_const_char_ptr(n_name, name, 0);
9164 xmlResetLastError();
9165 if (mem_base != xmlMemBlocks()) {
9166 printf("Leak of %d blocks found in xmlParseCharEncoding",
9167 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009168 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009169 printf(" %d", n_name);
9170 printf("\n");
9171 }
9172 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009173 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009174
Daniel Veillard42595322004-11-08 10:52:06 +00009175 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009176}
9177
9178
Daniel Veillardce682bc2004-11-05 17:22:25 +00009179#define gen_nb_xmlCharEncodingHandlerPtr 1
9180static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9181 return(NULL);
9182}
9183static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9184}
9185
Daniel Veillardd93f6252004-11-02 15:53:51 +00009186static int
9187test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009189
Daniel Veillardce682bc2004-11-05 17:22:25 +00009190 int mem_base;
9191 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
9192 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009193
Daniel Veillardce682bc2004-11-05 17:22:25 +00009194 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
9195 mem_base = xmlMemBlocks();
9196 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
9197
9198 xmlRegisterCharEncodingHandler(handler);
9199 call_tests++;
9200 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
9201 xmlResetLastError();
9202 if (mem_base != xmlMemBlocks()) {
9203 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
9204 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009205 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009206 printf(" %d", n_handler);
9207 printf("\n");
9208 }
9209 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00009210 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009211
Daniel Veillard42595322004-11-08 10:52:06 +00009212 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009213}
9214
9215static int
9216test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009218
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009219 if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009220 test_ret += test_UTF8Toisolat1();
9221 test_ret += test_isolat1ToUTF8();
9222 test_ret += test_xmlAddEncodingAlias();
9223 test_ret += test_xmlCharEncCloseFunc();
9224 test_ret += test_xmlCharEncFirstLine();
9225 test_ret += test_xmlCharEncInFunc();
9226 test_ret += test_xmlCharEncOutFunc();
9227 test_ret += test_xmlCleanupCharEncodingHandlers();
9228 test_ret += test_xmlCleanupEncodingAliases();
9229 test_ret += test_xmlDelEncodingAlias();
9230 test_ret += test_xmlDetectCharEncoding();
9231 test_ret += test_xmlFindCharEncodingHandler();
9232 test_ret += test_xmlGetCharEncodingHandler();
9233 test_ret += test_xmlGetCharEncodingName();
9234 test_ret += test_xmlGetEncodingAlias();
9235 test_ret += test_xmlInitCharEncodingHandlers();
9236 test_ret += test_xmlNewCharEncodingHandler();
9237 test_ret += test_xmlParseCharEncoding();
9238 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009239
Daniel Veillard42595322004-11-08 10:52:06 +00009240 if (test_ret != 0)
9241 printf("Module encoding: %d errors\n", test_ret);
9242 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009243}
9244
9245static int
9246test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009247 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009248
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009249 int mem_base;
9250 xmlEntityPtr ret_val;
9251 xmlDocPtr doc; /* the document */
9252 int n_doc;
9253 xmlChar * name; /* the entity name */
9254 int n_name;
9255 int type; /* the entity type XML_xxx_yyy_ENTITY */
9256 int n_type;
9257 xmlChar * ExternalID; /* the entity external ID if available */
9258 int n_ExternalID;
9259 xmlChar * SystemID; /* the entity system ID if available */
9260 int n_SystemID;
9261 xmlChar * content; /* the entity content */
9262 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009263
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009264 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9265 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9266 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9267 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9268 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9269 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9270 mem_base = xmlMemBlocks();
9271 doc = gen_xmlDocPtr(n_doc, 0);
9272 name = gen_const_xmlChar_ptr(n_name, 1);
9273 type = gen_int(n_type, 2);
9274 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9275 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9276 content = gen_const_xmlChar_ptr(n_content, 5);
9277
9278 ret_val = xmlAddDocEntity(doc, name, type, ExternalID, SystemID, content);
9279 desret_xmlEntityPtr(ret_val);
9280 call_tests++;
9281 des_xmlDocPtr(n_doc, doc, 0);
9282 des_const_xmlChar_ptr(n_name, name, 1);
9283 des_int(n_type, type, 2);
9284 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3);
9285 des_const_xmlChar_ptr(n_SystemID, SystemID, 4);
9286 des_const_xmlChar_ptr(n_content, content, 5);
9287 xmlResetLastError();
9288 if (mem_base != xmlMemBlocks()) {
9289 printf("Leak of %d blocks found in xmlAddDocEntity",
9290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009291 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009292 printf(" %d", n_doc);
9293 printf(" %d", n_name);
9294 printf(" %d", n_type);
9295 printf(" %d", n_ExternalID);
9296 printf(" %d", n_SystemID);
9297 printf(" %d", n_content);
9298 printf("\n");
9299 }
9300 }
9301 }
9302 }
9303 }
9304 }
9305 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009306 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009307
Daniel Veillard42595322004-11-08 10:52:06 +00009308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009309}
9310
9311
9312static int
9313test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009315
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009316 int mem_base;
9317 xmlEntityPtr ret_val;
9318 xmlDocPtr doc; /* the document */
9319 int n_doc;
9320 xmlChar * name; /* the entity name */
9321 int n_name;
9322 int type; /* the entity type XML_xxx_yyy_ENTITY */
9323 int n_type;
9324 xmlChar * ExternalID; /* the entity external ID if available */
9325 int n_ExternalID;
9326 xmlChar * SystemID; /* the entity system ID if available */
9327 int n_SystemID;
9328 xmlChar * content; /* the entity content */
9329 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009330
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009331 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9332 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9333 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9334 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9335 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9336 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9337 mem_base = xmlMemBlocks();
9338 doc = gen_xmlDocPtr(n_doc, 0);
9339 name = gen_const_xmlChar_ptr(n_name, 1);
9340 type = gen_int(n_type, 2);
9341 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9342 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9343 content = gen_const_xmlChar_ptr(n_content, 5);
9344
9345 ret_val = xmlAddDtdEntity(doc, name, type, ExternalID, SystemID, content);
9346 desret_xmlEntityPtr(ret_val);
9347 call_tests++;
9348 des_xmlDocPtr(n_doc, doc, 0);
9349 des_const_xmlChar_ptr(n_name, name, 1);
9350 des_int(n_type, type, 2);
9351 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3);
9352 des_const_xmlChar_ptr(n_SystemID, SystemID, 4);
9353 des_const_xmlChar_ptr(n_content, content, 5);
9354 xmlResetLastError();
9355 if (mem_base != xmlMemBlocks()) {
9356 printf("Leak of %d blocks found in xmlAddDtdEntity",
9357 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009358 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009359 printf(" %d", n_doc);
9360 printf(" %d", n_name);
9361 printf(" %d", n_type);
9362 printf(" %d", n_ExternalID);
9363 printf(" %d", n_SystemID);
9364 printf(" %d", n_content);
9365 printf("\n");
9366 }
9367 }
9368 }
9369 }
9370 }
9371 }
9372 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009373 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009374
Daniel Veillard42595322004-11-08 10:52:06 +00009375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009376}
9377
9378
9379static int
9380test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009382
Daniel Veillarda521d282004-11-09 14:59:59 +00009383#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009384 int mem_base;
9385
9386 mem_base = xmlMemBlocks();
9387
9388 xmlCleanupPredefinedEntities();
9389 call_tests++;
9390 xmlResetLastError();
9391 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009392 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009394 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009395 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009396 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009397 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009398#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009399
Daniel Veillard42595322004-11-08 10:52:06 +00009400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009401}
9402
9403
Daniel Veillardce682bc2004-11-05 17:22:25 +00009404#define gen_nb_xmlEntitiesTablePtr 1
9405static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9406 return(NULL);
9407}
9408static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9409}
9410
Daniel Veillardd93f6252004-11-02 15:53:51 +00009411static int
9412test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009414
9415
9416 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009418}
9419
9420
9421static int
9422test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009423 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009424
9425
9426 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009427 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009428}
9429
9430
9431static int
9432test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009433 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009434
Daniel Veillardce682bc2004-11-05 17:22:25 +00009435#ifdef LIBXML_OUTPUT_ENABLED
9436 int mem_base;
9437 xmlBufferPtr buf; /* An XML buffer. */
9438 int n_buf;
9439 xmlEntitiesTablePtr table; /* An entity table */
9440 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009441
Daniel Veillardce682bc2004-11-05 17:22:25 +00009442 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9443 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9444 mem_base = xmlMemBlocks();
9445 buf = gen_xmlBufferPtr(n_buf, 0);
9446 table = gen_xmlEntitiesTablePtr(n_table, 1);
9447
9448 xmlDumpEntitiesTable(buf, table);
9449 call_tests++;
9450 des_xmlBufferPtr(n_buf, buf, 0);
9451 des_xmlEntitiesTablePtr(n_table, table, 1);
9452 xmlResetLastError();
9453 if (mem_base != xmlMemBlocks()) {
9454 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9455 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009456 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009457 printf(" %d", n_buf);
9458 printf(" %d", n_table);
9459 printf("\n");
9460 }
9461 }
9462 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009463 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009464#endif
9465
Daniel Veillard42595322004-11-08 10:52:06 +00009466 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009467}
9468
9469
Daniel Veillardce682bc2004-11-05 17:22:25 +00009470#define gen_nb_xmlEntityPtr 1
9471static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9472 return(NULL);
9473}
9474static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9475}
9476
Daniel Veillardd93f6252004-11-02 15:53:51 +00009477static int
9478test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009479 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009480
Daniel Veillardce682bc2004-11-05 17:22:25 +00009481#ifdef LIBXML_OUTPUT_ENABLED
9482 int mem_base;
9483 xmlBufferPtr buf; /* An XML buffer. */
9484 int n_buf;
9485 xmlEntityPtr ent; /* An entity table */
9486 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009487
Daniel Veillardce682bc2004-11-05 17:22:25 +00009488 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9489 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9490 mem_base = xmlMemBlocks();
9491 buf = gen_xmlBufferPtr(n_buf, 0);
9492 ent = gen_xmlEntityPtr(n_ent, 1);
9493
9494 xmlDumpEntityDecl(buf, ent);
9495 call_tests++;
9496 des_xmlBufferPtr(n_buf, buf, 0);
9497 des_xmlEntityPtr(n_ent, ent, 1);
9498 xmlResetLastError();
9499 if (mem_base != xmlMemBlocks()) {
9500 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9501 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009502 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009503 printf(" %d", n_buf);
9504 printf(" %d", n_ent);
9505 printf("\n");
9506 }
9507 }
9508 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009509 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009510#endif
9511
Daniel Veillard42595322004-11-08 10:52:06 +00009512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009513}
9514
9515
9516static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009517test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009519
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009520 int mem_base;
9521 xmlChar * ret_val;
9522 xmlDocPtr doc; /* the document containing the string */
9523 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009524 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009525 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009526
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009527 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9528 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9529 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009530 doc = gen_xmlDocPtr(n_doc, 0);
9531 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009532
9533 ret_val = xmlEncodeEntitiesReentrant(doc, input);
9534 desret_xmlChar_ptr(ret_val);
9535 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009536 des_xmlDocPtr(n_doc, doc, 0);
9537 des_const_xmlChar_ptr(n_input, input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009538 xmlResetLastError();
9539 if (mem_base != xmlMemBlocks()) {
9540 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009542 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009543 printf(" %d", n_doc);
9544 printf(" %d", n_input);
9545 printf("\n");
9546 }
9547 }
9548 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009549 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009550
Daniel Veillard42595322004-11-08 10:52:06 +00009551 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009552}
9553
9554
9555static int
9556test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009557 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009558
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009559 int mem_base;
9560 xmlChar * ret_val;
9561 xmlDocPtr doc; /* the document containing the string */
9562 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009563 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009564 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009565
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009566 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9567 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9568 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009569 doc = gen_xmlDocPtr(n_doc, 0);
9570 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009571
9572 ret_val = xmlEncodeSpecialChars(doc, input);
9573 desret_xmlChar_ptr(ret_val);
9574 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009575 des_xmlDocPtr(n_doc, doc, 0);
9576 des_const_xmlChar_ptr(n_input, input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009577 xmlResetLastError();
9578 if (mem_base != xmlMemBlocks()) {
9579 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9580 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009581 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009582 printf(" %d", n_doc);
9583 printf(" %d", n_input);
9584 printf("\n");
9585 }
9586 }
9587 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009588 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009589
Daniel Veillard42595322004-11-08 10:52:06 +00009590 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009591}
9592
9593
9594static int
9595test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009596 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009597
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009598 int mem_base;
9599 xmlEntityPtr ret_val;
9600 xmlDocPtr doc; /* the document referencing the entity */
9601 int n_doc;
9602 xmlChar * name; /* the entity name */
9603 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009604
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009605 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9606 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9607 mem_base = xmlMemBlocks();
9608 doc = gen_xmlDocPtr(n_doc, 0);
9609 name = gen_const_xmlChar_ptr(n_name, 1);
9610
9611 ret_val = xmlGetDocEntity(doc, name);
9612 desret_xmlEntityPtr(ret_val);
9613 call_tests++;
9614 des_xmlDocPtr(n_doc, doc, 0);
9615 des_const_xmlChar_ptr(n_name, name, 1);
9616 xmlResetLastError();
9617 if (mem_base != xmlMemBlocks()) {
9618 printf("Leak of %d blocks found in xmlGetDocEntity",
9619 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009620 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009621 printf(" %d", n_doc);
9622 printf(" %d", n_name);
9623 printf("\n");
9624 }
9625 }
9626 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009627 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009628
Daniel Veillard42595322004-11-08 10:52:06 +00009629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009630}
9631
9632
9633static int
9634test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009636
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009637 int mem_base;
9638 xmlEntityPtr ret_val;
9639 xmlDocPtr doc; /* the document referencing the entity */
9640 int n_doc;
9641 xmlChar * name; /* the entity name */
9642 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009643
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009644 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9645 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9646 mem_base = xmlMemBlocks();
9647 doc = gen_xmlDocPtr(n_doc, 0);
9648 name = gen_const_xmlChar_ptr(n_name, 1);
9649
9650 ret_val = xmlGetDtdEntity(doc, name);
9651 desret_xmlEntityPtr(ret_val);
9652 call_tests++;
9653 des_xmlDocPtr(n_doc, doc, 0);
9654 des_const_xmlChar_ptr(n_name, name, 1);
9655 xmlResetLastError();
9656 if (mem_base != xmlMemBlocks()) {
9657 printf("Leak of %d blocks found in xmlGetDtdEntity",
9658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009659 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009660 printf(" %d", n_doc);
9661 printf(" %d", n_name);
9662 printf("\n");
9663 }
9664 }
9665 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009666 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009667
Daniel Veillard42595322004-11-08 10:52:06 +00009668 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009669}
9670
9671
9672static int
9673test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009674 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009675
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009676 int mem_base;
9677 xmlEntityPtr ret_val;
9678 xmlDocPtr doc; /* the document referencing the entity */
9679 int n_doc;
9680 xmlChar * name; /* the entity name */
9681 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009682
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009683 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9684 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9685 mem_base = xmlMemBlocks();
9686 doc = gen_xmlDocPtr(n_doc, 0);
9687 name = gen_const_xmlChar_ptr(n_name, 1);
9688
9689 ret_val = xmlGetParameterEntity(doc, name);
9690 desret_xmlEntityPtr(ret_val);
9691 call_tests++;
9692 des_xmlDocPtr(n_doc, doc, 0);
9693 des_const_xmlChar_ptr(n_name, name, 1);
9694 xmlResetLastError();
9695 if (mem_base != xmlMemBlocks()) {
9696 printf("Leak of %d blocks found in xmlGetParameterEntity",
9697 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009698 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009699 printf(" %d", n_doc);
9700 printf(" %d", n_name);
9701 printf("\n");
9702 }
9703 }
9704 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009705 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009706
Daniel Veillard42595322004-11-08 10:52:06 +00009707 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009708}
9709
9710
9711static int
9712test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009713 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009714
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009715 int mem_base;
9716 xmlEntityPtr ret_val;
9717 xmlChar * name; /* the entity name */
9718 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009719
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009720 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9721 mem_base = xmlMemBlocks();
9722 name = gen_const_xmlChar_ptr(n_name, 0);
9723
9724 ret_val = xmlGetPredefinedEntity(name);
9725 desret_xmlEntityPtr(ret_val);
9726 call_tests++;
9727 des_const_xmlChar_ptr(n_name, name, 0);
9728 xmlResetLastError();
9729 if (mem_base != xmlMemBlocks()) {
9730 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9731 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009732 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009733 printf(" %d", n_name);
9734 printf("\n");
9735 }
9736 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009737 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009738
Daniel Veillard42595322004-11-08 10:52:06 +00009739 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009740}
9741
9742
9743static int
9744test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009745 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009746
Daniel Veillarda521d282004-11-09 14:59:59 +00009747#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009748 int mem_base;
9749
9750 mem_base = xmlMemBlocks();
9751
9752 xmlInitializePredefinedEntities();
9753 call_tests++;
9754 xmlResetLastError();
9755 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009756 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009757 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009758 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009759 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009760 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009761 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009762#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009763
Daniel Veillard42595322004-11-08 10:52:06 +00009764 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009765}
9766
9767static int
9768test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009769 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009770
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009771 if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009772 test_ret += test_xmlAddDocEntity();
9773 test_ret += test_xmlAddDtdEntity();
9774 test_ret += test_xmlCleanupPredefinedEntities();
9775 test_ret += test_xmlCopyEntitiesTable();
9776 test_ret += test_xmlCreateEntitiesTable();
9777 test_ret += test_xmlDumpEntitiesTable();
9778 test_ret += test_xmlDumpEntityDecl();
9779 test_ret += test_xmlEncodeEntitiesReentrant();
9780 test_ret += test_xmlEncodeSpecialChars();
9781 test_ret += test_xmlGetDocEntity();
9782 test_ret += test_xmlGetDtdEntity();
9783 test_ret += test_xmlGetParameterEntity();
9784 test_ret += test_xmlGetPredefinedEntity();
9785 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009786
Daniel Veillard42595322004-11-08 10:52:06 +00009787 if (test_ret != 0)
9788 printf("Module entities: %d errors\n", test_ret);
9789 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009790}
9791
9792static int
9793test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009795
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009796 int mem_base;
9797 int ret_val;
9798 xmlHashTablePtr table; /* the hash table */
9799 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009800 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009801 int n_name;
9802 void * userdata; /* a pointer to the userdata */
9803 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009804
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009805 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9806 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9807 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9808 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009809 table = gen_xmlHashTablePtr(n_table, 0);
9810 name = gen_const_xmlChar_ptr(n_name, 1);
9811 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009812
9813 ret_val = xmlHashAddEntry(table, name, userdata);
9814 desret_int(ret_val);
9815 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009816 des_xmlHashTablePtr(n_table, table, 0);
9817 des_const_xmlChar_ptr(n_name, name, 1);
9818 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009819 xmlResetLastError();
9820 if (mem_base != xmlMemBlocks()) {
9821 printf("Leak of %d blocks found in xmlHashAddEntry",
9822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009823 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009824 printf(" %d", n_table);
9825 printf(" %d", n_name);
9826 printf(" %d", n_userdata);
9827 printf("\n");
9828 }
9829 }
9830 }
9831 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009832 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009833
Daniel Veillard42595322004-11-08 10:52:06 +00009834 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009835}
9836
9837
9838static int
9839test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009840 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009841
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009842 int mem_base;
9843 int ret_val;
9844 xmlHashTablePtr table; /* the hash table */
9845 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009846 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009847 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009848 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009849 int n_name2;
9850 void * userdata; /* a pointer to the userdata */
9851 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009852
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009853 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9854 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9855 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9856 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9857 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009858 table = gen_xmlHashTablePtr(n_table, 0);
9859 name = gen_const_xmlChar_ptr(n_name, 1);
9860 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9861 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009862
9863 ret_val = xmlHashAddEntry2(table, name, name2, userdata);
9864 desret_int(ret_val);
9865 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009866 des_xmlHashTablePtr(n_table, table, 0);
9867 des_const_xmlChar_ptr(n_name, name, 1);
9868 des_const_xmlChar_ptr(n_name2, name2, 2);
9869 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009870 xmlResetLastError();
9871 if (mem_base != xmlMemBlocks()) {
9872 printf("Leak of %d blocks found in xmlHashAddEntry2",
9873 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009874 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009875 printf(" %d", n_table);
9876 printf(" %d", n_name);
9877 printf(" %d", n_name2);
9878 printf(" %d", n_userdata);
9879 printf("\n");
9880 }
9881 }
9882 }
9883 }
9884 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009885 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009886
Daniel Veillard42595322004-11-08 10:52:06 +00009887 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009888}
9889
9890
9891static int
9892test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009893 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009894
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009895 int mem_base;
9896 int ret_val;
9897 xmlHashTablePtr table; /* the hash table */
9898 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009899 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009900 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009901 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009902 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009903 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009904 int n_name3;
9905 void * userdata; /* a pointer to the userdata */
9906 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009907
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009908 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9909 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9910 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9911 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9912 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9913 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009914 table = gen_xmlHashTablePtr(n_table, 0);
9915 name = gen_const_xmlChar_ptr(n_name, 1);
9916 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9917 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9918 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009919
9920 ret_val = xmlHashAddEntry3(table, name, name2, name3, userdata);
9921 desret_int(ret_val);
9922 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009923 des_xmlHashTablePtr(n_table, table, 0);
9924 des_const_xmlChar_ptr(n_name, name, 1);
9925 des_const_xmlChar_ptr(n_name2, name2, 2);
9926 des_const_xmlChar_ptr(n_name3, name3, 3);
9927 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009928 xmlResetLastError();
9929 if (mem_base != xmlMemBlocks()) {
9930 printf("Leak of %d blocks found in xmlHashAddEntry3",
9931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009932 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009933 printf(" %d", n_table);
9934 printf(" %d", n_name);
9935 printf(" %d", n_name2);
9936 printf(" %d", n_name3);
9937 printf(" %d", n_userdata);
9938 printf("\n");
9939 }
9940 }
9941 }
9942 }
9943 }
9944 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009945 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009946
Daniel Veillard42595322004-11-08 10:52:06 +00009947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009948}
9949
9950
9951static int
9952test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009954
9955
9956 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009958}
9959
9960
9961static int
9962test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009964
9965
9966 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009967 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009968}
9969
9970
9971static int
9972test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009973 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009974
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009975 int mem_base;
9976 void * ret_val;
9977 xmlHashTablePtr table; /* the hash table */
9978 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009979 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009980 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009981
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009982 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9983 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9984 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009985 table = gen_xmlHashTablePtr(n_table, 0);
9986 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009987
9988 ret_val = xmlHashLookup(table, name);
9989 desret_void_ptr(ret_val);
9990 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009991 des_xmlHashTablePtr(n_table, table, 0);
9992 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009993 xmlResetLastError();
9994 if (mem_base != xmlMemBlocks()) {
9995 printf("Leak of %d blocks found in xmlHashLookup",
9996 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009997 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009998 printf(" %d", n_table);
9999 printf(" %d", n_name);
10000 printf("\n");
10001 }
10002 }
10003 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010004 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010005
Daniel Veillard42595322004-11-08 10:52:06 +000010006 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010007}
10008
10009
10010static int
10011test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010012 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010013
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010014 int mem_base;
10015 void * ret_val;
10016 xmlHashTablePtr table; /* the hash table */
10017 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010018 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010019 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010020 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010021 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010022
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010023 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10024 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10025 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10026 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010027 table = gen_xmlHashTablePtr(n_table, 0);
10028 name = gen_const_xmlChar_ptr(n_name, 1);
10029 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010030
10031 ret_val = xmlHashLookup2(table, name, name2);
10032 desret_void_ptr(ret_val);
10033 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010034 des_xmlHashTablePtr(n_table, table, 0);
10035 des_const_xmlChar_ptr(n_name, name, 1);
10036 des_const_xmlChar_ptr(n_name2, name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010037 xmlResetLastError();
10038 if (mem_base != xmlMemBlocks()) {
10039 printf("Leak of %d blocks found in xmlHashLookup2",
10040 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010041 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010042 printf(" %d", n_table);
10043 printf(" %d", n_name);
10044 printf(" %d", n_name2);
10045 printf("\n");
10046 }
10047 }
10048 }
10049 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010050 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010051
Daniel Veillard42595322004-11-08 10:52:06 +000010052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010053}
10054
10055
10056static int
10057test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010058 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010059
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010060 int mem_base;
10061 void * ret_val;
10062 xmlHashTablePtr table; /* the hash table */
10063 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010064 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010065 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010066 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010067 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010068 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010069 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010070
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010071 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10072 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10073 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10074 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10075 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010076 table = gen_xmlHashTablePtr(n_table, 0);
10077 name = gen_const_xmlChar_ptr(n_name, 1);
10078 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10079 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010080
10081 ret_val = xmlHashLookup3(table, name, name2, name3);
10082 desret_void_ptr(ret_val);
10083 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010084 des_xmlHashTablePtr(n_table, table, 0);
10085 des_const_xmlChar_ptr(n_name, name, 1);
10086 des_const_xmlChar_ptr(n_name2, name2, 2);
10087 des_const_xmlChar_ptr(n_name3, name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010088 xmlResetLastError();
10089 if (mem_base != xmlMemBlocks()) {
10090 printf("Leak of %d blocks found in xmlHashLookup3",
10091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010092 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010093 printf(" %d", n_table);
10094 printf(" %d", n_name);
10095 printf(" %d", n_name2);
10096 printf(" %d", n_name3);
10097 printf("\n");
10098 }
10099 }
10100 }
10101 }
10102 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010103 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010104
Daniel Veillard42595322004-11-08 10:52:06 +000010105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010106}
10107
10108
10109static int
10110test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010112
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010113 int mem_base;
10114 void * ret_val;
10115 xmlHashTablePtr table; /* the hash table */
10116 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010117 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010118 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010119 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010120 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010121
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010122 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10123 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
10124 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10125 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010126 table = gen_xmlHashTablePtr(n_table, 0);
10127 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
10128 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010129
10130 ret_val = xmlHashQLookup(table, prefix, name);
10131 desret_void_ptr(ret_val);
10132 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010133 des_xmlHashTablePtr(n_table, table, 0);
10134 des_const_xmlChar_ptr(n_prefix, prefix, 1);
10135 des_const_xmlChar_ptr(n_name, name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010136 xmlResetLastError();
10137 if (mem_base != xmlMemBlocks()) {
10138 printf("Leak of %d blocks found in xmlHashQLookup",
10139 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010140 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010141 printf(" %d", n_table);
10142 printf(" %d", n_prefix);
10143 printf(" %d", n_name);
10144 printf("\n");
10145 }
10146 }
10147 }
10148 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010149 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010150
Daniel Veillard42595322004-11-08 10:52:06 +000010151 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010152}
10153
10154
10155static int
10156test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010157 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010158
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010159 int mem_base;
10160 void * ret_val;
10161 xmlHashTablePtr table; /* the hash table */
10162 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010163 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010164 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010165 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010166 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010167 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010168 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010169 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010170 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010171
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010172 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10173 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
10174 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10175 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
10176 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10177 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010178 table = gen_xmlHashTablePtr(n_table, 0);
10179 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
10180 name = gen_const_xmlChar_ptr(n_name, 2);
10181 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
10182 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010183
10184 ret_val = xmlHashQLookup2(table, prefix, name, prefix2, name2);
10185 desret_void_ptr(ret_val);
10186 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010187 des_xmlHashTablePtr(n_table, table, 0);
10188 des_const_xmlChar_ptr(n_prefix, prefix, 1);
10189 des_const_xmlChar_ptr(n_name, name, 2);
10190 des_const_xmlChar_ptr(n_prefix2, prefix2, 3);
10191 des_const_xmlChar_ptr(n_name2, name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010192 xmlResetLastError();
10193 if (mem_base != xmlMemBlocks()) {
10194 printf("Leak of %d blocks found in xmlHashQLookup2",
10195 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010196 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010197 printf(" %d", n_table);
10198 printf(" %d", n_prefix);
10199 printf(" %d", n_name);
10200 printf(" %d", n_prefix2);
10201 printf(" %d", n_name2);
10202 printf("\n");
10203 }
10204 }
10205 }
10206 }
10207 }
10208 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010209 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010210
Daniel Veillard42595322004-11-08 10:52:06 +000010211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010212}
10213
10214
10215static int
10216test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010218
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010219 int mem_base;
10220 void * ret_val;
10221 xmlHashTablePtr table; /* the hash table */
10222 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010223 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010224 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010225 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010226 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010227 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010228 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010229 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010230 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010231 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010232 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010233 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010234 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010235
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010236 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10237 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
10238 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10239 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
10240 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10241 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
10242 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10243 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010244 table = gen_xmlHashTablePtr(n_table, 0);
10245 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
10246 name = gen_const_xmlChar_ptr(n_name, 2);
10247 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
10248 name2 = gen_const_xmlChar_ptr(n_name2, 4);
10249 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
10250 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010251
10252 ret_val = xmlHashQLookup3(table, prefix, name, prefix2, name2, prefix3, name3);
10253 desret_void_ptr(ret_val);
10254 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010255 des_xmlHashTablePtr(n_table, table, 0);
10256 des_const_xmlChar_ptr(n_prefix, prefix, 1);
10257 des_const_xmlChar_ptr(n_name, name, 2);
10258 des_const_xmlChar_ptr(n_prefix2, prefix2, 3);
10259 des_const_xmlChar_ptr(n_name2, name2, 4);
10260 des_const_xmlChar_ptr(n_prefix3, prefix3, 5);
10261 des_const_xmlChar_ptr(n_name3, name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010262 xmlResetLastError();
10263 if (mem_base != xmlMemBlocks()) {
10264 printf("Leak of %d blocks found in xmlHashQLookup3",
10265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010266 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010267 printf(" %d", n_table);
10268 printf(" %d", n_prefix);
10269 printf(" %d", n_name);
10270 printf(" %d", n_prefix2);
10271 printf(" %d", n_name2);
10272 printf(" %d", n_prefix3);
10273 printf(" %d", n_name3);
10274 printf("\n");
10275 }
10276 }
10277 }
10278 }
10279 }
10280 }
10281 }
10282 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010283 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010284
Daniel Veillard42595322004-11-08 10:52:06 +000010285 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010286}
10287
10288
10289static int
10290test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010292
Daniel Veillard42595322004-11-08 10:52:06 +000010293 int mem_base;
10294 int ret_val;
10295 xmlHashTablePtr table; /* the hash table */
10296 int n_table;
10297 xmlChar * name; /* the name of the userdata */
10298 int n_name;
10299 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10300 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010301
Daniel Veillard42595322004-11-08 10:52:06 +000010302 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10303 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10304 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10305 mem_base = xmlMemBlocks();
10306 table = gen_xmlHashTablePtr(n_table, 0);
10307 name = gen_const_xmlChar_ptr(n_name, 1);
10308 f = gen_xmlHashDeallocator(n_f, 2);
10309
10310 ret_val = xmlHashRemoveEntry(table, name, f);
10311 desret_int(ret_val);
10312 call_tests++;
10313 des_xmlHashTablePtr(n_table, table, 0);
10314 des_const_xmlChar_ptr(n_name, name, 1);
10315 des_xmlHashDeallocator(n_f, f, 2);
10316 xmlResetLastError();
10317 if (mem_base != xmlMemBlocks()) {
10318 printf("Leak of %d blocks found in xmlHashRemoveEntry",
10319 xmlMemBlocks() - mem_base);
10320 test_ret++;
10321 printf(" %d", n_table);
10322 printf(" %d", n_name);
10323 printf(" %d", n_f);
10324 printf("\n");
10325 }
10326 }
10327 }
10328 }
Daniel Veillard42595322004-11-08 10:52:06 +000010329 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010330
Daniel Veillard42595322004-11-08 10:52:06 +000010331 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010332}
10333
10334
10335static int
10336test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010337 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010338
Daniel Veillard42595322004-11-08 10:52:06 +000010339 int mem_base;
10340 int ret_val;
10341 xmlHashTablePtr table; /* the hash table */
10342 int n_table;
10343 xmlChar * name; /* the name of the userdata */
10344 int n_name;
10345 xmlChar * name2; /* a second name of the userdata */
10346 int n_name2;
10347 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10348 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010349
Daniel Veillard42595322004-11-08 10:52:06 +000010350 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10351 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10352 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10353 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10354 mem_base = xmlMemBlocks();
10355 table = gen_xmlHashTablePtr(n_table, 0);
10356 name = gen_const_xmlChar_ptr(n_name, 1);
10357 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10358 f = gen_xmlHashDeallocator(n_f, 3);
10359
10360 ret_val = xmlHashRemoveEntry2(table, name, name2, f);
10361 desret_int(ret_val);
10362 call_tests++;
10363 des_xmlHashTablePtr(n_table, table, 0);
10364 des_const_xmlChar_ptr(n_name, name, 1);
10365 des_const_xmlChar_ptr(n_name2, name2, 2);
10366 des_xmlHashDeallocator(n_f, f, 3);
10367 xmlResetLastError();
10368 if (mem_base != xmlMemBlocks()) {
10369 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10370 xmlMemBlocks() - mem_base);
10371 test_ret++;
10372 printf(" %d", n_table);
10373 printf(" %d", n_name);
10374 printf(" %d", n_name2);
10375 printf(" %d", n_f);
10376 printf("\n");
10377 }
10378 }
10379 }
10380 }
10381 }
Daniel Veillard42595322004-11-08 10:52:06 +000010382 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010383
Daniel Veillard42595322004-11-08 10:52:06 +000010384 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010385}
10386
10387
10388static int
10389test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010390 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010391
Daniel Veillard42595322004-11-08 10:52:06 +000010392 int mem_base;
10393 int ret_val;
10394 xmlHashTablePtr table; /* the hash table */
10395 int n_table;
10396 xmlChar * name; /* the name of the userdata */
10397 int n_name;
10398 xmlChar * name2; /* a second name of the userdata */
10399 int n_name2;
10400 xmlChar * name3; /* a third name of the userdata */
10401 int n_name3;
10402 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10403 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010404
Daniel Veillard42595322004-11-08 10:52:06 +000010405 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10406 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10407 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10408 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10409 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10410 mem_base = xmlMemBlocks();
10411 table = gen_xmlHashTablePtr(n_table, 0);
10412 name = gen_const_xmlChar_ptr(n_name, 1);
10413 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10414 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10415 f = gen_xmlHashDeallocator(n_f, 4);
10416
10417 ret_val = xmlHashRemoveEntry3(table, name, name2, name3, f);
10418 desret_int(ret_val);
10419 call_tests++;
10420 des_xmlHashTablePtr(n_table, table, 0);
10421 des_const_xmlChar_ptr(n_name, name, 1);
10422 des_const_xmlChar_ptr(n_name2, name2, 2);
10423 des_const_xmlChar_ptr(n_name3, name3, 3);
10424 des_xmlHashDeallocator(n_f, f, 4);
10425 xmlResetLastError();
10426 if (mem_base != xmlMemBlocks()) {
10427 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10428 xmlMemBlocks() - mem_base);
10429 test_ret++;
10430 printf(" %d", n_table);
10431 printf(" %d", n_name);
10432 printf(" %d", n_name2);
10433 printf(" %d", n_name3);
10434 printf(" %d", n_f);
10435 printf("\n");
10436 }
10437 }
10438 }
10439 }
10440 }
10441 }
Daniel Veillard42595322004-11-08 10:52:06 +000010442 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010443
Daniel Veillard42595322004-11-08 10:52:06 +000010444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010445}
10446
10447
10448static int
10449test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010451
10452
10453 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010455}
10456
10457
10458static int
10459test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010461
10462
10463 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010464 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010465}
10466
10467
10468static int
10469test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010470 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010471
10472
10473 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010475}
10476
10477
10478static int
10479test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010481
10482
10483 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010485}
10486
10487
10488static int
10489test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010491
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010492 int mem_base;
10493 int ret_val;
10494 xmlHashTablePtr table; /* the hash table */
10495 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010496
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010497 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10498 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010499 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010500
10501 ret_val = xmlHashSize(table);
10502 desret_int(ret_val);
10503 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010504 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010505 xmlResetLastError();
10506 if (mem_base != xmlMemBlocks()) {
10507 printf("Leak of %d blocks found in xmlHashSize",
10508 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010509 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010510 printf(" %d", n_table);
10511 printf("\n");
10512 }
10513 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010514 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010515
Daniel Veillard42595322004-11-08 10:52:06 +000010516 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010517}
10518
10519
10520static int
10521test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010522 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010523
Daniel Veillard42595322004-11-08 10:52:06 +000010524 int mem_base;
10525 int ret_val;
10526 xmlHashTablePtr table; /* the hash table */
10527 int n_table;
10528 xmlChar * name; /* the name of the userdata */
10529 int n_name;
10530 void * userdata; /* a pointer to the userdata */
10531 int n_userdata;
10532 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10533 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010534
Daniel Veillard42595322004-11-08 10:52:06 +000010535 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10536 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10537 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10538 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10539 mem_base = xmlMemBlocks();
10540 table = gen_xmlHashTablePtr(n_table, 0);
10541 name = gen_const_xmlChar_ptr(n_name, 1);
10542 userdata = gen_userdata(n_userdata, 2);
10543 f = gen_xmlHashDeallocator(n_f, 3);
10544
10545 ret_val = xmlHashUpdateEntry(table, name, userdata, f);
10546 desret_int(ret_val);
10547 call_tests++;
10548 des_xmlHashTablePtr(n_table, table, 0);
10549 des_const_xmlChar_ptr(n_name, name, 1);
10550 des_userdata(n_userdata, userdata, 2);
10551 des_xmlHashDeallocator(n_f, f, 3);
10552 xmlResetLastError();
10553 if (mem_base != xmlMemBlocks()) {
10554 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10555 xmlMemBlocks() - mem_base);
10556 test_ret++;
10557 printf(" %d", n_table);
10558 printf(" %d", n_name);
10559 printf(" %d", n_userdata);
10560 printf(" %d", n_f);
10561 printf("\n");
10562 }
10563 }
10564 }
10565 }
10566 }
Daniel Veillard42595322004-11-08 10:52:06 +000010567 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010568
Daniel Veillard42595322004-11-08 10:52:06 +000010569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010570}
10571
10572
10573static int
10574test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010576
Daniel Veillard42595322004-11-08 10:52:06 +000010577 int mem_base;
10578 int ret_val;
10579 xmlHashTablePtr table; /* the hash table */
10580 int n_table;
10581 xmlChar * name; /* the name of the userdata */
10582 int n_name;
10583 xmlChar * name2; /* a second name of the userdata */
10584 int n_name2;
10585 void * userdata; /* a pointer to the userdata */
10586 int n_userdata;
10587 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10588 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010589
Daniel Veillard42595322004-11-08 10:52:06 +000010590 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10591 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10592 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10593 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10594 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10595 mem_base = xmlMemBlocks();
10596 table = gen_xmlHashTablePtr(n_table, 0);
10597 name = gen_const_xmlChar_ptr(n_name, 1);
10598 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10599 userdata = gen_userdata(n_userdata, 3);
10600 f = gen_xmlHashDeallocator(n_f, 4);
10601
10602 ret_val = xmlHashUpdateEntry2(table, name, name2, userdata, f);
10603 desret_int(ret_val);
10604 call_tests++;
10605 des_xmlHashTablePtr(n_table, table, 0);
10606 des_const_xmlChar_ptr(n_name, name, 1);
10607 des_const_xmlChar_ptr(n_name2, name2, 2);
10608 des_userdata(n_userdata, userdata, 3);
10609 des_xmlHashDeallocator(n_f, f, 4);
10610 xmlResetLastError();
10611 if (mem_base != xmlMemBlocks()) {
10612 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10613 xmlMemBlocks() - mem_base);
10614 test_ret++;
10615 printf(" %d", n_table);
10616 printf(" %d", n_name);
10617 printf(" %d", n_name2);
10618 printf(" %d", n_userdata);
10619 printf(" %d", n_f);
10620 printf("\n");
10621 }
10622 }
10623 }
10624 }
10625 }
10626 }
Daniel Veillard42595322004-11-08 10:52:06 +000010627 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010628
Daniel Veillard42595322004-11-08 10:52:06 +000010629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010630}
10631
10632
10633static int
10634test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010636
Daniel Veillard42595322004-11-08 10:52:06 +000010637 int mem_base;
10638 int ret_val;
10639 xmlHashTablePtr table; /* the hash table */
10640 int n_table;
10641 xmlChar * name; /* the name of the userdata */
10642 int n_name;
10643 xmlChar * name2; /* a second name of the userdata */
10644 int n_name2;
10645 xmlChar * name3; /* a third name of the userdata */
10646 int n_name3;
10647 void * userdata; /* a pointer to the userdata */
10648 int n_userdata;
10649 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10650 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010651
Daniel Veillard42595322004-11-08 10:52:06 +000010652 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10653 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10654 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10655 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10656 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10657 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10658 mem_base = xmlMemBlocks();
10659 table = gen_xmlHashTablePtr(n_table, 0);
10660 name = gen_const_xmlChar_ptr(n_name, 1);
10661 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10662 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10663 userdata = gen_userdata(n_userdata, 4);
10664 f = gen_xmlHashDeallocator(n_f, 5);
10665
10666 ret_val = xmlHashUpdateEntry3(table, name, name2, name3, userdata, f);
10667 desret_int(ret_val);
10668 call_tests++;
10669 des_xmlHashTablePtr(n_table, table, 0);
10670 des_const_xmlChar_ptr(n_name, name, 1);
10671 des_const_xmlChar_ptr(n_name2, name2, 2);
10672 des_const_xmlChar_ptr(n_name3, name3, 3);
10673 des_userdata(n_userdata, userdata, 4);
10674 des_xmlHashDeallocator(n_f, f, 5);
10675 xmlResetLastError();
10676 if (mem_base != xmlMemBlocks()) {
10677 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10678 xmlMemBlocks() - mem_base);
10679 test_ret++;
10680 printf(" %d", n_table);
10681 printf(" %d", n_name);
10682 printf(" %d", n_name2);
10683 printf(" %d", n_name3);
10684 printf(" %d", n_userdata);
10685 printf(" %d", n_f);
10686 printf("\n");
10687 }
10688 }
10689 }
10690 }
10691 }
10692 }
10693 }
Daniel Veillard42595322004-11-08 10:52:06 +000010694 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010695
Daniel Veillard42595322004-11-08 10:52:06 +000010696 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010697}
10698
10699static int
10700test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010701 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010702
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010703 if (quiet == 0) printf("Testing hash : 16 of 23 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000010704 test_ret += test_xmlHashAddEntry();
10705 test_ret += test_xmlHashAddEntry2();
10706 test_ret += test_xmlHashAddEntry3();
10707 test_ret += test_xmlHashCopy();
10708 test_ret += test_xmlHashCreate();
10709 test_ret += test_xmlHashLookup();
10710 test_ret += test_xmlHashLookup2();
10711 test_ret += test_xmlHashLookup3();
10712 test_ret += test_xmlHashQLookup();
10713 test_ret += test_xmlHashQLookup2();
10714 test_ret += test_xmlHashQLookup3();
10715 test_ret += test_xmlHashRemoveEntry();
10716 test_ret += test_xmlHashRemoveEntry2();
10717 test_ret += test_xmlHashRemoveEntry3();
10718 test_ret += test_xmlHashScan();
10719 test_ret += test_xmlHashScan3();
10720 test_ret += test_xmlHashScanFull();
10721 test_ret += test_xmlHashScanFull3();
10722 test_ret += test_xmlHashSize();
10723 test_ret += test_xmlHashUpdateEntry();
10724 test_ret += test_xmlHashUpdateEntry2();
10725 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010726
Daniel Veillard42595322004-11-08 10:52:06 +000010727 if (test_ret != 0)
10728 printf("Module hash: %d errors\n", test_ret);
10729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010730}
10731
Daniel Veillardce682bc2004-11-05 17:22:25 +000010732#define gen_nb_xmlLinkPtr 1
10733static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10734 return(NULL);
10735}
10736static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10737}
10738
Daniel Veillardd93f6252004-11-02 15:53:51 +000010739static int
10740test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010742
Daniel Veillardce682bc2004-11-05 17:22:25 +000010743 int mem_base;
10744 void * ret_val;
10745 xmlLinkPtr lk; /* a link */
10746 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010747
Daniel Veillardce682bc2004-11-05 17:22:25 +000010748 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10749 mem_base = xmlMemBlocks();
10750 lk = gen_xmlLinkPtr(n_lk, 0);
10751
10752 ret_val = xmlLinkGetData(lk);
10753 desret_void_ptr(ret_val);
10754 call_tests++;
10755 des_xmlLinkPtr(n_lk, lk, 0);
10756 xmlResetLastError();
10757 if (mem_base != xmlMemBlocks()) {
10758 printf("Leak of %d blocks found in xmlLinkGetData",
10759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010760 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010761 printf(" %d", n_lk);
10762 printf("\n");
10763 }
10764 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010765 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010766
Daniel Veillard42595322004-11-08 10:52:06 +000010767 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010768}
10769
10770
10771static int
10772test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010773 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010774
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010775 int mem_base;
10776 int ret_val;
10777 xmlListPtr l; /* a list */
10778 int n_l;
10779 void * data; /* the data */
10780 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010781
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010782 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10783 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10784 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010785 l = gen_xmlListPtr(n_l, 0);
10786 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010787
10788 ret_val = xmlListAppend(l, data);
10789 desret_int(ret_val);
10790 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010791 des_xmlListPtr(n_l, l, 0);
10792 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010793 xmlResetLastError();
10794 if (mem_base != xmlMemBlocks()) {
10795 printf("Leak of %d blocks found in xmlListAppend",
10796 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010797 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010798 printf(" %d", n_l);
10799 printf(" %d", n_data);
10800 printf("\n");
10801 }
10802 }
10803 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010804 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010805
Daniel Veillard42595322004-11-08 10:52:06 +000010806 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010807}
10808
10809
10810static int
10811test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010812 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010813
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010814 int mem_base;
10815 xmlListPtr l; /* a list */
10816 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010817
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010818 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10819 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010820 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010821
10822 xmlListClear(l);
10823 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010824 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010825 xmlResetLastError();
10826 if (mem_base != xmlMemBlocks()) {
10827 printf("Leak of %d blocks found in xmlListClear",
10828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010829 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010830 printf(" %d", n_l);
10831 printf("\n");
10832 }
10833 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010834 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010835
Daniel Veillard42595322004-11-08 10:52:06 +000010836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010837}
10838
10839
Daniel Veillardce682bc2004-11-05 17:22:25 +000010840#define gen_nb_const_xmlListPtr 1
10841static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10842 return(NULL);
10843}
10844static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10845}
10846
Daniel Veillardd93f6252004-11-02 15:53:51 +000010847static int
10848test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010850
Daniel Veillardce682bc2004-11-05 17:22:25 +000010851 int mem_base;
10852 int ret_val;
10853 xmlListPtr cur; /* the new list */
10854 int n_cur;
10855 xmlListPtr old; /* the old list */
10856 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010857
Daniel Veillardce682bc2004-11-05 17:22:25 +000010858 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10859 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10860 mem_base = xmlMemBlocks();
10861 cur = gen_xmlListPtr(n_cur, 0);
10862 old = gen_const_xmlListPtr(n_old, 1);
10863
10864 ret_val = xmlListCopy(cur, old);
10865 desret_int(ret_val);
10866 call_tests++;
10867 des_xmlListPtr(n_cur, cur, 0);
10868 des_const_xmlListPtr(n_old, old, 1);
10869 xmlResetLastError();
10870 if (mem_base != xmlMemBlocks()) {
10871 printf("Leak of %d blocks found in xmlListCopy",
10872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010873 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010874 printf(" %d", n_cur);
10875 printf(" %d", n_old);
10876 printf("\n");
10877 }
10878 }
10879 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010880 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010881
Daniel Veillard42595322004-11-08 10:52:06 +000010882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010883}
10884
10885
10886static int
10887test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010889
10890
10891 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010892 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010893}
10894
10895
10896static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010897test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010898 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010899
10900
10901 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010902 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010903}
10904
10905
10906static int
10907test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010908 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010909
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010910 int mem_base;
10911 int ret_val;
10912 xmlListPtr l; /* a list */
10913 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010914
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010915 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10916 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010917 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010918
10919 ret_val = xmlListEmpty(l);
10920 desret_int(ret_val);
10921 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010922 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010923 xmlResetLastError();
10924 if (mem_base != xmlMemBlocks()) {
10925 printf("Leak of %d blocks found in xmlListEmpty",
10926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010927 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010928 printf(" %d", n_l);
10929 printf("\n");
10930 }
10931 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010932 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010933
Daniel Veillard42595322004-11-08 10:52:06 +000010934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010935}
10936
10937
10938static int
10939test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010941
10942
10943 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010944 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010945}
10946
10947
10948static int
10949test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010950 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010951
10952
10953 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010954 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010955}
10956
10957
10958static int
10959test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010960 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010961
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010962 int mem_base;
10963 int ret_val;
10964 xmlListPtr l; /* a list */
10965 int n_l;
10966 void * data; /* the data */
10967 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010968
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010969 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10970 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10971 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010972 l = gen_xmlListPtr(n_l, 0);
10973 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010974
10975 ret_val = xmlListInsert(l, data);
10976 desret_int(ret_val);
10977 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010978 des_xmlListPtr(n_l, l, 0);
10979 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010980 xmlResetLastError();
10981 if (mem_base != xmlMemBlocks()) {
10982 printf("Leak of %d blocks found in xmlListInsert",
10983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010984 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010985 printf(" %d", n_l);
10986 printf(" %d", n_data);
10987 printf("\n");
10988 }
10989 }
10990 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010991 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010992
Daniel Veillard42595322004-11-08 10:52:06 +000010993 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010994}
10995
10996
10997static int
10998test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010999 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011000
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011001 int mem_base;
11002 xmlListPtr l1; /* the original list */
11003 int n_l1;
11004 xmlListPtr l2; /* the new list */
11005 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011006
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011007 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
11008 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
11009 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011010 l1 = gen_xmlListPtr(n_l1, 0);
11011 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011012
11013 xmlListMerge(l1, l2);
11014 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011015 des_xmlListPtr(n_l1, l1, 0);
11016 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011017 xmlResetLastError();
11018 if (mem_base != xmlMemBlocks()) {
11019 printf("Leak of %d blocks found in xmlListMerge",
11020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011021 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011022 printf(" %d", n_l1);
11023 printf(" %d", n_l2);
11024 printf("\n");
11025 }
11026 }
11027 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011028 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011029
Daniel Veillard42595322004-11-08 10:52:06 +000011030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011031}
11032
11033
11034static int
11035test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011037
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011038 int mem_base;
11039 xmlListPtr l; /* a list */
11040 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011041
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011042 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11043 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011044 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011045
11046 xmlListPopBack(l);
11047 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011048 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011049 xmlResetLastError();
11050 if (mem_base != xmlMemBlocks()) {
11051 printf("Leak of %d blocks found in xmlListPopBack",
11052 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011053 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011054 printf(" %d", n_l);
11055 printf("\n");
11056 }
11057 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011058 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011059
Daniel Veillard42595322004-11-08 10:52:06 +000011060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011061}
11062
11063
11064static int
11065test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011067
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011068 int mem_base;
11069 xmlListPtr l; /* a list */
11070 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011071
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011072 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11073 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011074 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011075
11076 xmlListPopFront(l);
11077 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011078 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011079 xmlResetLastError();
11080 if (mem_base != xmlMemBlocks()) {
11081 printf("Leak of %d blocks found in xmlListPopFront",
11082 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011083 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011084 printf(" %d", n_l);
11085 printf("\n");
11086 }
11087 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011088 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011089
Daniel Veillard42595322004-11-08 10:52:06 +000011090 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011091}
11092
11093
11094static int
11095test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011096 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011097
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011098 int mem_base;
11099 int ret_val;
11100 xmlListPtr l; /* a list */
11101 int n_l;
11102 void * data; /* new data */
11103 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011104
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011105 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11106 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11107 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011108 l = gen_xmlListPtr(n_l, 0);
11109 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011110
11111 ret_val = xmlListPushBack(l, data);
11112 desret_int(ret_val);
11113 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011114 des_xmlListPtr(n_l, l, 0);
11115 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011116 xmlResetLastError();
11117 if (mem_base != xmlMemBlocks()) {
11118 printf("Leak of %d blocks found in xmlListPushBack",
11119 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011120 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011121 printf(" %d", n_l);
11122 printf(" %d", n_data);
11123 printf("\n");
11124 }
11125 }
11126 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011127 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011128
Daniel Veillard42595322004-11-08 10:52:06 +000011129 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011130}
11131
11132
11133static int
11134test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011135 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011136
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011137 int mem_base;
11138 int ret_val;
11139 xmlListPtr l; /* a list */
11140 int n_l;
11141 void * data; /* new data */
11142 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011143
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011144 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11145 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11146 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011147 l = gen_xmlListPtr(n_l, 0);
11148 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011149
11150 ret_val = xmlListPushFront(l, data);
11151 desret_int(ret_val);
11152 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011153 des_xmlListPtr(n_l, l, 0);
11154 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011155 xmlResetLastError();
11156 if (mem_base != xmlMemBlocks()) {
11157 printf("Leak of %d blocks found in xmlListPushFront",
11158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011159 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011160 printf(" %d", n_l);
11161 printf(" %d", n_data);
11162 printf("\n");
11163 }
11164 }
11165 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011166 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011167
Daniel Veillard42595322004-11-08 10:52:06 +000011168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011169}
11170
11171
11172static int
11173test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011175
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011176 int mem_base;
11177 int ret_val;
11178 xmlListPtr l; /* a list */
11179 int n_l;
11180 void * data; /* list data */
11181 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011182
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011183 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11184 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11185 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011186 l = gen_xmlListPtr(n_l, 0);
11187 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011188
11189 ret_val = xmlListRemoveAll(l, data);
11190 desret_int(ret_val);
11191 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011192 des_xmlListPtr(n_l, l, 0);
11193 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011194 xmlResetLastError();
11195 if (mem_base != xmlMemBlocks()) {
11196 printf("Leak of %d blocks found in xmlListRemoveAll",
11197 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011198 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011199 printf(" %d", n_l);
11200 printf(" %d", n_data);
11201 printf("\n");
11202 }
11203 }
11204 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011205 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011206
Daniel Veillard42595322004-11-08 10:52:06 +000011207 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011208}
11209
11210
11211static int
11212test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011213 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011214
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011215 int mem_base;
11216 int ret_val;
11217 xmlListPtr l; /* a list */
11218 int n_l;
11219 void * data; /* list data */
11220 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011221
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011222 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11223 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11224 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011225 l = gen_xmlListPtr(n_l, 0);
11226 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011227
11228 ret_val = xmlListRemoveFirst(l, data);
11229 desret_int(ret_val);
11230 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011231 des_xmlListPtr(n_l, l, 0);
11232 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011233 xmlResetLastError();
11234 if (mem_base != xmlMemBlocks()) {
11235 printf("Leak of %d blocks found in xmlListRemoveFirst",
11236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011237 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011238 printf(" %d", n_l);
11239 printf(" %d", n_data);
11240 printf("\n");
11241 }
11242 }
11243 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011244 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011245
Daniel Veillard42595322004-11-08 10:52:06 +000011246 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011247}
11248
11249
11250static int
11251test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011252 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011253
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011254 int mem_base;
11255 int ret_val;
11256 xmlListPtr l; /* a list */
11257 int n_l;
11258 void * data; /* list data */
11259 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011260
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011261 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11262 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11263 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011264 l = gen_xmlListPtr(n_l, 0);
11265 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011266
11267 ret_val = xmlListRemoveLast(l, data);
11268 desret_int(ret_val);
11269 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011270 des_xmlListPtr(n_l, l, 0);
11271 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011272 xmlResetLastError();
11273 if (mem_base != xmlMemBlocks()) {
11274 printf("Leak of %d blocks found in xmlListRemoveLast",
11275 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011276 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011277 printf(" %d", n_l);
11278 printf(" %d", n_data);
11279 printf("\n");
11280 }
11281 }
11282 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011283 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011284
Daniel Veillard42595322004-11-08 10:52:06 +000011285 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011286}
11287
11288
11289static int
11290test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011292
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011293 int mem_base;
11294 xmlListPtr l; /* a list */
11295 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011296
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011297 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11298 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011299 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011300
11301 xmlListReverse(l);
11302 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011303 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011304 xmlResetLastError();
11305 if (mem_base != xmlMemBlocks()) {
11306 printf("Leak of %d blocks found in xmlListReverse",
11307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011308 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011309 printf(" %d", n_l);
11310 printf("\n");
11311 }
11312 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011313 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011314
Daniel Veillard42595322004-11-08 10:52:06 +000011315 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011316}
11317
11318
11319static int
11320test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011321 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011322
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011323 int mem_base;
11324 void * ret_val;
11325 xmlListPtr l; /* a list */
11326 int n_l;
11327 void * data; /* a search value */
11328 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011329
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011330 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11331 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11332 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011333 l = gen_xmlListPtr(n_l, 0);
11334 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011335
11336 ret_val = xmlListReverseSearch(l, data);
11337 desret_void_ptr(ret_val);
11338 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011339 des_xmlListPtr(n_l, l, 0);
11340 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011341 xmlResetLastError();
11342 if (mem_base != xmlMemBlocks()) {
11343 printf("Leak of %d blocks found in xmlListReverseSearch",
11344 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011345 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011346 printf(" %d", n_l);
11347 printf(" %d", n_data);
11348 printf("\n");
11349 }
11350 }
11351 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011352 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011353
Daniel Veillard42595322004-11-08 10:52:06 +000011354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011355}
11356
11357
11358static int
11359test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011361
11362
11363 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011364 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011365}
11366
11367
11368static int
11369test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011370 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011371
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011372 int mem_base;
11373 void * ret_val;
11374 xmlListPtr l; /* a list */
11375 int n_l;
11376 void * data; /* a search value */
11377 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011378
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011379 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11380 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11381 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011382 l = gen_xmlListPtr(n_l, 0);
11383 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011384
11385 ret_val = xmlListSearch(l, data);
11386 desret_void_ptr(ret_val);
11387 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011388 des_xmlListPtr(n_l, l, 0);
11389 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011390 xmlResetLastError();
11391 if (mem_base != xmlMemBlocks()) {
11392 printf("Leak of %d blocks found in xmlListSearch",
11393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011394 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011395 printf(" %d", n_l);
11396 printf(" %d", n_data);
11397 printf("\n");
11398 }
11399 }
11400 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011401 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011402
Daniel Veillard42595322004-11-08 10:52:06 +000011403 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011404}
11405
11406
11407static int
11408test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011409 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011410
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011411 int mem_base;
11412 int ret_val;
11413 xmlListPtr l; /* a list */
11414 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011415
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011416 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11417 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011418 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011419
11420 ret_val = xmlListSize(l);
11421 desret_int(ret_val);
11422 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011423 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011424 xmlResetLastError();
11425 if (mem_base != xmlMemBlocks()) {
11426 printf("Leak of %d blocks found in xmlListSize",
11427 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011428 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011429 printf(" %d", n_l);
11430 printf("\n");
11431 }
11432 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011433 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011434
Daniel Veillard42595322004-11-08 10:52:06 +000011435 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011436}
11437
11438
11439static int
11440test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011441 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011442
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011443 int mem_base;
11444 xmlListPtr l; /* a list */
11445 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011446
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011447 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11448 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011449 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011450
11451 xmlListSort(l);
11452 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011453 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011454 xmlResetLastError();
11455 if (mem_base != xmlMemBlocks()) {
11456 printf("Leak of %d blocks found in xmlListSort",
11457 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011458 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011459 printf(" %d", n_l);
11460 printf("\n");
11461 }
11462 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011463 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011464
Daniel Veillard42595322004-11-08 10:52:06 +000011465 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011466}
11467
11468
11469static int
11470test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011471 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011472
11473
11474 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011475 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011476}
11477
11478static int
11479test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011481
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011482 if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011483 test_ret += test_xmlLinkGetData();
11484 test_ret += test_xmlListAppend();
11485 test_ret += test_xmlListClear();
11486 test_ret += test_xmlListCopy();
11487 test_ret += test_xmlListCreate();
11488 test_ret += test_xmlListDup();
11489 test_ret += test_xmlListEmpty();
11490 test_ret += test_xmlListEnd();
11491 test_ret += test_xmlListFront();
11492 test_ret += test_xmlListInsert();
11493 test_ret += test_xmlListMerge();
11494 test_ret += test_xmlListPopBack();
11495 test_ret += test_xmlListPopFront();
11496 test_ret += test_xmlListPushBack();
11497 test_ret += test_xmlListPushFront();
11498 test_ret += test_xmlListRemoveAll();
11499 test_ret += test_xmlListRemoveFirst();
11500 test_ret += test_xmlListRemoveLast();
11501 test_ret += test_xmlListReverse();
11502 test_ret += test_xmlListReverseSearch();
11503 test_ret += test_xmlListReverseWalk();
11504 test_ret += test_xmlListSearch();
11505 test_ret += test_xmlListSize();
11506 test_ret += test_xmlListSort();
11507 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011508
Daniel Veillard42595322004-11-08 10:52:06 +000011509 if (test_ret != 0)
11510 printf("Module list: %d errors\n", test_ret);
11511 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011512}
11513
11514static int
11515test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011516 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011517
Daniel Veillard27f20102004-11-05 11:50:11 +000011518#ifdef LIBXML_FTP_ENABLED
11519 int mem_base;
11520 int ret_val;
11521 void * ctx; /* an FTP context */
11522 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011523
Daniel Veillard27f20102004-11-05 11:50:11 +000011524 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11525 mem_base = xmlMemBlocks();
11526 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11527
11528 ret_val = xmlNanoFTPCheckResponse(ctx);
11529 desret_int(ret_val);
11530 call_tests++;
11531 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11532 xmlResetLastError();
11533 if (mem_base != xmlMemBlocks()) {
11534 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011536 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011537 printf(" %d", n_ctx);
11538 printf("\n");
11539 }
11540 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011541 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011542#endif
11543
Daniel Veillard42595322004-11-08 10:52:06 +000011544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011545}
11546
11547
11548static int
11549test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011551
11552#ifdef LIBXML_FTP_ENABLED
11553 int mem_base;
11554
11555 mem_base = xmlMemBlocks();
11556
11557 xmlNanoFTPCleanup();
11558 call_tests++;
11559 xmlResetLastError();
11560 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011561 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011563 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011564 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011566 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011567#endif
11568
Daniel Veillard42595322004-11-08 10:52:06 +000011569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011570}
11571
11572
11573static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011574test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011576
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011577#ifdef LIBXML_FTP_ENABLED
11578 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011579 int ret_val;
11580 void * ctx; /* an FTP context */
11581 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011582
Daniel Veillard27f20102004-11-05 11:50:11 +000011583 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011584 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011585 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011586
Daniel Veillard27f20102004-11-05 11:50:11 +000011587 ret_val = xmlNanoFTPCloseConnection(ctx);
11588 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011589 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011590 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011591 xmlResetLastError();
11592 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011593 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011595 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011596 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011597 printf("\n");
11598 }
11599 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011600 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011601#endif
11602
Daniel Veillard42595322004-11-08 10:52:06 +000011603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011604}
11605
11606
11607static int
11608test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011610
Daniel Veillard27f20102004-11-05 11:50:11 +000011611#ifdef LIBXML_FTP_ENABLED
11612 int mem_base;
11613 int ret_val;
11614 void * ctx; /* an FTP context */
11615 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011616 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011617 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011618
Daniel Veillard27f20102004-11-05 11:50:11 +000011619 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11620 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11621 mem_base = xmlMemBlocks();
11622 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11623 directory = gen_const_char_ptr(n_directory, 1);
11624
11625 ret_val = xmlNanoFTPCwd(ctx, directory);
11626 desret_int(ret_val);
11627 call_tests++;
11628 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11629 des_const_char_ptr(n_directory, directory, 1);
11630 xmlResetLastError();
11631 if (mem_base != xmlMemBlocks()) {
11632 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11633 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011634 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011635 printf(" %d", n_ctx);
11636 printf(" %d", n_directory);
11637 printf("\n");
11638 }
11639 }
11640 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011641 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011642#endif
11643
Daniel Veillard42595322004-11-08 10:52:06 +000011644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011645}
11646
11647
11648static int
11649test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011651
Daniel Veillard27f20102004-11-05 11:50:11 +000011652#ifdef LIBXML_FTP_ENABLED
11653 int mem_base;
11654 int ret_val;
11655 void * ctx; /* an FTP context */
11656 int n_ctx;
11657 const char * file; /* a file or directory on the server */
11658 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011659
Daniel Veillard27f20102004-11-05 11:50:11 +000011660 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11661 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11662 mem_base = xmlMemBlocks();
11663 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11664 file = gen_filepath(n_file, 1);
11665
11666 ret_val = xmlNanoFTPDele(ctx, file);
11667 desret_int(ret_val);
11668 call_tests++;
11669 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11670 des_filepath(n_file, file, 1);
11671 xmlResetLastError();
11672 if (mem_base != xmlMemBlocks()) {
11673 printf("Leak of %d blocks found in xmlNanoFTPDele",
11674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011675 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011676 printf(" %d", n_ctx);
11677 printf(" %d", n_file);
11678 printf("\n");
11679 }
11680 }
11681 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011682 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011683#endif
11684
Daniel Veillard42595322004-11-08 10:52:06 +000011685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011686}
11687
11688
11689static int
11690test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011692
11693
11694 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011696}
11697
11698
11699static int
11700test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011701 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011702
Daniel Veillard27f20102004-11-05 11:50:11 +000011703#ifdef LIBXML_FTP_ENABLED
11704 int mem_base;
11705 int ret_val;
11706 void * ctx; /* an FTP context */
11707 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011708
Daniel Veillard27f20102004-11-05 11:50:11 +000011709 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11710 mem_base = xmlMemBlocks();
11711 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11712
11713 ret_val = xmlNanoFTPGetConnection(ctx);
11714 desret_int(ret_val);
11715 call_tests++;
11716 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11717 xmlResetLastError();
11718 if (mem_base != xmlMemBlocks()) {
11719 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11720 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011721 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011722 printf(" %d", n_ctx);
11723 printf("\n");
11724 }
11725 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011726 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011727#endif
11728
Daniel Veillard42595322004-11-08 10:52:06 +000011729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011730}
11731
11732
11733static int
11734test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011735 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011736
Daniel Veillard27f20102004-11-05 11:50:11 +000011737#ifdef LIBXML_FTP_ENABLED
11738 int mem_base;
11739 int ret_val;
11740 void * ctx; /* an FTP context */
11741 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011742
Daniel Veillard27f20102004-11-05 11:50:11 +000011743 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11744 mem_base = xmlMemBlocks();
11745 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11746
11747 ret_val = xmlNanoFTPGetResponse(ctx);
11748 desret_int(ret_val);
11749 call_tests++;
11750 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11751 xmlResetLastError();
11752 if (mem_base != xmlMemBlocks()) {
11753 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11754 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011755 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011756 printf(" %d", n_ctx);
11757 printf("\n");
11758 }
11759 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011760 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011761#endif
11762
Daniel Veillard42595322004-11-08 10:52:06 +000011763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011764}
11765
11766
11767static int
11768test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011769 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011770
Daniel Veillard27f20102004-11-05 11:50:11 +000011771#ifdef LIBXML_FTP_ENABLED
11772 int mem_base;
11773 int ret_val;
11774 void * ctx; /* an FTP context */
11775 int n_ctx;
11776 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11777 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011778
Daniel Veillard27f20102004-11-05 11:50:11 +000011779 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11780 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11781 mem_base = xmlMemBlocks();
11782 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11783 filename = gen_filepath(n_filename, 1);
11784
11785 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11786 desret_int(ret_val);
11787 call_tests++;
11788 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11789 des_filepath(n_filename, filename, 1);
11790 xmlResetLastError();
11791 if (mem_base != xmlMemBlocks()) {
11792 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011794 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011795 printf(" %d", n_ctx);
11796 printf(" %d", n_filename);
11797 printf("\n");
11798 }
11799 }
11800 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011801 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011802#endif
11803
Daniel Veillard42595322004-11-08 10:52:06 +000011804 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011805}
11806
11807
11808static int
11809test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011810 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011811
11812#ifdef LIBXML_FTP_ENABLED
11813 int mem_base;
11814
11815 mem_base = xmlMemBlocks();
11816
11817 xmlNanoFTPInit();
11818 call_tests++;
11819 xmlResetLastError();
11820 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011821 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011823 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011824 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011825 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011826 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011827#endif
11828
Daniel Veillard42595322004-11-08 10:52:06 +000011829 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011830}
11831
11832
11833static int
11834test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011835 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011836
11837
11838 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011840}
11841
11842
11843static int
11844test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011846
11847
11848 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011850}
11851
11852
11853static int
11854test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011856
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011857#ifdef LIBXML_FTP_ENABLED
11858 int mem_base;
11859 void * ret_val;
11860 const char * URL; /* the URL to the resource */
11861 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011862
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011863 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11864 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011865 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011866
11867 ret_val = xmlNanoFTPOpen(URL);
11868 desret_void_ptr(ret_val);
11869 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011870 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011871 xmlResetLastError();
11872 if (mem_base != xmlMemBlocks()) {
11873 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11874 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011875 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011876 printf(" %d", n_URL);
11877 printf("\n");
11878 }
11879 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011880 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011881#endif
11882
Daniel Veillard42595322004-11-08 10:52:06 +000011883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011884}
11885
11886
11887static int
11888test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011889 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011890
11891#ifdef LIBXML_FTP_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000011892 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011893 int n_host;
11894 int port; /* the proxy port */
11895 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011896 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011897 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011898 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011899 int n_passwd;
11900 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11901 int n_type;
11902
11903 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11904 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11905 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11906 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11907 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011908 host = gen_const_char_ptr(n_host, 0);
11909 port = gen_int(n_port, 1);
11910 user = gen_const_char_ptr(n_user, 2);
11911 passwd = gen_const_char_ptr(n_passwd, 3);
11912 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011913
11914 xmlNanoFTPProxy(host, port, user, passwd, type);
11915 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011916 des_const_char_ptr(n_host, host, 0);
11917 des_int(n_port, port, 1);
11918 des_const_char_ptr(n_user, user, 2);
11919 des_const_char_ptr(n_passwd, passwd, 3);
11920 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011921 xmlResetLastError();
11922 }
11923 }
11924 }
11925 }
11926 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011927 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011928#endif
11929
Daniel Veillard42595322004-11-08 10:52:06 +000011930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011931}
11932
11933
11934static int
11935test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011937
Daniel Veillard27f20102004-11-05 11:50:11 +000011938#ifdef LIBXML_FTP_ENABLED
11939 int mem_base;
11940 int ret_val;
11941 void * ctx; /* an FTP context */
11942 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011943
Daniel Veillard27f20102004-11-05 11:50:11 +000011944 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11945 mem_base = xmlMemBlocks();
11946 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11947
11948 ret_val = xmlNanoFTPQuit(ctx);
11949 desret_int(ret_val);
11950 call_tests++;
11951 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11952 xmlResetLastError();
11953 if (mem_base != xmlMemBlocks()) {
11954 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11955 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011956 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011957 printf(" %d", n_ctx);
11958 printf("\n");
11959 }
11960 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011961 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011962#endif
11963
Daniel Veillard42595322004-11-08 10:52:06 +000011964 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011965}
11966
11967
11968static int
11969test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011970 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011971
Daniel Veillard27f20102004-11-05 11:50:11 +000011972#ifdef LIBXML_FTP_ENABLED
11973 int mem_base;
11974 int ret_val;
11975 void * ctx; /* the FTP context */
11976 int n_ctx;
11977 void * dest; /* a buffer */
11978 int n_dest;
11979 int len; /* the buffer length */
11980 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011981
Daniel Veillard27f20102004-11-05 11:50:11 +000011982 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11983 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11984 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11985 mem_base = xmlMemBlocks();
11986 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11987 dest = gen_void_ptr(n_dest, 1);
11988 len = gen_int(n_len, 2);
11989
11990 ret_val = xmlNanoFTPRead(ctx, dest, len);
11991 desret_int(ret_val);
11992 call_tests++;
11993 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11994 des_void_ptr(n_dest, dest, 1);
11995 des_int(n_len, len, 2);
11996 xmlResetLastError();
11997 if (mem_base != xmlMemBlocks()) {
11998 printf("Leak of %d blocks found in xmlNanoFTPRead",
11999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012000 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012001 printf(" %d", n_ctx);
12002 printf(" %d", n_dest);
12003 printf(" %d", n_len);
12004 printf("\n");
12005 }
12006 }
12007 }
12008 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012009 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012010#endif
12011
Daniel Veillard42595322004-11-08 10:52:06 +000012012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012013}
12014
12015
12016static int
12017test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012019
12020#ifdef LIBXML_FTP_ENABLED
12021 const char * URL; /* The proxy URL used to initialize the proxy context */
12022 int n_URL;
12023
12024 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012025 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012026
12027 xmlNanoFTPScanProxy(URL);
12028 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012029 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012030 xmlResetLastError();
12031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012032 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012033#endif
12034
Daniel Veillard42595322004-11-08 10:52:06 +000012035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012036}
12037
12038
12039static int
12040test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012042
Daniel Veillard27f20102004-11-05 11:50:11 +000012043#ifdef LIBXML_FTP_ENABLED
12044 int mem_base;
12045 int ret_val;
12046 void * ctx; /* an FTP context */
12047 int n_ctx;
12048 const char * URL; /* The URL used to update the context */
12049 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012050
Daniel Veillard27f20102004-11-05 11:50:11 +000012051 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
12052 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12053 mem_base = xmlMemBlocks();
12054 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
12055 URL = gen_filepath(n_URL, 1);
12056
12057 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
12058 desret_int(ret_val);
12059 call_tests++;
12060 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
12061 des_filepath(n_URL, URL, 1);
12062 xmlResetLastError();
12063 if (mem_base != xmlMemBlocks()) {
12064 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
12065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012066 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012067 printf(" %d", n_ctx);
12068 printf(" %d", n_URL);
12069 printf("\n");
12070 }
12071 }
12072 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012073 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012074#endif
12075
Daniel Veillard42595322004-11-08 10:52:06 +000012076 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012077}
12078
12079static int
12080test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012081 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012082
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012083 if (quiet == 0) printf("Testing nanoftp : 15 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012084 test_ret += test_xmlNanoFTPCheckResponse();
12085 test_ret += test_xmlNanoFTPCleanup();
12086 test_ret += test_xmlNanoFTPCloseConnection();
12087 test_ret += test_xmlNanoFTPCwd();
12088 test_ret += test_xmlNanoFTPDele();
12089 test_ret += test_xmlNanoFTPGet();
12090 test_ret += test_xmlNanoFTPGetConnection();
12091 test_ret += test_xmlNanoFTPGetResponse();
12092 test_ret += test_xmlNanoFTPGetSocket();
12093 test_ret += test_xmlNanoFTPInit();
12094 test_ret += test_xmlNanoFTPList();
12095 test_ret += test_xmlNanoFTPNewCtxt();
12096 test_ret += test_xmlNanoFTPOpen();
12097 test_ret += test_xmlNanoFTPProxy();
12098 test_ret += test_xmlNanoFTPQuit();
12099 test_ret += test_xmlNanoFTPRead();
12100 test_ret += test_xmlNanoFTPScanProxy();
12101 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012102
Daniel Veillard42595322004-11-08 10:52:06 +000012103 if (test_ret != 0)
12104 printf("Module nanoftp: %d errors\n", test_ret);
12105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012106}
12107
12108static int
12109test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012111
Daniel Veillard27f20102004-11-05 11:50:11 +000012112#ifdef LIBXML_HTTP_ENABLED
12113 int mem_base;
12114 const char * ret_val;
12115 void * ctx; /* the HTTP context */
12116 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012117
Daniel Veillard27f20102004-11-05 11:50:11 +000012118 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12119 mem_base = xmlMemBlocks();
12120 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12121
12122 ret_val = xmlNanoHTTPAuthHeader(ctx);
12123 desret_const_char_ptr(ret_val);
12124 call_tests++;
12125 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12126 xmlResetLastError();
12127 if (mem_base != xmlMemBlocks()) {
12128 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
12129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012130 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012131 printf(" %d", n_ctx);
12132 printf("\n");
12133 }
12134 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012135 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012136#endif
12137
Daniel Veillard42595322004-11-08 10:52:06 +000012138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012139}
12140
12141
12142static int
12143test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012145
12146#ifdef LIBXML_HTTP_ENABLED
12147 int mem_base;
12148
12149 mem_base = xmlMemBlocks();
12150
12151 xmlNanoHTTPCleanup();
12152 call_tests++;
12153 xmlResetLastError();
12154 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012155 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012157 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012158 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012159 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012160 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012161#endif
12162
Daniel Veillard42595322004-11-08 10:52:06 +000012163 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012164}
12165
12166
12167static int
12168test_xmlNanoHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012170
Daniel Veillard27f20102004-11-05 11:50:11 +000012171#ifdef LIBXML_HTTP_ENABLED
12172 int mem_base;
12173 void * ctx; /* the HTTP context */
12174 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012175
Daniel Veillard27f20102004-11-05 11:50:11 +000012176 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12177 mem_base = xmlMemBlocks();
12178 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12179
12180 xmlNanoHTTPClose(ctx);
12181 call_tests++;
12182 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12183 xmlResetLastError();
12184 if (mem_base != xmlMemBlocks()) {
12185 printf("Leak of %d blocks found in xmlNanoHTTPClose",
12186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012187 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012188 printf(" %d", n_ctx);
12189 printf("\n");
12190 }
12191 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012192 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012193#endif
12194
Daniel Veillard42595322004-11-08 10:52:06 +000012195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012196}
12197
12198
12199static int
12200test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012202
Daniel Veillard27f20102004-11-05 11:50:11 +000012203#ifdef LIBXML_HTTP_ENABLED
12204 int mem_base;
12205 int ret_val;
12206 void * ctx; /* the HTTP context */
12207 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012208
Daniel Veillard27f20102004-11-05 11:50:11 +000012209 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12210 mem_base = xmlMemBlocks();
12211 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12212
12213 ret_val = xmlNanoHTTPContentLength(ctx);
12214 desret_int(ret_val);
12215 call_tests++;
12216 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12217 xmlResetLastError();
12218 if (mem_base != xmlMemBlocks()) {
12219 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
12220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012221 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012222 printf(" %d", n_ctx);
12223 printf("\n");
12224 }
12225 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012226 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012227#endif
12228
Daniel Veillard42595322004-11-08 10:52:06 +000012229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012230}
12231
12232
12233static int
12234test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012236
Daniel Veillard27f20102004-11-05 11:50:11 +000012237#ifdef LIBXML_HTTP_ENABLED
12238 int mem_base;
12239 const char * ret_val;
12240 void * ctx; /* the HTTP context */
12241 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012242
Daniel Veillard27f20102004-11-05 11:50:11 +000012243 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12244 mem_base = xmlMemBlocks();
12245 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12246
12247 ret_val = xmlNanoHTTPEncoding(ctx);
12248 desret_const_char_ptr(ret_val);
12249 call_tests++;
12250 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12251 xmlResetLastError();
12252 if (mem_base != xmlMemBlocks()) {
12253 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
12254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012255 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012256 printf(" %d", n_ctx);
12257 printf("\n");
12258 }
12259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012260 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012261#endif
12262
Daniel Veillard42595322004-11-08 10:52:06 +000012263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012264}
12265
12266
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012267#define gen_nb_char_ptr_ptr 1
12268static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12269 return(NULL);
12270}
12271static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12272}
12273
Daniel Veillardd93f6252004-11-02 15:53:51 +000012274static int
12275test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012277
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012278#ifdef LIBXML_HTTP_ENABLED
12279 int mem_base;
12280 int ret_val;
12281 const char * URL; /* The URL to load */
12282 int n_URL;
12283 const char * filename; /* the filename where the content should be saved */
12284 int n_filename;
12285 char ** contentType; /* if available the Content-Type information will be returned at that location */
12286 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012287
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012288 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12289 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12290 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12291 mem_base = xmlMemBlocks();
12292 URL = gen_filepath(n_URL, 0);
12293 filename = gen_filepath(n_filename, 1);
12294 contentType = gen_char_ptr_ptr(n_contentType, 2);
12295
12296 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
12297 desret_int(ret_val);
12298 call_tests++;
12299 des_filepath(n_URL, URL, 0);
12300 des_filepath(n_filename, filename, 1);
12301 des_char_ptr_ptr(n_contentType, contentType, 2);
12302 xmlResetLastError();
12303 if (mem_base != xmlMemBlocks()) {
12304 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
12305 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012306 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012307 printf(" %d", n_URL);
12308 printf(" %d", n_filename);
12309 printf(" %d", n_contentType);
12310 printf("\n");
12311 }
12312 }
12313 }
12314 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012315 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012316#endif
12317
Daniel Veillard42595322004-11-08 10:52:06 +000012318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012319}
12320
12321
12322static int
12323test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012325
12326#ifdef LIBXML_HTTP_ENABLED
12327 int mem_base;
12328
12329 mem_base = xmlMemBlocks();
12330
12331 xmlNanoHTTPInit();
12332 call_tests++;
12333 xmlResetLastError();
12334 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012335 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012337 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012338 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012339 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012340 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012341#endif
12342
Daniel Veillard42595322004-11-08 10:52:06 +000012343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012344}
12345
12346
12347static int
12348test_xmlNanoHTTPMethod(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012350
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012351#ifdef LIBXML_HTTP_ENABLED
12352 int mem_base;
12353 void * ret_val;
12354 const char * URL; /* The URL to load */
12355 int n_URL;
12356 char * method; /* the HTTP method to use */
12357 int n_method;
12358 char * input; /* the input string if any */
12359 int n_input;
12360 char ** contentType; /* the Content-Type information IN and OUT */
12361 int n_contentType;
12362 char * headers; /* the extra headers */
12363 int n_headers;
12364 int ilen; /* input length */
12365 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012366
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012367 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12368 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12369 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12370 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12371 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12372 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12373 mem_base = xmlMemBlocks();
12374 URL = gen_filepath(n_URL, 0);
12375 method = gen_const_char_ptr(n_method, 1);
12376 input = gen_const_char_ptr(n_input, 2);
12377 contentType = gen_char_ptr_ptr(n_contentType, 3);
12378 headers = gen_const_char_ptr(n_headers, 4);
12379 ilen = gen_int(n_ilen, 5);
12380
12381 ret_val = xmlNanoHTTPMethod(URL, method, input, contentType, headers, ilen);
12382 desret_void_ptr(ret_val);
12383 call_tests++;
12384 des_filepath(n_URL, URL, 0);
12385 des_const_char_ptr(n_method, method, 1);
12386 des_const_char_ptr(n_input, input, 2);
12387 des_char_ptr_ptr(n_contentType, contentType, 3);
12388 des_const_char_ptr(n_headers, headers, 4);
12389 des_int(n_ilen, ilen, 5);
12390 xmlResetLastError();
12391 if (mem_base != xmlMemBlocks()) {
12392 printf("Leak of %d blocks found in xmlNanoHTTPMethod",
12393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012394 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012395 printf(" %d", n_URL);
12396 printf(" %d", n_method);
12397 printf(" %d", n_input);
12398 printf(" %d", n_contentType);
12399 printf(" %d", n_headers);
12400 printf(" %d", n_ilen);
12401 printf("\n");
12402 }
12403 }
12404 }
12405 }
12406 }
12407 }
12408 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012409 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012410#endif
12411
Daniel Veillard42595322004-11-08 10:52:06 +000012412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012413}
12414
12415
12416static int
12417test_xmlNanoHTTPMethodRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012419
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012420#ifdef LIBXML_HTTP_ENABLED
12421 int mem_base;
12422 void * ret_val;
12423 const char * URL; /* The URL to load */
12424 int n_URL;
12425 char * method; /* the HTTP method to use */
12426 int n_method;
12427 char * input; /* the input string if any */
12428 int n_input;
12429 char ** contentType; /* the Content-Type information IN and OUT */
12430 int n_contentType;
12431 char ** redir; /* the redirected URL OUT */
12432 int n_redir;
12433 char * headers; /* the extra headers */
12434 int n_headers;
12435 int ilen; /* input length */
12436 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012437
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012438 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12439 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12440 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12441 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12442 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12443 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12444 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12445 mem_base = xmlMemBlocks();
12446 URL = gen_filepath(n_URL, 0);
12447 method = gen_const_char_ptr(n_method, 1);
12448 input = gen_const_char_ptr(n_input, 2);
12449 contentType = gen_char_ptr_ptr(n_contentType, 3);
12450 redir = gen_char_ptr_ptr(n_redir, 4);
12451 headers = gen_const_char_ptr(n_headers, 5);
12452 ilen = gen_int(n_ilen, 6);
12453
12454 ret_val = xmlNanoHTTPMethodRedir(URL, method, input, contentType, redir, headers, ilen);
12455 desret_void_ptr(ret_val);
12456 call_tests++;
12457 des_filepath(n_URL, URL, 0);
12458 des_const_char_ptr(n_method, method, 1);
12459 des_const_char_ptr(n_input, input, 2);
12460 des_char_ptr_ptr(n_contentType, contentType, 3);
12461 des_char_ptr_ptr(n_redir, redir, 4);
12462 des_const_char_ptr(n_headers, headers, 5);
12463 des_int(n_ilen, ilen, 6);
12464 xmlResetLastError();
12465 if (mem_base != xmlMemBlocks()) {
12466 printf("Leak of %d blocks found in xmlNanoHTTPMethodRedir",
12467 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012468 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012469 printf(" %d", n_URL);
12470 printf(" %d", n_method);
12471 printf(" %d", n_input);
12472 printf(" %d", n_contentType);
12473 printf(" %d", n_redir);
12474 printf(" %d", n_headers);
12475 printf(" %d", n_ilen);
12476 printf("\n");
12477 }
12478 }
12479 }
12480 }
12481 }
12482 }
12483 }
12484 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012485 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012486#endif
12487
Daniel Veillard42595322004-11-08 10:52:06 +000012488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012489}
12490
12491
12492static int
12493test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012495
Daniel Veillard27f20102004-11-05 11:50:11 +000012496#ifdef LIBXML_HTTP_ENABLED
12497 int mem_base;
12498 const char * ret_val;
12499 void * ctx; /* the HTTP context */
12500 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012501
Daniel Veillard27f20102004-11-05 11:50:11 +000012502 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12503 mem_base = xmlMemBlocks();
12504 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12505
12506 ret_val = xmlNanoHTTPMimeType(ctx);
12507 desret_const_char_ptr(ret_val);
12508 call_tests++;
12509 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12510 xmlResetLastError();
12511 if (mem_base != xmlMemBlocks()) {
12512 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12513 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012514 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012515 printf(" %d", n_ctx);
12516 printf("\n");
12517 }
12518 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012519 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012520#endif
12521
Daniel Veillard42595322004-11-08 10:52:06 +000012522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012523}
12524
12525
12526static int
12527test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012529
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012530#ifdef LIBXML_HTTP_ENABLED
12531 int mem_base;
12532 void * ret_val;
12533 const char * URL; /* The URL to load */
12534 int n_URL;
12535 char ** contentType; /* if available the Content-Type information will be returned at that location */
12536 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012537
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012538 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12539 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12540 mem_base = xmlMemBlocks();
12541 URL = gen_filepath(n_URL, 0);
12542 contentType = gen_char_ptr_ptr(n_contentType, 1);
12543
12544 ret_val = xmlNanoHTTPOpen(URL, contentType);
12545 desret_void_ptr(ret_val);
12546 call_tests++;
12547 des_filepath(n_URL, URL, 0);
12548 des_char_ptr_ptr(n_contentType, contentType, 1);
12549 xmlResetLastError();
12550 if (mem_base != xmlMemBlocks()) {
12551 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012553 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012554 printf(" %d", n_URL);
12555 printf(" %d", n_contentType);
12556 printf("\n");
12557 }
12558 }
12559 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012560 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012561#endif
12562
Daniel Veillard42595322004-11-08 10:52:06 +000012563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012564}
12565
12566
12567static int
12568test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012570
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012571#ifdef LIBXML_HTTP_ENABLED
12572 int mem_base;
12573 void * ret_val;
12574 const char * URL; /* The URL to load */
12575 int n_URL;
12576 char ** contentType; /* if available the Content-Type information will be returned at that location */
12577 int n_contentType;
12578 char ** redir; /* if available the redirected URL will be returned */
12579 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012580
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012581 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12582 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12583 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12584 mem_base = xmlMemBlocks();
12585 URL = gen_filepath(n_URL, 0);
12586 contentType = gen_char_ptr_ptr(n_contentType, 1);
12587 redir = gen_char_ptr_ptr(n_redir, 2);
12588
12589 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
12590 desret_void_ptr(ret_val);
12591 call_tests++;
12592 des_filepath(n_URL, URL, 0);
12593 des_char_ptr_ptr(n_contentType, contentType, 1);
12594 des_char_ptr_ptr(n_redir, redir, 2);
12595 xmlResetLastError();
12596 if (mem_base != xmlMemBlocks()) {
12597 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012599 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012600 printf(" %d", n_URL);
12601 printf(" %d", n_contentType);
12602 printf(" %d", n_redir);
12603 printf("\n");
12604 }
12605 }
12606 }
12607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012608 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012609#endif
12610
Daniel Veillard42595322004-11-08 10:52:06 +000012611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012612}
12613
12614
12615static int
12616test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012618
Daniel Veillard27f20102004-11-05 11:50:11 +000012619#ifdef LIBXML_HTTP_ENABLED
12620 int mem_base;
12621 int ret_val;
12622 void * ctx; /* the HTTP context */
12623 int n_ctx;
12624 void * dest; /* a buffer */
12625 int n_dest;
12626 int len; /* the buffer length */
12627 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012628
Daniel Veillard27f20102004-11-05 11:50:11 +000012629 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12630 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12631 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12632 mem_base = xmlMemBlocks();
12633 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12634 dest = gen_void_ptr(n_dest, 1);
12635 len = gen_int(n_len, 2);
12636
12637 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12638 desret_int(ret_val);
12639 call_tests++;
12640 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12641 des_void_ptr(n_dest, dest, 1);
12642 des_int(n_len, len, 2);
12643 xmlResetLastError();
12644 if (mem_base != xmlMemBlocks()) {
12645 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012647 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012648 printf(" %d", n_ctx);
12649 printf(" %d", n_dest);
12650 printf(" %d", n_len);
12651 printf("\n");
12652 }
12653 }
12654 }
12655 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012656 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012657#endif
12658
Daniel Veillard42595322004-11-08 10:52:06 +000012659 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012660}
12661
12662
12663static int
12664test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012665 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012666
12667
12668 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012669 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012670}
12671
12672
12673static int
12674test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012675 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012676
Daniel Veillard27f20102004-11-05 11:50:11 +000012677#ifdef LIBXML_HTTP_ENABLED
12678 int mem_base;
12679 int ret_val;
12680 void * ctx; /* the HTTP context */
12681 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012682
Daniel Veillard27f20102004-11-05 11:50:11 +000012683 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12684 mem_base = xmlMemBlocks();
12685 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12686
12687 ret_val = xmlNanoHTTPReturnCode(ctx);
12688 desret_int(ret_val);
12689 call_tests++;
12690 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12691 xmlResetLastError();
12692 if (mem_base != xmlMemBlocks()) {
12693 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012695 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012696 printf(" %d", n_ctx);
12697 printf("\n");
12698 }
12699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012700 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012701#endif
12702
Daniel Veillard42595322004-11-08 10:52:06 +000012703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012704}
12705
12706
12707static int
12708test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012710
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012711#ifdef LIBXML_HTTP_ENABLED
12712#ifdef LIBXML_OUTPUT_ENABLED
12713 int mem_base;
12714 int ret_val;
12715 void * ctxt; /* the HTTP context */
12716 int n_ctxt;
12717 const char * filename; /* the filename where the content should be saved */
12718 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012719
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012720 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12721 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12722 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012723 ctxt = gen_void_ptr(n_ctxt, 0);
12724 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012725
12726 ret_val = xmlNanoHTTPSave(ctxt, filename);
12727 desret_int(ret_val);
12728 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012729 des_void_ptr(n_ctxt, ctxt, 0);
12730 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012731 xmlResetLastError();
12732 if (mem_base != xmlMemBlocks()) {
12733 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012735 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012736 printf(" %d", n_ctxt);
12737 printf(" %d", n_filename);
12738 printf("\n");
12739 }
12740 }
12741 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012742 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012743#endif
12744#endif
12745
Daniel Veillard42595322004-11-08 10:52:06 +000012746 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012747}
12748
12749
12750static int
12751test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012752 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012753
12754#ifdef LIBXML_HTTP_ENABLED
12755 const char * URL; /* The proxy URL used to initialize the proxy context */
12756 int n_URL;
12757
12758 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012759 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012760
12761 xmlNanoHTTPScanProxy(URL);
12762 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012763 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012764 xmlResetLastError();
12765 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012766 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012767#endif
12768
Daniel Veillard42595322004-11-08 10:52:06 +000012769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012770}
12771
12772static int
12773test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012774 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012775
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012776 if (quiet == 0) printf("Testing nanohttp : 16 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012777 test_ret += test_xmlNanoHTTPAuthHeader();
12778 test_ret += test_xmlNanoHTTPCleanup();
12779 test_ret += test_xmlNanoHTTPClose();
12780 test_ret += test_xmlNanoHTTPContentLength();
12781 test_ret += test_xmlNanoHTTPEncoding();
12782 test_ret += test_xmlNanoHTTPFetch();
12783 test_ret += test_xmlNanoHTTPInit();
12784 test_ret += test_xmlNanoHTTPMethod();
12785 test_ret += test_xmlNanoHTTPMethodRedir();
12786 test_ret += test_xmlNanoHTTPMimeType();
12787 test_ret += test_xmlNanoHTTPOpen();
12788 test_ret += test_xmlNanoHTTPOpenRedir();
12789 test_ret += test_xmlNanoHTTPRead();
12790 test_ret += test_xmlNanoHTTPRedir();
12791 test_ret += test_xmlNanoHTTPReturnCode();
12792 test_ret += test_xmlNanoHTTPSave();
12793 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012794
Daniel Veillard42595322004-11-08 10:52:06 +000012795 if (test_ret != 0)
12796 printf("Module nanohttp: %d errors\n", test_ret);
12797 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012798}
12799
12800static int
12801test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012803
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012804 int mem_base;
12805 long ret_val;
12806 xmlParserCtxtPtr ctxt; /* an XML parser context */
12807 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012808
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012809 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12810 mem_base = xmlMemBlocks();
12811 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12812
12813 ret_val = xmlByteConsumed(ctxt);
12814 desret_long(ret_val);
12815 call_tests++;
12816 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12817 xmlResetLastError();
12818 if (mem_base != xmlMemBlocks()) {
12819 printf("Leak of %d blocks found in xmlByteConsumed",
12820 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012821 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012822 printf(" %d", n_ctxt);
12823 printf("\n");
12824 }
12825 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012826 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012827
Daniel Veillard42595322004-11-08 10:52:06 +000012828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012829}
12830
12831
Daniel Veillardce682bc2004-11-05 17:22:25 +000012832#define gen_nb_xmlParserNodeInfoSeqPtr 1
12833static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12834 return(NULL);
12835}
12836static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12837}
12838
Daniel Veillardd93f6252004-11-02 15:53:51 +000012839static int
12840test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012841 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012842
Daniel Veillardce682bc2004-11-05 17:22:25 +000012843 int mem_base;
12844 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12845 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012846
Daniel Veillardce682bc2004-11-05 17:22:25 +000012847 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12848 mem_base = xmlMemBlocks();
12849 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12850
12851 xmlClearNodeInfoSeq(seq);
12852 call_tests++;
12853 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12854 xmlResetLastError();
12855 if (mem_base != xmlMemBlocks()) {
12856 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012858 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012859 printf(" %d", n_seq);
12860 printf("\n");
12861 }
12862 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000012863 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012864
Daniel Veillard42595322004-11-08 10:52:06 +000012865 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012866}
12867
12868
12869static int
12870test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012871 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012872
12873 int mem_base;
12874 xmlParserCtxtPtr ctxt; /* an XML parser context */
12875 int n_ctxt;
12876
12877 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12878 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012879 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012880
12881 xmlClearParserCtxt(ctxt);
12882 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012883 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012884 xmlResetLastError();
12885 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012886 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012887 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012888 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012889 printf(" %d", n_ctxt);
12890 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012891 }
12892 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012893 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012894
Daniel Veillard42595322004-11-08 10:52:06 +000012895 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012896}
12897
12898
12899static int
12900test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012902
Daniel Veillard34099b42004-11-04 17:34:35 +000012903 int mem_base;
12904 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012905 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012906 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012907
Daniel Veillard34099b42004-11-04 17:34:35 +000012908 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12909 mem_base = xmlMemBlocks();
12910 cur = gen_const_xmlChar_ptr(n_cur, 0);
12911
12912 ret_val = xmlCreateDocParserCtxt(cur);
12913 desret_xmlParserCtxtPtr(ret_val);
12914 call_tests++;
12915 des_const_xmlChar_ptr(n_cur, cur, 0);
12916 xmlResetLastError();
12917 if (mem_base != xmlMemBlocks()) {
12918 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12919 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012920 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012921 printf(" %d", n_cur);
12922 printf("\n");
12923 }
12924 }
Daniel Veillard34099b42004-11-04 17:34:35 +000012925 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012926
Daniel Veillard42595322004-11-08 10:52:06 +000012927 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012928}
12929
12930
12931static int
12932test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012933 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012934
Daniel Veillard34099b42004-11-04 17:34:35 +000012935#ifdef LIBXML_PUSH_ENABLED
12936 int mem_base;
12937 xmlParserCtxtPtr ret_val;
12938 xmlSAXHandlerPtr sax; /* a SAX handler */
12939 int n_sax;
12940 void * user_data; /* The user data returned on SAX callbacks */
12941 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012942 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012943 int n_chunk;
12944 int size; /* number of chars in the array */
12945 int n_size;
12946 const char * filename; /* an optional file name or URI */
12947 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012948
Daniel Veillard34099b42004-11-04 17:34:35 +000012949 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12950 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12951 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12952 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012953 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012954 mem_base = xmlMemBlocks();
12955 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12956 user_data = gen_userdata(n_user_data, 1);
12957 chunk = gen_const_char_ptr(n_chunk, 2);
12958 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012959 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012960
12961 ret_val = xmlCreatePushParserCtxt(sax, user_data, chunk, size, filename);
12962 desret_xmlParserCtxtPtr(ret_val);
12963 call_tests++;
12964 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12965 des_userdata(n_user_data, user_data, 1);
12966 des_const_char_ptr(n_chunk, chunk, 2);
12967 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012968 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012969 xmlResetLastError();
12970 if (mem_base != xmlMemBlocks()) {
12971 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012973 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012974 printf(" %d", n_sax);
12975 printf(" %d", n_user_data);
12976 printf(" %d", n_chunk);
12977 printf(" %d", n_size);
12978 printf(" %d", n_filename);
12979 printf("\n");
12980 }
12981 }
12982 }
12983 }
12984 }
12985 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012986 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012987#endif
12988
Daniel Veillard42595322004-11-08 10:52:06 +000012989 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012990}
12991
12992
12993static int
12994test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012995 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012996
12997 int mem_base;
12998 xmlDocPtr ret_val;
12999 xmlParserCtxtPtr ctxt; /* an XML parser context */
13000 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013001 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013002 int n_cur;
13003 const char * URL; /* the base URL to use for the document */
13004 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013005 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013006 int n_encoding;
13007 int options; /* a combination of xmlParserOption */
13008 int n_options;
13009
13010 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13011 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
13012 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13013 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013014 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000013015 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013016 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13017 cur = gen_const_xmlChar_ptr(n_cur, 1);
13018 URL = gen_filepath(n_URL, 2);
13019 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000013020 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013021
13022 ret_val = xmlCtxtReadDoc(ctxt, cur, URL, encoding, options);
13023 desret_xmlDocPtr(ret_val);
13024 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013025 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13026 des_const_xmlChar_ptr(n_cur, cur, 1);
13027 des_filepath(n_URL, URL, 2);
13028 des_const_char_ptr(n_encoding, encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000013029 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013030 xmlResetLastError();
13031 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013032 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013033 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013034 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013035 printf(" %d", n_ctxt);
13036 printf(" %d", n_cur);
13037 printf(" %d", n_URL);
13038 printf(" %d", n_encoding);
13039 printf(" %d", n_options);
13040 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013041 }
13042 }
13043 }
13044 }
13045 }
13046 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013047 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013048
Daniel Veillard42595322004-11-08 10:52:06 +000013049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013050}
13051
13052
13053static int
13054test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013056
13057 int mem_base;
13058 xmlDocPtr ret_val;
13059 xmlParserCtxtPtr ctxt; /* an XML parser context */
13060 int n_ctxt;
13061 const char * filename; /* a file or URL */
13062 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013063 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013064 int n_encoding;
13065 int options; /* a combination of xmlParserOption */
13066 int n_options;
13067
13068 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13069 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13070 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013071 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000013072 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013073 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13074 filename = gen_filepath(n_filename, 1);
13075 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013076 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013077
13078 ret_val = xmlCtxtReadFile(ctxt, filename, encoding, options);
13079 desret_xmlDocPtr(ret_val);
13080 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013081 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13082 des_filepath(n_filename, filename, 1);
13083 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013084 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013085 xmlResetLastError();
13086 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013087 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013089 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013090 printf(" %d", n_ctxt);
13091 printf(" %d", n_filename);
13092 printf(" %d", n_encoding);
13093 printf(" %d", n_options);
13094 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013095 }
13096 }
13097 }
13098 }
13099 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013100 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013101
Daniel Veillard42595322004-11-08 10:52:06 +000013102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013103}
13104
13105
13106static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000013107test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013109
13110 int mem_base;
13111 xmlDocPtr ret_val;
13112 xmlParserCtxtPtr ctxt; /* an XML parser context */
13113 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013114 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013115 int n_buffer;
13116 int size; /* the size of the array */
13117 int n_size;
13118 const char * URL; /* the base URL to use for the document */
13119 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013120 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013121 int n_encoding;
13122 int options; /* a combination of xmlParserOption */
13123 int n_options;
13124
13125 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13126 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
13127 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13128 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13129 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013130 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000013131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013132 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13133 buffer = gen_const_char_ptr(n_buffer, 1);
13134 size = gen_int(n_size, 2);
13135 URL = gen_filepath(n_URL, 3);
13136 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000013137 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013138
13139 ret_val = xmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options);
13140 desret_xmlDocPtr(ret_val);
13141 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013142 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13143 des_const_char_ptr(n_buffer, buffer, 1);
13144 des_int(n_size, size, 2);
13145 des_filepath(n_URL, URL, 3);
13146 des_const_char_ptr(n_encoding, encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000013147 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013148 xmlResetLastError();
13149 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013150 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013151 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013152 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013153 printf(" %d", n_ctxt);
13154 printf(" %d", n_buffer);
13155 printf(" %d", n_size);
13156 printf(" %d", n_URL);
13157 printf(" %d", n_encoding);
13158 printf(" %d", n_options);
13159 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013160 }
13161 }
13162 }
13163 }
13164 }
13165 }
13166 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013167 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013168
Daniel Veillard42595322004-11-08 10:52:06 +000013169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013170}
13171
13172
13173static int
13174test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013176
13177 int mem_base;
13178 xmlParserCtxtPtr ctxt; /* an XML parser context */
13179 int n_ctxt;
13180
13181 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13182 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013183 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013184
13185 xmlCtxtReset(ctxt);
13186 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013187 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013188 xmlResetLastError();
13189 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013190 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013191 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013192 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013193 printf(" %d", n_ctxt);
13194 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013195 }
13196 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013197 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013198
Daniel Veillard42595322004-11-08 10:52:06 +000013199 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013200}
13201
13202
13203static int
13204test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013205 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013206
13207 int mem_base;
13208 int ret_val;
13209 xmlParserCtxtPtr ctxt; /* an XML parser context */
13210 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013211 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013212 int n_chunk;
13213 int size; /* number of chars in the array */
13214 int n_size;
13215 const char * filename; /* an optional file name or URI */
13216 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013217 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013218 int n_encoding;
13219
13220 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13221 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13222 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13223 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13224 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
13225 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013226 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13227 chunk = gen_const_char_ptr(n_chunk, 1);
13228 size = gen_int(n_size, 2);
13229 filename = gen_filepath(n_filename, 3);
13230 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013231
13232 ret_val = xmlCtxtResetPush(ctxt, chunk, size, filename, encoding);
13233 desret_int(ret_val);
13234 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013235 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13236 des_const_char_ptr(n_chunk, chunk, 1);
13237 des_int(n_size, size, 2);
13238 des_filepath(n_filename, filename, 3);
13239 des_const_char_ptr(n_encoding, encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013240 xmlResetLastError();
13241 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013242 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013243 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013244 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013245 printf(" %d", n_ctxt);
13246 printf(" %d", n_chunk);
13247 printf(" %d", n_size);
13248 printf(" %d", n_filename);
13249 printf(" %d", n_encoding);
13250 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013251 }
13252 }
13253 }
13254 }
13255 }
13256 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013257 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013258
Daniel Veillard42595322004-11-08 10:52:06 +000013259 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013260}
13261
13262
13263static int
13264test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013265 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013266
13267 int mem_base;
13268 int ret_val;
13269 xmlParserCtxtPtr ctxt; /* an XML parser context */
13270 int n_ctxt;
13271 int options; /* a combination of xmlParserOption */
13272 int n_options;
13273
13274 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013275 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000013276 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013277 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000013278 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013279
13280 ret_val = xmlCtxtUseOptions(ctxt, options);
13281 desret_int(ret_val);
13282 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013283 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000013284 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013285 xmlResetLastError();
13286 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013287 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013288 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013289 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013290 printf(" %d", n_ctxt);
13291 printf(" %d", n_options);
13292 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013293 }
13294 }
13295 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013296 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013297
Daniel Veillard42595322004-11-08 10:52:06 +000013298 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013299}
13300
13301
13302static int
13303test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013304 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013305
13306
13307 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000013308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013309}
13310
13311
13312static int
13313test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013315
Daniel Veillarda521d282004-11-09 14:59:59 +000013316#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013317 int mem_base;
13318 int ret_val;
13319 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
13320 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013321 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013322 int n_name;
13323 void * result; /* location to store the result */
13324 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013325
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013326 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13327 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
13328 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
13329 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013330 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13331 name = gen_const_char_ptr(n_name, 1);
13332 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013333
13334 ret_val = xmlGetFeature(ctxt, name, result);
13335 desret_int(ret_val);
13336 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013337 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13338 des_const_char_ptr(n_name, name, 1);
13339 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013340 xmlResetLastError();
13341 if (mem_base != xmlMemBlocks()) {
13342 printf("Leak of %d blocks found in xmlGetFeature",
13343 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013344 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013345 printf(" %d", n_ctxt);
13346 printf(" %d", n_name);
13347 printf(" %d", n_result);
13348 printf("\n");
13349 }
13350 }
13351 }
13352 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013353 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013354#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013355
Daniel Veillard42595322004-11-08 10:52:06 +000013356 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013357}
13358
13359
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013360#define gen_nb_const_char_ptr_ptr 1
13361static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13362 return(NULL);
13363}
13364static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13365}
13366
Daniel Veillardd93f6252004-11-02 15:53:51 +000013367static int
13368test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013370
Daniel Veillarda521d282004-11-09 14:59:59 +000013371#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013372 int mem_base;
13373 int ret_val;
13374 int * len; /* the length of the features name array (input/output) */
13375 int n_len;
13376 char ** result; /* an array of string to be filled with the features name. */
13377 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013378
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013379 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
13380 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
13381 mem_base = xmlMemBlocks();
13382 len = gen_int_ptr(n_len, 0);
13383 result = gen_const_char_ptr_ptr(n_result, 1);
13384
13385 ret_val = xmlGetFeaturesList(len, result);
13386 desret_int(ret_val);
13387 call_tests++;
13388 des_int_ptr(n_len, len, 0);
13389 des_const_char_ptr_ptr(n_result, result, 1);
13390 xmlResetLastError();
13391 if (mem_base != xmlMemBlocks()) {
13392 printf("Leak of %d blocks found in xmlGetFeaturesList",
13393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013394 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013395 printf(" %d", n_len);
13396 printf(" %d", n_result);
13397 printf("\n");
13398 }
13399 }
13400 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013401 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013402#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013403
Daniel Veillard42595322004-11-08 10:52:06 +000013404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013405}
13406
13407
13408static int
13409test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013411
Daniel Veillarda521d282004-11-09 14:59:59 +000013412#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013413 int mem_base;
13414 xmlDtdPtr ret_val;
13415 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
13416 int n_sax;
13417 xmlParserInputBufferPtr input; /* an Input Buffer */
13418 int n_input;
13419 xmlCharEncoding enc; /* the charset encoding if known */
13420 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013421
Daniel Veillard34099b42004-11-04 17:34:35 +000013422 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13423 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13424 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13425 mem_base = xmlMemBlocks();
13426 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
13427 input = gen_xmlParserInputBufferPtr(n_input, 1);
13428 enc = gen_xmlCharEncoding(n_enc, 2);
13429
13430 ret_val = xmlIOParseDTD(sax, input, enc);
13431 input = NULL;
13432 desret_xmlDtdPtr(ret_val);
13433 call_tests++;
13434 des_xmlSAXHandlerPtr(n_sax, sax, 0);
13435 des_xmlParserInputBufferPtr(n_input, input, 1);
13436 des_xmlCharEncoding(n_enc, enc, 2);
13437 xmlResetLastError();
13438 if (mem_base != xmlMemBlocks()) {
13439 printf("Leak of %d blocks found in xmlIOParseDTD",
13440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013441 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013442 printf(" %d", n_sax);
13443 printf(" %d", n_input);
13444 printf(" %d", n_enc);
13445 printf("\n");
13446 }
13447 }
13448 }
13449 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013450 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013451#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013452
Daniel Veillard42595322004-11-08 10:52:06 +000013453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013454}
13455
13456
13457static int
13458test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013460
Daniel Veillardce682bc2004-11-05 17:22:25 +000013461 int mem_base;
13462 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13463 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013464
Daniel Veillardce682bc2004-11-05 17:22:25 +000013465 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13466 mem_base = xmlMemBlocks();
13467 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13468
13469 xmlInitNodeInfoSeq(seq);
13470 call_tests++;
13471 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13472 xmlResetLastError();
13473 if (mem_base != xmlMemBlocks()) {
13474 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013476 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013477 printf(" %d", n_seq);
13478 printf("\n");
13479 }
13480 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013481 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013482
Daniel Veillard42595322004-11-08 10:52:06 +000013483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013484}
13485
13486
13487static int
13488test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013490
13491 int mem_base;
13492
13493 mem_base = xmlMemBlocks();
13494
13495 xmlInitParser();
13496 call_tests++;
13497 xmlResetLastError();
13498 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013499 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013500 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013501 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013502 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013503 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013504 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013505
Daniel Veillard42595322004-11-08 10:52:06 +000013506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013507}
13508
13509
13510static int
13511test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013513
13514 int mem_base;
13515 int ret_val;
13516 xmlParserCtxtPtr ctxt; /* an XML parser context */
13517 int n_ctxt;
13518
13519 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13520 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013521 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013522
13523 ret_val = xmlInitParserCtxt(ctxt);
13524 desret_int(ret_val);
13525 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013526 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013527 xmlResetLastError();
13528 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013529 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013531 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013532 printf(" %d", n_ctxt);
13533 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013534 }
13535 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013536 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013537
Daniel Veillard42595322004-11-08 10:52:06 +000013538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013539}
13540
13541
13542static int
13543test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013545
13546 int mem_base;
13547 int ret_val;
13548 int val; /* int 0 or 1 */
13549 int n_val;
13550
13551 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13552 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013553 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013554
13555 ret_val = xmlKeepBlanksDefault(val);
13556 desret_int(ret_val);
13557 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013558 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013559 xmlResetLastError();
13560 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013561 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013563 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013564 printf(" %d", n_val);
13565 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013566 }
13567 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013568 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013569
Daniel Veillard42595322004-11-08 10:52:06 +000013570 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013571}
13572
13573
13574static int
13575test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013577
13578 int mem_base;
13579 int ret_val;
13580 int val; /* int 0 or 1 */
13581 int n_val;
13582
13583 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13584 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013585 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013586
13587 ret_val = xmlLineNumbersDefault(val);
13588 desret_int(ret_val);
13589 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013590 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013591 xmlResetLastError();
13592 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013593 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013595 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013596 printf(" %d", n_val);
13597 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013598 }
13599 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013600 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013601
Daniel Veillard42595322004-11-08 10:52:06 +000013602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013603}
13604
13605
13606static int
13607test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013609
Daniel Veillard42595322004-11-08 10:52:06 +000013610 int mem_base;
13611 xmlParserInputPtr ret_val;
13612 const char * URL; /* the URL for the entity to load */
13613 int n_URL;
13614 char * ID; /* the Public ID for the entity to load */
13615 int n_ID;
13616 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13617 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013618
Daniel Veillard42595322004-11-08 10:52:06 +000013619 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13620 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13621 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13622 mem_base = xmlMemBlocks();
13623 URL = gen_filepath(n_URL, 0);
13624 ID = gen_const_char_ptr(n_ID, 1);
13625 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13626
13627 ret_val = xmlLoadExternalEntity(URL, ID, ctxt);
13628 desret_xmlParserInputPtr(ret_val);
13629 call_tests++;
13630 des_filepath(n_URL, URL, 0);
13631 des_const_char_ptr(n_ID, ID, 1);
13632 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13633 xmlResetLastError();
13634 if (mem_base != xmlMemBlocks()) {
13635 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13636 xmlMemBlocks() - mem_base);
13637 test_ret++;
13638 printf(" %d", n_URL);
13639 printf(" %d", n_ID);
13640 printf(" %d", n_ctxt);
13641 printf("\n");
13642 }
13643 }
13644 }
13645 }
Daniel Veillard42595322004-11-08 10:52:06 +000013646 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013647
Daniel Veillard42595322004-11-08 10:52:06 +000013648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013649}
13650
13651
13652static int
13653test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013655
Daniel Veillard42595322004-11-08 10:52:06 +000013656 int mem_base;
13657 xmlParserInputPtr ret_val;
13658 xmlParserCtxtPtr ctxt; /* an XML parser context */
13659 int n_ctxt;
13660 xmlParserInputBufferPtr input; /* an I/O Input */
13661 int n_input;
13662 xmlCharEncoding enc; /* the charset encoding if known */
13663 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013664
Daniel Veillard42595322004-11-08 10:52:06 +000013665 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13666 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13667 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13668 mem_base = xmlMemBlocks();
13669 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13670 input = gen_xmlParserInputBufferPtr(n_input, 1);
13671 enc = gen_xmlCharEncoding(n_enc, 2);
13672
13673 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13674 if (ret_val != NULL) input = NULL;
13675 desret_xmlParserInputPtr(ret_val);
13676 call_tests++;
13677 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13678 des_xmlParserInputBufferPtr(n_input, input, 1);
13679 des_xmlCharEncoding(n_enc, enc, 2);
13680 xmlResetLastError();
13681 if (mem_base != xmlMemBlocks()) {
13682 printf("Leak of %d blocks found in xmlNewIOInputStream",
13683 xmlMemBlocks() - mem_base);
13684 test_ret++;
13685 printf(" %d", n_ctxt);
13686 printf(" %d", n_input);
13687 printf(" %d", n_enc);
13688 printf("\n");
13689 }
13690 }
13691 }
13692 }
Daniel Veillard42595322004-11-08 10:52:06 +000013693 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013694
Daniel Veillard42595322004-11-08 10:52:06 +000013695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013696}
13697
13698
13699static int
13700test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013701 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013702
Daniel Veillard34099b42004-11-04 17:34:35 +000013703 int mem_base;
13704 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013705
Daniel Veillard34099b42004-11-04 17:34:35 +000013706 mem_base = xmlMemBlocks();
13707
13708 ret_val = xmlNewParserCtxt();
13709 desret_xmlParserCtxtPtr(ret_val);
13710 call_tests++;
13711 xmlResetLastError();
13712 if (mem_base != xmlMemBlocks()) {
13713 printf("Leak of %d blocks found in xmlNewParserCtxt",
13714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013715 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013716 printf("\n");
13717 }
Daniel Veillard34099b42004-11-04 17:34:35 +000013718 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013719
Daniel Veillard42595322004-11-08 10:52:06 +000013720 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013721}
13722
13723
Daniel Veillardce682bc2004-11-05 17:22:25 +000013724#define gen_nb_xmlNodePtr_ptr 1
13725static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13726 return(NULL);
13727}
13728static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13729}
13730
Daniel Veillardd93f6252004-11-02 15:53:51 +000013731static int
13732test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013734
Daniel Veillarda521d282004-11-09 14:59:59 +000013735#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013736 int mem_base;
13737 int ret_val;
13738 xmlDocPtr doc; /* the document the chunk pertains to */
13739 int n_doc;
13740 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13741 int n_sax;
13742 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13743 int n_user_data;
13744 int depth; /* Used for loop detection, use 0 */
13745 int n_depth;
13746 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13747 int n_string;
13748 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13749 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013750
Daniel Veillardce682bc2004-11-05 17:22:25 +000013751 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13752 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13753 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13754 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13755 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13756 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13757 mem_base = xmlMemBlocks();
13758 doc = gen_xmlDocPtr(n_doc, 0);
13759 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13760 user_data = gen_userdata(n_user_data, 2);
13761 depth = gen_int(n_depth, 3);
13762 string = gen_const_xmlChar_ptr(n_string, 4);
13763 lst = gen_xmlNodePtr_ptr(n_lst, 5);
Daniel Veillarda521d282004-11-09 14:59:59 +000013764
13765#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013766 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013767#endif
13768
Daniel Veillardce682bc2004-11-05 17:22:25 +000013769
13770 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, string, lst);
13771 desret_int(ret_val);
13772 call_tests++;
13773 des_xmlDocPtr(n_doc, doc, 0);
13774 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13775 des_userdata(n_user_data, user_data, 2);
13776 des_int(n_depth, depth, 3);
13777 des_const_xmlChar_ptr(n_string, string, 4);
13778 des_xmlNodePtr_ptr(n_lst, lst, 5);
13779 xmlResetLastError();
13780 if (mem_base != xmlMemBlocks()) {
13781 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13782 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013783 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013784 printf(" %d", n_doc);
13785 printf(" %d", n_sax);
13786 printf(" %d", n_user_data);
13787 printf(" %d", n_depth);
13788 printf(" %d", n_string);
13789 printf(" %d", n_lst);
13790 printf("\n");
13791 }
13792 }
13793 }
13794 }
13795 }
13796 }
13797 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013798 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013799#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013800
Daniel Veillard42595322004-11-08 10:52:06 +000013801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013802}
13803
13804
13805static int
13806test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013808
Daniel Veillarda521d282004-11-09 14:59:59 +000013809#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013810 int mem_base;
13811 int ret_val;
13812 xmlDocPtr doc; /* the document the chunk pertains to */
13813 int n_doc;
13814 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13815 int n_sax;
13816 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13817 int n_user_data;
13818 int depth; /* Used for loop detection, use 0 */
13819 int n_depth;
13820 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13821 int n_string;
13822 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13823 int n_lst;
13824 int recover; /* return nodes even if the data is broken (use 0) */
13825 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013826
Daniel Veillardce682bc2004-11-05 17:22:25 +000013827 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13828 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13829 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13830 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13831 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13832 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13833 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13834 mem_base = xmlMemBlocks();
13835 doc = gen_xmlDocPtr(n_doc, 0);
13836 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13837 user_data = gen_userdata(n_user_data, 2);
13838 depth = gen_int(n_depth, 3);
13839 string = gen_const_xmlChar_ptr(n_string, 4);
13840 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13841 recover = gen_int(n_recover, 6);
Daniel Veillarda521d282004-11-09 14:59:59 +000013842
13843#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013844 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013845#endif
13846
Daniel Veillardce682bc2004-11-05 17:22:25 +000013847
13848 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, string, lst, recover);
13849 desret_int(ret_val);
13850 call_tests++;
13851 des_xmlDocPtr(n_doc, doc, 0);
13852 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13853 des_userdata(n_user_data, user_data, 2);
13854 des_int(n_depth, depth, 3);
13855 des_const_xmlChar_ptr(n_string, string, 4);
13856 des_xmlNodePtr_ptr(n_lst, lst, 5);
13857 des_int(n_recover, recover, 6);
13858 xmlResetLastError();
13859 if (mem_base != xmlMemBlocks()) {
13860 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013862 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013863 printf(" %d", n_doc);
13864 printf(" %d", n_sax);
13865 printf(" %d", n_user_data);
13866 printf(" %d", n_depth);
13867 printf(" %d", n_string);
13868 printf(" %d", n_lst);
13869 printf(" %d", n_recover);
13870 printf("\n");
13871 }
13872 }
13873 }
13874 }
13875 }
13876 }
13877 }
13878 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013879 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013880#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013881
Daniel Veillard42595322004-11-08 10:52:06 +000013882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013883}
13884
13885
13886static int
13887test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013889
13890#ifdef LIBXML_PUSH_ENABLED
13891 int mem_base;
13892 int ret_val;
13893 xmlParserCtxtPtr ctxt; /* an XML parser context */
13894 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013895 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013896 int n_chunk;
13897 int size; /* the size in byte of the chunk */
13898 int n_size;
13899 int terminate; /* last chunk indicator */
13900 int n_terminate;
13901
13902 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13903 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13904 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13905 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13906 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013907 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13908 chunk = gen_const_char_ptr(n_chunk, 1);
13909 size = gen_int(n_size, 2);
13910 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013911
13912 ret_val = xmlParseChunk(ctxt, chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +000013913 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013914 desret_int(ret_val);
13915 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013916 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13917 des_const_char_ptr(n_chunk, chunk, 1);
13918 des_int(n_size, size, 2);
13919 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013920 xmlResetLastError();
13921 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013922 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013924 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013925 printf(" %d", n_ctxt);
13926 printf(" %d", n_chunk);
13927 printf(" %d", n_size);
13928 printf(" %d", n_terminate);
13929 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013930 }
13931 }
13932 }
13933 }
13934 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013935 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013936#endif
13937
Daniel Veillard42595322004-11-08 10:52:06 +000013938 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013939}
13940
13941
13942static int
13943test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013945
Daniel Veillardce682bc2004-11-05 17:22:25 +000013946 int mem_base;
13947 int ret_val;
13948 xmlParserCtxtPtr ctx; /* the existing parsing context */
13949 int n_ctx;
13950 xmlChar * URL; /* the URL for the entity to load */
13951 int n_URL;
13952 xmlChar * ID; /* the System ID for the entity to load */
13953 int n_ID;
13954 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13955 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013956
Daniel Veillardce682bc2004-11-05 17:22:25 +000013957 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13958 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13959 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13960 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13961 mem_base = xmlMemBlocks();
13962 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13963 URL = gen_const_xmlChar_ptr(n_URL, 1);
13964 ID = gen_const_xmlChar_ptr(n_ID, 2);
13965 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13966
13967 ret_val = xmlParseCtxtExternalEntity(ctx, URL, ID, lst);
13968 desret_int(ret_val);
13969 call_tests++;
13970 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
13971 des_const_xmlChar_ptr(n_URL, URL, 1);
13972 des_const_xmlChar_ptr(n_ID, ID, 2);
13973 des_xmlNodePtr_ptr(n_lst, lst, 3);
13974 xmlResetLastError();
13975 if (mem_base != xmlMemBlocks()) {
13976 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13977 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013978 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013979 printf(" %d", n_ctx);
13980 printf(" %d", n_URL);
13981 printf(" %d", n_ID);
13982 printf(" %d", n_lst);
13983 printf("\n");
13984 }
13985 }
13986 }
13987 }
13988 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013989 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013990
Daniel Veillard42595322004-11-08 10:52:06 +000013991 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013992}
13993
13994
13995static int
13996test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013997 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013998
Daniel Veillarda521d282004-11-09 14:59:59 +000013999#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014000 int mem_base;
14001 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014002 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014003 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014004 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014005 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014006
Daniel Veillard34099b42004-11-04 17:34:35 +000014007 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14008 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14009 mem_base = xmlMemBlocks();
14010 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
14011 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
14012
14013 ret_val = xmlParseDTD(ExternalID, SystemID);
14014 desret_xmlDtdPtr(ret_val);
14015 call_tests++;
14016 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 0);
14017 des_const_xmlChar_ptr(n_SystemID, SystemID, 1);
14018 xmlResetLastError();
14019 if (mem_base != xmlMemBlocks()) {
14020 printf("Leak of %d blocks found in xmlParseDTD",
14021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014022 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014023 printf(" %d", n_ExternalID);
14024 printf(" %d", n_SystemID);
14025 printf("\n");
14026 }
14027 }
14028 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014029 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014030#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014031
Daniel Veillard42595322004-11-08 10:52:06 +000014032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014033}
14034
14035
14036static int
14037test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014039
Daniel Veillarda521d282004-11-09 14:59:59 +000014040#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014041 int mem_base;
14042 xmlDocPtr ret_val;
14043 xmlChar * cur; /* a pointer to an array of xmlChar */
14044 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014045
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014046 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14047 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014048 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014049
14050 ret_val = xmlParseDoc(cur);
14051 desret_xmlDocPtr(ret_val);
14052 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014053 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014054 xmlResetLastError();
14055 if (mem_base != xmlMemBlocks()) {
14056 printf("Leak of %d blocks found in xmlParseDoc",
14057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014058 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014059 printf(" %d", n_cur);
14060 printf("\n");
14061 }
14062 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014063 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014064#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014065
Daniel Veillard42595322004-11-08 10:52:06 +000014066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014067}
14068
14069
14070static int
14071test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014073
14074 int mem_base;
14075 int ret_val;
14076 xmlParserCtxtPtr ctxt; /* an XML parser context */
14077 int n_ctxt;
14078
14079 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14080 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014081 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014082
14083 ret_val = xmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000014084 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000014085 desret_int(ret_val);
14086 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014087 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014088 xmlResetLastError();
14089 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014090 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014092 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014093 printf(" %d", n_ctxt);
14094 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014095 }
14096 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014097 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014098
Daniel Veillard42595322004-11-08 10:52:06 +000014099 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014100}
14101
14102
14103static int
14104test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014105 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014106
Daniel Veillarda521d282004-11-09 14:59:59 +000014107#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014108 int mem_base;
14109 xmlDocPtr ret_val;
14110 const char * filename; /* the filename */
14111 int n_filename;
14112
14113 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14114 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014115 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014116
14117 ret_val = xmlParseEntity(filename);
14118 desret_xmlDocPtr(ret_val);
14119 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014120 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014121 xmlResetLastError();
14122 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014123 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014125 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014126 printf(" %d", n_filename);
14127 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014128 }
14129 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014130 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014131#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014132
Daniel Veillard42595322004-11-08 10:52:06 +000014133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014134}
14135
14136
14137static int
14138test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014140
14141 int mem_base;
14142 int ret_val;
14143 xmlParserCtxtPtr ctxt; /* an XML parser context */
14144 int n_ctxt;
14145
14146 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14147 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014148 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014149
14150 ret_val = xmlParseExtParsedEnt(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000014151 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000014152 desret_int(ret_val);
14153 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014154 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014155 xmlResetLastError();
14156 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014157 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014159 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014160 printf(" %d", n_ctxt);
14161 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014162 }
14163 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014164 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014165
Daniel Veillard42595322004-11-08 10:52:06 +000014166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014167}
14168
14169
14170static int
14171test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014173
Daniel Veillarda521d282004-11-09 14:59:59 +000014174#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000014175 int mem_base;
14176 int ret_val;
14177 xmlDocPtr doc; /* the document the chunk pertains to */
14178 int n_doc;
14179 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
14180 int n_sax;
14181 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
14182 int n_user_data;
14183 int depth; /* Used for loop detection, use 0 */
14184 int n_depth;
14185 xmlChar * URL; /* the URL for the entity to load */
14186 int n_URL;
14187 xmlChar * ID; /* the System ID for the entity to load */
14188 int n_ID;
14189 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
14190 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014191
Daniel Veillardce682bc2004-11-05 17:22:25 +000014192 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
14193 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14194 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14195 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
14196 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
14197 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
14198 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
14199 mem_base = xmlMemBlocks();
14200 doc = gen_xmlDocPtr(n_doc, 0);
14201 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
14202 user_data = gen_userdata(n_user_data, 2);
14203 depth = gen_int(n_depth, 3);
14204 URL = gen_const_xmlChar_ptr(n_URL, 4);
14205 ID = gen_const_xmlChar_ptr(n_ID, 5);
14206 lst = gen_xmlNodePtr_ptr(n_lst, 6);
14207
14208 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, URL, ID, lst);
14209 desret_int(ret_val);
14210 call_tests++;
14211 des_xmlDocPtr(n_doc, doc, 0);
14212 des_xmlSAXHandlerPtr(n_sax, sax, 1);
14213 des_userdata(n_user_data, user_data, 2);
14214 des_int(n_depth, depth, 3);
14215 des_const_xmlChar_ptr(n_URL, URL, 4);
14216 des_const_xmlChar_ptr(n_ID, ID, 5);
14217 des_xmlNodePtr_ptr(n_lst, lst, 6);
14218 xmlResetLastError();
14219 if (mem_base != xmlMemBlocks()) {
14220 printf("Leak of %d blocks found in xmlParseExternalEntity",
14221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014222 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014223 printf(" %d", n_doc);
14224 printf(" %d", n_sax);
14225 printf(" %d", n_user_data);
14226 printf(" %d", n_depth);
14227 printf(" %d", n_URL);
14228 printf(" %d", n_ID);
14229 printf(" %d", n_lst);
14230 printf("\n");
14231 }
14232 }
14233 }
14234 }
14235 }
14236 }
14237 }
14238 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014239 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014240#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000014241
Daniel Veillard42595322004-11-08 10:52:06 +000014242 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014243}
14244
14245
14246static int
14247test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014248 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014249
Daniel Veillarda521d282004-11-09 14:59:59 +000014250#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014251 int mem_base;
14252 xmlDocPtr ret_val;
14253 const char * filename; /* the filename */
14254 int n_filename;
14255
14256 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14257 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014258 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014259
14260 ret_val = xmlParseFile(filename);
14261 desret_xmlDocPtr(ret_val);
14262 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014263 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014264 xmlResetLastError();
14265 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014266 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014267 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014268 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014269 printf(" %d", n_filename);
14270 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014271 }
14272 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014273 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014274#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014275
Daniel Veillard42595322004-11-08 10:52:06 +000014276 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014277}
14278
14279
14280static int
14281test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014282 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014283
Daniel Veillard57b25162004-11-06 14:50:18 +000014284 int mem_base;
14285 xmlParserErrors ret_val;
14286 xmlNodePtr node; /* the context node */
14287 int n_node;
14288 char * data; /* the input string */
14289 int n_data;
14290 int datalen; /* the input string length in bytes */
14291 int n_datalen;
14292 int options; /* a combination of xmlParserOption */
14293 int n_options;
14294 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
14295 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014296
Daniel Veillard57b25162004-11-06 14:50:18 +000014297 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
14298 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
14299 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014300 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000014301 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
14302 mem_base = xmlMemBlocks();
14303 node = gen_xmlNodePtr(n_node, 0);
14304 data = gen_const_char_ptr(n_data, 1);
14305 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014306 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000014307 lst = gen_xmlNodePtr_ptr(n_lst, 4);
14308
14309 ret_val = xmlParseInNodeContext(node, data, datalen, options, lst);
14310 desret_xmlParserErrors(ret_val);
14311 call_tests++;
14312 des_xmlNodePtr(n_node, node, 0);
14313 des_const_char_ptr(n_data, data, 1);
14314 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014315 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000014316 des_xmlNodePtr_ptr(n_lst, lst, 4);
14317 xmlResetLastError();
14318 if (mem_base != xmlMemBlocks()) {
14319 printf("Leak of %d blocks found in xmlParseInNodeContext",
14320 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014321 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000014322 printf(" %d", n_node);
14323 printf(" %d", n_data);
14324 printf(" %d", n_datalen);
14325 printf(" %d", n_options);
14326 printf(" %d", n_lst);
14327 printf("\n");
14328 }
14329 }
14330 }
14331 }
14332 }
14333 }
Daniel Veillard57b25162004-11-06 14:50:18 +000014334 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014335
Daniel Veillard42595322004-11-08 10:52:06 +000014336 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014337}
14338
14339
14340static int
14341test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014342 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014343
Daniel Veillarda521d282004-11-09 14:59:59 +000014344#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014345 int mem_base;
14346 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014347 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014348 int n_buffer;
14349 int size; /* the size of the array */
14350 int n_size;
14351
14352 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14353 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14354 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014355 buffer = gen_const_char_ptr(n_buffer, 0);
14356 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014357
14358 ret_val = xmlParseMemory(buffer, size);
14359 desret_xmlDocPtr(ret_val);
14360 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014361 des_const_char_ptr(n_buffer, buffer, 0);
14362 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014363 xmlResetLastError();
14364 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014365 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014367 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014368 printf(" %d", n_buffer);
14369 printf(" %d", n_size);
14370 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014371 }
14372 }
14373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014374 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014375#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014376
Daniel Veillard42595322004-11-08 10:52:06 +000014377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014378}
14379
14380
Daniel Veillardce682bc2004-11-05 17:22:25 +000014381#define gen_nb_const_xmlParserNodeInfoPtr 1
14382static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14383 return(NULL);
14384}
14385static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14386}
14387
Daniel Veillardd93f6252004-11-02 15:53:51 +000014388static int
14389test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014390 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014391
Daniel Veillardce682bc2004-11-05 17:22:25 +000014392 int mem_base;
14393 xmlParserCtxtPtr ctxt; /* an XML parser context */
14394 int n_ctxt;
14395 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
14396 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014397
Daniel Veillardce682bc2004-11-05 17:22:25 +000014398 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14399 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
14400 mem_base = xmlMemBlocks();
14401 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
14402 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
14403
14404 xmlParserAddNodeInfo(ctxt, info);
14405 call_tests++;
14406 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
14407 des_const_xmlParserNodeInfoPtr(n_info, info, 1);
14408 xmlResetLastError();
14409 if (mem_base != xmlMemBlocks()) {
14410 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
14411 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014412 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014413 printf(" %d", n_ctxt);
14414 printf(" %d", n_info);
14415 printf("\n");
14416 }
14417 }
14418 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014419 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014420
Daniel Veillard42595322004-11-08 10:52:06 +000014421 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014422}
14423
14424
Daniel Veillardce682bc2004-11-05 17:22:25 +000014425#define gen_nb_const_xmlParserCtxtPtr 1
14426static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14427 return(NULL);
14428}
14429static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14430}
14431
Daniel Veillarda521d282004-11-09 14:59:59 +000014432#define gen_nb_const_xmlNodePtr 1
14433static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14434 return(NULL);
14435}
14436static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14437}
14438
Daniel Veillardd93f6252004-11-02 15:53:51 +000014439static int
14440test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014441 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014442
14443
14444 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000014445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014446}
14447
14448
Daniel Veillardce682bc2004-11-05 17:22:25 +000014449#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14450static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14451 return(NULL);
14452}
14453static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14454}
14455
Daniel Veillardd93f6252004-11-02 15:53:51 +000014456static int
14457test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014459
14460
14461 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000014462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014463}
14464
14465
Daniel Veillardce682bc2004-11-05 17:22:25 +000014466#define gen_nb_xmlParserInputPtr 1
14467static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14468 return(NULL);
14469}
14470static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14471}
14472
Daniel Veillardd93f6252004-11-02 15:53:51 +000014473static int
14474test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014475 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014476
Daniel Veillardce682bc2004-11-05 17:22:25 +000014477 int mem_base;
14478 int ret_val;
14479 xmlParserInputPtr in; /* an XML parser input */
14480 int n_in;
14481 int len; /* an indicative size for the lookahead */
14482 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014483
Daniel Veillardce682bc2004-11-05 17:22:25 +000014484 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14485 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14486 mem_base = xmlMemBlocks();
14487 in = gen_xmlParserInputPtr(n_in, 0);
14488 len = gen_int(n_len, 1);
14489
14490 ret_val = xmlParserInputGrow(in, len);
14491 desret_int(ret_val);
14492 call_tests++;
14493 des_xmlParserInputPtr(n_in, in, 0);
14494 des_int(n_len, len, 1);
14495 xmlResetLastError();
14496 if (mem_base != xmlMemBlocks()) {
14497 printf("Leak of %d blocks found in xmlParserInputGrow",
14498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014499 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014500 printf(" %d", n_in);
14501 printf(" %d", n_len);
14502 printf("\n");
14503 }
14504 }
14505 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014506 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014507
Daniel Veillard42595322004-11-08 10:52:06 +000014508 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014509}
14510
14511
14512static int
14513test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014515
Daniel Veillardce682bc2004-11-05 17:22:25 +000014516 int mem_base;
14517 int ret_val;
14518 xmlParserInputPtr in; /* an XML parser input */
14519 int n_in;
14520 int len; /* an indicative size for the lookahead */
14521 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014522
Daniel Veillardce682bc2004-11-05 17:22:25 +000014523 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14524 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14525 mem_base = xmlMemBlocks();
14526 in = gen_xmlParserInputPtr(n_in, 0);
14527 len = gen_int(n_len, 1);
14528
14529 ret_val = xmlParserInputRead(in, len);
14530 desret_int(ret_val);
14531 call_tests++;
14532 des_xmlParserInputPtr(n_in, in, 0);
14533 des_int(n_len, len, 1);
14534 xmlResetLastError();
14535 if (mem_base != xmlMemBlocks()) {
14536 printf("Leak of %d blocks found in xmlParserInputRead",
14537 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014538 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014539 printf(" %d", n_in);
14540 printf(" %d", n_len);
14541 printf("\n");
14542 }
14543 }
14544 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014545 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014546
Daniel Veillard42595322004-11-08 10:52:06 +000014547 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014548}
14549
14550
14551static int
14552test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014554
14555 int mem_base;
14556 int ret_val;
14557 int val; /* int 0 or 1 */
14558 int n_val;
14559
14560 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14561 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014562 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014563
14564 ret_val = xmlPedanticParserDefault(val);
14565 desret_int(ret_val);
14566 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014567 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014568 xmlResetLastError();
14569 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014570 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014572 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014573 printf(" %d", n_val);
14574 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014575 }
14576 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014577 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014578
Daniel Veillard42595322004-11-08 10:52:06 +000014579 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014580}
14581
14582
14583static int
14584test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014585 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014586
14587 int mem_base;
14588 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014589 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014590 int n_cur;
14591 const char * URL; /* the base URL to use for the document */
14592 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014593 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014594 int n_encoding;
14595 int options; /* a combination of xmlParserOption */
14596 int n_options;
14597
14598 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14599 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14600 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014601 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014602 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014603 cur = gen_const_xmlChar_ptr(n_cur, 0);
14604 URL = gen_filepath(n_URL, 1);
14605 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014606 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014607
14608 ret_val = xmlReadDoc(cur, URL, encoding, options);
14609 desret_xmlDocPtr(ret_val);
14610 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014611 des_const_xmlChar_ptr(n_cur, cur, 0);
14612 des_filepath(n_URL, URL, 1);
14613 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014614 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014615 xmlResetLastError();
14616 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014617 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014618 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014619 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014620 printf(" %d", n_cur);
14621 printf(" %d", n_URL);
14622 printf(" %d", n_encoding);
14623 printf(" %d", n_options);
14624 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014625 }
14626 }
14627 }
14628 }
14629 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014630 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014631
Daniel Veillard42595322004-11-08 10:52:06 +000014632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014633}
14634
14635
14636static int
14637test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014639
14640 int mem_base;
14641 xmlDocPtr ret_val;
14642 const char * filename; /* a file or URL */
14643 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014644 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014645 int n_encoding;
14646 int options; /* a combination of xmlParserOption */
14647 int n_options;
14648
14649 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14650 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014651 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014652 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014653 filename = gen_filepath(n_filename, 0);
14654 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014655 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014656
14657 ret_val = xmlReadFile(filename, encoding, options);
14658 desret_xmlDocPtr(ret_val);
14659 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014660 des_filepath(n_filename, filename, 0);
14661 des_const_char_ptr(n_encoding, encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014662 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014663 xmlResetLastError();
14664 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014665 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014667 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014668 printf(" %d", n_filename);
14669 printf(" %d", n_encoding);
14670 printf(" %d", n_options);
14671 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014672 }
14673 }
14674 }
14675 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014676 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014677
Daniel Veillard42595322004-11-08 10:52:06 +000014678 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014679}
14680
14681
14682static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014683test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014684 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014685
14686 int mem_base;
14687 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014688 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014689 int n_buffer;
14690 int size; /* the size of the array */
14691 int n_size;
14692 const char * URL; /* the base URL to use for the document */
14693 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014694 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014695 int n_encoding;
14696 int options; /* a combination of xmlParserOption */
14697 int n_options;
14698
14699 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14700 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14701 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14702 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014703 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014704 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014705 buffer = gen_const_char_ptr(n_buffer, 0);
14706 size = gen_int(n_size, 1);
14707 URL = gen_filepath(n_URL, 2);
14708 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014709 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014710
14711 ret_val = xmlReadMemory(buffer, size, URL, encoding, options);
14712 desret_xmlDocPtr(ret_val);
14713 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014714 des_const_char_ptr(n_buffer, buffer, 0);
14715 des_int(n_size, size, 1);
14716 des_filepath(n_URL, URL, 2);
14717 des_const_char_ptr(n_encoding, encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014718 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014719 xmlResetLastError();
14720 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014721 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014723 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014724 printf(" %d", n_buffer);
14725 printf(" %d", n_size);
14726 printf(" %d", n_URL);
14727 printf(" %d", n_encoding);
14728 printf(" %d", n_options);
14729 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014730 }
14731 }
14732 }
14733 }
14734 }
14735 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014736 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014737
Daniel Veillard42595322004-11-08 10:52:06 +000014738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014739}
14740
14741
14742static int
14743test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014745
Daniel Veillarda521d282004-11-09 14:59:59 +000014746#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014747 int mem_base;
14748 xmlDocPtr ret_val;
14749 xmlChar * cur; /* a pointer to an array of xmlChar */
14750 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014751
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014752 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14753 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014754 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014755
14756 ret_val = xmlRecoverDoc(cur);
14757 desret_xmlDocPtr(ret_val);
14758 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014759 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014760 xmlResetLastError();
14761 if (mem_base != xmlMemBlocks()) {
14762 printf("Leak of %d blocks found in xmlRecoverDoc",
14763 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014764 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014765 printf(" %d", n_cur);
14766 printf("\n");
14767 }
14768 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014769 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014770#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014771
Daniel Veillard42595322004-11-08 10:52:06 +000014772 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014773}
14774
14775
14776static int
14777test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014778 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014779
Daniel Veillarda521d282004-11-09 14:59:59 +000014780#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014781 int mem_base;
14782 xmlDocPtr ret_val;
14783 const char * filename; /* the filename */
14784 int n_filename;
14785
14786 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14787 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014788 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014789
14790 ret_val = xmlRecoverFile(filename);
14791 desret_xmlDocPtr(ret_val);
14792 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014793 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014794 xmlResetLastError();
14795 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014796 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014797 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014798 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014799 printf(" %d", n_filename);
14800 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014801 }
14802 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014803 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014804#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014805
Daniel Veillard42595322004-11-08 10:52:06 +000014806 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014807}
14808
14809
14810static int
14811test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014812 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014813
Daniel Veillarda521d282004-11-09 14:59:59 +000014814#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014815 int mem_base;
14816 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014817 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014818 int n_buffer;
14819 int size; /* the size of the array */
14820 int n_size;
14821
14822 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14823 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14824 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014825 buffer = gen_const_char_ptr(n_buffer, 0);
14826 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014827
14828 ret_val = xmlRecoverMemory(buffer, size);
14829 desret_xmlDocPtr(ret_val);
14830 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014831 des_const_char_ptr(n_buffer, buffer, 0);
14832 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014833 xmlResetLastError();
14834 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014835 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014836 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014837 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014838 printf(" %d", n_buffer);
14839 printf(" %d", n_size);
14840 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014841 }
14842 }
14843 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014844 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014845#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014846
Daniel Veillard42595322004-11-08 10:52:06 +000014847 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014848}
14849
14850
14851static int
14852test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014853 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014854
Daniel Veillarda521d282004-11-09 14:59:59 +000014855#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014856 int mem_base;
14857 xmlDtdPtr ret_val;
14858 xmlSAXHandlerPtr sax; /* the SAX handler block */
14859 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014860 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014861 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014862 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014863 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014864
Daniel Veillard34099b42004-11-04 17:34:35 +000014865 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14866 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14867 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14868 mem_base = xmlMemBlocks();
14869 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14870 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14871 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14872
14873 ret_val = xmlSAXParseDTD(sax, ExternalID, SystemID);
14874 desret_xmlDtdPtr(ret_val);
14875 call_tests++;
14876 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14877 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
14878 des_const_xmlChar_ptr(n_SystemID, SystemID, 2);
14879 xmlResetLastError();
14880 if (mem_base != xmlMemBlocks()) {
14881 printf("Leak of %d blocks found in xmlSAXParseDTD",
14882 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014883 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014884 printf(" %d", n_sax);
14885 printf(" %d", n_ExternalID);
14886 printf(" %d", n_SystemID);
14887 printf("\n");
14888 }
14889 }
14890 }
14891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014892 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014893#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014894
Daniel Veillard42595322004-11-08 10:52:06 +000014895 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014896}
14897
14898
14899static int
14900test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014902
Daniel Veillarda521d282004-11-09 14:59:59 +000014903#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014904 int mem_base;
14905 xmlDocPtr ret_val;
14906 xmlSAXHandlerPtr sax; /* the SAX handler block */
14907 int n_sax;
14908 xmlChar * cur; /* a pointer to an array of xmlChar */
14909 int n_cur;
14910 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14911 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014912
Daniel Veillard34099b42004-11-04 17:34:35 +000014913 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14914 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14915 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14916 mem_base = xmlMemBlocks();
14917 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14918 cur = gen_xmlChar_ptr(n_cur, 1);
14919 recovery = gen_int(n_recovery, 2);
14920
14921 ret_val = xmlSAXParseDoc(sax, cur, recovery);
14922 desret_xmlDocPtr(ret_val);
14923 call_tests++;
14924 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14925 des_xmlChar_ptr(n_cur, cur, 1);
14926 des_int(n_recovery, recovery, 2);
14927 xmlResetLastError();
14928 if (mem_base != xmlMemBlocks()) {
14929 printf("Leak of %d blocks found in xmlSAXParseDoc",
14930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014931 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014932 printf(" %d", n_sax);
14933 printf(" %d", n_cur);
14934 printf(" %d", n_recovery);
14935 printf("\n");
14936 }
14937 }
14938 }
14939 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014940 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014941#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014942
Daniel Veillard42595322004-11-08 10:52:06 +000014943 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014944}
14945
14946
14947static int
14948test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014950
Daniel Veillarda521d282004-11-09 14:59:59 +000014951#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014952 int mem_base;
14953 xmlDocPtr ret_val;
14954 xmlSAXHandlerPtr sax; /* the SAX handler block */
14955 int n_sax;
14956 const char * filename; /* the filename */
14957 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014958
Daniel Veillard34099b42004-11-04 17:34:35 +000014959 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14960 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14961 mem_base = xmlMemBlocks();
14962 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14963 filename = gen_filepath(n_filename, 1);
14964
14965 ret_val = xmlSAXParseEntity(sax, filename);
14966 desret_xmlDocPtr(ret_val);
14967 call_tests++;
14968 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14969 des_filepath(n_filename, filename, 1);
14970 xmlResetLastError();
14971 if (mem_base != xmlMemBlocks()) {
14972 printf("Leak of %d blocks found in xmlSAXParseEntity",
14973 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014974 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014975 printf(" %d", n_sax);
14976 printf(" %d", n_filename);
14977 printf("\n");
14978 }
14979 }
14980 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014981 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014982#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014983
Daniel Veillard42595322004-11-08 10:52:06 +000014984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014985}
14986
14987
14988static int
14989test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014991
Daniel Veillarda521d282004-11-09 14:59:59 +000014992#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014993 int mem_base;
14994 xmlDocPtr ret_val;
14995 xmlSAXHandlerPtr sax; /* the SAX handler block */
14996 int n_sax;
14997 const char * filename; /* the filename */
14998 int n_filename;
14999 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
15000 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015001
Daniel Veillard34099b42004-11-04 17:34:35 +000015002 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15003 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15004 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
15005 mem_base = xmlMemBlocks();
15006 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15007 filename = gen_filepath(n_filename, 1);
15008 recovery = gen_int(n_recovery, 2);
15009
15010 ret_val = xmlSAXParseFile(sax, filename, recovery);
15011 desret_xmlDocPtr(ret_val);
15012 call_tests++;
15013 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15014 des_filepath(n_filename, filename, 1);
15015 des_int(n_recovery, recovery, 2);
15016 xmlResetLastError();
15017 if (mem_base != xmlMemBlocks()) {
15018 printf("Leak of %d blocks found in xmlSAXParseFile",
15019 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015020 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015021 printf(" %d", n_sax);
15022 printf(" %d", n_filename);
15023 printf(" %d", n_recovery);
15024 printf("\n");
15025 }
15026 }
15027 }
15028 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015029 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015030#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015031
Daniel Veillard42595322004-11-08 10:52:06 +000015032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015033}
15034
15035
15036static int
15037test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015039
Daniel Veillarda521d282004-11-09 14:59:59 +000015040#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015041 int mem_base;
15042 xmlDocPtr ret_val;
15043 xmlSAXHandlerPtr sax; /* the SAX handler block */
15044 int n_sax;
15045 const char * filename; /* the filename */
15046 int n_filename;
15047 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
15048 int n_recovery;
15049 void * data; /* the userdata */
15050 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015051
Daniel Veillard34099b42004-11-04 17:34:35 +000015052 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15053 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15054 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
15055 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
15056 mem_base = xmlMemBlocks();
15057 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15058 filename = gen_filepath(n_filename, 1);
15059 recovery = gen_int(n_recovery, 2);
15060 data = gen_userdata(n_data, 3);
15061
15062 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
15063 desret_xmlDocPtr(ret_val);
15064 call_tests++;
15065 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15066 des_filepath(n_filename, filename, 1);
15067 des_int(n_recovery, recovery, 2);
15068 des_userdata(n_data, data, 3);
15069 xmlResetLastError();
15070 if (mem_base != xmlMemBlocks()) {
15071 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
15072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015073 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015074 printf(" %d", n_sax);
15075 printf(" %d", n_filename);
15076 printf(" %d", n_recovery);
15077 printf(" %d", n_data);
15078 printf("\n");
15079 }
15080 }
15081 }
15082 }
15083 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015084 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015085#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015086
Daniel Veillard42595322004-11-08 10:52:06 +000015087 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015088}
15089
15090
15091static int
15092test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015093 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015094
Daniel Veillarda521d282004-11-09 14:59:59 +000015095#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015096 int mem_base;
15097 xmlDocPtr ret_val;
15098 xmlSAXHandlerPtr sax; /* the SAX handler block */
15099 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015100 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000015101 int n_buffer;
15102 int size; /* the size of the array */
15103 int n_size;
15104 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
15105 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015106
Daniel Veillard34099b42004-11-04 17:34:35 +000015107 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15108 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15109 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15110 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
15111 mem_base = xmlMemBlocks();
15112 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15113 buffer = gen_const_char_ptr(n_buffer, 1);
15114 size = gen_int(n_size, 2);
15115 recovery = gen_int(n_recovery, 3);
15116
15117 ret_val = xmlSAXParseMemory(sax, buffer, size, recovery);
15118 desret_xmlDocPtr(ret_val);
15119 call_tests++;
15120 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15121 des_const_char_ptr(n_buffer, buffer, 1);
15122 des_int(n_size, size, 2);
15123 des_int(n_recovery, recovery, 3);
15124 xmlResetLastError();
15125 if (mem_base != xmlMemBlocks()) {
15126 printf("Leak of %d blocks found in xmlSAXParseMemory",
15127 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015128 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015129 printf(" %d", n_sax);
15130 printf(" %d", n_buffer);
15131 printf(" %d", n_size);
15132 printf(" %d", n_recovery);
15133 printf("\n");
15134 }
15135 }
15136 }
15137 }
15138 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015139 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015140#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015141
Daniel Veillard42595322004-11-08 10:52:06 +000015142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015143}
15144
15145
15146static int
15147test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015149
Daniel Veillarda521d282004-11-09 14:59:59 +000015150#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015151 int mem_base;
15152 xmlDocPtr ret_val;
15153 xmlSAXHandlerPtr sax; /* the SAX handler block */
15154 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015155 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000015156 int n_buffer;
15157 int size; /* the size of the array */
15158 int n_size;
15159 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
15160 int n_recovery;
15161 void * data; /* the userdata */
15162 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015163
Daniel Veillard34099b42004-11-04 17:34:35 +000015164 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15165 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15166 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15167 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
15168 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
15169 mem_base = xmlMemBlocks();
15170 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15171 buffer = gen_const_char_ptr(n_buffer, 1);
15172 size = gen_int(n_size, 2);
15173 recovery = gen_int(n_recovery, 3);
15174 data = gen_userdata(n_data, 4);
15175
15176 ret_val = xmlSAXParseMemoryWithData(sax, buffer, size, recovery, data);
15177 desret_xmlDocPtr(ret_val);
15178 call_tests++;
15179 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15180 des_const_char_ptr(n_buffer, buffer, 1);
15181 des_int(n_size, size, 2);
15182 des_int(n_recovery, recovery, 3);
15183 des_userdata(n_data, data, 4);
15184 xmlResetLastError();
15185 if (mem_base != xmlMemBlocks()) {
15186 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
15187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015188 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015189 printf(" %d", n_sax);
15190 printf(" %d", n_buffer);
15191 printf(" %d", n_size);
15192 printf(" %d", n_recovery);
15193 printf(" %d", n_data);
15194 printf("\n");
15195 }
15196 }
15197 }
15198 }
15199 }
15200 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015201 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015202#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015203
Daniel Veillard42595322004-11-08 10:52:06 +000015204 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015205}
15206
15207
15208static int
15209test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015210 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015211
Daniel Veillarda521d282004-11-09 14:59:59 +000015212#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015213 int mem_base;
15214 int ret_val;
15215 xmlSAXHandlerPtr sax; /* a SAX handler */
15216 int n_sax;
15217 void * user_data; /* The user data returned on SAX callbacks */
15218 int n_user_data;
15219 const char * filename; /* a file name */
15220 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015221
Daniel Veillard34099b42004-11-04 17:34:35 +000015222 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15223 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
15224 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15225 mem_base = xmlMemBlocks();
15226 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15227 user_data = gen_userdata(n_user_data, 1);
15228 filename = gen_filepath(n_filename, 2);
Daniel Veillarda521d282004-11-09 14:59:59 +000015229
15230#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000015231 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000015232#endif
15233
Daniel Veillard34099b42004-11-04 17:34:35 +000015234
15235 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
15236 desret_int(ret_val);
15237 call_tests++;
15238 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15239 des_userdata(n_user_data, user_data, 1);
15240 des_filepath(n_filename, filename, 2);
15241 xmlResetLastError();
15242 if (mem_base != xmlMemBlocks()) {
15243 printf("Leak of %d blocks found in xmlSAXUserParseFile",
15244 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015245 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015246 printf(" %d", n_sax);
15247 printf(" %d", n_user_data);
15248 printf(" %d", n_filename);
15249 printf("\n");
15250 }
15251 }
15252 }
15253 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015254 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015255#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015256
Daniel Veillard42595322004-11-08 10:52:06 +000015257 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015258}
15259
15260
15261static int
15262test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015264
Daniel Veillarda521d282004-11-09 14:59:59 +000015265#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015266 int mem_base;
15267 int ret_val;
15268 xmlSAXHandlerPtr sax; /* a SAX handler */
15269 int n_sax;
15270 void * user_data; /* The user data returned on SAX callbacks */
15271 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015272 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000015273 int n_buffer;
15274 int size; /* the length of the XML document in bytes */
15275 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015276
Daniel Veillard34099b42004-11-04 17:34:35 +000015277 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15278 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
15279 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15280 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15281 mem_base = xmlMemBlocks();
15282 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15283 user_data = gen_userdata(n_user_data, 1);
15284 buffer = gen_const_char_ptr(n_buffer, 2);
15285 size = gen_int(n_size, 3);
Daniel Veillarda521d282004-11-09 14:59:59 +000015286
15287#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000015288 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000015289#endif
15290
Daniel Veillard34099b42004-11-04 17:34:35 +000015291
15292 ret_val = xmlSAXUserParseMemory(sax, user_data, buffer, size);
15293 desret_int(ret_val);
15294 call_tests++;
15295 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15296 des_userdata(n_user_data, user_data, 1);
15297 des_const_char_ptr(n_buffer, buffer, 2);
15298 des_int(n_size, size, 3);
15299 xmlResetLastError();
15300 if (mem_base != xmlMemBlocks()) {
15301 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
15302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015303 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015304 printf(" %d", n_sax);
15305 printf(" %d", n_user_data);
15306 printf(" %d", n_buffer);
15307 printf(" %d", n_size);
15308 printf("\n");
15309 }
15310 }
15311 }
15312 }
15313 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015314 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015315#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015316
Daniel Veillard42595322004-11-08 10:52:06 +000015317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015318}
15319
15320
15321static int
15322test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015324
15325
15326 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000015327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015328}
15329
15330
15331static int
15332test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015334
Daniel Veillarda521d282004-11-09 14:59:59 +000015335#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015336 int mem_base;
15337 int ret_val;
15338 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
15339 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015340 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015341 int n_name;
15342 void * value; /* pointer to the location of the new value */
15343 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015344
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015345 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15346 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15347 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15348 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015349 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15350 name = gen_const_char_ptr(n_name, 1);
15351 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015352
15353 ret_val = xmlSetFeature(ctxt, name, value);
15354 desret_int(ret_val);
15355 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015356 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15357 des_const_char_ptr(n_name, name, 1);
15358 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015359 xmlResetLastError();
15360 if (mem_base != xmlMemBlocks()) {
15361 printf("Leak of %d blocks found in xmlSetFeature",
15362 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015363 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015364 printf(" %d", n_ctxt);
15365 printf(" %d", n_name);
15366 printf(" %d", n_value);
15367 printf("\n");
15368 }
15369 }
15370 }
15371 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015372 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015373#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015374
Daniel Veillard42595322004-11-08 10:52:06 +000015375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015376}
15377
15378
15379static int
15380test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015382
Daniel Veillarda521d282004-11-09 14:59:59 +000015383#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015384 int mem_base;
15385 xmlParserCtxtPtr ctxt; /* an XML parser context */
15386 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015387 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015388 int n_buffer;
15389 const char * filename; /* a file name */
15390 int n_filename;
15391
15392 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15393 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15394 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15395 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015396 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15397 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15398 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015399
15400 xmlSetupParserForBuffer(ctxt, buffer, filename);
15401 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015402 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15403 des_const_xmlChar_ptr(n_buffer, buffer, 1);
15404 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015405 xmlResetLastError();
15406 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015407 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015408 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015409 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015410 printf(" %d", n_ctxt);
15411 printf(" %d", n_buffer);
15412 printf(" %d", n_filename);
15413 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015414 }
15415 }
15416 }
15417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015418 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015419#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015420
Daniel Veillard42595322004-11-08 10:52:06 +000015421 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015422}
15423
15424
15425static int
15426test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015427 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015428
Daniel Veillarda521d282004-11-09 14:59:59 +000015429#ifdef LIBXML_PUSH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015430 int mem_base;
15431 xmlParserCtxtPtr ctxt; /* an XML parser context */
15432 int n_ctxt;
15433
15434 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15435 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015436 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015437
15438 xmlStopParser(ctxt);
15439 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015440 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015441 xmlResetLastError();
15442 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015443 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015445 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015446 printf(" %d", n_ctxt);
15447 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015448 }
15449 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015450 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015451#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015452
Daniel Veillard42595322004-11-08 10:52:06 +000015453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015454}
15455
15456
15457static int
15458test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015460
15461 int mem_base;
15462 int ret_val;
15463 int val; /* int 0 or 1 */
15464 int n_val;
15465
15466 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15467 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015468 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015469
15470 ret_val = xmlSubstituteEntitiesDefault(val);
15471 desret_int(ret_val);
15472 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015473 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015474 xmlResetLastError();
15475 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015476 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015477 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015478 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015479 printf(" %d", n_val);
15480 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015481 }
15482 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000015483 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015484
Daniel Veillard42595322004-11-08 10:52:06 +000015485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015486}
15487
15488static int
15489test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015491
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015492 if (quiet == 0) printf("Testing parser : 58 of 69 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000015493 test_ret += test_xmlByteConsumed();
15494 test_ret += test_xmlClearNodeInfoSeq();
15495 test_ret += test_xmlClearParserCtxt();
15496 test_ret += test_xmlCreateDocParserCtxt();
15497 test_ret += test_xmlCreatePushParserCtxt();
15498 test_ret += test_xmlCtxtReadDoc();
15499 test_ret += test_xmlCtxtReadFile();
15500 test_ret += test_xmlCtxtReadMemory();
15501 test_ret += test_xmlCtxtReset();
15502 test_ret += test_xmlCtxtResetPush();
15503 test_ret += test_xmlCtxtUseOptions();
15504 test_ret += test_xmlGetExternalEntityLoader();
15505 test_ret += test_xmlGetFeature();
15506 test_ret += test_xmlGetFeaturesList();
15507 test_ret += test_xmlIOParseDTD();
15508 test_ret += test_xmlInitNodeInfoSeq();
15509 test_ret += test_xmlInitParser();
15510 test_ret += test_xmlInitParserCtxt();
15511 test_ret += test_xmlKeepBlanksDefault();
15512 test_ret += test_xmlLineNumbersDefault();
15513 test_ret += test_xmlLoadExternalEntity();
15514 test_ret += test_xmlNewIOInputStream();
15515 test_ret += test_xmlNewParserCtxt();
15516 test_ret += test_xmlParseBalancedChunkMemory();
15517 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15518 test_ret += test_xmlParseChunk();
15519 test_ret += test_xmlParseCtxtExternalEntity();
15520 test_ret += test_xmlParseDTD();
15521 test_ret += test_xmlParseDoc();
15522 test_ret += test_xmlParseDocument();
15523 test_ret += test_xmlParseEntity();
15524 test_ret += test_xmlParseExtParsedEnt();
15525 test_ret += test_xmlParseExternalEntity();
15526 test_ret += test_xmlParseFile();
15527 test_ret += test_xmlParseInNodeContext();
15528 test_ret += test_xmlParseMemory();
15529 test_ret += test_xmlParserAddNodeInfo();
15530 test_ret += test_xmlParserFindNodeInfo();
15531 test_ret += test_xmlParserFindNodeInfoIndex();
15532 test_ret += test_xmlParserInputGrow();
15533 test_ret += test_xmlParserInputRead();
15534 test_ret += test_xmlPedanticParserDefault();
15535 test_ret += test_xmlReadDoc();
15536 test_ret += test_xmlReadFile();
15537 test_ret += test_xmlReadMemory();
15538 test_ret += test_xmlRecoverDoc();
15539 test_ret += test_xmlRecoverFile();
15540 test_ret += test_xmlRecoverMemory();
15541 test_ret += test_xmlSAXParseDTD();
15542 test_ret += test_xmlSAXParseDoc();
15543 test_ret += test_xmlSAXParseEntity();
15544 test_ret += test_xmlSAXParseFile();
15545 test_ret += test_xmlSAXParseFileWithData();
15546 test_ret += test_xmlSAXParseMemory();
15547 test_ret += test_xmlSAXParseMemoryWithData();
15548 test_ret += test_xmlSAXUserParseFile();
15549 test_ret += test_xmlSAXUserParseMemory();
15550 test_ret += test_xmlSetExternalEntityLoader();
15551 test_ret += test_xmlSetFeature();
15552 test_ret += test_xmlSetupParserForBuffer();
15553 test_ret += test_xmlStopParser();
15554 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015555
Daniel Veillard42595322004-11-08 10:52:06 +000015556 if (test_ret != 0)
15557 printf("Module parser: %d errors\n", test_ret);
15558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015559}
15560
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015561static int
15562test_htmlCreateFileParserCtxt(void) {
15563 int test_ret = 0;
15564
15565#ifdef LIBXML_HTML_ENABLED
15566 int mem_base;
15567 htmlParserCtxtPtr ret_val;
15568 const char * filename; /* the filename */
15569 int n_filename;
15570 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15571 int n_encoding;
15572
15573 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15574 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15575 mem_base = xmlMemBlocks();
15576 filename = gen_fileoutput(n_filename, 0);
15577 encoding = gen_const_char_ptr(n_encoding, 1);
15578
15579 ret_val = htmlCreateFileParserCtxt(filename, encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +000015580 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015581 call_tests++;
15582 des_fileoutput(n_filename, filename, 0);
15583 des_const_char_ptr(n_encoding, encoding, 1);
15584 xmlResetLastError();
15585 if (mem_base != xmlMemBlocks()) {
15586 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15587 xmlMemBlocks() - mem_base);
15588 test_ret++;
15589 printf(" %d", n_filename);
15590 printf(" %d", n_encoding);
15591 printf("\n");
15592 }
15593 }
15594 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015595 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015596#endif
15597
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015598 return(test_ret);
15599}
15600
15601
15602static int
15603test_htmlInitAutoClose(void) {
15604 int test_ret = 0;
15605
15606#ifdef LIBXML_HTML_ENABLED
15607 int mem_base;
15608
15609 mem_base = xmlMemBlocks();
15610
15611 htmlInitAutoClose();
15612 call_tests++;
15613 xmlResetLastError();
15614 if (mem_base != xmlMemBlocks()) {
15615 printf("Leak of %d blocks found in htmlInitAutoClose",
15616 xmlMemBlocks() - mem_base);
15617 test_ret++;
15618 printf("\n");
15619 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015620 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015621#endif
15622
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015623 return(test_ret);
15624}
15625
15626
15627static int
15628test_inputPop(void) {
15629 int test_ret = 0;
15630
15631 int mem_base;
15632 xmlParserInputPtr ret_val;
15633 xmlParserCtxtPtr ctxt; /* an XML parser context */
15634 int n_ctxt;
15635
15636 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15637 mem_base = xmlMemBlocks();
15638 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15639
15640 ret_val = inputPop(ctxt);
15641 desret_xmlParserInputPtr(ret_val);
15642 call_tests++;
15643 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15644 xmlResetLastError();
15645 if (mem_base != xmlMemBlocks()) {
15646 printf("Leak of %d blocks found in inputPop",
15647 xmlMemBlocks() - mem_base);
15648 test_ret++;
15649 printf(" %d", n_ctxt);
15650 printf("\n");
15651 }
15652 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015653 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015654
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015655 return(test_ret);
15656}
15657
15658
15659static int
15660test_inputPush(void) {
15661 int test_ret = 0;
15662
15663 int mem_base;
15664 int ret_val;
15665 xmlParserCtxtPtr ctxt; /* an XML parser context */
15666 int n_ctxt;
15667 xmlParserInputPtr value; /* the parser input */
15668 int n_value;
15669
15670 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15671 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15672 mem_base = xmlMemBlocks();
15673 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15674 value = gen_xmlParserInputPtr(n_value, 1);
15675
15676 ret_val = inputPush(ctxt, value);
15677 desret_int(ret_val);
15678 call_tests++;
15679 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15680 des_xmlParserInputPtr(n_value, value, 1);
15681 xmlResetLastError();
15682 if (mem_base != xmlMemBlocks()) {
15683 printf("Leak of %d blocks found in inputPush",
15684 xmlMemBlocks() - mem_base);
15685 test_ret++;
15686 printf(" %d", n_ctxt);
15687 printf(" %d", n_value);
15688 printf("\n");
15689 }
15690 }
15691 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015692 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015693
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015694 return(test_ret);
15695}
15696
15697
15698static int
15699test_namePop(void) {
15700 int test_ret = 0;
15701
15702 int mem_base;
15703 const xmlChar * ret_val;
15704 xmlParserCtxtPtr ctxt; /* an XML parser context */
15705 int n_ctxt;
15706
15707 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15708 mem_base = xmlMemBlocks();
15709 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15710
15711 ret_val = namePop(ctxt);
15712 desret_const_xmlChar_ptr(ret_val);
15713 call_tests++;
15714 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15715 xmlResetLastError();
15716 if (mem_base != xmlMemBlocks()) {
15717 printf("Leak of %d blocks found in namePop",
15718 xmlMemBlocks() - mem_base);
15719 test_ret++;
15720 printf(" %d", n_ctxt);
15721 printf("\n");
15722 }
15723 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015724 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015725
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015726 return(test_ret);
15727}
15728
15729
15730static int
15731test_namePush(void) {
15732 int test_ret = 0;
15733
15734 int mem_base;
15735 int ret_val;
15736 xmlParserCtxtPtr ctxt; /* an XML parser context */
15737 int n_ctxt;
15738 xmlChar * value; /* the element name */
15739 int n_value;
15740
15741 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15742 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15743 mem_base = xmlMemBlocks();
15744 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15745 value = gen_const_xmlChar_ptr(n_value, 1);
15746
15747 ret_val = namePush(ctxt, value);
15748 desret_int(ret_val);
15749 call_tests++;
15750 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15751 des_const_xmlChar_ptr(n_value, value, 1);
15752 xmlResetLastError();
15753 if (mem_base != xmlMemBlocks()) {
15754 printf("Leak of %d blocks found in namePush",
15755 xmlMemBlocks() - mem_base);
15756 test_ret++;
15757 printf(" %d", n_ctxt);
15758 printf(" %d", n_value);
15759 printf("\n");
15760 }
15761 }
15762 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015763 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015764
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015765 return(test_ret);
15766}
15767
15768
15769static int
15770test_nodePop(void) {
15771 int test_ret = 0;
15772
15773 int mem_base;
15774 xmlNodePtr ret_val;
15775 xmlParserCtxtPtr ctxt; /* an XML parser context */
15776 int n_ctxt;
15777
15778 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15779 mem_base = xmlMemBlocks();
15780 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15781
15782 ret_val = nodePop(ctxt);
15783 desret_xmlNodePtr(ret_val);
15784 call_tests++;
15785 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15786 xmlResetLastError();
15787 if (mem_base != xmlMemBlocks()) {
15788 printf("Leak of %d blocks found in nodePop",
15789 xmlMemBlocks() - mem_base);
15790 test_ret++;
15791 printf(" %d", n_ctxt);
15792 printf("\n");
15793 }
15794 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015795 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015796
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015797 return(test_ret);
15798}
15799
15800
15801static int
15802test_nodePush(void) {
15803 int test_ret = 0;
15804
15805 int mem_base;
15806 int ret_val;
15807 xmlParserCtxtPtr ctxt; /* an XML parser context */
15808 int n_ctxt;
15809 xmlNodePtr value; /* the element node */
15810 int n_value;
15811
15812 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15813 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15814 mem_base = xmlMemBlocks();
15815 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15816 value = gen_xmlNodePtr(n_value, 1);
15817
15818 ret_val = nodePush(ctxt, value);
15819 desret_int(ret_val);
15820 call_tests++;
15821 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15822 des_xmlNodePtr(n_value, value, 1);
15823 xmlResetLastError();
15824 if (mem_base != xmlMemBlocks()) {
15825 printf("Leak of %d blocks found in nodePush",
15826 xmlMemBlocks() - mem_base);
15827 test_ret++;
15828 printf(" %d", n_ctxt);
15829 printf(" %d", n_value);
15830 printf("\n");
15831 }
15832 }
15833 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015834 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015835
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015836 return(test_ret);
15837}
15838
15839
15840static int
15841test_xmlCheckLanguageID(void) {
15842 int test_ret = 0;
15843
15844 int mem_base;
15845 int ret_val;
15846 xmlChar * lang; /* pointer to the string value */
15847 int n_lang;
15848
15849 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15850 mem_base = xmlMemBlocks();
15851 lang = gen_const_xmlChar_ptr(n_lang, 0);
15852
15853 ret_val = xmlCheckLanguageID(lang);
15854 desret_int(ret_val);
15855 call_tests++;
15856 des_const_xmlChar_ptr(n_lang, lang, 0);
15857 xmlResetLastError();
15858 if (mem_base != xmlMemBlocks()) {
15859 printf("Leak of %d blocks found in xmlCheckLanguageID",
15860 xmlMemBlocks() - mem_base);
15861 test_ret++;
15862 printf(" %d", n_lang);
15863 printf("\n");
15864 }
15865 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015866 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015867
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015868 return(test_ret);
15869}
15870
15871
15872static int
15873test_xmlCopyChar(void) {
15874 int test_ret = 0;
15875
15876 int mem_base;
15877 int ret_val;
15878 int len; /* Ignored, compatibility */
15879 int n_len;
15880 xmlChar * out; /* pointer to an array of xmlChar */
15881 int n_out;
15882 int val; /* the char value */
15883 int n_val;
15884
15885 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15886 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15887 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15888 mem_base = xmlMemBlocks();
15889 len = gen_int(n_len, 0);
15890 out = gen_xmlChar_ptr(n_out, 1);
15891 val = gen_int(n_val, 2);
15892
15893 ret_val = xmlCopyChar(len, out, val);
15894 desret_int(ret_val);
15895 call_tests++;
15896 des_int(n_len, len, 0);
15897 des_xmlChar_ptr(n_out, out, 1);
15898 des_int(n_val, val, 2);
15899 xmlResetLastError();
15900 if (mem_base != xmlMemBlocks()) {
15901 printf("Leak of %d blocks found in xmlCopyChar",
15902 xmlMemBlocks() - mem_base);
15903 test_ret++;
15904 printf(" %d", n_len);
15905 printf(" %d", n_out);
15906 printf(" %d", n_val);
15907 printf("\n");
15908 }
15909 }
15910 }
15911 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015912 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015913
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015914 return(test_ret);
15915}
15916
15917
15918static int
15919test_xmlCopyCharMultiByte(void) {
15920 int test_ret = 0;
15921
15922 int mem_base;
15923 int ret_val;
15924 xmlChar * out; /* pointer to an array of xmlChar */
15925 int n_out;
15926 int val; /* the char value */
15927 int n_val;
15928
15929 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15930 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15931 mem_base = xmlMemBlocks();
15932 out = gen_xmlChar_ptr(n_out, 0);
15933 val = gen_int(n_val, 1);
15934
15935 ret_val = xmlCopyCharMultiByte(out, val);
15936 desret_int(ret_val);
15937 call_tests++;
15938 des_xmlChar_ptr(n_out, out, 0);
15939 des_int(n_val, val, 1);
15940 xmlResetLastError();
15941 if (mem_base != xmlMemBlocks()) {
15942 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15943 xmlMemBlocks() - mem_base);
15944 test_ret++;
15945 printf(" %d", n_out);
15946 printf(" %d", n_val);
15947 printf("\n");
15948 }
15949 }
15950 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015951 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015952
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015953 return(test_ret);
15954}
15955
15956
15957static int
15958test_xmlCreateEntityParserCtxt(void) {
15959 int test_ret = 0;
15960
15961 int mem_base;
15962 xmlParserCtxtPtr ret_val;
15963 xmlChar * URL; /* the entity URL */
15964 int n_URL;
15965 xmlChar * ID; /* the entity PUBLIC ID */
15966 int n_ID;
15967 xmlChar * base; /* a possible base for the target URI */
15968 int n_base;
15969
15970 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15971 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15972 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15973 mem_base = xmlMemBlocks();
15974 URL = gen_const_xmlChar_ptr(n_URL, 0);
15975 ID = gen_const_xmlChar_ptr(n_ID, 1);
15976 base = gen_const_xmlChar_ptr(n_base, 2);
15977
15978 ret_val = xmlCreateEntityParserCtxt(URL, ID, base);
15979 desret_xmlParserCtxtPtr(ret_val);
15980 call_tests++;
15981 des_const_xmlChar_ptr(n_URL, URL, 0);
15982 des_const_xmlChar_ptr(n_ID, ID, 1);
15983 des_const_xmlChar_ptr(n_base, base, 2);
15984 xmlResetLastError();
15985 if (mem_base != xmlMemBlocks()) {
15986 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15987 xmlMemBlocks() - mem_base);
15988 test_ret++;
15989 printf(" %d", n_URL);
15990 printf(" %d", n_ID);
15991 printf(" %d", n_base);
15992 printf("\n");
15993 }
15994 }
15995 }
15996 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015997 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015998
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015999 return(test_ret);
16000}
16001
16002
16003static int
16004test_xmlCreateFileParserCtxt(void) {
16005 int test_ret = 0;
16006
16007 int mem_base;
16008 xmlParserCtxtPtr ret_val;
16009 const char * filename; /* the filename */
16010 int n_filename;
16011
16012 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
16013 mem_base = xmlMemBlocks();
16014 filename = gen_fileoutput(n_filename, 0);
16015
16016 ret_val = xmlCreateFileParserCtxt(filename);
16017 desret_xmlParserCtxtPtr(ret_val);
16018 call_tests++;
16019 des_fileoutput(n_filename, filename, 0);
16020 xmlResetLastError();
16021 if (mem_base != xmlMemBlocks()) {
16022 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
16023 xmlMemBlocks() - mem_base);
16024 test_ret++;
16025 printf(" %d", n_filename);
16026 printf("\n");
16027 }
16028 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016029 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016030
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016031 return(test_ret);
16032}
16033
16034
16035static int
16036test_xmlCreateMemoryParserCtxt(void) {
16037 int test_ret = 0;
16038
16039 int mem_base;
16040 xmlParserCtxtPtr ret_val;
16041 char * buffer; /* a pointer to a char array */
16042 int n_buffer;
16043 int size; /* the size of the array */
16044 int n_size;
16045
16046 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
16047 for (n_size = 0;n_size < gen_nb_int;n_size++) {
16048 mem_base = xmlMemBlocks();
16049 buffer = gen_const_char_ptr(n_buffer, 0);
16050 size = gen_int(n_size, 1);
16051
16052 ret_val = xmlCreateMemoryParserCtxt(buffer, size);
16053 desret_xmlParserCtxtPtr(ret_val);
16054 call_tests++;
16055 des_const_char_ptr(n_buffer, buffer, 0);
16056 des_int(n_size, size, 1);
16057 xmlResetLastError();
16058 if (mem_base != xmlMemBlocks()) {
16059 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
16060 xmlMemBlocks() - mem_base);
16061 test_ret++;
16062 printf(" %d", n_buffer);
16063 printf(" %d", n_size);
16064 printf("\n");
16065 }
16066 }
16067 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016068 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016069
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016070 return(test_ret);
16071}
16072
16073
16074static int
16075test_xmlCreateURLParserCtxt(void) {
16076 int test_ret = 0;
16077
16078 int mem_base;
16079 xmlParserCtxtPtr ret_val;
16080 const char * filename; /* the filename or URL */
16081 int n_filename;
16082 int options; /* a combination of xmlParserOption */
16083 int n_options;
16084
16085 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
16086 for (n_options = 0;n_options < gen_nb_int;n_options++) {
16087 mem_base = xmlMemBlocks();
16088 filename = gen_fileoutput(n_filename, 0);
16089 options = gen_int(n_options, 1);
16090
16091 ret_val = xmlCreateURLParserCtxt(filename, options);
16092 desret_xmlParserCtxtPtr(ret_val);
16093 call_tests++;
16094 des_fileoutput(n_filename, filename, 0);
16095 des_int(n_options, options, 1);
16096 xmlResetLastError();
16097 if (mem_base != xmlMemBlocks()) {
16098 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
16099 xmlMemBlocks() - mem_base);
16100 test_ret++;
16101 printf(" %d", n_filename);
16102 printf(" %d", n_options);
16103 printf("\n");
16104 }
16105 }
16106 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016107 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016108
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016109 return(test_ret);
16110}
16111
16112
16113static int
16114test_xmlCurrentChar(void) {
16115 int test_ret = 0;
16116
16117 int mem_base;
16118 int ret_val;
16119 xmlParserCtxtPtr ctxt; /* the XML parser context */
16120 int n_ctxt;
16121 int * len; /* pointer to the length of the char read */
16122 int n_len;
16123
16124 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16125 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16126 mem_base = xmlMemBlocks();
16127 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16128 len = gen_int_ptr(n_len, 1);
16129
16130 ret_val = xmlCurrentChar(ctxt, len);
16131 desret_int(ret_val);
16132 call_tests++;
16133 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16134 des_int_ptr(n_len, len, 1);
16135 xmlResetLastError();
16136 if (mem_base != xmlMemBlocks()) {
16137 printf("Leak of %d blocks found in xmlCurrentChar",
16138 xmlMemBlocks() - mem_base);
16139 test_ret++;
16140 printf(" %d", n_ctxt);
16141 printf(" %d", n_len);
16142 printf("\n");
16143 }
16144 }
16145 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016146 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016147
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016148 return(test_ret);
16149}
16150
16151
16152static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016153test_xmlErrMemory(void) {
16154 int test_ret = 0;
16155
16156 int mem_base;
16157 xmlParserCtxtPtr ctxt; /* an XML parser context */
16158 int n_ctxt;
16159 char * extra; /* extra informations */
16160 int n_extra;
16161
16162 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16163 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
16164 mem_base = xmlMemBlocks();
16165 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16166 extra = gen_const_char_ptr(n_extra, 1);
16167
16168 xmlErrMemory(ctxt, extra);
16169 call_tests++;
16170 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16171 des_const_char_ptr(n_extra, extra, 1);
16172 xmlResetLastError();
16173 if (mem_base != xmlMemBlocks()) {
16174 printf("Leak of %d blocks found in xmlErrMemory",
16175 xmlMemBlocks() - mem_base);
16176 test_ret++;
16177 printf(" %d", n_ctxt);
16178 printf(" %d", n_extra);
16179 printf("\n");
16180 }
16181 }
16182 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016183 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016184
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016185 return(test_ret);
16186}
16187
16188
16189static int
16190test_xmlIsLetter(void) {
16191 int test_ret = 0;
16192
16193 int mem_base;
16194 int ret_val;
16195 int c; /* an unicode character (int) */
16196 int n_c;
16197
16198 for (n_c = 0;n_c < gen_nb_int;n_c++) {
16199 mem_base = xmlMemBlocks();
16200 c = gen_int(n_c, 0);
16201
16202 ret_val = xmlIsLetter(c);
16203 desret_int(ret_val);
16204 call_tests++;
16205 des_int(n_c, c, 0);
16206 xmlResetLastError();
16207 if (mem_base != xmlMemBlocks()) {
16208 printf("Leak of %d blocks found in xmlIsLetter",
16209 xmlMemBlocks() - mem_base);
16210 test_ret++;
16211 printf(" %d", n_c);
16212 printf("\n");
16213 }
16214 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016215 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016216
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016217 return(test_ret);
16218}
16219
16220
16221static int
16222test_xmlNewEntityInputStream(void) {
16223 int test_ret = 0;
16224
16225 int mem_base;
16226 xmlParserInputPtr ret_val;
16227 xmlParserCtxtPtr ctxt; /* an XML parser context */
16228 int n_ctxt;
16229 xmlEntityPtr entity; /* an Entity pointer */
16230 int n_entity;
16231
16232 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16233 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
16234 mem_base = xmlMemBlocks();
16235 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16236 entity = gen_xmlEntityPtr(n_entity, 1);
16237
16238 ret_val = xmlNewEntityInputStream(ctxt, entity);
16239 desret_xmlParserInputPtr(ret_val);
16240 call_tests++;
16241 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16242 des_xmlEntityPtr(n_entity, entity, 1);
16243 xmlResetLastError();
16244 if (mem_base != xmlMemBlocks()) {
16245 printf("Leak of %d blocks found in xmlNewEntityInputStream",
16246 xmlMemBlocks() - mem_base);
16247 test_ret++;
16248 printf(" %d", n_ctxt);
16249 printf(" %d", n_entity);
16250 printf("\n");
16251 }
16252 }
16253 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016254 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016255
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016256 return(test_ret);
16257}
16258
16259
16260static int
16261test_xmlNewInputFromFile(void) {
16262 int test_ret = 0;
16263
16264 int mem_base;
16265 xmlParserInputPtr ret_val;
16266 xmlParserCtxtPtr ctxt; /* an XML parser context */
16267 int n_ctxt;
16268 const char * filename; /* the filename to use as entity */
16269 int n_filename;
16270
16271 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16272 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
16273 mem_base = xmlMemBlocks();
16274 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16275 filename = gen_filepath(n_filename, 1);
16276
16277 ret_val = xmlNewInputFromFile(ctxt, filename);
16278 desret_xmlParserInputPtr(ret_val);
16279 call_tests++;
16280 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16281 des_filepath(n_filename, filename, 1);
16282 xmlResetLastError();
16283 if (mem_base != xmlMemBlocks()) {
16284 printf("Leak of %d blocks found in xmlNewInputFromFile",
16285 xmlMemBlocks() - mem_base);
16286 test_ret++;
16287 printf(" %d", n_ctxt);
16288 printf(" %d", n_filename);
16289 printf("\n");
16290 }
16291 }
16292 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016293 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016294
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016295 return(test_ret);
16296}
16297
16298
16299static int
16300test_xmlNewInputStream(void) {
16301 int test_ret = 0;
16302
16303 int mem_base;
16304 xmlParserInputPtr ret_val;
16305 xmlParserCtxtPtr ctxt; /* an XML parser context */
16306 int n_ctxt;
16307
16308 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16309 mem_base = xmlMemBlocks();
16310 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16311
16312 ret_val = xmlNewInputStream(ctxt);
16313 desret_xmlParserInputPtr(ret_val);
16314 call_tests++;
16315 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16316 xmlResetLastError();
16317 if (mem_base != xmlMemBlocks()) {
16318 printf("Leak of %d blocks found in xmlNewInputStream",
16319 xmlMemBlocks() - mem_base);
16320 test_ret++;
16321 printf(" %d", n_ctxt);
16322 printf("\n");
16323 }
16324 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016325 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016326
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016327 return(test_ret);
16328}
16329
16330
16331static int
16332test_xmlNewStringInputStream(void) {
16333 int test_ret = 0;
16334
16335 int mem_base;
16336 xmlParserInputPtr ret_val;
16337 xmlParserCtxtPtr ctxt; /* an XML parser context */
16338 int n_ctxt;
16339 xmlChar * buffer; /* an memory buffer */
16340 int n_buffer;
16341
16342 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16343 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16344 mem_base = xmlMemBlocks();
16345 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16346 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16347
16348 ret_val = xmlNewStringInputStream(ctxt, buffer);
16349 desret_xmlParserInputPtr(ret_val);
16350 call_tests++;
16351 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16352 des_const_xmlChar_ptr(n_buffer, buffer, 1);
16353 xmlResetLastError();
16354 if (mem_base != xmlMemBlocks()) {
16355 printf("Leak of %d blocks found in xmlNewStringInputStream",
16356 xmlMemBlocks() - mem_base);
16357 test_ret++;
16358 printf(" %d", n_ctxt);
16359 printf(" %d", n_buffer);
16360 printf("\n");
16361 }
16362 }
16363 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016364 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016365
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016366 return(test_ret);
16367}
16368
16369
16370static int
16371test_xmlNextChar(void) {
16372 int test_ret = 0;
16373
16374 int mem_base;
16375 xmlParserCtxtPtr ctxt; /* the XML parser context */
16376 int n_ctxt;
16377
16378 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16379 mem_base = xmlMemBlocks();
16380 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16381
16382 xmlNextChar(ctxt);
16383 call_tests++;
16384 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16385 xmlResetLastError();
16386 if (mem_base != xmlMemBlocks()) {
16387 printf("Leak of %d blocks found in xmlNextChar",
16388 xmlMemBlocks() - mem_base);
16389 test_ret++;
16390 printf(" %d", n_ctxt);
16391 printf("\n");
16392 }
16393 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016394 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016395
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016396 return(test_ret);
16397}
16398
16399
16400static int
16401test_xmlParserInputShrink(void) {
16402 int test_ret = 0;
16403
16404 int mem_base;
16405 xmlParserInputPtr in; /* an XML parser input */
16406 int n_in;
16407
16408 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16409 mem_base = xmlMemBlocks();
16410 in = gen_xmlParserInputPtr(n_in, 0);
16411
16412 xmlParserInputShrink(in);
16413 call_tests++;
16414 des_xmlParserInputPtr(n_in, in, 0);
16415 xmlResetLastError();
16416 if (mem_base != xmlMemBlocks()) {
16417 printf("Leak of %d blocks found in xmlParserInputShrink",
16418 xmlMemBlocks() - mem_base);
16419 test_ret++;
16420 printf(" %d", n_in);
16421 printf("\n");
16422 }
16423 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016424 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016425
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016426 return(test_ret);
16427}
16428
16429
16430static int
16431test_xmlPopInput(void) {
16432 int test_ret = 0;
16433
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016434 int mem_base;
16435 xmlChar ret_val;
16436 xmlParserCtxtPtr ctxt; /* an XML parser context */
16437 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016438
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016439 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16440 mem_base = xmlMemBlocks();
16441 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16442
16443 ret_val = xmlPopInput(ctxt);
16444 desret_xmlChar(ret_val);
16445 call_tests++;
16446 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16447 xmlResetLastError();
16448 if (mem_base != xmlMemBlocks()) {
16449 printf("Leak of %d blocks found in xmlPopInput",
16450 xmlMemBlocks() - mem_base);
16451 test_ret++;
16452 printf(" %d", n_ctxt);
16453 printf("\n");
16454 }
16455 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016456 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016457
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016458 return(test_ret);
16459}
16460
16461
16462static int
16463test_xmlPushInput(void) {
16464 int test_ret = 0;
16465
16466 int mem_base;
16467 xmlParserCtxtPtr ctxt; /* an XML parser context */
16468 int n_ctxt;
16469 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16470 int n_input;
16471
16472 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16473 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16474 mem_base = xmlMemBlocks();
16475 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16476 input = gen_xmlParserInputPtr(n_input, 1);
16477
16478 xmlPushInput(ctxt, input);
16479 call_tests++;
16480 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16481 des_xmlParserInputPtr(n_input, input, 1);
16482 xmlResetLastError();
16483 if (mem_base != xmlMemBlocks()) {
16484 printf("Leak of %d blocks found in xmlPushInput",
16485 xmlMemBlocks() - mem_base);
16486 test_ret++;
16487 printf(" %d", n_ctxt);
16488 printf(" %d", n_input);
16489 printf("\n");
16490 }
16491 }
16492 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016493 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016494
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016495 return(test_ret);
16496}
16497
16498
16499static int
16500test_xmlSetEntityReferenceFunc(void) {
16501 int test_ret = 0;
16502
16503
16504 /* missing type support */
16505 return(test_ret);
16506}
16507
16508
16509static int
16510test_xmlSplitQName(void) {
16511 int test_ret = 0;
16512
16513 int mem_base;
16514 xmlChar * ret_val;
16515 xmlParserCtxtPtr ctxt; /* an XML parser context */
16516 int n_ctxt;
16517 xmlChar * name; /* an XML parser context */
16518 int n_name;
16519 xmlChar ** prefix; /* a xmlChar ** */
16520 int n_prefix;
16521
16522 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16523 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16524 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16525 mem_base = xmlMemBlocks();
16526 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16527 name = gen_const_xmlChar_ptr(n_name, 1);
16528 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16529
16530 ret_val = xmlSplitQName(ctxt, name, prefix);
16531 desret_xmlChar_ptr(ret_val);
16532 call_tests++;
16533 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16534 des_const_xmlChar_ptr(n_name, name, 1);
16535 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16536 xmlResetLastError();
16537 if (mem_base != xmlMemBlocks()) {
16538 printf("Leak of %d blocks found in xmlSplitQName",
16539 xmlMemBlocks() - mem_base);
16540 test_ret++;
16541 printf(" %d", n_ctxt);
16542 printf(" %d", n_name);
16543 printf(" %d", n_prefix);
16544 printf("\n");
16545 }
16546 }
16547 }
16548 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016549 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016550
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016551 return(test_ret);
16552}
16553
16554
16555static int
16556test_xmlStringCurrentChar(void) {
16557 int test_ret = 0;
16558
16559 int mem_base;
16560 int ret_val;
16561 xmlParserCtxtPtr ctxt; /* the XML parser context */
16562 int n_ctxt;
16563 xmlChar * cur; /* pointer to the beginning of the char */
16564 int n_cur;
16565 int * len; /* pointer to the length of the char read */
16566 int n_len;
16567
16568 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16569 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16570 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16571 mem_base = xmlMemBlocks();
16572 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16573 cur = gen_const_xmlChar_ptr(n_cur, 1);
16574 len = gen_int_ptr(n_len, 2);
16575
16576 ret_val = xmlStringCurrentChar(ctxt, cur, len);
16577 desret_int(ret_val);
16578 call_tests++;
16579 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16580 des_const_xmlChar_ptr(n_cur, cur, 1);
16581 des_int_ptr(n_len, len, 2);
16582 xmlResetLastError();
16583 if (mem_base != xmlMemBlocks()) {
16584 printf("Leak of %d blocks found in xmlStringCurrentChar",
16585 xmlMemBlocks() - mem_base);
16586 test_ret++;
16587 printf(" %d", n_ctxt);
16588 printf(" %d", n_cur);
16589 printf(" %d", n_len);
16590 printf("\n");
16591 }
16592 }
16593 }
16594 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016595 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016596
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016597 return(test_ret);
16598}
16599
16600
16601static int
16602test_xmlStringDecodeEntities(void) {
16603 int test_ret = 0;
16604
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016605 int mem_base;
16606 xmlChar * ret_val;
16607 xmlParserCtxtPtr ctxt; /* the parser context */
16608 int n_ctxt;
16609 xmlChar * str; /* the input string */
16610 int n_str;
16611 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16612 int n_what;
16613 xmlChar end; /* an end marker xmlChar, 0 if none */
16614 int n_end;
16615 xmlChar end2; /* an end marker xmlChar, 0 if none */
16616 int n_end2;
16617 xmlChar end3; /* an end marker xmlChar, 0 if none */
16618 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016619
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016620 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16621 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16622 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16623 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16624 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16625 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16626 mem_base = xmlMemBlocks();
16627 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16628 str = gen_const_xmlChar_ptr(n_str, 1);
16629 what = gen_int(n_what, 2);
16630 end = gen_xmlChar(n_end, 3);
16631 end2 = gen_xmlChar(n_end2, 4);
16632 end3 = gen_xmlChar(n_end3, 5);
16633
16634 ret_val = xmlStringDecodeEntities(ctxt, str, what, end, end2, end3);
16635 desret_xmlChar_ptr(ret_val);
16636 call_tests++;
16637 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16638 des_const_xmlChar_ptr(n_str, str, 1);
16639 des_int(n_what, what, 2);
16640 des_xmlChar(n_end, end, 3);
16641 des_xmlChar(n_end2, end2, 4);
16642 des_xmlChar(n_end3, end3, 5);
16643 xmlResetLastError();
16644 if (mem_base != xmlMemBlocks()) {
16645 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16646 xmlMemBlocks() - mem_base);
16647 test_ret++;
16648 printf(" %d", n_ctxt);
16649 printf(" %d", n_str);
16650 printf(" %d", n_what);
16651 printf(" %d", n_end);
16652 printf(" %d", n_end2);
16653 printf(" %d", n_end3);
16654 printf("\n");
16655 }
16656 }
16657 }
16658 }
16659 }
16660 }
16661 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016662 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016663
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016664 return(test_ret);
16665}
16666
16667
16668static int
16669test_xmlStringLenDecodeEntities(void) {
16670 int test_ret = 0;
16671
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016672 int mem_base;
16673 xmlChar * ret_val;
16674 xmlParserCtxtPtr ctxt; /* the parser context */
16675 int n_ctxt;
16676 xmlChar * str; /* the input string */
16677 int n_str;
16678 int len; /* the string length */
16679 int n_len;
16680 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16681 int n_what;
16682 xmlChar end; /* an end marker xmlChar, 0 if none */
16683 int n_end;
16684 xmlChar end2; /* an end marker xmlChar, 0 if none */
16685 int n_end2;
16686 xmlChar end3; /* an end marker xmlChar, 0 if none */
16687 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016688
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016689 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16690 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16691 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16692 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16693 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16694 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16695 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16696 mem_base = xmlMemBlocks();
16697 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16698 str = gen_const_xmlChar_ptr(n_str, 1);
16699 len = gen_int(n_len, 2);
16700 what = gen_int(n_what, 3);
16701 end = gen_xmlChar(n_end, 4);
16702 end2 = gen_xmlChar(n_end2, 5);
16703 end3 = gen_xmlChar(n_end3, 6);
16704
16705 ret_val = xmlStringLenDecodeEntities(ctxt, str, len, what, end, end2, end3);
16706 desret_xmlChar_ptr(ret_val);
16707 call_tests++;
16708 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16709 des_const_xmlChar_ptr(n_str, str, 1);
16710 des_int(n_len, len, 2);
16711 des_int(n_what, what, 3);
16712 des_xmlChar(n_end, end, 4);
16713 des_xmlChar(n_end2, end2, 5);
16714 des_xmlChar(n_end3, end3, 6);
16715 xmlResetLastError();
16716 if (mem_base != xmlMemBlocks()) {
16717 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16718 xmlMemBlocks() - mem_base);
16719 test_ret++;
16720 printf(" %d", n_ctxt);
16721 printf(" %d", n_str);
16722 printf(" %d", n_len);
16723 printf(" %d", n_what);
16724 printf(" %d", n_end);
16725 printf(" %d", n_end2);
16726 printf(" %d", n_end3);
16727 printf("\n");
16728 }
16729 }
16730 }
16731 }
16732 }
16733 }
16734 }
16735 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016736 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016737
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016738 return(test_ret);
16739}
16740
16741
16742static int
16743test_xmlSwitchEncoding(void) {
16744 int test_ret = 0;
16745
16746 int mem_base;
16747 int ret_val;
16748 xmlParserCtxtPtr ctxt; /* the parser context */
16749 int n_ctxt;
16750 xmlCharEncoding enc; /* the encoding value (number) */
16751 int n_enc;
16752
16753 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16754 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16755 mem_base = xmlMemBlocks();
16756 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16757 enc = gen_xmlCharEncoding(n_enc, 1);
16758
16759 ret_val = xmlSwitchEncoding(ctxt, enc);
16760 desret_int(ret_val);
16761 call_tests++;
16762 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16763 des_xmlCharEncoding(n_enc, enc, 1);
16764 xmlResetLastError();
16765 if (mem_base != xmlMemBlocks()) {
16766 printf("Leak of %d blocks found in xmlSwitchEncoding",
16767 xmlMemBlocks() - mem_base);
16768 test_ret++;
16769 printf(" %d", n_ctxt);
16770 printf(" %d", n_enc);
16771 printf("\n");
16772 }
16773 }
16774 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016775 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016776
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016777 return(test_ret);
16778}
16779
16780
16781static int
16782test_xmlSwitchInputEncoding(void) {
16783 int test_ret = 0;
16784
16785 int mem_base;
16786 int ret_val;
16787 xmlParserCtxtPtr ctxt; /* the parser context */
16788 int n_ctxt;
16789 xmlParserInputPtr input; /* the input stream */
16790 int n_input;
16791 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16792 int n_handler;
16793
16794 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16795 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16796 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16797 mem_base = xmlMemBlocks();
16798 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16799 input = gen_xmlParserInputPtr(n_input, 1);
16800 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16801
16802 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16803 desret_int(ret_val);
16804 call_tests++;
16805 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16806 des_xmlParserInputPtr(n_input, input, 1);
16807 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16808 xmlResetLastError();
16809 if (mem_base != xmlMemBlocks()) {
16810 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16811 xmlMemBlocks() - mem_base);
16812 test_ret++;
16813 printf(" %d", n_ctxt);
16814 printf(" %d", n_input);
16815 printf(" %d", n_handler);
16816 printf("\n");
16817 }
16818 }
16819 }
16820 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016821 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016822
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016823 return(test_ret);
16824}
16825
16826
16827static int
16828test_xmlSwitchToEncoding(void) {
16829 int test_ret = 0;
16830
16831 int mem_base;
16832 int ret_val;
16833 xmlParserCtxtPtr ctxt; /* the parser context */
16834 int n_ctxt;
16835 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16836 int n_handler;
16837
16838 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16839 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16840 mem_base = xmlMemBlocks();
16841 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16842 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16843
16844 ret_val = xmlSwitchToEncoding(ctxt, handler);
16845 desret_int(ret_val);
16846 call_tests++;
16847 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16848 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16849 xmlResetLastError();
16850 if (mem_base != xmlMemBlocks()) {
16851 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16852 xmlMemBlocks() - mem_base);
16853 test_ret++;
16854 printf(" %d", n_ctxt);
16855 printf(" %d", n_handler);
16856 printf("\n");
16857 }
16858 }
16859 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016860 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016861
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016862 return(test_ret);
16863}
16864
16865static int
16866test_parserInternals(void) {
16867 int test_ret = 0;
16868
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016869 if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016870 test_ret += test_htmlCreateFileParserCtxt();
16871 test_ret += test_htmlInitAutoClose();
16872 test_ret += test_inputPop();
16873 test_ret += test_inputPush();
16874 test_ret += test_namePop();
16875 test_ret += test_namePush();
16876 test_ret += test_nodePop();
16877 test_ret += test_nodePush();
16878 test_ret += test_xmlCheckLanguageID();
16879 test_ret += test_xmlCopyChar();
16880 test_ret += test_xmlCopyCharMultiByte();
16881 test_ret += test_xmlCreateEntityParserCtxt();
16882 test_ret += test_xmlCreateFileParserCtxt();
16883 test_ret += test_xmlCreateMemoryParserCtxt();
16884 test_ret += test_xmlCreateURLParserCtxt();
16885 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016886 test_ret += test_xmlErrMemory();
16887 test_ret += test_xmlIsLetter();
16888 test_ret += test_xmlNewEntityInputStream();
16889 test_ret += test_xmlNewInputFromFile();
16890 test_ret += test_xmlNewInputStream();
16891 test_ret += test_xmlNewStringInputStream();
16892 test_ret += test_xmlNextChar();
16893 test_ret += test_xmlParserInputShrink();
16894 test_ret += test_xmlPopInput();
16895 test_ret += test_xmlPushInput();
16896 test_ret += test_xmlSetEntityReferenceFunc();
16897 test_ret += test_xmlSplitQName();
16898 test_ret += test_xmlStringCurrentChar();
16899 test_ret += test_xmlStringDecodeEntities();
16900 test_ret += test_xmlStringLenDecodeEntities();
16901 test_ret += test_xmlSwitchEncoding();
16902 test_ret += test_xmlSwitchInputEncoding();
16903 test_ret += test_xmlSwitchToEncoding();
16904
16905 if (test_ret != 0)
16906 printf("Module parserInternals: %d errors\n", test_ret);
16907 return(test_ret);
16908}
16909
Daniel Veillardd93f6252004-11-02 15:53:51 +000016910static int
16911test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016913
Daniel Veillardce682bc2004-11-05 17:22:25 +000016914#ifdef LIBXML_PATTERN_ENABLED
16915 int mem_base;
16916 int ret_val;
16917 xmlPatternPtr comp; /* the precompiled pattern */
16918 int n_comp;
16919 xmlNodePtr node; /* a node */
16920 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016921
Daniel Veillardce682bc2004-11-05 17:22:25 +000016922 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16923 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16924 mem_base = xmlMemBlocks();
16925 comp = gen_xmlPatternPtr(n_comp, 0);
16926 node = gen_xmlNodePtr(n_node, 1);
16927
16928 ret_val = xmlPatternMatch(comp, node);
16929 desret_int(ret_val);
16930 call_tests++;
16931 des_xmlPatternPtr(n_comp, comp, 0);
16932 des_xmlNodePtr(n_node, node, 1);
16933 xmlResetLastError();
16934 if (mem_base != xmlMemBlocks()) {
16935 printf("Leak of %d blocks found in xmlPatternMatch",
16936 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016937 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016938 printf(" %d", n_comp);
16939 printf(" %d", n_node);
16940 printf("\n");
16941 }
16942 }
16943 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016944 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016945#endif
16946
Daniel Veillard42595322004-11-08 10:52:06 +000016947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016948}
16949
16950
16951static int
16952test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016954
16955
16956 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016958}
16959
16960static int
16961test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016962 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016963
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016964 if (quiet == 0) printf("Testing pattern : 1 of 4 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000016965 test_ret += test_xmlPatternMatch();
16966 test_ret += test_xmlPatterncompile();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016967
Daniel Veillard42595322004-11-08 10:52:06 +000016968 if (test_ret != 0)
16969 printf("Module pattern: %d errors\n", test_ret);
16970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016971}
Daniel Veillarda521d282004-11-09 14:59:59 +000016972#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016973
Daniel Veillardce682bc2004-11-05 17:22:25 +000016974#define gen_nb_xmlRelaxNGPtr 1
16975static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16976 return(NULL);
16977}
16978static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16979}
Daniel Veillarda521d282004-11-09 14:59:59 +000016980#endif
16981
Daniel Veillardce682bc2004-11-05 17:22:25 +000016982
Daniel Veillardd93f6252004-11-02 15:53:51 +000016983static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016984test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016986
Daniel Veillardce682bc2004-11-05 17:22:25 +000016987#ifdef LIBXML_SCHEMAS_ENABLED
16988#ifdef LIBXML_OUTPUT_ENABLED
16989 int mem_base;
16990 FILE * output; /* the file output */
16991 int n_output;
16992 xmlRelaxNGPtr schema; /* a schema structure */
16993 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016994
Daniel Veillardce682bc2004-11-05 17:22:25 +000016995 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16996 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16997 mem_base = xmlMemBlocks();
16998 output = gen_FILE_ptr(n_output, 0);
16999 schema = gen_xmlRelaxNGPtr(n_schema, 1);
17000
17001 xmlRelaxNGDump(output, schema);
17002 call_tests++;
17003 des_FILE_ptr(n_output, output, 0);
17004 des_xmlRelaxNGPtr(n_schema, schema, 1);
17005 xmlResetLastError();
17006 if (mem_base != xmlMemBlocks()) {
17007 printf("Leak of %d blocks found in xmlRelaxNGDump",
17008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017009 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017010 printf(" %d", n_output);
17011 printf(" %d", n_schema);
17012 printf("\n");
17013 }
17014 }
17015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017016 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017017#endif
17018#endif
17019
Daniel Veillard42595322004-11-08 10:52:06 +000017020 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017021}
17022
17023
17024static int
17025test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017026 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017027
Daniel Veillardce682bc2004-11-05 17:22:25 +000017028#ifdef LIBXML_SCHEMAS_ENABLED
17029#ifdef LIBXML_OUTPUT_ENABLED
17030 int mem_base;
17031 FILE * output; /* the file output */
17032 int n_output;
17033 xmlRelaxNGPtr schema; /* a schema structure */
17034 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017035
Daniel Veillardce682bc2004-11-05 17:22:25 +000017036 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
17037 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
17038 mem_base = xmlMemBlocks();
17039 output = gen_FILE_ptr(n_output, 0);
17040 schema = gen_xmlRelaxNGPtr(n_schema, 1);
17041
17042 xmlRelaxNGDumpTree(output, schema);
17043 call_tests++;
17044 des_FILE_ptr(n_output, output, 0);
17045 des_xmlRelaxNGPtr(n_schema, schema, 1);
17046 xmlResetLastError();
17047 if (mem_base != xmlMemBlocks()) {
17048 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
17049 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017050 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017051 printf(" %d", n_output);
17052 printf(" %d", n_schema);
17053 printf("\n");
17054 }
17055 }
17056 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017057 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017058#endif
17059#endif
17060
Daniel Veillard42595322004-11-08 10:52:06 +000017061 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017062}
17063
Daniel Veillarda521d282004-11-09 14:59:59 +000017064#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000017065
Daniel Veillardce682bc2004-11-05 17:22:25 +000017066#define gen_nb_xmlRelaxNGParserCtxtPtr 1
17067static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17068 return(NULL);
17069}
17070static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17071}
Daniel Veillarda521d282004-11-09 14:59:59 +000017072#endif
17073
17074#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017075
17076#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
17077static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17078 return(NULL);
17079}
17080static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17081}
Daniel Veillarda521d282004-11-09 14:59:59 +000017082#endif
17083
17084#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017085
17086#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
17087static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17088 return(NULL);
17089}
17090static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17091}
Daniel Veillarda521d282004-11-09 14:59:59 +000017092#endif
17093
17094#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017095
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017096#define gen_nb_void_ptr_ptr 1
17097static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17098 return(NULL);
17099}
17100static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17101}
Daniel Veillarda521d282004-11-09 14:59:59 +000017102#endif
17103
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017104
Daniel Veillardd93f6252004-11-02 15:53:51 +000017105static int
17106test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017108
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017109#ifdef LIBXML_SCHEMAS_ENABLED
17110 int mem_base;
17111 int ret_val;
17112 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
17113 int n_ctxt;
17114 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
17115 int n_err;
17116 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
17117 int n_warn;
17118 void ** ctx; /* contextual data for the callbacks result */
17119 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017120
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017121 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17122 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17123 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17124 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17125 mem_base = xmlMemBlocks();
17126 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17127 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17128 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17129 ctx = gen_void_ptr_ptr(n_ctx, 3);
17130
17131 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
17132 desret_int(ret_val);
17133 call_tests++;
17134 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17135 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17136 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17137 des_void_ptr_ptr(n_ctx, ctx, 3);
17138 xmlResetLastError();
17139 if (mem_base != xmlMemBlocks()) {
17140 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
17141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017142 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017143 printf(" %d", n_ctxt);
17144 printf(" %d", n_err);
17145 printf(" %d", n_warn);
17146 printf(" %d", n_ctx);
17147 printf("\n");
17148 }
17149 }
17150 }
17151 }
17152 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017153 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017154#endif
17155
Daniel Veillard42595322004-11-08 10:52:06 +000017156 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017157}
17158
Daniel Veillarda521d282004-11-09 14:59:59 +000017159#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000017160
Daniel Veillardce682bc2004-11-05 17:22:25 +000017161#define gen_nb_xmlRelaxNGValidCtxtPtr 1
17162static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17163 return(NULL);
17164}
17165static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17166}
Daniel Veillarda521d282004-11-09 14:59:59 +000017167#endif
17168
Daniel Veillardce682bc2004-11-05 17:22:25 +000017169
Daniel Veillardd93f6252004-11-02 15:53:51 +000017170static int
17171test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017173
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017174#ifdef LIBXML_SCHEMAS_ENABLED
17175 int mem_base;
17176 int ret_val;
17177 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17178 int n_ctxt;
17179 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
17180 int n_err;
17181 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
17182 int n_warn;
17183 void ** ctx; /* the functions context result */
17184 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017185
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017186 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17187 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17188 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17189 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17190 mem_base = xmlMemBlocks();
17191 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17192 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17193 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17194 ctx = gen_void_ptr_ptr(n_ctx, 3);
17195
17196 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
17197 desret_int(ret_val);
17198 call_tests++;
17199 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17200 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17201 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17202 des_void_ptr_ptr(n_ctx, ctx, 3);
17203 xmlResetLastError();
17204 if (mem_base != xmlMemBlocks()) {
17205 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
17206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017207 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017208 printf(" %d", n_ctxt);
17209 printf(" %d", n_err);
17210 printf(" %d", n_warn);
17211 printf(" %d", n_ctx);
17212 printf("\n");
17213 }
17214 }
17215 }
17216 }
17217 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017218 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017219#endif
17220
Daniel Veillard42595322004-11-08 10:52:06 +000017221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017222}
17223
17224
17225static int
Daniel Veillard34099b42004-11-04 17:34:35 +000017226test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017227 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000017228
17229#ifdef LIBXML_SCHEMAS_ENABLED
17230 int mem_base;
17231 int ret_val;
17232
17233 mem_base = xmlMemBlocks();
17234
17235 ret_val = xmlRelaxNGInitTypes();
17236 desret_int(ret_val);
17237 call_tests++;
17238 xmlResetLastError();
17239 if (mem_base != xmlMemBlocks()) {
17240 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
17241 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017242 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017243 printf("\n");
17244 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017245 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017246#endif
17247
Daniel Veillard42595322004-11-08 10:52:06 +000017248 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000017249}
17250
17251
17252static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017253test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017255
Daniel Veillard42595322004-11-08 10:52:06 +000017256#ifdef LIBXML_SCHEMAS_ENABLED
17257 int mem_base;
17258 xmlRelaxNGParserCtxtPtr ret_val;
17259 xmlDocPtr doc; /* a preparsed document tree */
17260 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017261
Daniel Veillard42595322004-11-08 10:52:06 +000017262 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17263 mem_base = xmlMemBlocks();
17264 doc = gen_xmlDocPtr(n_doc, 0);
17265
17266 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17267 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17268 call_tests++;
17269 des_xmlDocPtr(n_doc, doc, 0);
17270 xmlResetLastError();
17271 if (mem_base != xmlMemBlocks()) {
17272 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17273 xmlMemBlocks() - mem_base);
17274 test_ret++;
17275 printf(" %d", n_doc);
17276 printf("\n");
17277 }
17278 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017279 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017280#endif
17281
Daniel Veillard42595322004-11-08 10:52:06 +000017282 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017283}
17284
17285
17286static int
17287test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017288 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017289
Daniel Veillard42595322004-11-08 10:52:06 +000017290#ifdef LIBXML_SCHEMAS_ENABLED
17291 int mem_base;
17292 xmlRelaxNGParserCtxtPtr ret_val;
17293 char * buffer; /* a pointer to a char array containing the schemas */
17294 int n_buffer;
17295 int size; /* the size of the array */
17296 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017297
Daniel Veillard42595322004-11-08 10:52:06 +000017298 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17299 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17300 mem_base = xmlMemBlocks();
17301 buffer = gen_const_char_ptr(n_buffer, 0);
17302 size = gen_int(n_size, 1);
17303
17304 ret_val = xmlRelaxNGNewMemParserCtxt(buffer, size);
17305 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17306 call_tests++;
17307 des_const_char_ptr(n_buffer, buffer, 0);
17308 des_int(n_size, size, 1);
17309 xmlResetLastError();
17310 if (mem_base != xmlMemBlocks()) {
17311 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17312 xmlMemBlocks() - mem_base);
17313 test_ret++;
17314 printf(" %d", n_buffer);
17315 printf(" %d", n_size);
17316 printf("\n");
17317 }
17318 }
17319 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017320 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017321#endif
17322
Daniel Veillard42595322004-11-08 10:52:06 +000017323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017324}
17325
17326
17327static int
17328test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017330
Daniel Veillard42595322004-11-08 10:52:06 +000017331#ifdef LIBXML_SCHEMAS_ENABLED
17332 int mem_base;
17333 xmlRelaxNGParserCtxtPtr ret_val;
17334 char * URL; /* the location of the schema */
17335 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017336
Daniel Veillard42595322004-11-08 10:52:06 +000017337 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17338 mem_base = xmlMemBlocks();
17339 URL = gen_const_char_ptr(n_URL, 0);
17340
17341 ret_val = xmlRelaxNGNewParserCtxt(URL);
17342 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17343 call_tests++;
17344 des_const_char_ptr(n_URL, URL, 0);
17345 xmlResetLastError();
17346 if (mem_base != xmlMemBlocks()) {
17347 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17348 xmlMemBlocks() - mem_base);
17349 test_ret++;
17350 printf(" %d", n_URL);
17351 printf("\n");
17352 }
17353 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017354 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017355#endif
17356
Daniel Veillard42595322004-11-08 10:52:06 +000017357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017358}
17359
17360
17361static int
17362test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017364
17365
17366 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017368}
17369
17370
17371static int
17372test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017373 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017374
17375
17376 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017378}
17379
17380
17381static int
17382test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017384
17385
17386 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017388}
17389
17390
17391static int
17392test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017394
17395
17396 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017398}
17399
17400
17401static int
17402test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017404
Daniel Veillardce682bc2004-11-05 17:22:25 +000017405#ifdef LIBXML_SCHEMAS_ENABLED
17406 int mem_base;
17407 int ret_val;
17408 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17409 int n_ctxt;
17410 xmlDocPtr doc; /* a parsed document tree */
17411 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017412
Daniel Veillardce682bc2004-11-05 17:22:25 +000017413 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17414 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17415 mem_base = xmlMemBlocks();
17416 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17417 doc = gen_xmlDocPtr(n_doc, 1);
17418
17419 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17420 desret_int(ret_val);
17421 call_tests++;
17422 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17423 des_xmlDocPtr(n_doc, doc, 1);
17424 xmlResetLastError();
17425 if (mem_base != xmlMemBlocks()) {
17426 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17427 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017428 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017429 printf(" %d", n_ctxt);
17430 printf(" %d", n_doc);
17431 printf("\n");
17432 }
17433 }
17434 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017435 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017436#endif
17437
Daniel Veillard42595322004-11-08 10:52:06 +000017438 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017439}
17440
17441
17442static int
17443test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017444 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017445
Daniel Veillardce682bc2004-11-05 17:22:25 +000017446#ifdef LIBXML_SCHEMAS_ENABLED
17447 int mem_base;
17448 int ret_val;
17449 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17450 int n_ctxt;
17451 xmlDocPtr doc; /* a document instance */
17452 int n_doc;
17453 xmlNodePtr elem; /* an element instance */
17454 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017455
Daniel Veillardce682bc2004-11-05 17:22:25 +000017456 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17457 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17458 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17459 mem_base = xmlMemBlocks();
17460 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17461 doc = gen_xmlDocPtr(n_doc, 1);
17462 elem = gen_xmlNodePtr(n_elem, 2);
17463
17464 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17465 desret_int(ret_val);
17466 call_tests++;
17467 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17468 des_xmlDocPtr(n_doc, doc, 1);
17469 des_xmlNodePtr(n_elem, elem, 2);
17470 xmlResetLastError();
17471 if (mem_base != xmlMemBlocks()) {
17472 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017474 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017475 printf(" %d", n_ctxt);
17476 printf(" %d", n_doc);
17477 printf(" %d", n_elem);
17478 printf("\n");
17479 }
17480 }
17481 }
17482 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017483 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017484#endif
17485
Daniel Veillard42595322004-11-08 10:52:06 +000017486 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017487}
17488
17489
17490static int
17491test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017492 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017493
Daniel Veillardce682bc2004-11-05 17:22:25 +000017494#ifdef LIBXML_SCHEMAS_ENABLED
17495 int mem_base;
17496 int ret_val;
17497 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17498 int n_ctxt;
17499 xmlDocPtr doc; /* a document instance */
17500 int n_doc;
17501 xmlNodePtr elem; /* an element instance */
17502 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017503
Daniel Veillardce682bc2004-11-05 17:22:25 +000017504 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17505 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17506 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17507 mem_base = xmlMemBlocks();
17508 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17509 doc = gen_xmlDocPtr(n_doc, 1);
17510 elem = gen_xmlNodePtr(n_elem, 2);
17511
17512 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17513 desret_int(ret_val);
17514 call_tests++;
17515 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17516 des_xmlDocPtr(n_doc, doc, 1);
17517 des_xmlNodePtr(n_elem, elem, 2);
17518 xmlResetLastError();
17519 if (mem_base != xmlMemBlocks()) {
17520 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017522 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017523 printf(" %d", n_ctxt);
17524 printf(" %d", n_doc);
17525 printf(" %d", n_elem);
17526 printf("\n");
17527 }
17528 }
17529 }
17530 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017531 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017532#endif
17533
Daniel Veillard42595322004-11-08 10:52:06 +000017534 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017535}
17536
17537
17538static int
17539test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017540 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017541
Daniel Veillardce682bc2004-11-05 17:22:25 +000017542#ifdef LIBXML_SCHEMAS_ENABLED
17543 int mem_base;
17544 int ret_val;
17545 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17546 int n_ctxt;
17547 xmlChar * data; /* some character data read */
17548 int n_data;
17549 int len; /* the lenght of the data */
17550 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017551
Daniel Veillardce682bc2004-11-05 17:22:25 +000017552 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17553 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17554 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17555 mem_base = xmlMemBlocks();
17556 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17557 data = gen_const_xmlChar_ptr(n_data, 1);
17558 len = gen_int(n_len, 2);
17559
17560 ret_val = xmlRelaxNGValidatePushCData(ctxt, data, len);
17561 desret_int(ret_val);
17562 call_tests++;
17563 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17564 des_const_xmlChar_ptr(n_data, data, 1);
17565 des_int(n_len, len, 2);
17566 xmlResetLastError();
17567 if (mem_base != xmlMemBlocks()) {
17568 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17569 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017570 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017571 printf(" %d", n_ctxt);
17572 printf(" %d", n_data);
17573 printf(" %d", n_len);
17574 printf("\n");
17575 }
17576 }
17577 }
17578 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017579 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017580#endif
17581
Daniel Veillard42595322004-11-08 10:52:06 +000017582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017583}
17584
17585
17586static int
17587test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017589
Daniel Veillardce682bc2004-11-05 17:22:25 +000017590#ifdef LIBXML_SCHEMAS_ENABLED
17591 int mem_base;
17592 int ret_val;
17593 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17594 int n_ctxt;
17595 xmlDocPtr doc; /* a document instance */
17596 int n_doc;
17597 xmlNodePtr elem; /* an element instance */
17598 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017599
Daniel Veillardce682bc2004-11-05 17:22:25 +000017600 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17601 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17602 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17603 mem_base = xmlMemBlocks();
17604 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17605 doc = gen_xmlDocPtr(n_doc, 1);
17606 elem = gen_xmlNodePtr(n_elem, 2);
17607
17608 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17609 desret_int(ret_val);
17610 call_tests++;
17611 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17612 des_xmlDocPtr(n_doc, doc, 1);
17613 des_xmlNodePtr(n_elem, elem, 2);
17614 xmlResetLastError();
17615 if (mem_base != xmlMemBlocks()) {
17616 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017618 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017619 printf(" %d", n_ctxt);
17620 printf(" %d", n_doc);
17621 printf(" %d", n_elem);
17622 printf("\n");
17623 }
17624 }
17625 }
17626 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017627 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017628#endif
17629
Daniel Veillard42595322004-11-08 10:52:06 +000017630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017631}
17632
17633
17634static int
17635test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017637
Daniel Veillardce682bc2004-11-05 17:22:25 +000017638#ifdef LIBXML_SCHEMAS_ENABLED
17639 int mem_base;
17640 int ret_val;
17641 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17642 int n_ctxt;
17643 int flags; /* a set of flags values */
17644 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017645
Daniel Veillardce682bc2004-11-05 17:22:25 +000017646 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17647 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17648 mem_base = xmlMemBlocks();
17649 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17650 flags = gen_int(n_flags, 1);
17651
17652 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17653 desret_int(ret_val);
17654 call_tests++;
17655 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17656 des_int(n_flags, flags, 1);
17657 xmlResetLastError();
17658 if (mem_base != xmlMemBlocks()) {
17659 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17660 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017661 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017662 printf(" %d", n_ctxt);
17663 printf(" %d", n_flags);
17664 printf("\n");
17665 }
17666 }
17667 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017668 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017669#endif
17670
Daniel Veillard42595322004-11-08 10:52:06 +000017671 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017672}
17673
17674static int
17675test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017676 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017677
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017678 if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000017679 test_ret += test_xmlRelaxNGDump();
17680 test_ret += test_xmlRelaxNGDumpTree();
17681 test_ret += test_xmlRelaxNGGetParserErrors();
17682 test_ret += test_xmlRelaxNGGetValidErrors();
17683 test_ret += test_xmlRelaxNGInitTypes();
17684 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17685 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17686 test_ret += test_xmlRelaxNGNewParserCtxt();
17687 test_ret += test_xmlRelaxNGNewValidCtxt();
17688 test_ret += test_xmlRelaxNGParse();
17689 test_ret += test_xmlRelaxNGSetParserErrors();
17690 test_ret += test_xmlRelaxNGSetValidErrors();
17691 test_ret += test_xmlRelaxNGValidateDoc();
17692 test_ret += test_xmlRelaxNGValidateFullElement();
17693 test_ret += test_xmlRelaxNGValidatePopElement();
17694 test_ret += test_xmlRelaxNGValidatePushCData();
17695 test_ret += test_xmlRelaxNGValidatePushElement();
17696 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017697
Daniel Veillard42595322004-11-08 10:52:06 +000017698 if (test_ret != 0)
17699 printf("Module relaxng: %d errors\n", test_ret);
17700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017701}
17702static int
17703test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017704 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017705
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017706 if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017707
Daniel Veillard42595322004-11-08 10:52:06 +000017708 if (test_ret != 0)
17709 printf("Module schemasInternals: %d errors\n", test_ret);
17710 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017711}
17712
17713static int
17714test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017715 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017716
17717 int mem_base;
17718 xmlNodePtr ret_val;
17719 xmlNodePtr parent; /* the parent node */
17720 int n_parent;
17721 xmlNodePtr cur; /* the child node */
17722 int n_cur;
17723
Daniel Veillarda03e3652004-11-02 18:45:30 +000017724 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017725 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17726 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017727 parent = gen_xmlNodePtr(n_parent, 0);
17728 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017729
17730 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017731 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017732 desret_xmlNodePtr(ret_val);
17733 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017734 des_xmlNodePtr(n_parent, parent, 0);
17735 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017736 xmlResetLastError();
17737 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017738 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017740 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017741 printf(" %d", n_parent);
17742 printf(" %d", n_cur);
17743 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017744 }
17745 }
17746 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017747 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017748
Daniel Veillard42595322004-11-08 10:52:06 +000017749 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017750}
17751
17752
17753static int
17754test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017755 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017756
17757 int mem_base;
17758 xmlNodePtr ret_val;
17759 xmlNodePtr parent; /* the parent node */
17760 int n_parent;
17761 xmlNodePtr cur; /* the first node in the list */
17762 int n_cur;
17763
Daniel Veillarda03e3652004-11-02 18:45:30 +000017764 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017765 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17766 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017767 parent = gen_xmlNodePtr(n_parent, 0);
17768 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017769
17770 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017771 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017772 desret_xmlNodePtr(ret_val);
17773 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017774 des_xmlNodePtr(n_parent, parent, 0);
17775 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017776 xmlResetLastError();
17777 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017778 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017779 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017780 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017781 printf(" %d", n_parent);
17782 printf(" %d", n_cur);
17783 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017784 }
17785 }
17786 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017787 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017788
Daniel Veillard42595322004-11-08 10:52:06 +000017789 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017790}
17791
17792
17793static int
17794test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017795 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017796
17797 int mem_base;
17798 xmlNodePtr ret_val;
17799 xmlNodePtr cur; /* the child node */
17800 int n_cur;
17801 xmlNodePtr elem; /* the new node */
17802 int n_elem;
17803
17804 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017805 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017806 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017807 cur = gen_xmlNodePtr(n_cur, 0);
17808 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017809
17810 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017811 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017812 desret_xmlNodePtr(ret_val);
17813 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017814 des_xmlNodePtr(n_cur, cur, 0);
17815 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017816 xmlResetLastError();
17817 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017818 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017819 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017820 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017821 printf(" %d", n_cur);
17822 printf(" %d", n_elem);
17823 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017824 }
17825 }
17826 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017827 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017828
Daniel Veillard42595322004-11-08 10:52:06 +000017829 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017830}
17831
17832
17833static int
17834test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017835 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017836
17837#ifdef LIBXML_TREE_ENABLED
17838 int mem_base;
17839 xmlNodePtr ret_val;
17840 xmlNodePtr cur; /* the child node */
17841 int n_cur;
17842 xmlNodePtr elem; /* the new node */
17843 int n_elem;
17844
17845 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017846 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017847 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017848 cur = gen_xmlNodePtr(n_cur, 0);
17849 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017850
17851 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017852 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017853 desret_xmlNodePtr(ret_val);
17854 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017855 des_xmlNodePtr(n_cur, cur, 0);
17856 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017857 xmlResetLastError();
17858 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017859 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017861 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017862 printf(" %d", n_cur);
17863 printf(" %d", n_elem);
17864 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017865 }
17866 }
17867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017868 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017869#endif
17870
Daniel Veillard42595322004-11-08 10:52:06 +000017871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017872}
17873
17874
17875static int
17876test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017878
17879 int mem_base;
17880 xmlNodePtr ret_val;
17881 xmlNodePtr cur; /* the child node */
17882 int n_cur;
17883 xmlNodePtr elem; /* the new node */
17884 int n_elem;
17885
17886 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017887 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017888 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017889 cur = gen_xmlNodePtr(n_cur, 0);
17890 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017891
17892 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017893 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017894 desret_xmlNodePtr(ret_val);
17895 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017896 des_xmlNodePtr(n_cur, cur, 0);
17897 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017898 xmlResetLastError();
17899 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017900 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017901 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017902 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017903 printf(" %d", n_cur);
17904 printf(" %d", n_elem);
17905 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017906 }
17907 }
17908 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017909 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017910
Daniel Veillard42595322004-11-08 10:52:06 +000017911 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017912}
17913
17914
17915static int
17916test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017917 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017918
Daniel Veillarda521d282004-11-09 14:59:59 +000017919#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000017920 int mem_base;
17921 xmlBufferPtr buf; /* the XML buffer output */
17922 int n_buf;
17923 xmlDocPtr doc; /* the document */
17924 int n_doc;
17925 xmlAttrPtr attr; /* the attribute node */
17926 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017927 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017928 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017929
Daniel Veillardce244ad2004-11-05 10:03:46 +000017930 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17931 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17932 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17933 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17934 mem_base = xmlMemBlocks();
17935 buf = gen_xmlBufferPtr(n_buf, 0);
17936 doc = gen_xmlDocPtr(n_doc, 1);
17937 attr = gen_xmlAttrPtr(n_attr, 2);
17938 string = gen_const_xmlChar_ptr(n_string, 3);
17939
17940 xmlAttrSerializeTxtContent(buf, doc, attr, string);
17941 call_tests++;
17942 des_xmlBufferPtr(n_buf, buf, 0);
17943 des_xmlDocPtr(n_doc, doc, 1);
17944 des_xmlAttrPtr(n_attr, attr, 2);
17945 des_const_xmlChar_ptr(n_string, string, 3);
17946 xmlResetLastError();
17947 if (mem_base != xmlMemBlocks()) {
17948 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017950 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017951 printf(" %d", n_buf);
17952 printf(" %d", n_doc);
17953 printf(" %d", n_attr);
17954 printf(" %d", n_string);
17955 printf("\n");
17956 }
17957 }
17958 }
17959 }
17960 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017961 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000017962#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000017963
Daniel Veillard42595322004-11-08 10:52:06 +000017964 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017965}
17966
17967
17968static int
17969test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017970 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017971
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017972 int mem_base;
17973 int ret_val;
17974 xmlBufferPtr buf; /* the buffer to dump */
17975 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017976 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017977 int n_str;
17978 int len; /* the number of #xmlChar to add */
17979 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017980
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017981 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17982 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17983 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17984 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017985 buf = gen_xmlBufferPtr(n_buf, 0);
17986 str = gen_const_xmlChar_ptr(n_str, 1);
17987 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017988
17989 ret_val = xmlBufferAdd(buf, str, len);
17990 desret_int(ret_val);
17991 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017992 des_xmlBufferPtr(n_buf, buf, 0);
17993 des_const_xmlChar_ptr(n_str, str, 1);
17994 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017995 xmlResetLastError();
17996 if (mem_base != xmlMemBlocks()) {
17997 printf("Leak of %d blocks found in xmlBufferAdd",
17998 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017999 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018000 printf(" %d", n_buf);
18001 printf(" %d", n_str);
18002 printf(" %d", n_len);
18003 printf("\n");
18004 }
18005 }
18006 }
18007 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018008 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018009
Daniel Veillard42595322004-11-08 10:52:06 +000018010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018011}
18012
18013
18014static int
18015test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018016 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018017
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018018 int mem_base;
18019 int ret_val;
18020 xmlBufferPtr buf; /* the buffer */
18021 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018022 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018023 int n_str;
18024 int len; /* the number of #xmlChar to add */
18025 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018026
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018027 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18028 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
18029 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18030 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018031 buf = gen_xmlBufferPtr(n_buf, 0);
18032 str = gen_const_xmlChar_ptr(n_str, 1);
18033 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018034
18035 ret_val = xmlBufferAddHead(buf, str, len);
18036 desret_int(ret_val);
18037 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018038 des_xmlBufferPtr(n_buf, buf, 0);
18039 des_const_xmlChar_ptr(n_str, str, 1);
18040 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018041 xmlResetLastError();
18042 if (mem_base != xmlMemBlocks()) {
18043 printf("Leak of %d blocks found in xmlBufferAddHead",
18044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018045 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018046 printf(" %d", n_buf);
18047 printf(" %d", n_str);
18048 printf(" %d", n_len);
18049 printf("\n");
18050 }
18051 }
18052 }
18053 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018054 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018055
Daniel Veillard42595322004-11-08 10:52:06 +000018056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018057}
18058
18059
18060static int
18061test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018062 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018063
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018064 int mem_base;
18065 int ret_val;
18066 xmlBufferPtr buf; /* the buffer to dump */
18067 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018068 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018069 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018070
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018071 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18072 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
18073 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018074 buf = gen_xmlBufferPtr(n_buf, 0);
18075 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018076
18077 ret_val = xmlBufferCCat(buf, str);
18078 desret_int(ret_val);
18079 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018080 des_xmlBufferPtr(n_buf, buf, 0);
18081 des_const_char_ptr(n_str, str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018082 xmlResetLastError();
18083 if (mem_base != xmlMemBlocks()) {
18084 printf("Leak of %d blocks found in xmlBufferCCat",
18085 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018086 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018087 printf(" %d", n_buf);
18088 printf(" %d", n_str);
18089 printf("\n");
18090 }
18091 }
18092 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018093 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018094
Daniel Veillard42595322004-11-08 10:52:06 +000018095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018096}
18097
18098
18099static int
18100test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018102
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018103 int mem_base;
18104 int ret_val;
18105 xmlBufferPtr buf; /* the buffer to add to */
18106 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018107 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018108 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018109
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018110 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18111 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
18112 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018113 buf = gen_xmlBufferPtr(n_buf, 0);
18114 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018115
18116 ret_val = xmlBufferCat(buf, str);
18117 desret_int(ret_val);
18118 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018119 des_xmlBufferPtr(n_buf, buf, 0);
18120 des_const_xmlChar_ptr(n_str, str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018121 xmlResetLastError();
18122 if (mem_base != xmlMemBlocks()) {
18123 printf("Leak of %d blocks found in xmlBufferCat",
18124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018125 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018126 printf(" %d", n_buf);
18127 printf(" %d", n_str);
18128 printf("\n");
18129 }
18130 }
18131 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018132 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018133
Daniel Veillard42595322004-11-08 10:52:06 +000018134 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018135}
18136
18137
Daniel Veillardce682bc2004-11-05 17:22:25 +000018138#define gen_nb_const_xmlBufferPtr 1
18139static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18140 return(NULL);
18141}
18142static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18143}
18144
Daniel Veillardd93f6252004-11-02 15:53:51 +000018145static int
18146test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018147 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018148
Daniel Veillardce682bc2004-11-05 17:22:25 +000018149 int mem_base;
18150 const xmlChar * ret_val;
18151 xmlBufferPtr buf; /* the buffer */
18152 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018153
Daniel Veillardce682bc2004-11-05 17:22:25 +000018154 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18155 mem_base = xmlMemBlocks();
18156 buf = gen_const_xmlBufferPtr(n_buf, 0);
18157
18158 ret_val = xmlBufferContent(buf);
18159 desret_const_xmlChar_ptr(ret_val);
18160 call_tests++;
18161 des_const_xmlBufferPtr(n_buf, buf, 0);
18162 xmlResetLastError();
18163 if (mem_base != xmlMemBlocks()) {
18164 printf("Leak of %d blocks found in xmlBufferContent",
18165 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018166 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018167 printf(" %d", n_buf);
18168 printf("\n");
18169 }
18170 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018171 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018172
Daniel Veillard42595322004-11-08 10:52:06 +000018173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018174}
18175
18176
18177static int
18178test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018179 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018180
Daniel Veillard3d95c732004-11-06 22:25:14 +000018181 int mem_base;
18182 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018183
Daniel Veillard3d95c732004-11-06 22:25:14 +000018184 mem_base = xmlMemBlocks();
18185
18186 ret_val = xmlBufferCreate();
18187 desret_xmlBufferPtr(ret_val);
18188 call_tests++;
18189 xmlResetLastError();
18190 if (mem_base != xmlMemBlocks()) {
18191 printf("Leak of %d blocks found in xmlBufferCreate",
18192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018193 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000018194 printf("\n");
18195 }
Daniel Veillard3d95c732004-11-06 22:25:14 +000018196 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018197
Daniel Veillard42595322004-11-08 10:52:06 +000018198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018199}
18200
18201
18202static int
18203test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018205
18206
18207 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018209}
18210
18211
18212static int
18213test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018215
18216
18217 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018219}
18220
18221
18222static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000018223test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018225
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018226 int mem_base;
18227 xmlBufferPtr buf; /* the buffer */
18228 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018229
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018230 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18231 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018232 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018233
18234 xmlBufferEmpty(buf);
18235 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018236 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018237 xmlResetLastError();
18238 if (mem_base != xmlMemBlocks()) {
18239 printf("Leak of %d blocks found in xmlBufferEmpty",
18240 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018241 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018242 printf(" %d", n_buf);
18243 printf("\n");
18244 }
18245 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018246 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018247
Daniel Veillard42595322004-11-08 10:52:06 +000018248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018249}
18250
18251
18252static int
18253test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018255
Daniel Veillard3d97e662004-11-04 10:49:00 +000018256 int mem_base;
18257 int ret_val;
18258 xmlBufferPtr buf; /* the buffer */
18259 int n_buf;
18260 unsigned int len; /* the minimum free size to allocate */
18261 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018262
Daniel Veillard3d97e662004-11-04 10:49:00 +000018263 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18264 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18265 mem_base = xmlMemBlocks();
18266 buf = gen_xmlBufferPtr(n_buf, 0);
18267 len = gen_unsigned_int(n_len, 1);
18268
18269 ret_val = xmlBufferGrow(buf, len);
18270 desret_int(ret_val);
18271 call_tests++;
18272 des_xmlBufferPtr(n_buf, buf, 0);
18273 des_unsigned_int(n_len, len, 1);
18274 xmlResetLastError();
18275 if (mem_base != xmlMemBlocks()) {
18276 printf("Leak of %d blocks found in xmlBufferGrow",
18277 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018278 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018279 printf(" %d", n_buf);
18280 printf(" %d", n_len);
18281 printf("\n");
18282 }
18283 }
18284 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018285 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018286
Daniel Veillard42595322004-11-08 10:52:06 +000018287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018288}
18289
18290
18291static int
18292test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018294
Daniel Veillardce682bc2004-11-05 17:22:25 +000018295 int mem_base;
18296 int ret_val;
18297 xmlBufferPtr buf; /* the buffer */
18298 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018299
Daniel Veillardce682bc2004-11-05 17:22:25 +000018300 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18301 mem_base = xmlMemBlocks();
18302 buf = gen_const_xmlBufferPtr(n_buf, 0);
18303
18304 ret_val = xmlBufferLength(buf);
18305 desret_int(ret_val);
18306 call_tests++;
18307 des_const_xmlBufferPtr(n_buf, buf, 0);
18308 xmlResetLastError();
18309 if (mem_base != xmlMemBlocks()) {
18310 printf("Leak of %d blocks found in xmlBufferLength",
18311 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018312 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018313 printf(" %d", n_buf);
18314 printf("\n");
18315 }
18316 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018317 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018318
Daniel Veillard42595322004-11-08 10:52:06 +000018319 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018320}
18321
18322
18323static int
18324test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018325 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018326
Daniel Veillard3d97e662004-11-04 10:49:00 +000018327 int mem_base;
18328 int ret_val;
18329 xmlBufferPtr buf; /* the buffer to resize */
18330 int n_buf;
18331 unsigned int size; /* the desired size */
18332 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018333
Daniel Veillard3d97e662004-11-04 10:49:00 +000018334 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18335 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18336 mem_base = xmlMemBlocks();
18337 buf = gen_xmlBufferPtr(n_buf, 0);
18338 size = gen_unsigned_int(n_size, 1);
18339
18340 ret_val = xmlBufferResize(buf, size);
18341 desret_int(ret_val);
18342 call_tests++;
18343 des_xmlBufferPtr(n_buf, buf, 0);
18344 des_unsigned_int(n_size, size, 1);
18345 xmlResetLastError();
18346 if (mem_base != xmlMemBlocks()) {
18347 printf("Leak of %d blocks found in xmlBufferResize",
18348 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018349 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018350 printf(" %d", n_buf);
18351 printf(" %d", n_size);
18352 printf("\n");
18353 }
18354 }
18355 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018356 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018357
Daniel Veillard42595322004-11-08 10:52:06 +000018358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018359}
18360
18361
18362static int
18363test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018365
Daniel Veillard57b25162004-11-06 14:50:18 +000018366 int mem_base;
18367 xmlBufferPtr buf; /* the buffer to tune */
18368 int n_buf;
18369 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18370 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018371
Daniel Veillard57b25162004-11-06 14:50:18 +000018372 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18373 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18374 mem_base = xmlMemBlocks();
18375 buf = gen_xmlBufferPtr(n_buf, 0);
18376 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18377
18378 xmlBufferSetAllocationScheme(buf, scheme);
18379 call_tests++;
18380 des_xmlBufferPtr(n_buf, buf, 0);
18381 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18382 xmlResetLastError();
18383 if (mem_base != xmlMemBlocks()) {
18384 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18385 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018386 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018387 printf(" %d", n_buf);
18388 printf(" %d", n_scheme);
18389 printf("\n");
18390 }
18391 }
18392 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018393 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018394
Daniel Veillard42595322004-11-08 10:52:06 +000018395 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018396}
18397
18398
18399static int
18400test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018401 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018402
Daniel Veillard3d97e662004-11-04 10:49:00 +000018403 int mem_base;
18404 int ret_val;
18405 xmlBufferPtr buf; /* the buffer to dump */
18406 int n_buf;
18407 unsigned int len; /* the number of xmlChar to remove */
18408 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018409
Daniel Veillard3d97e662004-11-04 10:49:00 +000018410 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18411 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18412 mem_base = xmlMemBlocks();
18413 buf = gen_xmlBufferPtr(n_buf, 0);
18414 len = gen_unsigned_int(n_len, 1);
18415
18416 ret_val = xmlBufferShrink(buf, len);
18417 desret_int(ret_val);
18418 call_tests++;
18419 des_xmlBufferPtr(n_buf, buf, 0);
18420 des_unsigned_int(n_len, len, 1);
18421 xmlResetLastError();
18422 if (mem_base != xmlMemBlocks()) {
18423 printf("Leak of %d blocks found in xmlBufferShrink",
18424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018425 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018426 printf(" %d", n_buf);
18427 printf(" %d", n_len);
18428 printf("\n");
18429 }
18430 }
18431 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018432 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018433
Daniel Veillard42595322004-11-08 10:52:06 +000018434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018435}
18436
18437
18438static int
18439test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018441
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018442 int mem_base;
18443 xmlBufferPtr buf; /* the XML buffer */
18444 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018445 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018446 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018447
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018448 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18449 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18450 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018451 buf = gen_xmlBufferPtr(n_buf, 0);
18452 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018453
18454 xmlBufferWriteCHAR(buf, string);
18455 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018456 des_xmlBufferPtr(n_buf, buf, 0);
18457 des_const_xmlChar_ptr(n_string, string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018458 xmlResetLastError();
18459 if (mem_base != xmlMemBlocks()) {
18460 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018462 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018463 printf(" %d", n_buf);
18464 printf(" %d", n_string);
18465 printf("\n");
18466 }
18467 }
18468 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018469 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018470
Daniel Veillard42595322004-11-08 10:52:06 +000018471 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018472}
18473
18474
18475static int
18476test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018477 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018478
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018479 int mem_base;
18480 xmlBufferPtr buf; /* the XML buffer output */
18481 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018482 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018483 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018484
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018485 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18486 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18487 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018488 buf = gen_xmlBufferPtr(n_buf, 0);
18489 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018490
18491 xmlBufferWriteChar(buf, string);
18492 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018493 des_xmlBufferPtr(n_buf, buf, 0);
18494 des_const_char_ptr(n_string, string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018495 xmlResetLastError();
18496 if (mem_base != xmlMemBlocks()) {
18497 printf("Leak of %d blocks found in xmlBufferWriteChar",
18498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018499 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018500 printf(" %d", n_buf);
18501 printf(" %d", n_string);
18502 printf("\n");
18503 }
18504 }
18505 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018506 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018507
Daniel Veillard42595322004-11-08 10:52:06 +000018508 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018509}
18510
18511
18512static int
18513test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018515
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018516 int mem_base;
18517 xmlBufferPtr buf; /* the XML buffer output */
18518 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018519 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018520 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018521
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018522 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18523 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18524 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018525 buf = gen_xmlBufferPtr(n_buf, 0);
18526 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018527
18528 xmlBufferWriteQuotedString(buf, string);
18529 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018530 des_xmlBufferPtr(n_buf, buf, 0);
18531 des_const_xmlChar_ptr(n_string, string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018532 xmlResetLastError();
18533 if (mem_base != xmlMemBlocks()) {
18534 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018536 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018537 printf(" %d", n_buf);
18538 printf(" %d", n_string);
18539 printf("\n");
18540 }
18541 }
18542 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018543 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018544
Daniel Veillard42595322004-11-08 10:52:06 +000018545 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018546}
18547
18548
18549static int
18550test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018551 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018552
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018553 int mem_base;
18554 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018555 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018556 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018557 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018558 int n_prefix;
18559 xmlChar * memory; /* preallocated memory */
18560 int n_memory;
18561 int len; /* preallocated memory length */
18562 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018563
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018564 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18565 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18566 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18567 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18568 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018569 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18570 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18571 memory = gen_xmlChar_ptr(n_memory, 2);
18572 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018573
18574 ret_val = xmlBuildQName(ncname, prefix, memory, len);
18575 if ((ret_val != NULL) && (ret_val != ncname) &&
18576 (ret_val != prefix) && (ret_val != memory))
18577 xmlFree(ret_val);
18578 ret_val = NULL;
18579 desret_xmlChar_ptr(ret_val);
18580 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018581 des_const_xmlChar_ptr(n_ncname, ncname, 0);
18582 des_const_xmlChar_ptr(n_prefix, prefix, 1);
18583 des_xmlChar_ptr(n_memory, memory, 2);
18584 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018585 xmlResetLastError();
18586 if (mem_base != xmlMemBlocks()) {
18587 printf("Leak of %d blocks found in xmlBuildQName",
18588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018589 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018590 printf(" %d", n_ncname);
18591 printf(" %d", n_prefix);
18592 printf(" %d", n_memory);
18593 printf(" %d", n_len);
18594 printf("\n");
18595 }
18596 }
18597 }
18598 }
18599 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018600 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018601
Daniel Veillard42595322004-11-08 10:52:06 +000018602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018603}
18604
18605
18606static int
18607test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018609
18610#ifdef LIBXML_TREE_ENABLED
18611 int mem_base;
18612 xmlDocPtr ret_val;
18613 xmlDocPtr doc; /* the document */
18614 int n_doc;
18615 int recursive; /* if not zero do a recursive copy. */
18616 int n_recursive;
18617
18618 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18619 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18620 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018621 doc = gen_xmlDocPtr(n_doc, 0);
18622 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018623
18624 ret_val = xmlCopyDoc(doc, recursive);
18625 desret_xmlDocPtr(ret_val);
18626 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018627 des_xmlDocPtr(n_doc, doc, 0);
18628 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018629 xmlResetLastError();
18630 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018631 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018633 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018634 printf(" %d", n_doc);
18635 printf(" %d", n_recursive);
18636 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018637 }
18638 }
18639 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018640 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018641#endif
18642
Daniel Veillard42595322004-11-08 10:52:06 +000018643 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018644}
18645
18646
18647static int
18648test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018649 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018650
Daniel Veillard27f20102004-11-05 11:50:11 +000018651#ifdef LIBXML_TREE_ENABLED
18652 int mem_base;
18653 xmlDtdPtr ret_val;
18654 xmlDtdPtr dtd; /* the dtd */
18655 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018656
Daniel Veillard27f20102004-11-05 11:50:11 +000018657 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18658 mem_base = xmlMemBlocks();
18659 dtd = gen_xmlDtdPtr(n_dtd, 0);
18660
18661 ret_val = xmlCopyDtd(dtd);
18662 desret_xmlDtdPtr(ret_val);
18663 call_tests++;
18664 des_xmlDtdPtr(n_dtd, dtd, 0);
18665 xmlResetLastError();
18666 if (mem_base != xmlMemBlocks()) {
18667 printf("Leak of %d blocks found in xmlCopyDtd",
18668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018669 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018670 printf(" %d", n_dtd);
18671 printf("\n");
18672 }
18673 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018674 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018675#endif
18676
Daniel Veillard42595322004-11-08 10:52:06 +000018677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018678}
18679
18680
18681static int
18682test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018683 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018684
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018685 int mem_base;
18686 xmlNsPtr ret_val;
18687 xmlNsPtr cur; /* the namespace */
18688 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018689
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018690 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18691 mem_base = xmlMemBlocks();
18692 cur = gen_xmlNsPtr(n_cur, 0);
18693
18694 ret_val = xmlCopyNamespace(cur);
18695 if (ret_val != NULL) xmlFreeNs(ret_val);
18696 desret_xmlNsPtr(ret_val);
18697 call_tests++;
18698 des_xmlNsPtr(n_cur, cur, 0);
18699 xmlResetLastError();
18700 if (mem_base != xmlMemBlocks()) {
18701 printf("Leak of %d blocks found in xmlCopyNamespace",
18702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018703 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018704 printf(" %d", n_cur);
18705 printf("\n");
18706 }
18707 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018708 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018709
Daniel Veillard42595322004-11-08 10:52:06 +000018710 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018711}
18712
18713
18714static int
18715test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018716 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018717
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018718 int mem_base;
18719 xmlNsPtr ret_val;
18720 xmlNsPtr cur; /* the first namespace */
18721 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018722
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018723 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18724 mem_base = xmlMemBlocks();
18725 cur = gen_xmlNsPtr(n_cur, 0);
18726
18727 ret_val = xmlCopyNamespaceList(cur);
18728 if (ret_val != NULL) xmlFreeNsList(ret_val);
18729 desret_xmlNsPtr(ret_val);
18730 call_tests++;
18731 des_xmlNsPtr(n_cur, cur, 0);
18732 xmlResetLastError();
18733 if (mem_base != xmlMemBlocks()) {
18734 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018736 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018737 printf(" %d", n_cur);
18738 printf("\n");
18739 }
18740 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018741 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018742
Daniel Veillard42595322004-11-08 10:52:06 +000018743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018744}
18745
18746
18747static int
18748test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018750
Daniel Veillardce682bc2004-11-05 17:22:25 +000018751 int mem_base;
18752 xmlNodePtr ret_val;
18753 xmlNodePtr node; /* the node */
18754 int n_node;
18755 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18756 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018757
Daniel Veillardce682bc2004-11-05 17:22:25 +000018758 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18759 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18760 mem_base = xmlMemBlocks();
18761 node = gen_const_xmlNodePtr(n_node, 0);
18762 extended = gen_int(n_extended, 1);
18763
18764 ret_val = xmlCopyNode(node, extended);
18765 desret_xmlNodePtr(ret_val);
18766 call_tests++;
18767 des_const_xmlNodePtr(n_node, node, 0);
18768 des_int(n_extended, extended, 1);
18769 xmlResetLastError();
18770 if (mem_base != xmlMemBlocks()) {
18771 printf("Leak of %d blocks found in xmlCopyNode",
18772 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018773 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018774 printf(" %d", n_node);
18775 printf(" %d", n_extended);
18776 printf("\n");
18777 }
18778 }
18779 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018780 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018781
Daniel Veillard42595322004-11-08 10:52:06 +000018782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018783}
18784
18785
18786static int
18787test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018789
Daniel Veillardce682bc2004-11-05 17:22:25 +000018790 int mem_base;
18791 xmlNodePtr ret_val;
18792 xmlNodePtr node; /* the first node in the list. */
18793 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018794
Daniel Veillardce682bc2004-11-05 17:22:25 +000018795 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18796 mem_base = xmlMemBlocks();
18797 node = gen_const_xmlNodePtr(n_node, 0);
18798
18799 ret_val = xmlCopyNodeList(node);
18800 desret_xmlNodePtr(ret_val);
18801 call_tests++;
18802 des_const_xmlNodePtr(n_node, node, 0);
18803 xmlResetLastError();
18804 if (mem_base != xmlMemBlocks()) {
18805 printf("Leak of %d blocks found in xmlCopyNodeList",
18806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018807 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018808 printf(" %d", n_node);
18809 printf("\n");
18810 }
18811 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018812 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018813
Daniel Veillard42595322004-11-08 10:52:06 +000018814 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018815}
18816
18817
18818static int
18819test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018820 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018821
Daniel Veillard57b25162004-11-06 14:50:18 +000018822 int mem_base;
18823 xmlAttrPtr ret_val;
18824 xmlNodePtr target; /* the element where the attribute will be grafted */
18825 int n_target;
18826 xmlAttrPtr cur; /* the attribute */
18827 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018828
Daniel Veillard57b25162004-11-06 14:50:18 +000018829 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18830 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18831 mem_base = xmlMemBlocks();
18832 target = gen_xmlNodePtr(n_target, 0);
18833 cur = gen_xmlAttrPtr(n_cur, 1);
18834
18835 ret_val = xmlCopyProp(target, cur);
18836 desret_xmlAttrPtr(ret_val);
18837 call_tests++;
18838 des_xmlNodePtr(n_target, target, 0);
18839 des_xmlAttrPtr(n_cur, cur, 1);
18840 xmlResetLastError();
18841 if (mem_base != xmlMemBlocks()) {
18842 printf("Leak of %d blocks found in xmlCopyProp",
18843 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018844 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018845 printf(" %d", n_target);
18846 printf(" %d", n_cur);
18847 printf("\n");
18848 }
18849 }
18850 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018851 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018852
Daniel Veillard42595322004-11-08 10:52:06 +000018853 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018854}
18855
18856
18857static int
18858test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018859 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018860
Daniel Veillard57b25162004-11-06 14:50:18 +000018861 int mem_base;
18862 xmlAttrPtr ret_val;
18863 xmlNodePtr target; /* the element where the attributes will be grafted */
18864 int n_target;
18865 xmlAttrPtr cur; /* the first attribute */
18866 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018867
Daniel Veillard57b25162004-11-06 14:50:18 +000018868 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18869 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18870 mem_base = xmlMemBlocks();
18871 target = gen_xmlNodePtr(n_target, 0);
18872 cur = gen_xmlAttrPtr(n_cur, 1);
18873
18874 ret_val = xmlCopyPropList(target, cur);
18875 desret_xmlAttrPtr(ret_val);
18876 call_tests++;
18877 des_xmlNodePtr(n_target, target, 0);
18878 des_xmlAttrPtr(n_cur, cur, 1);
18879 xmlResetLastError();
18880 if (mem_base != xmlMemBlocks()) {
18881 printf("Leak of %d blocks found in xmlCopyPropList",
18882 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018883 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018884 printf(" %d", n_target);
18885 printf(" %d", n_cur);
18886 printf("\n");
18887 }
18888 }
18889 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018890 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018891
Daniel Veillard42595322004-11-08 10:52:06 +000018892 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018893}
18894
18895
18896static int
18897test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018898 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018899
Daniel Veillard34099b42004-11-04 17:34:35 +000018900 int mem_base;
18901 xmlDtdPtr ret_val;
18902 xmlDocPtr doc; /* the document pointer */
18903 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018904 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018905 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018906 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018907 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018908 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018909 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018910
Daniel Veillard34099b42004-11-04 17:34:35 +000018911 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18912 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18913 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18914 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18915 mem_base = xmlMemBlocks();
18916 doc = gen_xmlDocPtr(n_doc, 0);
18917 name = gen_const_xmlChar_ptr(n_name, 1);
18918 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18919 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18920
18921 ret_val = xmlCreateIntSubset(doc, name, ExternalID, SystemID);
18922 desret_xmlDtdPtr(ret_val);
18923 call_tests++;
18924 des_xmlDocPtr(n_doc, doc, 0);
18925 des_const_xmlChar_ptr(n_name, name, 1);
18926 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
18927 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
18928 xmlResetLastError();
18929 if (mem_base != xmlMemBlocks()) {
18930 printf("Leak of %d blocks found in xmlCreateIntSubset",
18931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018932 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018933 printf(" %d", n_doc);
18934 printf(" %d", n_name);
18935 printf(" %d", n_ExternalID);
18936 printf(" %d", n_SystemID);
18937 printf("\n");
18938 }
18939 }
18940 }
18941 }
18942 }
Daniel Veillard34099b42004-11-04 17:34:35 +000018943 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018944
Daniel Veillard42595322004-11-08 10:52:06 +000018945 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018946}
18947
18948
18949static int
18950test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018952
Daniel Veillardce682bc2004-11-05 17:22:25 +000018953 int mem_base;
18954 xmlNodePtr ret_val;
18955 xmlNodePtr node; /* the node */
18956 int n_node;
18957 xmlDocPtr doc; /* the document */
18958 int n_doc;
18959 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18960 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018961
Daniel Veillardce682bc2004-11-05 17:22:25 +000018962 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18963 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18964 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18965 mem_base = xmlMemBlocks();
18966 node = gen_const_xmlNodePtr(n_node, 0);
18967 doc = gen_xmlDocPtr(n_doc, 1);
18968 extended = gen_int(n_extended, 2);
18969
18970 ret_val = xmlDocCopyNode(node, doc, extended);
18971 desret_xmlNodePtr(ret_val);
18972 call_tests++;
18973 des_const_xmlNodePtr(n_node, node, 0);
18974 des_xmlDocPtr(n_doc, doc, 1);
18975 des_int(n_extended, extended, 2);
18976 xmlResetLastError();
18977 if (mem_base != xmlMemBlocks()) {
18978 printf("Leak of %d blocks found in xmlDocCopyNode",
18979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018980 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018981 printf(" %d", n_node);
18982 printf(" %d", n_doc);
18983 printf(" %d", n_extended);
18984 printf("\n");
18985 }
18986 }
18987 }
18988 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018989 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018990
Daniel Veillard42595322004-11-08 10:52:06 +000018991 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018992}
18993
18994
18995static int
18996test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018997 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018998
Daniel Veillardce682bc2004-11-05 17:22:25 +000018999 int mem_base;
19000 xmlNodePtr ret_val;
19001 xmlDocPtr doc; /* the target document */
19002 int n_doc;
19003 xmlNodePtr node; /* the first node in the list. */
19004 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019005
Daniel Veillardce682bc2004-11-05 17:22:25 +000019006 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19007 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
19008 mem_base = xmlMemBlocks();
19009 doc = gen_xmlDocPtr(n_doc, 0);
19010 node = gen_const_xmlNodePtr(n_node, 1);
19011
19012 ret_val = xmlDocCopyNodeList(doc, node);
19013 desret_xmlNodePtr(ret_val);
19014 call_tests++;
19015 des_xmlDocPtr(n_doc, doc, 0);
19016 des_const_xmlNodePtr(n_node, node, 1);
19017 xmlResetLastError();
19018 if (mem_base != xmlMemBlocks()) {
19019 printf("Leak of %d blocks found in xmlDocCopyNodeList",
19020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019021 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019022 printf(" %d", n_doc);
19023 printf(" %d", n_node);
19024 printf("\n");
19025 }
19026 }
19027 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000019028 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019029
Daniel Veillard42595322004-11-08 10:52:06 +000019030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019031}
19032
19033
19034static int
19035test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019037
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019038#ifdef LIBXML_OUTPUT_ENABLED
19039 int mem_base;
19040 int ret_val;
19041 FILE * f; /* the FILE* */
19042 int n_f;
19043 xmlDocPtr cur; /* the document */
19044 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019045
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019046 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19047 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19048 mem_base = xmlMemBlocks();
19049 f = gen_FILE_ptr(n_f, 0);
19050 cur = gen_xmlDocPtr(n_cur, 1);
19051
19052 ret_val = xmlDocDump(f, cur);
19053 desret_int(ret_val);
19054 call_tests++;
19055 des_FILE_ptr(n_f, f, 0);
19056 des_xmlDocPtr(n_cur, cur, 1);
19057 xmlResetLastError();
19058 if (mem_base != xmlMemBlocks()) {
19059 printf("Leak of %d blocks found in xmlDocDump",
19060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019061 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019062 printf(" %d", n_f);
19063 printf(" %d", n_cur);
19064 printf("\n");
19065 }
19066 }
19067 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019068 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019069#endif
19070
Daniel Veillard42595322004-11-08 10:52:06 +000019071 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019072}
19073
19074
19075static int
19076test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019077 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019078
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019079#ifdef LIBXML_OUTPUT_ENABLED
19080 int mem_base;
19081 xmlDocPtr cur; /* the document */
19082 int n_cur;
19083 xmlChar ** mem; /* OUT: the memory pointer */
19084 int n_mem;
19085 int * size; /* OUT: the memory length */
19086 int n_size;
19087 int format; /* should formatting spaces been added */
19088 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019089
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019090 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19091 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19092 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19093 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19094 mem_base = xmlMemBlocks();
19095 cur = gen_xmlDocPtr(n_cur, 0);
19096 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19097 size = gen_int_ptr(n_size, 2);
19098 format = gen_int(n_format, 3);
19099
19100 xmlDocDumpFormatMemory(cur, mem, size, format);
19101 call_tests++;
19102 des_xmlDocPtr(n_cur, cur, 0);
19103 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19104 des_int_ptr(n_size, size, 2);
19105 des_int(n_format, format, 3);
19106 xmlResetLastError();
19107 if (mem_base != xmlMemBlocks()) {
19108 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
19109 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019110 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019111 printf(" %d", n_cur);
19112 printf(" %d", n_mem);
19113 printf(" %d", n_size);
19114 printf(" %d", n_format);
19115 printf("\n");
19116 }
19117 }
19118 }
19119 }
19120 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019121 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019122#endif
19123
Daniel Veillard42595322004-11-08 10:52:06 +000019124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019125}
19126
19127
19128static int
19129test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019131
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019132#ifdef LIBXML_OUTPUT_ENABLED
19133 int mem_base;
19134 xmlDocPtr out_doc; /* Document to generate XML text from */
19135 int n_out_doc;
19136 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19137 int n_doc_txt_ptr;
19138 int * doc_txt_len; /* Length of the generated XML text */
19139 int n_doc_txt_len;
19140 char * txt_encoding; /* Character encoding to use when generating XML text */
19141 int n_txt_encoding;
19142 int format; /* should formatting spaces been added */
19143 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019144
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019145 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19146 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19147 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19148 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19149 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19150 mem_base = xmlMemBlocks();
19151 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19152 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19153 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19154 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19155 format = gen_int(n_format, 4);
19156
19157 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, txt_encoding, format);
19158 call_tests++;
19159 des_xmlDocPtr(n_out_doc, out_doc, 0);
19160 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19161 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
19162 des_const_char_ptr(n_txt_encoding, txt_encoding, 3);
19163 des_int(n_format, format, 4);
19164 xmlResetLastError();
19165 if (mem_base != xmlMemBlocks()) {
19166 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
19167 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019168 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019169 printf(" %d", n_out_doc);
19170 printf(" %d", n_doc_txt_ptr);
19171 printf(" %d", n_doc_txt_len);
19172 printf(" %d", n_txt_encoding);
19173 printf(" %d", n_format);
19174 printf("\n");
19175 }
19176 }
19177 }
19178 }
19179 }
19180 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019181 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019182#endif
19183
Daniel Veillard42595322004-11-08 10:52:06 +000019184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019185}
19186
19187
19188static int
19189test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019191
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019192#ifdef LIBXML_OUTPUT_ENABLED
19193 int mem_base;
19194 xmlDocPtr cur; /* the document */
19195 int n_cur;
19196 xmlChar ** mem; /* OUT: the memory pointer */
19197 int n_mem;
19198 int * size; /* OUT: the memory length */
19199 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019200
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019201 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19202 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19203 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19204 mem_base = xmlMemBlocks();
19205 cur = gen_xmlDocPtr(n_cur, 0);
19206 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19207 size = gen_int_ptr(n_size, 2);
19208
19209 xmlDocDumpMemory(cur, mem, size);
19210 call_tests++;
19211 des_xmlDocPtr(n_cur, cur, 0);
19212 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19213 des_int_ptr(n_size, size, 2);
19214 xmlResetLastError();
19215 if (mem_base != xmlMemBlocks()) {
19216 printf("Leak of %d blocks found in xmlDocDumpMemory",
19217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019218 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019219 printf(" %d", n_cur);
19220 printf(" %d", n_mem);
19221 printf(" %d", n_size);
19222 printf("\n");
19223 }
19224 }
19225 }
19226 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019227 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019228#endif
19229
Daniel Veillard42595322004-11-08 10:52:06 +000019230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019231}
19232
19233
19234static int
19235test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019237
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019238#ifdef LIBXML_OUTPUT_ENABLED
19239 int mem_base;
19240 xmlDocPtr out_doc; /* Document to generate XML text from */
19241 int n_out_doc;
19242 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19243 int n_doc_txt_ptr;
19244 int * doc_txt_len; /* Length of the generated XML text */
19245 int n_doc_txt_len;
19246 char * txt_encoding; /* Character encoding to use when generating XML text */
19247 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019248
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019249 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19250 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19251 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19252 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19253 mem_base = xmlMemBlocks();
19254 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19255 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19256 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19257 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19258
19259 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, txt_encoding);
19260 call_tests++;
19261 des_xmlDocPtr(n_out_doc, out_doc, 0);
19262 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19263 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
19264 des_const_char_ptr(n_txt_encoding, txt_encoding, 3);
19265 xmlResetLastError();
19266 if (mem_base != xmlMemBlocks()) {
19267 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
19268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019269 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019270 printf(" %d", n_out_doc);
19271 printf(" %d", n_doc_txt_ptr);
19272 printf(" %d", n_doc_txt_len);
19273 printf(" %d", n_txt_encoding);
19274 printf("\n");
19275 }
19276 }
19277 }
19278 }
19279 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019280 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019281#endif
19282
Daniel Veillard42595322004-11-08 10:52:06 +000019283 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019284}
19285
19286
19287static int
19288test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019289 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019290
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019291#ifdef LIBXML_OUTPUT_ENABLED
19292 int mem_base;
19293 int ret_val;
19294 FILE * f; /* the FILE* */
19295 int n_f;
19296 xmlDocPtr cur; /* the document */
19297 int n_cur;
19298 int format; /* should formatting spaces been added */
19299 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019300
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019301 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19302 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19303 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19304 mem_base = xmlMemBlocks();
19305 f = gen_FILE_ptr(n_f, 0);
19306 cur = gen_xmlDocPtr(n_cur, 1);
19307 format = gen_int(n_format, 2);
19308
19309 ret_val = xmlDocFormatDump(f, cur, format);
19310 desret_int(ret_val);
19311 call_tests++;
19312 des_FILE_ptr(n_f, f, 0);
19313 des_xmlDocPtr(n_cur, cur, 1);
19314 des_int(n_format, format, 2);
19315 xmlResetLastError();
19316 if (mem_base != xmlMemBlocks()) {
19317 printf("Leak of %d blocks found in xmlDocFormatDump",
19318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019319 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019320 printf(" %d", n_f);
19321 printf(" %d", n_cur);
19322 printf(" %d", n_format);
19323 printf("\n");
19324 }
19325 }
19326 }
19327 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019328 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019329#endif
19330
Daniel Veillard42595322004-11-08 10:52:06 +000019331 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019332}
19333
19334
19335static int
19336test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019337 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019338
19339 int mem_base;
19340 xmlNodePtr ret_val;
19341 xmlDocPtr doc; /* the document */
19342 int n_doc;
19343
19344 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19345 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019346 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019347
19348 ret_val = xmlDocGetRootElement(doc);
19349 desret_xmlNodePtr(ret_val);
19350 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019351 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019352 xmlResetLastError();
19353 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019354 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019356 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019357 printf(" %d", n_doc);
19358 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019359 }
19360 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019361 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019362
Daniel Veillard42595322004-11-08 10:52:06 +000019363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019364}
19365
19366
19367static int
19368test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019370
19371#ifdef LIBXML_TREE_ENABLED
19372 int mem_base;
19373 xmlNodePtr ret_val;
19374 xmlDocPtr doc; /* the document */
19375 int n_doc;
19376 xmlNodePtr root; /* the new document root element */
19377 int n_root;
19378
19379 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019380 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019381 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019382 doc = gen_xmlDocPtr(n_doc, 0);
19383 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019384
19385 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019386 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019387 desret_xmlNodePtr(ret_val);
19388 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019389 des_xmlDocPtr(n_doc, doc, 0);
19390 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019391 xmlResetLastError();
19392 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019393 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019395 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019396 printf(" %d", n_doc);
19397 printf(" %d", n_root);
19398 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019399 }
19400 }
19401 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019402 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019403#endif
19404
Daniel Veillard42595322004-11-08 10:52:06 +000019405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019406}
19407
19408
19409static int
19410test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019412
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019413#ifdef LIBXML_OUTPUT_ENABLED
19414 int mem_base;
19415 FILE * f; /* the FILE * for the output */
19416 int n_f;
19417 xmlDocPtr doc; /* the document */
19418 int n_doc;
19419 xmlNodePtr cur; /* the current node */
19420 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019421
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019422 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19423 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19424 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19425 mem_base = xmlMemBlocks();
19426 f = gen_FILE_ptr(n_f, 0);
19427 doc = gen_xmlDocPtr(n_doc, 1);
19428 cur = gen_xmlNodePtr(n_cur, 2);
19429
19430 xmlElemDump(f, doc, cur);
19431 call_tests++;
19432 des_FILE_ptr(n_f, f, 0);
19433 des_xmlDocPtr(n_doc, doc, 1);
19434 des_xmlNodePtr(n_cur, cur, 2);
19435 xmlResetLastError();
19436 if (mem_base != xmlMemBlocks()) {
19437 printf("Leak of %d blocks found in xmlElemDump",
19438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019439 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019440 printf(" %d", n_f);
19441 printf(" %d", n_doc);
19442 printf(" %d", n_cur);
19443 printf("\n");
19444 }
19445 }
19446 }
19447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019448 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019449#endif
19450
Daniel Veillard42595322004-11-08 10:52:06 +000019451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019452}
19453
19454
19455static int
19456test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019458
Daniel Veillard57b25162004-11-06 14:50:18 +000019459 int mem_base;
19460 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019461
Daniel Veillard57b25162004-11-06 14:50:18 +000019462 mem_base = xmlMemBlocks();
19463
19464 ret_val = xmlGetBufferAllocationScheme();
19465 desret_xmlBufferAllocationScheme(ret_val);
19466 call_tests++;
19467 xmlResetLastError();
19468 if (mem_base != xmlMemBlocks()) {
19469 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019471 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019472 printf("\n");
19473 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019474 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019475
Daniel Veillard42595322004-11-08 10:52:06 +000019476 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019477}
19478
19479
19480static int
19481test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019482 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019483
19484 int mem_base;
19485 int ret_val;
19486
19487 mem_base = xmlMemBlocks();
19488
19489 ret_val = xmlGetCompressMode();
19490 desret_int(ret_val);
19491 call_tests++;
19492 xmlResetLastError();
19493 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019494 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019495 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019496 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019497 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019498 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019499 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019500
Daniel Veillard42595322004-11-08 10:52:06 +000019501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019502}
19503
19504
19505static int
19506test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019507 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019508
19509 int mem_base;
19510 int ret_val;
19511 xmlDocPtr doc; /* the document */
19512 int n_doc;
19513
19514 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19515 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019516 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019517
19518 ret_val = xmlGetDocCompressMode(doc);
19519 desret_int(ret_val);
19520 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019521 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019522 xmlResetLastError();
19523 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019524 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019525 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019526 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019527 printf(" %d", n_doc);
19528 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019529 }
19530 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019531 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019532
Daniel Veillard42595322004-11-08 10:52:06 +000019533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019534}
19535
19536
19537static int
19538test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019539 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019540
Daniel Veillard34099b42004-11-04 17:34:35 +000019541 int mem_base;
19542 xmlDtdPtr ret_val;
19543 xmlDocPtr doc; /* the document pointer */
19544 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019545
Daniel Veillard34099b42004-11-04 17:34:35 +000019546 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19547 mem_base = xmlMemBlocks();
19548 doc = gen_xmlDocPtr(n_doc, 0);
19549
19550 ret_val = xmlGetIntSubset(doc);
19551 desret_xmlDtdPtr(ret_val);
19552 call_tests++;
19553 des_xmlDocPtr(n_doc, doc, 0);
19554 xmlResetLastError();
19555 if (mem_base != xmlMemBlocks()) {
19556 printf("Leak of %d blocks found in xmlGetIntSubset",
19557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019558 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019559 printf(" %d", n_doc);
19560 printf("\n");
19561 }
19562 }
Daniel Veillard34099b42004-11-04 17:34:35 +000019563 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019564
Daniel Veillard42595322004-11-08 10:52:06 +000019565 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019566}
19567
19568
19569static int
19570test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019571 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019572
19573 int mem_base;
19574 xmlNodePtr ret_val;
19575 xmlNodePtr parent; /* the parent node */
19576 int n_parent;
19577
19578 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19579 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019580 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019581
19582 ret_val = xmlGetLastChild(parent);
19583 desret_xmlNodePtr(ret_val);
19584 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019585 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019586 xmlResetLastError();
19587 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019588 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019590 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019591 printf(" %d", n_parent);
19592 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019593 }
19594 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019595 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019596
Daniel Veillard42595322004-11-08 10:52:06 +000019597 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019598}
19599
19600
19601static int
19602test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019603 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019604
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019605 int mem_base;
19606 long ret_val;
19607 xmlNodePtr node; /* valid node */
19608 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019609
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019610 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19611 mem_base = xmlMemBlocks();
19612 node = gen_xmlNodePtr(n_node, 0);
19613
19614 ret_val = xmlGetLineNo(node);
19615 desret_long(ret_val);
19616 call_tests++;
19617 des_xmlNodePtr(n_node, node, 0);
19618 xmlResetLastError();
19619 if (mem_base != xmlMemBlocks()) {
19620 printf("Leak of %d blocks found in xmlGetLineNo",
19621 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019622 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019623 printf(" %d", n_node);
19624 printf("\n");
19625 }
19626 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019627 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019628
Daniel Veillard42595322004-11-08 10:52:06 +000019629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019630}
19631
19632
19633static int
19634test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019636
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019637 int mem_base;
19638 xmlChar * ret_val;
19639 xmlNodePtr node; /* the node */
19640 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019641 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019642 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019643
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019644 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19645 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19646 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019647 node = gen_xmlNodePtr(n_node, 0);
19648 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019649
19650 ret_val = xmlGetNoNsProp(node, name);
19651 desret_xmlChar_ptr(ret_val);
19652 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019653 des_xmlNodePtr(n_node, node, 0);
19654 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019655 xmlResetLastError();
19656 if (mem_base != xmlMemBlocks()) {
19657 printf("Leak of %d blocks found in xmlGetNoNsProp",
19658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019659 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019660 printf(" %d", n_node);
19661 printf(" %d", n_name);
19662 printf("\n");
19663 }
19664 }
19665 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019666 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019667
Daniel Veillard42595322004-11-08 10:52:06 +000019668 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019669}
19670
19671
19672static int
19673test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019674 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019675
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019676#ifdef LIBXML_TREE_ENABLED
19677 int mem_base;
19678 xmlChar * ret_val;
19679 xmlNodePtr node; /* a node */
19680 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019681
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019682 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19683 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019684 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019685
19686 ret_val = xmlGetNodePath(node);
19687 desret_xmlChar_ptr(ret_val);
19688 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019689 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019690 xmlResetLastError();
19691 if (mem_base != xmlMemBlocks()) {
19692 printf("Leak of %d blocks found in xmlGetNodePath",
19693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019694 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019695 printf(" %d", n_node);
19696 printf("\n");
19697 }
19698 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019699 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019700#endif
19701
Daniel Veillard42595322004-11-08 10:52:06 +000019702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019703}
19704
19705
19706static int
19707test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019709
19710
19711 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019713}
19714
19715
19716static int
19717test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019719
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019720 int mem_base;
19721 xmlChar * ret_val;
19722 xmlNodePtr node; /* the node */
19723 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019724 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019725 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019726 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019727 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019728
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019729 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19730 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19731 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19732 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019733 node = gen_xmlNodePtr(n_node, 0);
19734 name = gen_const_xmlChar_ptr(n_name, 1);
19735 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019736
19737 ret_val = xmlGetNsProp(node, name, nameSpace);
19738 desret_xmlChar_ptr(ret_val);
19739 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019740 des_xmlNodePtr(n_node, node, 0);
19741 des_const_xmlChar_ptr(n_name, name, 1);
19742 des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019743 xmlResetLastError();
19744 if (mem_base != xmlMemBlocks()) {
19745 printf("Leak of %d blocks found in xmlGetNsProp",
19746 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019747 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019748 printf(" %d", n_node);
19749 printf(" %d", n_name);
19750 printf(" %d", n_nameSpace);
19751 printf("\n");
19752 }
19753 }
19754 }
19755 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019756 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019757
Daniel Veillard42595322004-11-08 10:52:06 +000019758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019759}
19760
19761
19762static int
19763test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019765
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019766 int mem_base;
19767 xmlChar * ret_val;
19768 xmlNodePtr node; /* the node */
19769 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019770 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019771 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019772
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019773 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19774 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19775 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019776 node = gen_xmlNodePtr(n_node, 0);
19777 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019778
19779 ret_val = xmlGetProp(node, name);
19780 desret_xmlChar_ptr(ret_val);
19781 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019782 des_xmlNodePtr(n_node, node, 0);
19783 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019784 xmlResetLastError();
19785 if (mem_base != xmlMemBlocks()) {
19786 printf("Leak of %d blocks found in xmlGetProp",
19787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019788 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019789 printf(" %d", n_node);
19790 printf(" %d", n_name);
19791 printf("\n");
19792 }
19793 }
19794 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019795 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019796
Daniel Veillard42595322004-11-08 10:52:06 +000019797 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019798}
19799
19800
19801static int
19802test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019803 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019804
Daniel Veillard57b25162004-11-06 14:50:18 +000019805 int mem_base;
19806 xmlAttrPtr ret_val;
19807 xmlNodePtr node; /* the node */
19808 int n_node;
19809 xmlChar * name; /* the attribute name */
19810 int n_name;
19811 xmlChar * nameSpace; /* the URI of the namespace */
19812 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019813
Daniel Veillard57b25162004-11-06 14:50:18 +000019814 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19815 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19816 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19817 mem_base = xmlMemBlocks();
19818 node = gen_xmlNodePtr(n_node, 0);
19819 name = gen_const_xmlChar_ptr(n_name, 1);
19820 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19821
19822 ret_val = xmlHasNsProp(node, name, nameSpace);
19823 desret_xmlAttrPtr(ret_val);
19824 call_tests++;
19825 des_xmlNodePtr(n_node, node, 0);
19826 des_const_xmlChar_ptr(n_name, name, 1);
19827 des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
19828 xmlResetLastError();
19829 if (mem_base != xmlMemBlocks()) {
19830 printf("Leak of %d blocks found in xmlHasNsProp",
19831 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019832 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019833 printf(" %d", n_node);
19834 printf(" %d", n_name);
19835 printf(" %d", n_nameSpace);
19836 printf("\n");
19837 }
19838 }
19839 }
19840 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019841 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019842
Daniel Veillard42595322004-11-08 10:52:06 +000019843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019844}
19845
19846
19847static int
19848test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019850
Daniel Veillard57b25162004-11-06 14:50:18 +000019851 int mem_base;
19852 xmlAttrPtr ret_val;
19853 xmlNodePtr node; /* the node */
19854 int n_node;
19855 xmlChar * name; /* the attribute name */
19856 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019857
Daniel Veillard57b25162004-11-06 14:50:18 +000019858 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19859 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19860 mem_base = xmlMemBlocks();
19861 node = gen_xmlNodePtr(n_node, 0);
19862 name = gen_const_xmlChar_ptr(n_name, 1);
19863
19864 ret_val = xmlHasProp(node, name);
19865 desret_xmlAttrPtr(ret_val);
19866 call_tests++;
19867 des_xmlNodePtr(n_node, node, 0);
19868 des_const_xmlChar_ptr(n_name, name, 1);
19869 xmlResetLastError();
19870 if (mem_base != xmlMemBlocks()) {
19871 printf("Leak of %d blocks found in xmlHasProp",
19872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019873 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019874 printf(" %d", n_node);
19875 printf(" %d", n_name);
19876 printf("\n");
19877 }
19878 }
19879 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019880 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019881
Daniel Veillard42595322004-11-08 10:52:06 +000019882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019883}
19884
19885
19886static int
19887test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019889
19890 int mem_base;
19891 int ret_val;
19892 xmlNodePtr node; /* the node */
19893 int n_node;
19894
19895 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19896 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019897 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019898
19899 ret_val = xmlIsBlankNode(node);
19900 desret_int(ret_val);
19901 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019902 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019903 xmlResetLastError();
19904 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019905 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019906 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019907 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019908 printf(" %d", n_node);
19909 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019910 }
19911 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019912 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019913
Daniel Veillard42595322004-11-08 10:52:06 +000019914 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019915}
19916
19917
19918static int
19919test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019920 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019921
19922 int mem_base;
19923 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019924 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019925 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019926 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019927 int n_publicID;
19928
19929 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19930 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19931 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019932 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19933 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019934
19935 ret_val = xmlIsXHTML(systemID, publicID);
19936 desret_int(ret_val);
19937 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019938 des_const_xmlChar_ptr(n_systemID, systemID, 0);
19939 des_const_xmlChar_ptr(n_publicID, publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019940 xmlResetLastError();
19941 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019942 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019943 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019944 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019945 printf(" %d", n_systemID);
19946 printf(" %d", n_publicID);
19947 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019948 }
19949 }
19950 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019951 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019952
Daniel Veillard42595322004-11-08 10:52:06 +000019953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019954}
19955
19956
19957static int
19958test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019960
19961 int mem_base;
19962 xmlNodePtr ret_val;
19963 xmlDocPtr doc; /* the document */
19964 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019965 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019966 int n_content;
19967 int len; /* the length of the block */
19968 int n_len;
19969
19970 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19971 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19972 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19973 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019974 doc = gen_xmlDocPtr(n_doc, 0);
19975 content = gen_const_xmlChar_ptr(n_content, 1);
19976 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019977
19978 ret_val = xmlNewCDataBlock(doc, content, len);
19979 desret_xmlNodePtr(ret_val);
19980 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019981 des_xmlDocPtr(n_doc, doc, 0);
19982 des_const_xmlChar_ptr(n_content, content, 1);
19983 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019984 xmlResetLastError();
19985 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019986 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019988 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019989 printf(" %d", n_doc);
19990 printf(" %d", n_content);
19991 printf(" %d", n_len);
19992 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019993 }
19994 }
19995 }
19996 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019997 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019998
Daniel Veillard42595322004-11-08 10:52:06 +000019999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020000}
20001
20002
20003static int
20004test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020006
20007 int mem_base;
20008 xmlNodePtr ret_val;
20009 xmlDocPtr doc; /* the document */
20010 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020011 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020012 int n_name;
20013
20014 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20015 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20016 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020017 doc = gen_xmlDocPtr(n_doc, 0);
20018 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020019
20020 ret_val = xmlNewCharRef(doc, name);
20021 desret_xmlNodePtr(ret_val);
20022 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020023 des_xmlDocPtr(n_doc, doc, 0);
20024 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020025 xmlResetLastError();
20026 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020027 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020029 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020030 printf(" %d", n_doc);
20031 printf(" %d", n_name);
20032 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020033 }
20034 }
20035 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020036 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020037
Daniel Veillard42595322004-11-08 10:52:06 +000020038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020039}
20040
20041
20042static int
20043test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020045
Daniel Veillarda521d282004-11-09 14:59:59 +000020046#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020047 int mem_base;
20048 xmlNodePtr ret_val;
20049 xmlNodePtr parent; /* the parent node */
20050 int n_parent;
20051 xmlNsPtr ns; /* a namespace if any */
20052 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020053 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020054 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020055 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020056 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020057
Daniel Veillard27f20102004-11-05 11:50:11 +000020058 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20059 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20060 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20061 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20062 mem_base = xmlMemBlocks();
20063 parent = gen_xmlNodePtr(n_parent, 0);
20064 ns = gen_xmlNsPtr(n_ns, 1);
20065 name = gen_const_xmlChar_ptr(n_name, 2);
20066 content = gen_const_xmlChar_ptr(n_content, 3);
20067
20068 ret_val = xmlNewChild(parent, ns, name, content);
20069 desret_xmlNodePtr(ret_val);
20070 call_tests++;
20071 des_xmlNodePtr(n_parent, parent, 0);
20072 des_xmlNsPtr(n_ns, ns, 1);
20073 des_const_xmlChar_ptr(n_name, name, 2);
20074 des_const_xmlChar_ptr(n_content, content, 3);
20075 xmlResetLastError();
20076 if (mem_base != xmlMemBlocks()) {
20077 printf("Leak of %d blocks found in xmlNewChild",
20078 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020079 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020080 printf(" %d", n_parent);
20081 printf(" %d", n_ns);
20082 printf(" %d", n_name);
20083 printf(" %d", n_content);
20084 printf("\n");
20085 }
20086 }
20087 }
20088 }
20089 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020090 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020091#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020092
Daniel Veillard42595322004-11-08 10:52:06 +000020093 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020094}
20095
20096
20097static int
20098test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020099 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020100
20101 int mem_base;
20102 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020103 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020104 int n_content;
20105
20106 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20107 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020108 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020109
20110 ret_val = xmlNewComment(content);
20111 desret_xmlNodePtr(ret_val);
20112 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020113 des_const_xmlChar_ptr(n_content, content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020114 xmlResetLastError();
20115 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020116 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020118 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020119 printf(" %d", n_content);
20120 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020121 }
20122 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020123 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020124
Daniel Veillard42595322004-11-08 10:52:06 +000020125 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020126}
20127
20128
20129static int
20130test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020131 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020132
20133 int mem_base;
20134 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020135 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020136 int n_version;
20137
20138 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
20139 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020140 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020141
20142 ret_val = xmlNewDoc(version);
20143 desret_xmlDocPtr(ret_val);
20144 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020145 des_const_xmlChar_ptr(n_version, version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020146 xmlResetLastError();
20147 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020148 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020149 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020150 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020151 printf(" %d", n_version);
20152 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020153 }
20154 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020155 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020156
Daniel Veillard42595322004-11-08 10:52:06 +000020157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020158}
20159
20160
20161static int
20162test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020164
20165 int mem_base;
20166 xmlNodePtr ret_val;
20167 xmlDocPtr doc; /* the document */
20168 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020169 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020170 int n_content;
20171
20172 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20173 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20174 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020175 doc = gen_xmlDocPtr(n_doc, 0);
20176 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020177
20178 ret_val = xmlNewDocComment(doc, content);
20179 desret_xmlNodePtr(ret_val);
20180 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020181 des_xmlDocPtr(n_doc, doc, 0);
20182 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020183 xmlResetLastError();
20184 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020185 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020187 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020188 printf(" %d", n_doc);
20189 printf(" %d", n_content);
20190 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020191 }
20192 }
20193 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020194 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020195
Daniel Veillard42595322004-11-08 10:52:06 +000020196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020197}
20198
20199
20200static int
20201test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020203
20204#ifdef LIBXML_TREE_ENABLED
20205 int mem_base;
20206 xmlNodePtr ret_val;
20207 xmlDocPtr doc; /* the document owning the fragment */
20208 int n_doc;
20209
20210 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20211 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020212 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020213
20214 ret_val = xmlNewDocFragment(doc);
20215 desret_xmlNodePtr(ret_val);
20216 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020217 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020218 xmlResetLastError();
20219 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020220 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020222 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020223 printf(" %d", n_doc);
20224 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020225 }
20226 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020227 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020228#endif
20229
Daniel Veillard42595322004-11-08 10:52:06 +000020230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020231}
20232
20233
20234static int
20235test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020237
Daniel Veillard27f20102004-11-05 11:50:11 +000020238 int mem_base;
20239 xmlNodePtr ret_val;
20240 xmlDocPtr doc; /* the document */
20241 int n_doc;
20242 xmlNsPtr ns; /* namespace if any */
20243 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020244 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020245 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020246 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020247 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020248
Daniel Veillard27f20102004-11-05 11:50:11 +000020249 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20250 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20251 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20252 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20253 mem_base = xmlMemBlocks();
20254 doc = gen_xmlDocPtr(n_doc, 0);
20255 ns = gen_xmlNsPtr(n_ns, 1);
20256 name = gen_const_xmlChar_ptr(n_name, 2);
20257 content = gen_const_xmlChar_ptr(n_content, 3);
20258
20259 ret_val = xmlNewDocNode(doc, ns, name, content);
20260 desret_xmlNodePtr(ret_val);
20261 call_tests++;
20262 des_xmlDocPtr(n_doc, doc, 0);
20263 des_xmlNsPtr(n_ns, ns, 1);
20264 des_const_xmlChar_ptr(n_name, name, 2);
20265 des_const_xmlChar_ptr(n_content, content, 3);
20266 xmlResetLastError();
20267 if (mem_base != xmlMemBlocks()) {
20268 printf("Leak of %d blocks found in xmlNewDocNode",
20269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020270 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020271 printf(" %d", n_doc);
20272 printf(" %d", n_ns);
20273 printf(" %d", n_name);
20274 printf(" %d", n_content);
20275 printf("\n");
20276 }
20277 }
20278 }
20279 }
20280 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020281 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020282
Daniel Veillard42595322004-11-08 10:52:06 +000020283 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020284}
20285
20286
20287static int
20288test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020289 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020290
Daniel Veillard27f20102004-11-05 11:50:11 +000020291 int mem_base;
20292 xmlNodePtr ret_val;
20293 xmlDocPtr doc; /* the document */
20294 int n_doc;
20295 xmlNsPtr ns; /* namespace if any */
20296 int n_ns;
20297 xmlChar * name; /* the node name */
20298 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020299 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020300 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020301
Daniel Veillard27f20102004-11-05 11:50:11 +000020302 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20303 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20304 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20305 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20306 mem_base = xmlMemBlocks();
20307 doc = gen_xmlDocPtr(n_doc, 0);
20308 ns = gen_xmlNsPtr(n_ns, 1);
20309 name = gen_eaten_name(n_name, 2);
20310 content = gen_const_xmlChar_ptr(n_content, 3);
20311
20312 ret_val = xmlNewDocNodeEatName(doc, ns, name, content);
20313 desret_xmlNodePtr(ret_val);
20314 call_tests++;
20315 des_xmlDocPtr(n_doc, doc, 0);
20316 des_xmlNsPtr(n_ns, ns, 1);
20317 des_eaten_name(n_name, name, 2);
20318 des_const_xmlChar_ptr(n_content, content, 3);
20319 xmlResetLastError();
20320 if (mem_base != xmlMemBlocks()) {
20321 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020323 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020324 printf(" %d", n_doc);
20325 printf(" %d", n_ns);
20326 printf(" %d", n_name);
20327 printf(" %d", n_content);
20328 printf("\n");
20329 }
20330 }
20331 }
20332 }
20333 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020334 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020335
Daniel Veillard42595322004-11-08 10:52:06 +000020336 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020337}
20338
20339
20340static int
20341test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020342 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020343
20344 int mem_base;
20345 xmlNodePtr ret_val;
20346 xmlDocPtr doc; /* the target document */
20347 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020348 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020349 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020350 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020351 int n_content;
20352
20353 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20354 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20355 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20356 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020357 doc = gen_xmlDocPtr(n_doc, 0);
20358 name = gen_const_xmlChar_ptr(n_name, 1);
20359 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020360
20361 ret_val = xmlNewDocPI(doc, name, content);
20362 desret_xmlNodePtr(ret_val);
20363 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020364 des_xmlDocPtr(n_doc, doc, 0);
20365 des_const_xmlChar_ptr(n_name, name, 1);
20366 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020367 xmlResetLastError();
20368 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020369 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020370 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020371 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020372 printf(" %d", n_doc);
20373 printf(" %d", n_name);
20374 printf(" %d", n_content);
20375 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020376 }
20377 }
20378 }
20379 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020380 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020381
Daniel Veillard42595322004-11-08 10:52:06 +000020382 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020383}
20384
20385
20386static int
20387test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020388 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020389
Daniel Veillard57b25162004-11-06 14:50:18 +000020390 int mem_base;
20391 xmlAttrPtr ret_val;
20392 xmlDocPtr doc; /* the document */
20393 int n_doc;
20394 xmlChar * name; /* the name of the attribute */
20395 int n_name;
20396 xmlChar * value; /* the value of the attribute */
20397 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020398
Daniel Veillard57b25162004-11-06 14:50:18 +000020399 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20400 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20401 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20402 mem_base = xmlMemBlocks();
20403 doc = gen_xmlDocPtr(n_doc, 0);
20404 name = gen_const_xmlChar_ptr(n_name, 1);
20405 value = gen_const_xmlChar_ptr(n_value, 2);
20406
20407 ret_val = xmlNewDocProp(doc, name, value);
20408 desret_xmlAttrPtr(ret_val);
20409 call_tests++;
20410 des_xmlDocPtr(n_doc, doc, 0);
20411 des_const_xmlChar_ptr(n_name, name, 1);
20412 des_const_xmlChar_ptr(n_value, value, 2);
20413 xmlResetLastError();
20414 if (mem_base != xmlMemBlocks()) {
20415 printf("Leak of %d blocks found in xmlNewDocProp",
20416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020417 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020418 printf(" %d", n_doc);
20419 printf(" %d", n_name);
20420 printf(" %d", n_value);
20421 printf("\n");
20422 }
20423 }
20424 }
20425 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020426 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020427
Daniel Veillard42595322004-11-08 10:52:06 +000020428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020429}
20430
20431
20432static int
20433test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020435
Daniel Veillarda521d282004-11-09 14:59:59 +000020436#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020437 int mem_base;
20438 xmlNodePtr ret_val;
20439 xmlDocPtr doc; /* the document */
20440 int n_doc;
20441 xmlNsPtr ns; /* namespace if any */
20442 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020443 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020444 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020445 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020446 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020447
Daniel Veillard27f20102004-11-05 11:50:11 +000020448 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20449 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20450 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20451 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20452 mem_base = xmlMemBlocks();
20453 doc = gen_xmlDocPtr(n_doc, 0);
20454 ns = gen_xmlNsPtr(n_ns, 1);
20455 name = gen_const_xmlChar_ptr(n_name, 2);
20456 content = gen_const_xmlChar_ptr(n_content, 3);
20457
20458 ret_val = xmlNewDocRawNode(doc, ns, name, content);
20459 desret_xmlNodePtr(ret_val);
20460 call_tests++;
20461 des_xmlDocPtr(n_doc, doc, 0);
20462 des_xmlNsPtr(n_ns, ns, 1);
20463 des_const_xmlChar_ptr(n_name, name, 2);
20464 des_const_xmlChar_ptr(n_content, content, 3);
20465 xmlResetLastError();
20466 if (mem_base != xmlMemBlocks()) {
20467 printf("Leak of %d blocks found in xmlNewDocRawNode",
20468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020469 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020470 printf(" %d", n_doc);
20471 printf(" %d", n_ns);
20472 printf(" %d", n_name);
20473 printf(" %d", n_content);
20474 printf("\n");
20475 }
20476 }
20477 }
20478 }
20479 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020480 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020481#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020482
Daniel Veillard42595322004-11-08 10:52:06 +000020483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020484}
20485
20486
20487static int
20488test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020490
20491 int mem_base;
20492 xmlNodePtr ret_val;
20493 xmlDocPtr doc; /* the document */
20494 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020495 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020496 int n_content;
20497
20498 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20499 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20500 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020501 doc = gen_xmlDocPtr(n_doc, 0);
20502 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020503
20504 ret_val = xmlNewDocText(doc, content);
20505 desret_xmlNodePtr(ret_val);
20506 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020507 des_xmlDocPtr(n_doc, doc, 0);
20508 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020509 xmlResetLastError();
20510 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020511 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020513 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020514 printf(" %d", n_doc);
20515 printf(" %d", n_content);
20516 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020517 }
20518 }
20519 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020520 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020521
Daniel Veillard42595322004-11-08 10:52:06 +000020522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020523}
20524
20525
20526static int
20527test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020529
20530 int mem_base;
20531 xmlNodePtr ret_val;
20532 xmlDocPtr doc; /* the document */
20533 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020534 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020535 int n_content;
20536 int len; /* the text len. */
20537 int n_len;
20538
20539 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20540 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20541 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20542 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020543 doc = gen_xmlDocPtr(n_doc, 0);
20544 content = gen_const_xmlChar_ptr(n_content, 1);
20545 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020546
20547 ret_val = xmlNewDocTextLen(doc, content, len);
20548 desret_xmlNodePtr(ret_val);
20549 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020550 des_xmlDocPtr(n_doc, doc, 0);
20551 des_const_xmlChar_ptr(n_content, content, 1);
20552 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020553 xmlResetLastError();
20554 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020555 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020556 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020557 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020558 printf(" %d", n_doc);
20559 printf(" %d", n_content);
20560 printf(" %d", n_len);
20561 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020562 }
20563 }
20564 }
20565 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020566 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020567
Daniel Veillard42595322004-11-08 10:52:06 +000020568 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020569}
20570
20571
20572static int
20573test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020575
Daniel Veillard34099b42004-11-04 17:34:35 +000020576 int mem_base;
20577 xmlDtdPtr ret_val;
20578 xmlDocPtr doc; /* the document pointer */
20579 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020580 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020581 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020582 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020583 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020584 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020585 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020586
Daniel Veillard34099b42004-11-04 17:34:35 +000020587 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20588 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20589 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20590 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20591 mem_base = xmlMemBlocks();
20592 doc = gen_xmlDocPtr(n_doc, 0);
20593 name = gen_const_xmlChar_ptr(n_name, 1);
20594 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20595 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20596
20597 ret_val = xmlNewDtd(doc, name, ExternalID, SystemID);
20598 desret_xmlDtdPtr(ret_val);
20599 call_tests++;
20600 des_xmlDocPtr(n_doc, doc, 0);
20601 des_const_xmlChar_ptr(n_name, name, 1);
20602 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
20603 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
20604 xmlResetLastError();
20605 if (mem_base != xmlMemBlocks()) {
20606 printf("Leak of %d blocks found in xmlNewDtd",
20607 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020608 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020609 printf(" %d", n_doc);
20610 printf(" %d", n_name);
20611 printf(" %d", n_ExternalID);
20612 printf(" %d", n_SystemID);
20613 printf("\n");
20614 }
20615 }
20616 }
20617 }
20618 }
Daniel Veillard34099b42004-11-04 17:34:35 +000020619 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020620
Daniel Veillard42595322004-11-08 10:52:06 +000020621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020622}
20623
20624
20625static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020626test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020628
Daniel Veillard27f20102004-11-05 11:50:11 +000020629 int mem_base;
20630 xmlNodePtr ret_val;
20631 xmlNsPtr ns; /* namespace if any */
20632 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020633 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020634 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020635
Daniel Veillard27f20102004-11-05 11:50:11 +000020636 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20637 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20638 mem_base = xmlMemBlocks();
20639 ns = gen_xmlNsPtr(n_ns, 0);
20640 name = gen_const_xmlChar_ptr(n_name, 1);
20641
20642 ret_val = xmlNewNode(ns, name);
20643 desret_xmlNodePtr(ret_val);
20644 call_tests++;
20645 des_xmlNsPtr(n_ns, ns, 0);
20646 des_const_xmlChar_ptr(n_name, name, 1);
20647 xmlResetLastError();
20648 if (mem_base != xmlMemBlocks()) {
20649 printf("Leak of %d blocks found in xmlNewNode",
20650 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020651 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020652 printf(" %d", n_ns);
20653 printf(" %d", n_name);
20654 printf("\n");
20655 }
20656 }
20657 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020658 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020659
Daniel Veillard42595322004-11-08 10:52:06 +000020660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020661}
20662
20663
20664static int
20665test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020667
Daniel Veillard27f20102004-11-05 11:50:11 +000020668 int mem_base;
20669 xmlNodePtr ret_val;
20670 xmlNsPtr ns; /* namespace if any */
20671 int n_ns;
20672 xmlChar * name; /* the node name */
20673 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020674
Daniel Veillard27f20102004-11-05 11:50:11 +000020675 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20676 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20677 mem_base = xmlMemBlocks();
20678 ns = gen_xmlNsPtr(n_ns, 0);
20679 name = gen_eaten_name(n_name, 1);
20680
20681 ret_val = xmlNewNodeEatName(ns, name);
20682 desret_xmlNodePtr(ret_val);
20683 call_tests++;
20684 des_xmlNsPtr(n_ns, ns, 0);
20685 des_eaten_name(n_name, name, 1);
20686 xmlResetLastError();
20687 if (mem_base != xmlMemBlocks()) {
20688 printf("Leak of %d blocks found in xmlNewNodeEatName",
20689 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020690 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020691 printf(" %d", n_ns);
20692 printf(" %d", n_name);
20693 printf("\n");
20694 }
20695 }
20696 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020697 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020698
Daniel Veillard42595322004-11-08 10:52:06 +000020699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020700}
20701
20702
20703static int
20704test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020706
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020707 int mem_base;
20708 xmlNsPtr ret_val;
20709 xmlNodePtr node; /* the element carrying the namespace */
20710 int n_node;
20711 xmlChar * href; /* the URI associated */
20712 int n_href;
20713 xmlChar * prefix; /* the prefix for the namespace */
20714 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020715
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020716 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20717 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20718 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20719 mem_base = xmlMemBlocks();
20720 node = gen_xmlNodePtr(n_node, 0);
20721 href = gen_const_xmlChar_ptr(n_href, 1);
20722 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20723
20724 ret_val = xmlNewNs(node, href, prefix);
20725 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20726 desret_xmlNsPtr(ret_val);
20727 call_tests++;
20728 des_xmlNodePtr(n_node, node, 0);
20729 des_const_xmlChar_ptr(n_href, href, 1);
20730 des_const_xmlChar_ptr(n_prefix, prefix, 2);
20731 xmlResetLastError();
20732 if (mem_base != xmlMemBlocks()) {
20733 printf("Leak of %d blocks found in xmlNewNs",
20734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020735 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020736 printf(" %d", n_node);
20737 printf(" %d", n_href);
20738 printf(" %d", n_prefix);
20739 printf("\n");
20740 }
20741 }
20742 }
20743 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020744 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020745
Daniel Veillard42595322004-11-08 10:52:06 +000020746 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020747}
20748
20749
20750static int
20751test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020752 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020753
Daniel Veillard57b25162004-11-06 14:50:18 +000020754 int mem_base;
20755 xmlAttrPtr ret_val;
20756 xmlNodePtr node; /* the holding node */
20757 int n_node;
20758 xmlNsPtr ns; /* the namespace */
20759 int n_ns;
20760 xmlChar * name; /* the name of the attribute */
20761 int n_name;
20762 xmlChar * value; /* the value of the attribute */
20763 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020764
Daniel Veillard57b25162004-11-06 14:50:18 +000020765 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20766 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20767 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20768 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20769 mem_base = xmlMemBlocks();
20770 node = gen_xmlNodePtr(n_node, 0);
20771 ns = gen_xmlNsPtr(n_ns, 1);
20772 name = gen_const_xmlChar_ptr(n_name, 2);
20773 value = gen_const_xmlChar_ptr(n_value, 3);
20774
20775 ret_val = xmlNewNsProp(node, ns, name, value);
20776 desret_xmlAttrPtr(ret_val);
20777 call_tests++;
20778 des_xmlNodePtr(n_node, node, 0);
20779 des_xmlNsPtr(n_ns, ns, 1);
20780 des_const_xmlChar_ptr(n_name, name, 2);
20781 des_const_xmlChar_ptr(n_value, value, 3);
20782 xmlResetLastError();
20783 if (mem_base != xmlMemBlocks()) {
20784 printf("Leak of %d blocks found in xmlNewNsProp",
20785 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020786 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020787 printf(" %d", n_node);
20788 printf(" %d", n_ns);
20789 printf(" %d", n_name);
20790 printf(" %d", n_value);
20791 printf("\n");
20792 }
20793 }
20794 }
20795 }
20796 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020797 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020798
Daniel Veillard42595322004-11-08 10:52:06 +000020799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020800}
20801
20802
20803static int
20804test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020806
Daniel Veillard57b25162004-11-06 14:50:18 +000020807 int mem_base;
20808 xmlAttrPtr ret_val;
20809 xmlNodePtr node; /* the holding node */
20810 int n_node;
20811 xmlNsPtr ns; /* the namespace */
20812 int n_ns;
20813 xmlChar * name; /* the name of the attribute */
20814 int n_name;
20815 xmlChar * value; /* the value of the attribute */
20816 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020817
Daniel Veillard57b25162004-11-06 14:50:18 +000020818 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20819 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20820 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20821 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20822 mem_base = xmlMemBlocks();
20823 node = gen_xmlNodePtr(n_node, 0);
20824 ns = gen_xmlNsPtr(n_ns, 1);
20825 name = gen_eaten_name(n_name, 2);
20826 value = gen_const_xmlChar_ptr(n_value, 3);
20827
20828 ret_val = xmlNewNsPropEatName(node, ns, name, value);
20829 desret_xmlAttrPtr(ret_val);
20830 call_tests++;
20831 des_xmlNodePtr(n_node, node, 0);
20832 des_xmlNsPtr(n_ns, ns, 1);
20833 des_eaten_name(n_name, name, 2);
20834 des_const_xmlChar_ptr(n_value, value, 3);
20835 xmlResetLastError();
20836 if (mem_base != xmlMemBlocks()) {
20837 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20838 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020839 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020840 printf(" %d", n_node);
20841 printf(" %d", n_ns);
20842 printf(" %d", n_name);
20843 printf(" %d", n_value);
20844 printf("\n");
20845 }
20846 }
20847 }
20848 }
20849 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020850 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020851
Daniel Veillard42595322004-11-08 10:52:06 +000020852 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020853}
20854
20855
20856static int
20857test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020858 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020859
20860 int mem_base;
20861 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020862 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020863 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020864 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020865 int n_content;
20866
20867 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20868 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20869 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020870 name = gen_const_xmlChar_ptr(n_name, 0);
20871 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020872
20873 ret_val = xmlNewPI(name, content);
20874 desret_xmlNodePtr(ret_val);
20875 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020876 des_const_xmlChar_ptr(n_name, name, 0);
20877 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020878 xmlResetLastError();
20879 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020880 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020881 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020882 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020883 printf(" %d", n_name);
20884 printf(" %d", n_content);
20885 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020886 }
20887 }
20888 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020889 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020890
Daniel Veillard42595322004-11-08 10:52:06 +000020891 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020892}
20893
20894
20895static int
20896test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020897 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020898
Daniel Veillarda521d282004-11-09 14:59:59 +000020899#ifdef LIBXML_TREE_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +000020900 int mem_base;
20901 xmlAttrPtr ret_val;
20902 xmlNodePtr node; /* the holding node */
20903 int n_node;
20904 xmlChar * name; /* the name of the attribute */
20905 int n_name;
20906 xmlChar * value; /* the value of the attribute */
20907 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020908
Daniel Veillard57b25162004-11-06 14:50:18 +000020909 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20910 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20911 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20912 mem_base = xmlMemBlocks();
20913 node = gen_xmlNodePtr(n_node, 0);
20914 name = gen_const_xmlChar_ptr(n_name, 1);
20915 value = gen_const_xmlChar_ptr(n_value, 2);
20916
20917 ret_val = xmlNewProp(node, name, value);
20918 desret_xmlAttrPtr(ret_val);
20919 call_tests++;
20920 des_xmlNodePtr(n_node, node, 0);
20921 des_const_xmlChar_ptr(n_name, name, 1);
20922 des_const_xmlChar_ptr(n_value, value, 2);
20923 xmlResetLastError();
20924 if (mem_base != xmlMemBlocks()) {
20925 printf("Leak of %d blocks found in xmlNewProp",
20926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020927 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020928 printf(" %d", n_node);
20929 printf(" %d", n_name);
20930 printf(" %d", n_value);
20931 printf("\n");
20932 }
20933 }
20934 }
20935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020936 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020937#endif
Daniel Veillard57b25162004-11-06 14:50:18 +000020938
Daniel Veillard42595322004-11-08 10:52:06 +000020939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020940}
20941
20942
20943static int
20944test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020946
20947 int mem_base;
20948 xmlNodePtr ret_val;
20949 xmlDocPtr doc; /* the document */
20950 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020951 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020952 int n_name;
20953
20954 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20955 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20956 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020957 doc = gen_xmlDocPtr(n_doc, 0);
20958 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020959
20960 ret_val = xmlNewReference(doc, name);
20961 desret_xmlNodePtr(ret_val);
20962 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020963 des_xmlDocPtr(n_doc, doc, 0);
20964 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020965 xmlResetLastError();
20966 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020967 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020969 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020970 printf(" %d", n_doc);
20971 printf(" %d", n_name);
20972 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020973 }
20974 }
20975 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020976 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020977
Daniel Veillard42595322004-11-08 10:52:06 +000020978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020979}
20980
20981
20982static int
20983test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020985
20986 int mem_base;
20987 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020988 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020989 int n_content;
20990
20991 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20992 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020993 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020994
20995 ret_val = xmlNewText(content);
20996 desret_xmlNodePtr(ret_val);
20997 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020998 des_const_xmlChar_ptr(n_content, content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020999 xmlResetLastError();
21000 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021001 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021003 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021004 printf(" %d", n_content);
21005 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021006 }
21007 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021008 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021009
Daniel Veillard42595322004-11-08 10:52:06 +000021010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021011}
21012
21013
21014static int
21015test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021016 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021017
Daniel Veillarda521d282004-11-09 14:59:59 +000021018#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000021019 int mem_base;
21020 xmlNodePtr ret_val;
21021 xmlNodePtr parent; /* the parent node */
21022 int n_parent;
21023 xmlNsPtr ns; /* a namespace if any */
21024 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021025 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000021026 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021027 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000021028 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021029
Daniel Veillard27f20102004-11-05 11:50:11 +000021030 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
21031 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
21032 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21033 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21034 mem_base = xmlMemBlocks();
21035 parent = gen_xmlNodePtr(n_parent, 0);
21036 ns = gen_xmlNsPtr(n_ns, 1);
21037 name = gen_const_xmlChar_ptr(n_name, 2);
21038 content = gen_const_xmlChar_ptr(n_content, 3);
21039
21040 ret_val = xmlNewTextChild(parent, ns, name, content);
21041 desret_xmlNodePtr(ret_val);
21042 call_tests++;
21043 des_xmlNodePtr(n_parent, parent, 0);
21044 des_xmlNsPtr(n_ns, ns, 1);
21045 des_const_xmlChar_ptr(n_name, name, 2);
21046 des_const_xmlChar_ptr(n_content, content, 3);
21047 xmlResetLastError();
21048 if (mem_base != xmlMemBlocks()) {
21049 printf("Leak of %d blocks found in xmlNewTextChild",
21050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021051 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000021052 printf(" %d", n_parent);
21053 printf(" %d", n_ns);
21054 printf(" %d", n_name);
21055 printf(" %d", n_content);
21056 printf("\n");
21057 }
21058 }
21059 }
21060 }
21061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021062 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021063#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000021064
Daniel Veillard42595322004-11-08 10:52:06 +000021065 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021066}
21067
21068
21069static int
21070test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021072
21073 int mem_base;
21074 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021075 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021076 int n_content;
21077 int len; /* the text len. */
21078 int n_len;
21079
21080 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21081 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21082 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021083 content = gen_const_xmlChar_ptr(n_content, 0);
21084 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021085
21086 ret_val = xmlNewTextLen(content, len);
21087 desret_xmlNodePtr(ret_val);
21088 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021089 des_const_xmlChar_ptr(n_content, content, 0);
21090 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021091 xmlResetLastError();
21092 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021093 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021094 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021095 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021096 printf(" %d", n_content);
21097 printf(" %d", n_len);
21098 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021099 }
21100 }
21101 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021102 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021103
Daniel Veillard42595322004-11-08 10:52:06 +000021104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021105}
21106
21107
21108static int
21109test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021111
21112 int mem_base;
21113 xmlNodePtr cur; /* the node being modified */
21114 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021115 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021116 int n_content;
21117
21118 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21119 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21120 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021121 cur = gen_xmlNodePtr(n_cur, 0);
21122 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021123
21124 xmlNodeAddContent(cur, content);
21125 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021126 des_xmlNodePtr(n_cur, cur, 0);
21127 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021128 xmlResetLastError();
21129 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021130 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021131 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021132 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021133 printf(" %d", n_cur);
21134 printf(" %d", n_content);
21135 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021136 }
21137 }
21138 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021139 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021140
Daniel Veillard42595322004-11-08 10:52:06 +000021141 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021142}
21143
21144
21145static int
21146test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021147 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021148
21149 int mem_base;
21150 xmlNodePtr cur; /* the node being modified */
21151 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021152 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021153 int n_content;
21154 int len; /* the size of @content */
21155 int n_len;
21156
21157 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21158 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21159 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21160 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021161 cur = gen_xmlNodePtr(n_cur, 0);
21162 content = gen_const_xmlChar_ptr(n_content, 1);
21163 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021164
21165 xmlNodeAddContentLen(cur, content, len);
21166 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021167 des_xmlNodePtr(n_cur, cur, 0);
21168 des_const_xmlChar_ptr(n_content, content, 1);
21169 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021170 xmlResetLastError();
21171 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021172 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021173 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021174 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021175 printf(" %d", n_cur);
21176 printf(" %d", n_content);
21177 printf(" %d", n_len);
21178 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021179 }
21180 }
21181 }
21182 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021183 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021184
Daniel Veillard42595322004-11-08 10:52:06 +000021185 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021186}
21187
21188
21189static int
21190test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021192
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021193 int mem_base;
21194 int ret_val;
21195 xmlBufferPtr buffer; /* a buffer */
21196 int n_buffer;
21197 xmlNodePtr cur; /* the node being read */
21198 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021199
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021200 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
21201 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21202 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021203 buffer = gen_xmlBufferPtr(n_buffer, 0);
21204 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021205
21206 ret_val = xmlNodeBufGetContent(buffer, cur);
21207 desret_int(ret_val);
21208 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021209 des_xmlBufferPtr(n_buffer, buffer, 0);
21210 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021211 xmlResetLastError();
21212 if (mem_base != xmlMemBlocks()) {
21213 printf("Leak of %d blocks found in xmlNodeBufGetContent",
21214 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021215 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021216 printf(" %d", n_buffer);
21217 printf(" %d", n_cur);
21218 printf("\n");
21219 }
21220 }
21221 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021222 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021223
Daniel Veillard42595322004-11-08 10:52:06 +000021224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021225}
21226
21227
21228static int
21229test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021231
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021232#ifdef LIBXML_OUTPUT_ENABLED
21233 int mem_base;
21234 int ret_val;
21235 xmlBufferPtr buf; /* the XML buffer output */
21236 int n_buf;
21237 xmlDocPtr doc; /* the document */
21238 int n_doc;
21239 xmlNodePtr cur; /* the current node */
21240 int n_cur;
21241 int level; /* the imbrication level for indenting */
21242 int n_level;
21243 int format; /* is formatting allowed */
21244 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021245
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021246 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
21247 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21248 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21249 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21250 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21251 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021252 buf = gen_xmlBufferPtr(n_buf, 0);
21253 doc = gen_xmlDocPtr(n_doc, 1);
21254 cur = gen_xmlNodePtr(n_cur, 2);
21255 level = gen_int(n_level, 3);
21256 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021257
21258 ret_val = xmlNodeDump(buf, doc, cur, level, format);
21259 desret_int(ret_val);
21260 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021261 des_xmlBufferPtr(n_buf, buf, 0);
21262 des_xmlDocPtr(n_doc, doc, 1);
21263 des_xmlNodePtr(n_cur, cur, 2);
21264 des_int(n_level, level, 3);
21265 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021266 xmlResetLastError();
21267 if (mem_base != xmlMemBlocks()) {
21268 printf("Leak of %d blocks found in xmlNodeDump",
21269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021270 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021271 printf(" %d", n_buf);
21272 printf(" %d", n_doc);
21273 printf(" %d", n_cur);
21274 printf(" %d", n_level);
21275 printf(" %d", n_format);
21276 printf("\n");
21277 }
21278 }
21279 }
21280 }
21281 }
21282 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021283 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021284#endif
21285
Daniel Veillard42595322004-11-08 10:52:06 +000021286 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021287}
21288
21289
21290static int
21291test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021292 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021293
Daniel Veillard3d97e662004-11-04 10:49:00 +000021294#ifdef LIBXML_OUTPUT_ENABLED
21295 int mem_base;
21296 xmlOutputBufferPtr buf; /* the XML buffer output */
21297 int n_buf;
21298 xmlDocPtr doc; /* the document */
21299 int n_doc;
21300 xmlNodePtr cur; /* the current node */
21301 int n_cur;
21302 int level; /* the imbrication level for indenting */
21303 int n_level;
21304 int format; /* is formatting allowed */
21305 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021306 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021307 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021308
Daniel Veillard3d97e662004-11-04 10:49:00 +000021309 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21310 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21311 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21312 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21313 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21314 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21315 mem_base = xmlMemBlocks();
21316 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21317 doc = gen_xmlDocPtr(n_doc, 1);
21318 cur = gen_xmlNodePtr(n_cur, 2);
21319 level = gen_int(n_level, 3);
21320 format = gen_int(n_format, 4);
21321 encoding = gen_const_char_ptr(n_encoding, 5);
21322
21323 xmlNodeDumpOutput(buf, doc, cur, level, format, encoding);
21324 call_tests++;
21325 des_xmlOutputBufferPtr(n_buf, buf, 0);
21326 des_xmlDocPtr(n_doc, doc, 1);
21327 des_xmlNodePtr(n_cur, cur, 2);
21328 des_int(n_level, level, 3);
21329 des_int(n_format, format, 4);
21330 des_const_char_ptr(n_encoding, encoding, 5);
21331 xmlResetLastError();
21332 if (mem_base != xmlMemBlocks()) {
21333 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021335 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021336 printf(" %d", n_buf);
21337 printf(" %d", n_doc);
21338 printf(" %d", n_cur);
21339 printf(" %d", n_level);
21340 printf(" %d", n_format);
21341 printf(" %d", n_encoding);
21342 printf("\n");
21343 }
21344 }
21345 }
21346 }
21347 }
21348 }
21349 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021350 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021351#endif
21352
Daniel Veillard42595322004-11-08 10:52:06 +000021353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021354}
21355
21356
21357static int
21358test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021360
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021361 int mem_base;
21362 xmlChar * ret_val;
21363 xmlDocPtr doc; /* the document the node pertains to */
21364 int n_doc;
21365 xmlNodePtr cur; /* the node being checked */
21366 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021367
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021368 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21369 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21370 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021371 doc = gen_xmlDocPtr(n_doc, 0);
21372 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021373
21374 ret_val = xmlNodeGetBase(doc, cur);
21375 desret_xmlChar_ptr(ret_val);
21376 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021377 des_xmlDocPtr(n_doc, doc, 0);
21378 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021379 xmlResetLastError();
21380 if (mem_base != xmlMemBlocks()) {
21381 printf("Leak of %d blocks found in xmlNodeGetBase",
21382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021383 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021384 printf(" %d", n_doc);
21385 printf(" %d", n_cur);
21386 printf("\n");
21387 }
21388 }
21389 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021390 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021391
Daniel Veillard42595322004-11-08 10:52:06 +000021392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021393}
21394
21395
21396static int
21397test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021399
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021400 int mem_base;
21401 xmlChar * ret_val;
21402 xmlNodePtr cur; /* the node being read */
21403 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021404
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021405 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21406 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021407 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021408
21409 ret_val = xmlNodeGetContent(cur);
21410 desret_xmlChar_ptr(ret_val);
21411 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021412 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021413 xmlResetLastError();
21414 if (mem_base != xmlMemBlocks()) {
21415 printf("Leak of %d blocks found in xmlNodeGetContent",
21416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021417 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021418 printf(" %d", n_cur);
21419 printf("\n");
21420 }
21421 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021422 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021423
Daniel Veillard42595322004-11-08 10:52:06 +000021424 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021425}
21426
21427
21428static int
21429test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021430 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021431
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021432 int mem_base;
21433 xmlChar * ret_val;
21434 xmlNodePtr cur; /* the node being checked */
21435 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021436
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021437 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21438 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021439 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021440
21441 ret_val = xmlNodeGetLang(cur);
21442 desret_xmlChar_ptr(ret_val);
21443 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021444 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021445 xmlResetLastError();
21446 if (mem_base != xmlMemBlocks()) {
21447 printf("Leak of %d blocks found in xmlNodeGetLang",
21448 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021449 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021450 printf(" %d", n_cur);
21451 printf("\n");
21452 }
21453 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021454 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021455
Daniel Veillard42595322004-11-08 10:52:06 +000021456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021457}
21458
21459
21460static int
21461test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021463
21464 int mem_base;
21465 int ret_val;
21466 xmlNodePtr cur; /* the node being checked */
21467 int n_cur;
21468
21469 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21470 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021471 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021472
21473 ret_val = xmlNodeGetSpacePreserve(cur);
21474 desret_int(ret_val);
21475 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021476 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021477 xmlResetLastError();
21478 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021479 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021480 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021481 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021482 printf(" %d", n_cur);
21483 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021484 }
21485 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021486 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021487
Daniel Veillard42595322004-11-08 10:52:06 +000021488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021489}
21490
21491
21492static int
21493test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021495
21496 int mem_base;
21497 int ret_val;
21498 xmlNodePtr node; /* the node */
21499 int n_node;
21500
21501 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21502 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021503 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021504
21505 ret_val = xmlNodeIsText(node);
21506 desret_int(ret_val);
21507 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021508 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021509 xmlResetLastError();
21510 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021511 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021513 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021514 printf(" %d", n_node);
21515 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021516 }
21517 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021518 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021519
Daniel Veillard42595322004-11-08 10:52:06 +000021520 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021521}
21522
21523
21524static int
21525test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021526 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021527
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021528#ifdef LIBXML_TREE_ENABLED
21529 int mem_base;
21530 xmlChar * ret_val;
21531 xmlDocPtr doc; /* the document */
21532 int n_doc;
21533 xmlNodePtr list; /* a Node list */
21534 int n_list;
21535 int inLine; /* should we replace entity contents or show their external form */
21536 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021537
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021538 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21539 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21540 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21541 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021542 doc = gen_xmlDocPtr(n_doc, 0);
21543 list = gen_xmlNodePtr(n_list, 1);
21544 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021545
21546 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21547 desret_xmlChar_ptr(ret_val);
21548 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021549 des_xmlDocPtr(n_doc, doc, 0);
21550 des_xmlNodePtr(n_list, list, 1);
21551 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021552 xmlResetLastError();
21553 if (mem_base != xmlMemBlocks()) {
21554 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021556 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021557 printf(" %d", n_doc);
21558 printf(" %d", n_list);
21559 printf(" %d", n_inLine);
21560 printf("\n");
21561 }
21562 }
21563 }
21564 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021565 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021566#endif
21567
Daniel Veillard42595322004-11-08 10:52:06 +000021568 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021569}
21570
21571
21572static int
21573test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021575
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021576 int mem_base;
21577 xmlChar * ret_val;
21578 xmlDocPtr doc; /* the document */
21579 int n_doc;
21580 xmlNodePtr list; /* a Node list */
21581 int n_list;
21582 int inLine; /* should we replace entity contents or show their external form */
21583 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021584
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021585 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21586 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21587 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21588 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021589 doc = gen_xmlDocPtr(n_doc, 0);
21590 list = gen_xmlNodePtr(n_list, 1);
21591 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021592
21593 ret_val = xmlNodeListGetString(doc, list, inLine);
21594 desret_xmlChar_ptr(ret_val);
21595 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021596 des_xmlDocPtr(n_doc, doc, 0);
21597 des_xmlNodePtr(n_list, list, 1);
21598 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021599 xmlResetLastError();
21600 if (mem_base != xmlMemBlocks()) {
21601 printf("Leak of %d blocks found in xmlNodeListGetString",
21602 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021603 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021604 printf(" %d", n_doc);
21605 printf(" %d", n_list);
21606 printf(" %d", n_inLine);
21607 printf("\n");
21608 }
21609 }
21610 }
21611 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021612 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021613
Daniel Veillard42595322004-11-08 10:52:06 +000021614 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021615}
21616
21617
21618static int
21619test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021621
21622#ifdef LIBXML_TREE_ENABLED
21623 int mem_base;
21624 xmlNodePtr cur; /* the node being changed */
21625 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021626 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021627 int n_uri;
21628
21629 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21630 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21631 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021632 cur = gen_xmlNodePtr(n_cur, 0);
21633 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021634
21635 xmlNodeSetBase(cur, uri);
21636 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021637 des_xmlNodePtr(n_cur, cur, 0);
21638 des_const_xmlChar_ptr(n_uri, uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021639 xmlResetLastError();
21640 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021641 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021643 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021644 printf(" %d", n_cur);
21645 printf(" %d", n_uri);
21646 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021647 }
21648 }
21649 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021650 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021651#endif
21652
Daniel Veillard42595322004-11-08 10:52:06 +000021653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021654}
21655
21656
21657static int
21658test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021660
21661 int mem_base;
21662 xmlNodePtr cur; /* the node being modified */
21663 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021664 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021665 int n_content;
21666
21667 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21668 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21669 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021670 cur = gen_xmlNodePtr(n_cur, 0);
21671 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021672
21673 xmlNodeSetContent(cur, content);
21674 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021675 des_xmlNodePtr(n_cur, cur, 0);
21676 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021677 xmlResetLastError();
21678 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021679 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021681 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021682 printf(" %d", n_cur);
21683 printf(" %d", n_content);
21684 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021685 }
21686 }
21687 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021688 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021689
Daniel Veillard42595322004-11-08 10:52:06 +000021690 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021691}
21692
21693
21694static int
21695test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021696 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021697
21698#ifdef LIBXML_TREE_ENABLED
21699 int mem_base;
21700 xmlNodePtr cur; /* the node being modified */
21701 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021702 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021703 int n_content;
21704 int len; /* the size of @content */
21705 int n_len;
21706
21707 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21708 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21709 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21710 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021711 cur = gen_xmlNodePtr(n_cur, 0);
21712 content = gen_const_xmlChar_ptr(n_content, 1);
21713 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021714
21715 xmlNodeSetContentLen(cur, content, len);
21716 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021717 des_xmlNodePtr(n_cur, cur, 0);
21718 des_const_xmlChar_ptr(n_content, content, 1);
21719 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021720 xmlResetLastError();
21721 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021722 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021724 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021725 printf(" %d", n_cur);
21726 printf(" %d", n_content);
21727 printf(" %d", n_len);
21728 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021729 }
21730 }
21731 }
21732 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021733 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021734#endif
21735
Daniel Veillard42595322004-11-08 10:52:06 +000021736 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021737}
21738
21739
21740static int
21741test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021742 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021743
21744#ifdef LIBXML_TREE_ENABLED
21745 int mem_base;
21746 xmlNodePtr cur; /* the node being changed */
21747 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021748 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021749 int n_lang;
21750
21751 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21752 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21753 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021754 cur = gen_xmlNodePtr(n_cur, 0);
21755 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021756
21757 xmlNodeSetLang(cur, lang);
21758 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021759 des_xmlNodePtr(n_cur, cur, 0);
21760 des_const_xmlChar_ptr(n_lang, lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021761 xmlResetLastError();
21762 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021763 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021765 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021766 printf(" %d", n_cur);
21767 printf(" %d", n_lang);
21768 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021769 }
21770 }
21771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021772 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021773#endif
21774
Daniel Veillard42595322004-11-08 10:52:06 +000021775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021776}
21777
21778
21779static int
21780test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021782
21783#ifdef LIBXML_TREE_ENABLED
21784 int mem_base;
21785 xmlNodePtr cur; /* the node being changed */
21786 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021787 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021788 int n_name;
21789
21790 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21791 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21792 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021793 cur = gen_xmlNodePtr(n_cur, 0);
21794 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021795
21796 xmlNodeSetName(cur, name);
21797 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021798 des_xmlNodePtr(n_cur, cur, 0);
21799 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021800 xmlResetLastError();
21801 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021802 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021804 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021805 printf(" %d", n_cur);
21806 printf(" %d", n_name);
21807 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021808 }
21809 }
21810 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021811 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021812#endif
21813
Daniel Veillard42595322004-11-08 10:52:06 +000021814 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021815}
21816
21817
21818static int
21819test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021820 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021821
21822#ifdef LIBXML_TREE_ENABLED
21823 int mem_base;
21824 xmlNodePtr cur; /* the node being changed */
21825 int n_cur;
21826 int val; /* the xml:space value ("0": default, 1: "preserve") */
21827 int n_val;
21828
21829 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21830 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21831 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021832 cur = gen_xmlNodePtr(n_cur, 0);
21833 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021834
21835 xmlNodeSetSpacePreserve(cur, val);
21836 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021837 des_xmlNodePtr(n_cur, cur, 0);
21838 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021839 xmlResetLastError();
21840 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021841 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021843 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021844 printf(" %d", n_cur);
21845 printf(" %d", n_val);
21846 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021847 }
21848 }
21849 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021850 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021851#endif
21852
Daniel Veillard42595322004-11-08 10:52:06 +000021853 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021854}
21855
21856
21857static int
21858test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021859 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021860
Daniel Veillarda521d282004-11-09 14:59:59 +000021861#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000021862 int mem_base;
21863 int ret_val;
21864 xmlDocPtr doc; /* the document */
21865 int n_doc;
21866 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21867 int n_tree;
21868
21869 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21870 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21871 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021872 doc = gen_xmlDocPtr(n_doc, 0);
21873 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021874
21875 ret_val = xmlReconciliateNs(doc, tree);
21876 desret_int(ret_val);
21877 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021878 des_xmlDocPtr(n_doc, doc, 0);
21879 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021880 xmlResetLastError();
21881 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021882 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021883 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021884 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021885 printf(" %d", n_doc);
21886 printf(" %d", n_tree);
21887 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021888 }
21889 }
21890 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021891 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021892#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000021893
Daniel Veillard42595322004-11-08 10:52:06 +000021894 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021895}
21896
21897
21898static int
21899test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021900 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021901
Daniel Veillardce244ad2004-11-05 10:03:46 +000021902#ifdef LIBXML_TREE_ENABLED
21903 int mem_base;
21904 int ret_val;
21905 xmlAttrPtr cur; /* an attribute */
21906 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021907
Daniel Veillardce244ad2004-11-05 10:03:46 +000021908 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21909 mem_base = xmlMemBlocks();
21910 cur = gen_xmlAttrPtr(n_cur, 0);
21911
21912 ret_val = xmlRemoveProp(cur);
21913 cur = NULL;
21914 desret_int(ret_val);
21915 call_tests++;
21916 des_xmlAttrPtr(n_cur, cur, 0);
21917 xmlResetLastError();
21918 if (mem_base != xmlMemBlocks()) {
21919 printf("Leak of %d blocks found in xmlRemoveProp",
21920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021921 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021922 printf(" %d", n_cur);
21923 printf("\n");
21924 }
21925 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021926 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021927#endif
21928
Daniel Veillard42595322004-11-08 10:52:06 +000021929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021930}
21931
21932
21933static int
21934test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021936
21937#ifdef LIBXML_TREE_ENABLED
21938 int mem_base;
21939 xmlNodePtr ret_val;
21940 xmlNodePtr old; /* the old node */
21941 int n_old;
21942 xmlNodePtr cur; /* the node */
21943 int n_cur;
21944
21945 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021946 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021947 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021948 old = gen_xmlNodePtr(n_old, 0);
21949 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021950
21951 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021952 if (cur != NULL) {
21953 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021954 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021955 if (old != NULL) {
21956 xmlUnlinkNode(old);
21957 xmlFreeNode(old) ; old = NULL ; }
21958 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021959 desret_xmlNodePtr(ret_val);
21960 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021961 des_xmlNodePtr(n_old, old, 0);
21962 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021963 xmlResetLastError();
21964 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021965 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021967 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021968 printf(" %d", n_old);
21969 printf(" %d", n_cur);
21970 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021971 }
21972 }
21973 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021974 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021975#endif
21976
Daniel Veillard42595322004-11-08 10:52:06 +000021977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021978}
21979
21980
21981static int
21982test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021984
21985#ifdef LIBXML_OUTPUT_ENABLED
21986 int mem_base;
21987 int ret_val;
21988 const char * filename; /* the filename (or URL) */
21989 int n_filename;
21990 xmlDocPtr cur; /* the document */
21991 int n_cur;
21992
21993 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21994 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21995 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021996 filename = gen_fileoutput(n_filename, 0);
21997 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021998
21999 ret_val = xmlSaveFile(filename, cur);
22000 desret_int(ret_val);
22001 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022002 des_fileoutput(n_filename, filename, 0);
22003 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022004 xmlResetLastError();
22005 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022006 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022007 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022008 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022009 printf(" %d", n_filename);
22010 printf(" %d", n_cur);
22011 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022012 }
22013 }
22014 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022015 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022016#endif
22017
Daniel Veillard42595322004-11-08 10:52:06 +000022018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022019}
22020
22021
22022static int
22023test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022024 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022025
22026#ifdef LIBXML_OUTPUT_ENABLED
22027 int mem_base;
22028 int ret_val;
22029 const char * filename; /* the filename (or URL) */
22030 int n_filename;
22031 xmlDocPtr cur; /* the document */
22032 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022033 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022034 int n_encoding;
22035
22036 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22037 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22038 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22039 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022040 filename = gen_fileoutput(n_filename, 0);
22041 cur = gen_xmlDocPtr(n_cur, 1);
22042 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022043
22044 ret_val = xmlSaveFileEnc(filename, cur, encoding);
22045 desret_int(ret_val);
22046 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022047 des_fileoutput(n_filename, filename, 0);
22048 des_xmlDocPtr(n_cur, cur, 1);
22049 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022050 xmlResetLastError();
22051 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022052 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022054 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022055 printf(" %d", n_filename);
22056 printf(" %d", n_cur);
22057 printf(" %d", n_encoding);
22058 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022059 }
22060 }
22061 }
22062 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022063 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022064#endif
22065
Daniel Veillard42595322004-11-08 10:52:06 +000022066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022067}
22068
22069
22070static int
22071test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022073
Daniel Veillard3d97e662004-11-04 10:49:00 +000022074#ifdef LIBXML_OUTPUT_ENABLED
22075 int mem_base;
22076 int ret_val;
22077 xmlOutputBufferPtr buf; /* an output I/O buffer */
22078 int n_buf;
22079 xmlDocPtr cur; /* the document */
22080 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022081 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022082 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022083
Daniel Veillard3d97e662004-11-04 10:49:00 +000022084 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22085 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22086 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22087 mem_base = xmlMemBlocks();
22088 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22089 cur = gen_xmlDocPtr(n_cur, 1);
22090 encoding = gen_const_char_ptr(n_encoding, 2);
22091
22092 ret_val = xmlSaveFileTo(buf, cur, encoding);
22093 buf = NULL;
22094 desret_int(ret_val);
22095 call_tests++;
22096 des_xmlOutputBufferPtr(n_buf, buf, 0);
22097 des_xmlDocPtr(n_cur, cur, 1);
22098 des_const_char_ptr(n_encoding, encoding, 2);
22099 xmlResetLastError();
22100 if (mem_base != xmlMemBlocks()) {
22101 printf("Leak of %d blocks found in xmlSaveFileTo",
22102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022103 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022104 printf(" %d", n_buf);
22105 printf(" %d", n_cur);
22106 printf(" %d", n_encoding);
22107 printf("\n");
22108 }
22109 }
22110 }
22111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022112 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022113#endif
22114
Daniel Veillard42595322004-11-08 10:52:06 +000022115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022116}
22117
22118
22119static int
22120test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022122
22123#ifdef LIBXML_OUTPUT_ENABLED
22124 int mem_base;
22125 int ret_val;
22126 const char * filename; /* the filename (or URL) */
22127 int n_filename;
22128 xmlDocPtr cur; /* the document */
22129 int n_cur;
22130 int format; /* should formatting spaces been added */
22131 int n_format;
22132
22133 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22134 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22135 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22136 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022137 filename = gen_fileoutput(n_filename, 0);
22138 cur = gen_xmlDocPtr(n_cur, 1);
22139 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022140
22141 ret_val = xmlSaveFormatFile(filename, cur, format);
22142 desret_int(ret_val);
22143 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022144 des_fileoutput(n_filename, filename, 0);
22145 des_xmlDocPtr(n_cur, cur, 1);
22146 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022147 xmlResetLastError();
22148 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022149 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022151 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022152 printf(" %d", n_filename);
22153 printf(" %d", n_cur);
22154 printf(" %d", n_format);
22155 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022156 }
22157 }
22158 }
22159 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022160 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022161#endif
22162
Daniel Veillard42595322004-11-08 10:52:06 +000022163 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022164}
22165
22166
22167static int
22168test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022170
22171#ifdef LIBXML_OUTPUT_ENABLED
22172 int mem_base;
22173 int ret_val;
22174 const char * filename; /* the filename or URL to output */
22175 int n_filename;
22176 xmlDocPtr cur; /* the document being saved */
22177 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022178 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022179 int n_encoding;
22180 int format; /* should formatting spaces be added. */
22181 int n_format;
22182
22183 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22184 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22185 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22186 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22187 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022188 filename = gen_fileoutput(n_filename, 0);
22189 cur = gen_xmlDocPtr(n_cur, 1);
22190 encoding = gen_const_char_ptr(n_encoding, 2);
22191 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022192
22193 ret_val = xmlSaveFormatFileEnc(filename, cur, encoding, format);
22194 desret_int(ret_val);
22195 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022196 des_fileoutput(n_filename, filename, 0);
22197 des_xmlDocPtr(n_cur, cur, 1);
22198 des_const_char_ptr(n_encoding, encoding, 2);
22199 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022200 xmlResetLastError();
22201 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022202 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022204 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022205 printf(" %d", n_filename);
22206 printf(" %d", n_cur);
22207 printf(" %d", n_encoding);
22208 printf(" %d", n_format);
22209 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022210 }
22211 }
22212 }
22213 }
22214 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022215 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022216#endif
22217
Daniel Veillard42595322004-11-08 10:52:06 +000022218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022219}
22220
22221
22222static int
22223test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022225
Daniel Veillard3d97e662004-11-04 10:49:00 +000022226#ifdef LIBXML_OUTPUT_ENABLED
22227 int mem_base;
22228 int ret_val;
22229 xmlOutputBufferPtr buf; /* an output I/O buffer */
22230 int n_buf;
22231 xmlDocPtr cur; /* the document */
22232 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022233 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022234 int n_encoding;
22235 int format; /* should formatting spaces been added */
22236 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022237
Daniel Veillard3d97e662004-11-04 10:49:00 +000022238 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22239 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22240 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22241 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22242 mem_base = xmlMemBlocks();
22243 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22244 cur = gen_xmlDocPtr(n_cur, 1);
22245 encoding = gen_const_char_ptr(n_encoding, 2);
22246 format = gen_int(n_format, 3);
22247
22248 ret_val = xmlSaveFormatFileTo(buf, cur, encoding, format);
22249 buf = NULL;
22250 desret_int(ret_val);
22251 call_tests++;
22252 des_xmlOutputBufferPtr(n_buf, buf, 0);
22253 des_xmlDocPtr(n_cur, cur, 1);
22254 des_const_char_ptr(n_encoding, encoding, 2);
22255 des_int(n_format, format, 3);
22256 xmlResetLastError();
22257 if (mem_base != xmlMemBlocks()) {
22258 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
22259 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022260 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022261 printf(" %d", n_buf);
22262 printf(" %d", n_cur);
22263 printf(" %d", n_encoding);
22264 printf(" %d", n_format);
22265 printf("\n");
22266 }
22267 }
22268 }
22269 }
22270 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022271 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022272#endif
22273
Daniel Veillard42595322004-11-08 10:52:06 +000022274 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022275}
22276
22277
22278static int
22279test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022280 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022281
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022282 int mem_base;
22283 xmlNsPtr ret_val;
22284 xmlDocPtr doc; /* the document */
22285 int n_doc;
22286 xmlNodePtr node; /* the current node */
22287 int n_node;
22288 xmlChar * nameSpace; /* the namespace prefix */
22289 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022290
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022291 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22292 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22293 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22294 mem_base = xmlMemBlocks();
22295 doc = gen_xmlDocPtr(n_doc, 0);
22296 node = gen_xmlNodePtr(n_node, 1);
22297 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22298
22299 ret_val = xmlSearchNs(doc, node, nameSpace);
22300 desret_xmlNsPtr(ret_val);
22301 call_tests++;
22302 des_xmlDocPtr(n_doc, doc, 0);
22303 des_xmlNodePtr(n_node, node, 1);
22304 des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
22305 xmlResetLastError();
22306 if (mem_base != xmlMemBlocks()) {
22307 printf("Leak of %d blocks found in xmlSearchNs",
22308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022309 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022310 printf(" %d", n_doc);
22311 printf(" %d", n_node);
22312 printf(" %d", n_nameSpace);
22313 printf("\n");
22314 }
22315 }
22316 }
22317 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022318 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022319
Daniel Veillard42595322004-11-08 10:52:06 +000022320 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022321}
22322
22323
22324static int
22325test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022326 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022327
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022328 int mem_base;
22329 xmlNsPtr ret_val;
22330 xmlDocPtr doc; /* the document */
22331 int n_doc;
22332 xmlNodePtr node; /* the current node */
22333 int n_node;
22334 xmlChar * href; /* the namespace value */
22335 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022336
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022337 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22338 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22339 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22340 mem_base = xmlMemBlocks();
22341 doc = gen_xmlDocPtr(n_doc, 0);
22342 node = gen_xmlNodePtr(n_node, 1);
22343 href = gen_const_xmlChar_ptr(n_href, 2);
22344
22345 ret_val = xmlSearchNsByHref(doc, node, href);
22346 desret_xmlNsPtr(ret_val);
22347 call_tests++;
22348 des_xmlDocPtr(n_doc, doc, 0);
22349 des_xmlNodePtr(n_node, node, 1);
22350 des_const_xmlChar_ptr(n_href, href, 2);
22351 xmlResetLastError();
22352 if (mem_base != xmlMemBlocks()) {
22353 printf("Leak of %d blocks found in xmlSearchNsByHref",
22354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022355 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022356 printf(" %d", n_doc);
22357 printf(" %d", n_node);
22358 printf(" %d", n_href);
22359 printf("\n");
22360 }
22361 }
22362 }
22363 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022364 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022365
Daniel Veillard42595322004-11-08 10:52:06 +000022366 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022367}
22368
22369
22370static int
22371test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022373
Daniel Veillard57b25162004-11-06 14:50:18 +000022374 int mem_base;
22375 xmlBufferAllocationScheme scheme; /* allocation method to use */
22376 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022377
Daniel Veillard57b25162004-11-06 14:50:18 +000022378 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22379 mem_base = xmlMemBlocks();
22380 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22381
22382 xmlSetBufferAllocationScheme(scheme);
22383 call_tests++;
22384 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22385 xmlResetLastError();
22386 if (mem_base != xmlMemBlocks()) {
22387 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022389 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022390 printf(" %d", n_scheme);
22391 printf("\n");
22392 }
22393 }
Daniel Veillard57b25162004-11-06 14:50:18 +000022394 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022395
Daniel Veillard42595322004-11-08 10:52:06 +000022396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022397}
22398
22399
22400static int
22401test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022403
22404 int mem_base;
22405 int mode; /* the compression ratio */
22406 int n_mode;
22407
22408 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22409 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022410 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022411
22412 xmlSetCompressMode(mode);
22413 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022414 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022415 xmlResetLastError();
22416 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022417 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022418 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022419 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022420 printf(" %d", n_mode);
22421 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022422 }
22423 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022424 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022425
Daniel Veillard42595322004-11-08 10:52:06 +000022426 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022427}
22428
22429
22430static int
22431test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022432 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022433
22434 int mem_base;
22435 xmlDocPtr doc; /* the document */
22436 int n_doc;
22437 int mode; /* the compression ratio */
22438 int n_mode;
22439
22440 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22441 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22442 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022443 doc = gen_xmlDocPtr(n_doc, 0);
22444 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022445
22446 xmlSetDocCompressMode(doc, mode);
22447 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022448 des_xmlDocPtr(n_doc, doc, 0);
22449 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022450 xmlResetLastError();
22451 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022452 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022454 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022455 printf(" %d", n_doc);
22456 printf(" %d", n_mode);
22457 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022458 }
22459 }
22460 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022461 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022462
Daniel Veillard42595322004-11-08 10:52:06 +000022463 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022464}
22465
22466
22467static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022468test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022469 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022470
Daniel Veillard27f20102004-11-05 11:50:11 +000022471 int mem_base;
22472 xmlNodePtr node; /* a node in the document */
22473 int n_node;
22474 xmlNsPtr ns; /* a namespace pointer */
22475 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022476
Daniel Veillard27f20102004-11-05 11:50:11 +000022477 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22478 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22479 mem_base = xmlMemBlocks();
22480 node = gen_xmlNodePtr(n_node, 0);
22481 ns = gen_xmlNsPtr(n_ns, 1);
22482
22483 xmlSetNs(node, ns);
22484 call_tests++;
22485 des_xmlNodePtr(n_node, node, 0);
22486 des_xmlNsPtr(n_ns, ns, 1);
22487 xmlResetLastError();
22488 if (mem_base != xmlMemBlocks()) {
22489 printf("Leak of %d blocks found in xmlSetNs",
22490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022491 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022492 printf(" %d", n_node);
22493 printf(" %d", n_ns);
22494 printf("\n");
22495 }
22496 }
22497 }
Daniel Veillard27f20102004-11-05 11:50:11 +000022498 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022499
Daniel Veillard42595322004-11-08 10:52:06 +000022500 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022501}
22502
22503
22504static int
22505test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022506 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022507
Daniel Veillard57b25162004-11-06 14:50:18 +000022508#ifdef LIBXML_TREE_ENABLED
22509 int mem_base;
22510 xmlAttrPtr ret_val;
22511 xmlNodePtr node; /* the node */
22512 int n_node;
22513 xmlNsPtr ns; /* the namespace definition */
22514 int n_ns;
22515 xmlChar * name; /* the attribute name */
22516 int n_name;
22517 xmlChar * value; /* the attribute value */
22518 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022519
Daniel Veillard57b25162004-11-06 14:50:18 +000022520 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22521 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22522 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22523 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22524 mem_base = xmlMemBlocks();
22525 node = gen_xmlNodePtr(n_node, 0);
22526 ns = gen_xmlNsPtr(n_ns, 1);
22527 name = gen_const_xmlChar_ptr(n_name, 2);
22528 value = gen_const_xmlChar_ptr(n_value, 3);
22529
22530 ret_val = xmlSetNsProp(node, ns, name, value);
22531 desret_xmlAttrPtr(ret_val);
22532 call_tests++;
22533 des_xmlNodePtr(n_node, node, 0);
22534 des_xmlNsPtr(n_ns, ns, 1);
22535 des_const_xmlChar_ptr(n_name, name, 2);
22536 des_const_xmlChar_ptr(n_value, value, 3);
22537 xmlResetLastError();
22538 if (mem_base != xmlMemBlocks()) {
22539 printf("Leak of %d blocks found in xmlSetNsProp",
22540 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022541 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022542 printf(" %d", n_node);
22543 printf(" %d", n_ns);
22544 printf(" %d", n_name);
22545 printf(" %d", n_value);
22546 printf("\n");
22547 }
22548 }
22549 }
22550 }
22551 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022552 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022553#endif
22554
Daniel Veillard42595322004-11-08 10:52:06 +000022555 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022556}
22557
22558
22559static int
22560test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022561 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022562
Daniel Veillard57b25162004-11-06 14:50:18 +000022563#ifdef LIBXML_TREE_ENABLED
22564 int mem_base;
22565 xmlAttrPtr ret_val;
22566 xmlNodePtr node; /* the node */
22567 int n_node;
22568 xmlChar * name; /* the attribute name */
22569 int n_name;
22570 xmlChar * value; /* the attribute value */
22571 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022572
Daniel Veillard57b25162004-11-06 14:50:18 +000022573 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22574 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22575 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22576 mem_base = xmlMemBlocks();
22577 node = gen_xmlNodePtr(n_node, 0);
22578 name = gen_const_xmlChar_ptr(n_name, 1);
22579 value = gen_const_xmlChar_ptr(n_value, 2);
22580
22581 ret_val = xmlSetProp(node, name, value);
22582 desret_xmlAttrPtr(ret_val);
22583 call_tests++;
22584 des_xmlNodePtr(n_node, node, 0);
22585 des_const_xmlChar_ptr(n_name, name, 1);
22586 des_const_xmlChar_ptr(n_value, value, 2);
22587 xmlResetLastError();
22588 if (mem_base != xmlMemBlocks()) {
22589 printf("Leak of %d blocks found in xmlSetProp",
22590 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022591 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022592 printf(" %d", n_node);
22593 printf(" %d", n_name);
22594 printf(" %d", n_value);
22595 printf("\n");
22596 }
22597 }
22598 }
22599 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022600 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022601#endif
22602
Daniel Veillard42595322004-11-08 10:52:06 +000022603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022604}
22605
22606
22607static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022608test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022610
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022611 int mem_base;
22612 xmlChar * ret_val;
22613 xmlChar * name; /* the full QName */
22614 int n_name;
22615 xmlChar ** prefix; /* a xmlChar ** */
22616 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022617
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022618 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22619 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22620 mem_base = xmlMemBlocks();
22621 name = gen_const_xmlChar_ptr(n_name, 0);
22622 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22623
22624 ret_val = xmlSplitQName2(name, prefix);
22625 desret_xmlChar_ptr(ret_val);
22626 call_tests++;
22627 des_const_xmlChar_ptr(n_name, name, 0);
22628 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22629 xmlResetLastError();
22630 if (mem_base != xmlMemBlocks()) {
22631 printf("Leak of %d blocks found in xmlSplitQName2",
22632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022633 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022634 printf(" %d", n_name);
22635 printf(" %d", n_prefix);
22636 printf("\n");
22637 }
22638 }
22639 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022640 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022641
Daniel Veillard42595322004-11-08 10:52:06 +000022642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022643}
22644
22645
22646static int
22647test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022649
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022650 int mem_base;
22651 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022652 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022653 int n_name;
22654 int * len; /* an int * */
22655 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022656
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022657 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22658 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22659 mem_base = xmlMemBlocks();
22660 name = gen_const_xmlChar_ptr(n_name, 0);
22661 len = gen_int_ptr(n_len, 1);
22662
22663 ret_val = xmlSplitQName3(name, len);
22664 desret_const_xmlChar_ptr(ret_val);
22665 call_tests++;
22666 des_const_xmlChar_ptr(n_name, name, 0);
22667 des_int_ptr(n_len, len, 1);
22668 xmlResetLastError();
22669 if (mem_base != xmlMemBlocks()) {
22670 printf("Leak of %d blocks found in xmlSplitQName3",
22671 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022672 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022673 printf(" %d", n_name);
22674 printf(" %d", n_len);
22675 printf("\n");
22676 }
22677 }
22678 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022679 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022680
Daniel Veillard42595322004-11-08 10:52:06 +000022681 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022682}
22683
22684
22685static int
22686test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022688
22689 int mem_base;
22690 xmlNodePtr ret_val;
22691 xmlDocPtr doc; /* the document */
22692 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022693 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022694 int n_value;
22695
22696 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22697 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22698 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022699 doc = gen_xmlDocPtr(n_doc, 0);
22700 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022701
22702 ret_val = xmlStringGetNodeList(doc, value);
22703 desret_xmlNodePtr(ret_val);
22704 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022705 des_xmlDocPtr(n_doc, doc, 0);
22706 des_const_xmlChar_ptr(n_value, value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022707 xmlResetLastError();
22708 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022709 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022711 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022712 printf(" %d", n_doc);
22713 printf(" %d", n_value);
22714 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022715 }
22716 }
22717 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022718 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022719
Daniel Veillard42595322004-11-08 10:52:06 +000022720 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022721}
22722
22723
22724static int
22725test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022726 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022727
22728 int mem_base;
22729 xmlNodePtr ret_val;
22730 xmlDocPtr doc; /* the document */
22731 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022732 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022733 int n_value;
22734 int len; /* the length of the string value */
22735 int n_len;
22736
22737 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22738 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22739 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22740 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022741 doc = gen_xmlDocPtr(n_doc, 0);
22742 value = gen_const_xmlChar_ptr(n_value, 1);
22743 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022744
22745 ret_val = xmlStringLenGetNodeList(doc, value, len);
22746 desret_xmlNodePtr(ret_val);
22747 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022748 des_xmlDocPtr(n_doc, doc, 0);
22749 des_const_xmlChar_ptr(n_value, value, 1);
22750 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022751 xmlResetLastError();
22752 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022753 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022754 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022755 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022756 printf(" %d", n_doc);
22757 printf(" %d", n_value);
22758 printf(" %d", n_len);
22759 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022760 }
22761 }
22762 }
22763 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022764 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022765
Daniel Veillard42595322004-11-08 10:52:06 +000022766 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022767}
22768
22769
22770static int
22771test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022772 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022773
22774 int mem_base;
22775 int ret_val;
22776 xmlNodePtr node; /* the node */
22777 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022778 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022779 int n_content;
22780 int len; /* @content length */
22781 int n_len;
22782
22783 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22784 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22785 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22786 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022787 node = gen_xmlNodePtr(n_node, 0);
22788 content = gen_const_xmlChar_ptr(n_content, 1);
22789 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022790
22791 ret_val = xmlTextConcat(node, content, len);
22792 desret_int(ret_val);
22793 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022794 des_xmlNodePtr(n_node, node, 0);
22795 des_const_xmlChar_ptr(n_content, content, 1);
22796 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022797 xmlResetLastError();
22798 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022799 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022800 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022801 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022802 printf(" %d", n_node);
22803 printf(" %d", n_content);
22804 printf(" %d", n_len);
22805 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022806 }
22807 }
22808 }
22809 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022810 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022811
Daniel Veillard42595322004-11-08 10:52:06 +000022812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022813}
22814
22815
22816static int
22817test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022819
22820 int mem_base;
22821 xmlNodePtr ret_val;
22822 xmlNodePtr first; /* the first text node */
22823 int n_first;
22824 xmlNodePtr second; /* the second text node being merged */
22825 int n_second;
22826
Daniel Veillarda03e3652004-11-02 18:45:30 +000022827 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22828 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022829 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022830 first = gen_xmlNodePtr_in(n_first, 0);
22831 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022832
22833 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022834 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022835 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022836 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022837 desret_xmlNodePtr(ret_val);
22838 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022839 des_xmlNodePtr_in(n_first, first, 0);
22840 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022841 xmlResetLastError();
22842 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022843 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022845 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022846 printf(" %d", n_first);
22847 printf(" %d", n_second);
22848 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022849 }
22850 }
22851 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022852 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022853
Daniel Veillard42595322004-11-08 10:52:06 +000022854 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022855}
22856
22857
22858static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022859test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022860 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022861
Daniel Veillard27f20102004-11-05 11:50:11 +000022862#ifdef LIBXML_TREE_ENABLED
22863 int mem_base;
22864 int ret_val;
22865 xmlNodePtr node; /* the node */
22866 int n_node;
22867 xmlNsPtr ns; /* the namespace definition */
22868 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022869 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022870 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022871
Daniel Veillard27f20102004-11-05 11:50:11 +000022872 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22873 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22874 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22875 mem_base = xmlMemBlocks();
22876 node = gen_xmlNodePtr(n_node, 0);
22877 ns = gen_xmlNsPtr(n_ns, 1);
22878 name = gen_const_xmlChar_ptr(n_name, 2);
22879
22880 ret_val = xmlUnsetNsProp(node, ns, name);
22881 desret_int(ret_val);
22882 call_tests++;
22883 des_xmlNodePtr(n_node, node, 0);
22884 des_xmlNsPtr(n_ns, ns, 1);
22885 des_const_xmlChar_ptr(n_name, name, 2);
22886 xmlResetLastError();
22887 if (mem_base != xmlMemBlocks()) {
22888 printf("Leak of %d blocks found in xmlUnsetNsProp",
22889 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022890 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022891 printf(" %d", n_node);
22892 printf(" %d", n_ns);
22893 printf(" %d", n_name);
22894 printf("\n");
22895 }
22896 }
22897 }
22898 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022899 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022900#endif
22901
Daniel Veillard42595322004-11-08 10:52:06 +000022902 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022903}
22904
22905
22906static int
22907test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022908 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022909
22910#ifdef LIBXML_TREE_ENABLED
22911 int mem_base;
22912 int ret_val;
22913 xmlNodePtr node; /* the node */
22914 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022915 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022916 int n_name;
22917
22918 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22919 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22920 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022921 node = gen_xmlNodePtr(n_node, 0);
22922 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022923
22924 ret_val = xmlUnsetProp(node, name);
22925 desret_int(ret_val);
22926 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022927 des_xmlNodePtr(n_node, node, 0);
22928 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022929 xmlResetLastError();
22930 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022931 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022933 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022934 printf(" %d", n_node);
22935 printf(" %d", n_name);
22936 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022937 }
22938 }
22939 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022940 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022941#endif
22942
Daniel Veillard42595322004-11-08 10:52:06 +000022943 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022944}
22945
22946
22947static int
22948test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022950
Daniel Veillarda521d282004-11-09 14:59:59 +000022951#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022952 int mem_base;
22953 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022954 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022955 int n_value;
22956 int space; /* allow spaces in front and end of the string */
22957 int n_space;
22958
22959 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22960 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22961 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022962 value = gen_const_xmlChar_ptr(n_value, 0);
22963 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022964
22965 ret_val = xmlValidateNCName(value, space);
22966 desret_int(ret_val);
22967 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022968 des_const_xmlChar_ptr(n_value, value, 0);
22969 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022970 xmlResetLastError();
22971 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022972 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022973 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022974 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022975 printf(" %d", n_value);
22976 printf(" %d", n_space);
22977 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022978 }
22979 }
22980 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022981 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022982#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022983
Daniel Veillard42595322004-11-08 10:52:06 +000022984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022985}
22986
22987
22988static int
22989test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022991
Daniel Veillarda521d282004-11-09 14:59:59 +000022992#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022993 int mem_base;
22994 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022995 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022996 int n_value;
22997 int space; /* allow spaces in front and end of the string */
22998 int n_space;
22999
23000 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23001 for (n_space = 0;n_space < gen_nb_int;n_space++) {
23002 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023003 value = gen_const_xmlChar_ptr(n_value, 0);
23004 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023005
23006 ret_val = xmlValidateNMToken(value, space);
23007 desret_int(ret_val);
23008 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023009 des_const_xmlChar_ptr(n_value, value, 0);
23010 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023011 xmlResetLastError();
23012 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023013 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023015 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023016 printf(" %d", n_value);
23017 printf(" %d", n_space);
23018 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023019 }
23020 }
23021 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023022 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023023#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023024
Daniel Veillard42595322004-11-08 10:52:06 +000023025 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023026}
23027
23028
23029static int
23030test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023031 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023032
Daniel Veillarda521d282004-11-09 14:59:59 +000023033#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000023034 int mem_base;
23035 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023036 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023037 int n_value;
23038 int space; /* allow spaces in front and end of the string */
23039 int n_space;
23040
23041 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23042 for (n_space = 0;n_space < gen_nb_int;n_space++) {
23043 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023044 value = gen_const_xmlChar_ptr(n_value, 0);
23045 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023046
23047 ret_val = xmlValidateName(value, space);
23048 desret_int(ret_val);
23049 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023050 des_const_xmlChar_ptr(n_value, value, 0);
23051 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023052 xmlResetLastError();
23053 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023054 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023055 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023056 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023057 printf(" %d", n_value);
23058 printf(" %d", n_space);
23059 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023060 }
23061 }
23062 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023063 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023064#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023065
Daniel Veillard42595322004-11-08 10:52:06 +000023066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023067}
23068
23069
23070static int
23071test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023073
Daniel Veillarda521d282004-11-09 14:59:59 +000023074#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000023075 int mem_base;
23076 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023077 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023078 int n_value;
23079 int space; /* allow spaces in front and end of the string */
23080 int n_space;
23081
23082 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23083 for (n_space = 0;n_space < gen_nb_int;n_space++) {
23084 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023085 value = gen_const_xmlChar_ptr(n_value, 0);
23086 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023087
23088 ret_val = xmlValidateQName(value, space);
23089 desret_int(ret_val);
23090 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023091 des_const_xmlChar_ptr(n_value, value, 0);
23092 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023093 xmlResetLastError();
23094 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023095 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023097 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023098 printf(" %d", n_value);
23099 printf(" %d", n_space);
23100 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023101 }
23102 }
23103 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023104 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023105#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023106
Daniel Veillard42595322004-11-08 10:52:06 +000023107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023108}
23109
23110static int
23111test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023112 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023113
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023114 if (quiet == 0) printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023115 test_ret += test_xmlAddChild();
23116 test_ret += test_xmlAddChildList();
23117 test_ret += test_xmlAddNextSibling();
23118 test_ret += test_xmlAddPrevSibling();
23119 test_ret += test_xmlAddSibling();
23120 test_ret += test_xmlAttrSerializeTxtContent();
23121 test_ret += test_xmlBufferAdd();
23122 test_ret += test_xmlBufferAddHead();
23123 test_ret += test_xmlBufferCCat();
23124 test_ret += test_xmlBufferCat();
23125 test_ret += test_xmlBufferContent();
23126 test_ret += test_xmlBufferCreate();
23127 test_ret += test_xmlBufferCreateSize();
23128 test_ret += test_xmlBufferCreateStatic();
23129 test_ret += test_xmlBufferEmpty();
23130 test_ret += test_xmlBufferGrow();
23131 test_ret += test_xmlBufferLength();
23132 test_ret += test_xmlBufferResize();
23133 test_ret += test_xmlBufferSetAllocationScheme();
23134 test_ret += test_xmlBufferShrink();
23135 test_ret += test_xmlBufferWriteCHAR();
23136 test_ret += test_xmlBufferWriteChar();
23137 test_ret += test_xmlBufferWriteQuotedString();
23138 test_ret += test_xmlBuildQName();
23139 test_ret += test_xmlCopyDoc();
23140 test_ret += test_xmlCopyDtd();
23141 test_ret += test_xmlCopyNamespace();
23142 test_ret += test_xmlCopyNamespaceList();
23143 test_ret += test_xmlCopyNode();
23144 test_ret += test_xmlCopyNodeList();
23145 test_ret += test_xmlCopyProp();
23146 test_ret += test_xmlCopyPropList();
23147 test_ret += test_xmlCreateIntSubset();
23148 test_ret += test_xmlDocCopyNode();
23149 test_ret += test_xmlDocCopyNodeList();
23150 test_ret += test_xmlDocDump();
23151 test_ret += test_xmlDocDumpFormatMemory();
23152 test_ret += test_xmlDocDumpFormatMemoryEnc();
23153 test_ret += test_xmlDocDumpMemory();
23154 test_ret += test_xmlDocDumpMemoryEnc();
23155 test_ret += test_xmlDocFormatDump();
23156 test_ret += test_xmlDocGetRootElement();
23157 test_ret += test_xmlDocSetRootElement();
23158 test_ret += test_xmlElemDump();
23159 test_ret += test_xmlGetBufferAllocationScheme();
23160 test_ret += test_xmlGetCompressMode();
23161 test_ret += test_xmlGetDocCompressMode();
23162 test_ret += test_xmlGetIntSubset();
23163 test_ret += test_xmlGetLastChild();
23164 test_ret += test_xmlGetLineNo();
23165 test_ret += test_xmlGetNoNsProp();
23166 test_ret += test_xmlGetNodePath();
23167 test_ret += test_xmlGetNsList();
23168 test_ret += test_xmlGetNsProp();
23169 test_ret += test_xmlGetProp();
23170 test_ret += test_xmlHasNsProp();
23171 test_ret += test_xmlHasProp();
23172 test_ret += test_xmlIsBlankNode();
23173 test_ret += test_xmlIsXHTML();
23174 test_ret += test_xmlNewCDataBlock();
23175 test_ret += test_xmlNewCharRef();
23176 test_ret += test_xmlNewChild();
23177 test_ret += test_xmlNewComment();
23178 test_ret += test_xmlNewDoc();
23179 test_ret += test_xmlNewDocComment();
23180 test_ret += test_xmlNewDocFragment();
23181 test_ret += test_xmlNewDocNode();
23182 test_ret += test_xmlNewDocNodeEatName();
23183 test_ret += test_xmlNewDocPI();
23184 test_ret += test_xmlNewDocProp();
23185 test_ret += test_xmlNewDocRawNode();
23186 test_ret += test_xmlNewDocText();
23187 test_ret += test_xmlNewDocTextLen();
23188 test_ret += test_xmlNewDtd();
23189 test_ret += test_xmlNewNode();
23190 test_ret += test_xmlNewNodeEatName();
23191 test_ret += test_xmlNewNs();
23192 test_ret += test_xmlNewNsProp();
23193 test_ret += test_xmlNewNsPropEatName();
23194 test_ret += test_xmlNewPI();
23195 test_ret += test_xmlNewProp();
23196 test_ret += test_xmlNewReference();
23197 test_ret += test_xmlNewText();
23198 test_ret += test_xmlNewTextChild();
23199 test_ret += test_xmlNewTextLen();
23200 test_ret += test_xmlNodeAddContent();
23201 test_ret += test_xmlNodeAddContentLen();
23202 test_ret += test_xmlNodeBufGetContent();
23203 test_ret += test_xmlNodeDump();
23204 test_ret += test_xmlNodeDumpOutput();
23205 test_ret += test_xmlNodeGetBase();
23206 test_ret += test_xmlNodeGetContent();
23207 test_ret += test_xmlNodeGetLang();
23208 test_ret += test_xmlNodeGetSpacePreserve();
23209 test_ret += test_xmlNodeIsText();
23210 test_ret += test_xmlNodeListGetRawString();
23211 test_ret += test_xmlNodeListGetString();
23212 test_ret += test_xmlNodeSetBase();
23213 test_ret += test_xmlNodeSetContent();
23214 test_ret += test_xmlNodeSetContentLen();
23215 test_ret += test_xmlNodeSetLang();
23216 test_ret += test_xmlNodeSetName();
23217 test_ret += test_xmlNodeSetSpacePreserve();
23218 test_ret += test_xmlReconciliateNs();
23219 test_ret += test_xmlRemoveProp();
23220 test_ret += test_xmlReplaceNode();
23221 test_ret += test_xmlSaveFile();
23222 test_ret += test_xmlSaveFileEnc();
23223 test_ret += test_xmlSaveFileTo();
23224 test_ret += test_xmlSaveFormatFile();
23225 test_ret += test_xmlSaveFormatFileEnc();
23226 test_ret += test_xmlSaveFormatFileTo();
23227 test_ret += test_xmlSearchNs();
23228 test_ret += test_xmlSearchNsByHref();
23229 test_ret += test_xmlSetBufferAllocationScheme();
23230 test_ret += test_xmlSetCompressMode();
23231 test_ret += test_xmlSetDocCompressMode();
23232 test_ret += test_xmlSetNs();
23233 test_ret += test_xmlSetNsProp();
23234 test_ret += test_xmlSetProp();
23235 test_ret += test_xmlSplitQName2();
23236 test_ret += test_xmlSplitQName3();
23237 test_ret += test_xmlStringGetNodeList();
23238 test_ret += test_xmlStringLenGetNodeList();
23239 test_ret += test_xmlTextConcat();
23240 test_ret += test_xmlTextMerge();
23241 test_ret += test_xmlUnsetNsProp();
23242 test_ret += test_xmlUnsetProp();
23243 test_ret += test_xmlValidateNCName();
23244 test_ret += test_xmlValidateNMToken();
23245 test_ret += test_xmlValidateName();
23246 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023247
Daniel Veillard42595322004-11-08 10:52:06 +000023248 if (test_ret != 0)
23249 printf("Module tree: %d errors\n", test_ret);
23250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023251}
23252
23253static int
23254test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023256
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023257 int mem_base;
23258 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023259 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023260 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023261 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023262 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023263
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023264 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23265 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23266 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023267 URI = gen_const_xmlChar_ptr(n_URI, 0);
23268 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023269
23270 ret_val = xmlBuildRelativeURI(URI, base);
23271 desret_xmlChar_ptr(ret_val);
23272 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023273 des_const_xmlChar_ptr(n_URI, URI, 0);
23274 des_const_xmlChar_ptr(n_base, base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023275 xmlResetLastError();
23276 if (mem_base != xmlMemBlocks()) {
23277 printf("Leak of %d blocks found in xmlBuildRelativeURI",
23278 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023279 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023280 printf(" %d", n_URI);
23281 printf(" %d", n_base);
23282 printf("\n");
23283 }
23284 }
23285 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023286 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023287
Daniel Veillard42595322004-11-08 10:52:06 +000023288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023289}
23290
23291
23292static int
23293test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023295
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023296 int mem_base;
23297 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023298 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023299 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023300 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023301 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023302
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023303 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23304 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23305 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023306 URI = gen_const_xmlChar_ptr(n_URI, 0);
23307 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023308
23309 ret_val = xmlBuildURI(URI, base);
23310 desret_xmlChar_ptr(ret_val);
23311 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023312 des_const_xmlChar_ptr(n_URI, URI, 0);
23313 des_const_xmlChar_ptr(n_base, base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023314 xmlResetLastError();
23315 if (mem_base != xmlMemBlocks()) {
23316 printf("Leak of %d blocks found in xmlBuildURI",
23317 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023318 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023319 printf(" %d", n_URI);
23320 printf(" %d", n_base);
23321 printf("\n");
23322 }
23323 }
23324 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023325 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023326
Daniel Veillard42595322004-11-08 10:52:06 +000023327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023328}
23329
23330
23331static int
23332test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023334
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023335 int mem_base;
23336 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023337 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023338 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023339
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023340 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23341 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023342 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023343
23344 ret_val = xmlCanonicPath(path);
23345 desret_xmlChar_ptr(ret_val);
23346 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023347 des_const_xmlChar_ptr(n_path, path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023348 xmlResetLastError();
23349 if (mem_base != xmlMemBlocks()) {
23350 printf("Leak of %d blocks found in xmlCanonicPath",
23351 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023352 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023353 printf(" %d", n_path);
23354 printf("\n");
23355 }
23356 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023357 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023358
Daniel Veillard42595322004-11-08 10:52:06 +000023359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023360}
23361
23362
23363static int
23364test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023366
23367
23368 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023370}
23371
23372
23373static int
23374test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023376
Daniel Veillardce682bc2004-11-05 17:22:25 +000023377 int mem_base;
23378 int ret_val;
23379 char * path; /* pointer to the path string */
23380 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023381
Daniel Veillardce682bc2004-11-05 17:22:25 +000023382 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23383 mem_base = xmlMemBlocks();
23384 path = gen_char_ptr(n_path, 0);
23385
23386 ret_val = xmlNormalizeURIPath(path);
23387 desret_int(ret_val);
23388 call_tests++;
23389 des_char_ptr(n_path, path, 0);
23390 xmlResetLastError();
23391 if (mem_base != xmlMemBlocks()) {
23392 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023394 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023395 printf(" %d", n_path);
23396 printf("\n");
23397 }
23398 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023399 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023400
Daniel Veillard42595322004-11-08 10:52:06 +000023401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023402}
23403
23404
23405static int
23406test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023408
23409
23410 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023412}
23413
23414
Daniel Veillardce682bc2004-11-05 17:22:25 +000023415#define gen_nb_xmlURIPtr 1
23416static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23417 return(NULL);
23418}
23419static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23420}
23421
Daniel Veillardd93f6252004-11-02 15:53:51 +000023422static int
23423test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023424 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023425
Daniel Veillardce682bc2004-11-05 17:22:25 +000023426 int mem_base;
23427 int ret_val;
23428 xmlURIPtr uri; /* pointer to an URI structure */
23429 int n_uri;
23430 char * str; /* the string to analyze */
23431 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023432
Daniel Veillardce682bc2004-11-05 17:22:25 +000023433 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23434 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23435 mem_base = xmlMemBlocks();
23436 uri = gen_xmlURIPtr(n_uri, 0);
23437 str = gen_const_char_ptr(n_str, 1);
23438
23439 ret_val = xmlParseURIReference(uri, str);
23440 desret_int(ret_val);
23441 call_tests++;
23442 des_xmlURIPtr(n_uri, uri, 0);
23443 des_const_char_ptr(n_str, str, 1);
23444 xmlResetLastError();
23445 if (mem_base != xmlMemBlocks()) {
23446 printf("Leak of %d blocks found in xmlParseURIReference",
23447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023448 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023449 printf(" %d", n_uri);
23450 printf(" %d", n_str);
23451 printf("\n");
23452 }
23453 }
23454 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023455 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023456
Daniel Veillard42595322004-11-08 10:52:06 +000023457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023458}
23459
23460
23461static int
23462test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023463 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023464
Daniel Veillardce682bc2004-11-05 17:22:25 +000023465 int mem_base;
23466 FILE * stream; /* a FILE* for the output */
23467 int n_stream;
23468 xmlURIPtr uri; /* pointer to an xmlURI */
23469 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023470
Daniel Veillardce682bc2004-11-05 17:22:25 +000023471 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23472 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23473 mem_base = xmlMemBlocks();
23474 stream = gen_FILE_ptr(n_stream, 0);
23475 uri = gen_xmlURIPtr(n_uri, 1);
23476
23477 xmlPrintURI(stream, uri);
23478 call_tests++;
23479 des_FILE_ptr(n_stream, stream, 0);
23480 des_xmlURIPtr(n_uri, uri, 1);
23481 xmlResetLastError();
23482 if (mem_base != xmlMemBlocks()) {
23483 printf("Leak of %d blocks found in xmlPrintURI",
23484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023485 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023486 printf(" %d", n_stream);
23487 printf(" %d", n_uri);
23488 printf("\n");
23489 }
23490 }
23491 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023492 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023493
Daniel Veillard42595322004-11-08 10:52:06 +000023494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023495}
23496
23497
23498static int
23499test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023501
Daniel Veillardce682bc2004-11-05 17:22:25 +000023502 int mem_base;
23503 xmlChar * ret_val;
23504 xmlURIPtr uri; /* pointer to an xmlURI */
23505 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023506
Daniel Veillardce682bc2004-11-05 17:22:25 +000023507 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23508 mem_base = xmlMemBlocks();
23509 uri = gen_xmlURIPtr(n_uri, 0);
23510
23511 ret_val = xmlSaveUri(uri);
23512 desret_xmlChar_ptr(ret_val);
23513 call_tests++;
23514 des_xmlURIPtr(n_uri, uri, 0);
23515 xmlResetLastError();
23516 if (mem_base != xmlMemBlocks()) {
23517 printf("Leak of %d blocks found in xmlSaveUri",
23518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023519 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023520 printf(" %d", n_uri);
23521 printf("\n");
23522 }
23523 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023524 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023525
Daniel Veillard42595322004-11-08 10:52:06 +000023526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023527}
23528
23529
23530static int
23531test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023533
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023534 int mem_base;
23535 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023536 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023537 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023538
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023539 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23540 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023541 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023542
23543 ret_val = xmlURIEscape(str);
23544 desret_xmlChar_ptr(ret_val);
23545 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023546 des_const_xmlChar_ptr(n_str, str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023547 xmlResetLastError();
23548 if (mem_base != xmlMemBlocks()) {
23549 printf("Leak of %d blocks found in xmlURIEscape",
23550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023551 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023552 printf(" %d", n_str);
23553 printf("\n");
23554 }
23555 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023556 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023557
Daniel Veillard42595322004-11-08 10:52:06 +000023558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023559}
23560
23561
23562static int
23563test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023565
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023566 int mem_base;
23567 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023568 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023569 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023570 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023571 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023572
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023573 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23574 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23575 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023576 str = gen_const_xmlChar_ptr(n_str, 0);
23577 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023578
23579 ret_val = xmlURIEscapeStr(str, list);
23580 desret_xmlChar_ptr(ret_val);
23581 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023582 des_const_xmlChar_ptr(n_str, str, 0);
23583 des_const_xmlChar_ptr(n_list, list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023584 xmlResetLastError();
23585 if (mem_base != xmlMemBlocks()) {
23586 printf("Leak of %d blocks found in xmlURIEscapeStr",
23587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023588 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023589 printf(" %d", n_str);
23590 printf(" %d", n_list);
23591 printf("\n");
23592 }
23593 }
23594 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023595 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023596
Daniel Veillard42595322004-11-08 10:52:06 +000023597 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023598}
23599
23600
23601static int
23602test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023603 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023604
23605
23606 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023607 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023608}
23609
23610static int
23611test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023612 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023613
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023614 if (quiet == 0) printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023615 test_ret += test_xmlBuildRelativeURI();
23616 test_ret += test_xmlBuildURI();
23617 test_ret += test_xmlCanonicPath();
23618 test_ret += test_xmlCreateURI();
23619 test_ret += test_xmlNormalizeURIPath();
23620 test_ret += test_xmlParseURI();
23621 test_ret += test_xmlParseURIReference();
23622 test_ret += test_xmlPrintURI();
23623 test_ret += test_xmlSaveUri();
23624 test_ret += test_xmlURIEscape();
23625 test_ret += test_xmlURIEscapeStr();
23626 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023627
Daniel Veillard42595322004-11-08 10:52:06 +000023628 if (test_ret != 0)
23629 printf("Module uri: %d errors\n", test_ret);
23630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023631}
23632
23633static int
23634test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023636
Daniel Veillard42595322004-11-08 10:52:06 +000023637 int mem_base;
23638 xmlAttributePtr ret_val;
23639 xmlValidCtxtPtr ctxt; /* the validation context */
23640 int n_ctxt;
23641 xmlDtdPtr dtd; /* pointer to the DTD */
23642 int n_dtd;
23643 xmlChar * elem; /* the element name */
23644 int n_elem;
23645 xmlChar * name; /* the attribute name */
23646 int n_name;
23647 xmlChar * ns; /* the attribute namespace prefix */
23648 int n_ns;
23649 xmlAttributeType type; /* the attribute type */
23650 int n_type;
23651 xmlAttributeDefault def; /* the attribute default type */
23652 int n_def;
23653 xmlChar * defaultValue; /* the attribute default value */
23654 int n_defaultValue;
23655 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23656 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023657
Daniel Veillard42595322004-11-08 10:52:06 +000023658 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23659 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23660 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23661 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23662 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23663 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23664 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23665 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23666 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23667 mem_base = xmlMemBlocks();
23668 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23669 dtd = gen_xmlDtdPtr(n_dtd, 1);
23670 elem = gen_const_xmlChar_ptr(n_elem, 2);
23671 name = gen_const_xmlChar_ptr(n_name, 3);
23672 ns = gen_const_xmlChar_ptr(n_ns, 4);
23673 type = gen_xmlAttributeType(n_type, 5);
23674 def = gen_xmlAttributeDefault(n_def, 6);
23675 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23676 tree = gen_xmlEnumerationPtr(n_tree, 8);
23677
23678 ret_val = xmlAddAttributeDecl(ctxt, dtd, elem, name, ns, type, def, defaultValue, tree);
23679 desret_xmlAttributePtr(ret_val);
23680 call_tests++;
23681 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23682 des_xmlDtdPtr(n_dtd, dtd, 1);
23683 des_const_xmlChar_ptr(n_elem, elem, 2);
23684 des_const_xmlChar_ptr(n_name, name, 3);
23685 des_const_xmlChar_ptr(n_ns, ns, 4);
23686 des_xmlAttributeType(n_type, type, 5);
23687 des_xmlAttributeDefault(n_def, def, 6);
23688 des_const_xmlChar_ptr(n_defaultValue, defaultValue, 7);
23689 des_xmlEnumerationPtr(n_tree, tree, 8);
23690 xmlResetLastError();
23691 if (mem_base != xmlMemBlocks()) {
23692 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23693 xmlMemBlocks() - mem_base);
23694 test_ret++;
23695 printf(" %d", n_ctxt);
23696 printf(" %d", n_dtd);
23697 printf(" %d", n_elem);
23698 printf(" %d", n_name);
23699 printf(" %d", n_ns);
23700 printf(" %d", n_type);
23701 printf(" %d", n_def);
23702 printf(" %d", n_defaultValue);
23703 printf(" %d", n_tree);
23704 printf("\n");
23705 }
23706 }
23707 }
23708 }
23709 }
23710 }
23711 }
23712 }
23713 }
23714 }
Daniel Veillard42595322004-11-08 10:52:06 +000023715 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023716
Daniel Veillard42595322004-11-08 10:52:06 +000023717 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023718}
23719
23720
23721static int
23722test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023723 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023724
Daniel Veillard42595322004-11-08 10:52:06 +000023725 int mem_base;
23726 xmlElementPtr ret_val;
23727 xmlValidCtxtPtr ctxt; /* the validation context */
23728 int n_ctxt;
23729 xmlDtdPtr dtd; /* pointer to the DTD */
23730 int n_dtd;
23731 xmlChar * name; /* the entity name */
23732 int n_name;
23733 xmlElementTypeVal type; /* the element type */
23734 int n_type;
23735 xmlElementContentPtr content; /* the element content tree or NULL */
23736 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023737
Daniel Veillard42595322004-11-08 10:52:06 +000023738 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23739 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23740 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23741 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23742 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23743 mem_base = xmlMemBlocks();
23744 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23745 dtd = gen_xmlDtdPtr(n_dtd, 1);
23746 name = gen_const_xmlChar_ptr(n_name, 2);
23747 type = gen_xmlElementTypeVal(n_type, 3);
23748 content = gen_xmlElementContentPtr(n_content, 4);
23749
23750 ret_val = xmlAddElementDecl(ctxt, dtd, name, type, content);
23751 desret_xmlElementPtr(ret_val);
23752 call_tests++;
23753 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23754 des_xmlDtdPtr(n_dtd, dtd, 1);
23755 des_const_xmlChar_ptr(n_name, name, 2);
23756 des_xmlElementTypeVal(n_type, type, 3);
23757 des_xmlElementContentPtr(n_content, content, 4);
23758 xmlResetLastError();
23759 if (mem_base != xmlMemBlocks()) {
23760 printf("Leak of %d blocks found in xmlAddElementDecl",
23761 xmlMemBlocks() - mem_base);
23762 test_ret++;
23763 printf(" %d", n_ctxt);
23764 printf(" %d", n_dtd);
23765 printf(" %d", n_name);
23766 printf(" %d", n_type);
23767 printf(" %d", n_content);
23768 printf("\n");
23769 }
23770 }
23771 }
23772 }
23773 }
23774 }
Daniel Veillard42595322004-11-08 10:52:06 +000023775 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023776
Daniel Veillard42595322004-11-08 10:52:06 +000023777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023778}
23779
23780
23781static int
23782test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023784
23785
23786 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023788}
23789
23790
23791static int
23792test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023794
23795
23796 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023797 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023798}
23799
23800
23801static int
23802test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023803 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023804
23805
23806 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023807 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023808}
23809
23810
Daniel Veillardce682bc2004-11-05 17:22:25 +000023811#define gen_nb_xmlAttributeTablePtr 1
23812static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23813 return(NULL);
23814}
23815static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23816}
23817
Daniel Veillardd93f6252004-11-02 15:53:51 +000023818static int
23819test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023820 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023821
23822
23823 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023824 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023825}
23826
23827
23828static int
23829test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023830 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023831
23832
23833 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023834 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023835}
23836
23837
Daniel Veillardce682bc2004-11-05 17:22:25 +000023838#define gen_nb_xmlElementTablePtr 1
23839static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23840 return(NULL);
23841}
23842static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23843}
23844
Daniel Veillardd93f6252004-11-02 15:53:51 +000023845static int
23846test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023847 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023848
23849
23850 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023852}
23853
23854
23855static int
23856test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023858
23859
23860 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023862}
23863
23864
Daniel Veillardce682bc2004-11-05 17:22:25 +000023865#define gen_nb_xmlNotationTablePtr 1
23866static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23867 return(NULL);
23868}
23869static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23870}
23871
Daniel Veillardd93f6252004-11-02 15:53:51 +000023872static int
23873test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023875
23876
23877 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023879}
23880
23881
23882static int
23883test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023885
23886
23887 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023889}
23890
23891
Daniel Veillardce682bc2004-11-05 17:22:25 +000023892#define gen_nb_xmlAttributePtr 1
23893static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23894 return(NULL);
23895}
23896static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23897}
23898
Daniel Veillardd93f6252004-11-02 15:53:51 +000023899static int
23900test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023902
Daniel Veillardce682bc2004-11-05 17:22:25 +000023903#ifdef LIBXML_OUTPUT_ENABLED
23904 int mem_base;
23905 xmlBufferPtr buf; /* the XML buffer output */
23906 int n_buf;
23907 xmlAttributePtr attr; /* An attribute declaration */
23908 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023909
Daniel Veillardce682bc2004-11-05 17:22:25 +000023910 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23911 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23912 mem_base = xmlMemBlocks();
23913 buf = gen_xmlBufferPtr(n_buf, 0);
23914 attr = gen_xmlAttributePtr(n_attr, 1);
23915
23916 xmlDumpAttributeDecl(buf, attr);
23917 call_tests++;
23918 des_xmlBufferPtr(n_buf, buf, 0);
23919 des_xmlAttributePtr(n_attr, attr, 1);
23920 xmlResetLastError();
23921 if (mem_base != xmlMemBlocks()) {
23922 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023924 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023925 printf(" %d", n_buf);
23926 printf(" %d", n_attr);
23927 printf("\n");
23928 }
23929 }
23930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023931 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023932#endif
23933
Daniel Veillard42595322004-11-08 10:52:06 +000023934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023935}
23936
23937
23938static int
23939test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023941
Daniel Veillardce682bc2004-11-05 17:22:25 +000023942#ifdef LIBXML_OUTPUT_ENABLED
23943 int mem_base;
23944 xmlBufferPtr buf; /* the XML buffer output */
23945 int n_buf;
23946 xmlAttributeTablePtr table; /* An attribute table */
23947 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023948
Daniel Veillardce682bc2004-11-05 17:22:25 +000023949 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23950 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23951 mem_base = xmlMemBlocks();
23952 buf = gen_xmlBufferPtr(n_buf, 0);
23953 table = gen_xmlAttributeTablePtr(n_table, 1);
23954
23955 xmlDumpAttributeTable(buf, table);
23956 call_tests++;
23957 des_xmlBufferPtr(n_buf, buf, 0);
23958 des_xmlAttributeTablePtr(n_table, table, 1);
23959 xmlResetLastError();
23960 if (mem_base != xmlMemBlocks()) {
23961 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023963 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023964 printf(" %d", n_buf);
23965 printf(" %d", n_table);
23966 printf("\n");
23967 }
23968 }
23969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023970 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023971#endif
23972
Daniel Veillard42595322004-11-08 10:52:06 +000023973 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023974}
23975
23976
Daniel Veillardce682bc2004-11-05 17:22:25 +000023977#define gen_nb_xmlElementPtr 1
23978static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23979 return(NULL);
23980}
23981static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23982}
23983
Daniel Veillardd93f6252004-11-02 15:53:51 +000023984static int
23985test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023987
Daniel Veillardce682bc2004-11-05 17:22:25 +000023988#ifdef LIBXML_OUTPUT_ENABLED
23989 int mem_base;
23990 xmlBufferPtr buf; /* the XML buffer output */
23991 int n_buf;
23992 xmlElementPtr elem; /* An element table */
23993 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023994
Daniel Veillardce682bc2004-11-05 17:22:25 +000023995 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23996 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
23997 mem_base = xmlMemBlocks();
23998 buf = gen_xmlBufferPtr(n_buf, 0);
23999 elem = gen_xmlElementPtr(n_elem, 1);
24000
24001 xmlDumpElementDecl(buf, elem);
24002 call_tests++;
24003 des_xmlBufferPtr(n_buf, buf, 0);
24004 des_xmlElementPtr(n_elem, elem, 1);
24005 xmlResetLastError();
24006 if (mem_base != xmlMemBlocks()) {
24007 printf("Leak of %d blocks found in xmlDumpElementDecl",
24008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024009 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024010 printf(" %d", n_buf);
24011 printf(" %d", n_elem);
24012 printf("\n");
24013 }
24014 }
24015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024016 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024017#endif
24018
Daniel Veillard42595322004-11-08 10:52:06 +000024019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024020}
24021
24022
24023static int
24024test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024025 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024026
Daniel Veillardce682bc2004-11-05 17:22:25 +000024027#ifdef LIBXML_OUTPUT_ENABLED
24028 int mem_base;
24029 xmlBufferPtr buf; /* the XML buffer output */
24030 int n_buf;
24031 xmlElementTablePtr table; /* An element table */
24032 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024033
Daniel Veillardce682bc2004-11-05 17:22:25 +000024034 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24035 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
24036 mem_base = xmlMemBlocks();
24037 buf = gen_xmlBufferPtr(n_buf, 0);
24038 table = gen_xmlElementTablePtr(n_table, 1);
24039
24040 xmlDumpElementTable(buf, table);
24041 call_tests++;
24042 des_xmlBufferPtr(n_buf, buf, 0);
24043 des_xmlElementTablePtr(n_table, table, 1);
24044 xmlResetLastError();
24045 if (mem_base != xmlMemBlocks()) {
24046 printf("Leak of %d blocks found in xmlDumpElementTable",
24047 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024048 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024049 printf(" %d", n_buf);
24050 printf(" %d", n_table);
24051 printf("\n");
24052 }
24053 }
24054 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024055 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024056#endif
24057
Daniel Veillard42595322004-11-08 10:52:06 +000024058 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024059}
24060
24061
Daniel Veillardce682bc2004-11-05 17:22:25 +000024062#define gen_nb_xmlNotationPtr 1
24063static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24064 return(NULL);
24065}
24066static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24067}
24068
Daniel Veillardd93f6252004-11-02 15:53:51 +000024069static int
24070test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024072
Daniel Veillardce682bc2004-11-05 17:22:25 +000024073#ifdef LIBXML_OUTPUT_ENABLED
24074 int mem_base;
24075 xmlBufferPtr buf; /* the XML buffer output */
24076 int n_buf;
24077 xmlNotationPtr nota; /* A notation declaration */
24078 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024079
Daniel Veillardce682bc2004-11-05 17:22:25 +000024080 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24081 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
24082 mem_base = xmlMemBlocks();
24083 buf = gen_xmlBufferPtr(n_buf, 0);
24084 nota = gen_xmlNotationPtr(n_nota, 1);
24085
24086 xmlDumpNotationDecl(buf, nota);
24087 call_tests++;
24088 des_xmlBufferPtr(n_buf, buf, 0);
24089 des_xmlNotationPtr(n_nota, nota, 1);
24090 xmlResetLastError();
24091 if (mem_base != xmlMemBlocks()) {
24092 printf("Leak of %d blocks found in xmlDumpNotationDecl",
24093 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024094 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024095 printf(" %d", n_buf);
24096 printf(" %d", n_nota);
24097 printf("\n");
24098 }
24099 }
24100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024101 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024102#endif
24103
Daniel Veillard42595322004-11-08 10:52:06 +000024104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024105}
24106
24107
24108static int
24109test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024111
Daniel Veillardce682bc2004-11-05 17:22:25 +000024112#ifdef LIBXML_OUTPUT_ENABLED
24113 int mem_base;
24114 xmlBufferPtr buf; /* the XML buffer output */
24115 int n_buf;
24116 xmlNotationTablePtr table; /* A notation table */
24117 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024118
Daniel Veillardce682bc2004-11-05 17:22:25 +000024119 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24120 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
24121 mem_base = xmlMemBlocks();
24122 buf = gen_xmlBufferPtr(n_buf, 0);
24123 table = gen_xmlNotationTablePtr(n_table, 1);
24124
24125 xmlDumpNotationTable(buf, table);
24126 call_tests++;
24127 des_xmlBufferPtr(n_buf, buf, 0);
24128 des_xmlNotationTablePtr(n_table, table, 1);
24129 xmlResetLastError();
24130 if (mem_base != xmlMemBlocks()) {
24131 printf("Leak of %d blocks found in xmlDumpNotationTable",
24132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024133 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024134 printf(" %d", n_buf);
24135 printf(" %d", n_table);
24136 printf("\n");
24137 }
24138 }
24139 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024140 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024141#endif
24142
Daniel Veillard42595322004-11-08 10:52:06 +000024143 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024144}
24145
24146
24147static int
24148test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024149 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024150
Daniel Veillard42595322004-11-08 10:52:06 +000024151 int mem_base;
24152 xmlAttributePtr ret_val;
24153 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24154 int n_dtd;
24155 xmlChar * elem; /* the element name */
24156 int n_elem;
24157 xmlChar * name; /* the attribute name */
24158 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024159
Daniel Veillard42595322004-11-08 10:52:06 +000024160 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24161 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24162 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24163 mem_base = xmlMemBlocks();
24164 dtd = gen_xmlDtdPtr(n_dtd, 0);
24165 elem = gen_const_xmlChar_ptr(n_elem, 1);
24166 name = gen_const_xmlChar_ptr(n_name, 2);
24167
24168 ret_val = xmlGetDtdAttrDesc(dtd, elem, name);
24169 desret_xmlAttributePtr(ret_val);
24170 call_tests++;
24171 des_xmlDtdPtr(n_dtd, dtd, 0);
24172 des_const_xmlChar_ptr(n_elem, elem, 1);
24173 des_const_xmlChar_ptr(n_name, name, 2);
24174 xmlResetLastError();
24175 if (mem_base != xmlMemBlocks()) {
24176 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
24177 xmlMemBlocks() - mem_base);
24178 test_ret++;
24179 printf(" %d", n_dtd);
24180 printf(" %d", n_elem);
24181 printf(" %d", n_name);
24182 printf("\n");
24183 }
24184 }
24185 }
24186 }
Daniel Veillard42595322004-11-08 10:52:06 +000024187 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024188
Daniel Veillard42595322004-11-08 10:52:06 +000024189 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024190}
24191
24192
24193static int
24194test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024195 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024196
Daniel Veillard42595322004-11-08 10:52:06 +000024197 int mem_base;
24198 xmlElementPtr ret_val;
24199 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24200 int n_dtd;
24201 xmlChar * name; /* the element name */
24202 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024203
Daniel Veillard42595322004-11-08 10:52:06 +000024204 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24205 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24206 mem_base = xmlMemBlocks();
24207 dtd = gen_xmlDtdPtr(n_dtd, 0);
24208 name = gen_const_xmlChar_ptr(n_name, 1);
24209
24210 ret_val = xmlGetDtdElementDesc(dtd, name);
24211 desret_xmlElementPtr(ret_val);
24212 call_tests++;
24213 des_xmlDtdPtr(n_dtd, dtd, 0);
24214 des_const_xmlChar_ptr(n_name, name, 1);
24215 xmlResetLastError();
24216 if (mem_base != xmlMemBlocks()) {
24217 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
24218 xmlMemBlocks() - mem_base);
24219 test_ret++;
24220 printf(" %d", n_dtd);
24221 printf(" %d", n_name);
24222 printf("\n");
24223 }
24224 }
24225 }
Daniel Veillard42595322004-11-08 10:52:06 +000024226 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024227
Daniel Veillard42595322004-11-08 10:52:06 +000024228 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024229}
24230
24231
24232static int
24233test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024235
24236
24237 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024239}
24240
24241
24242static int
24243test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024245
Daniel Veillard42595322004-11-08 10:52:06 +000024246 int mem_base;
24247 xmlAttributePtr ret_val;
24248 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24249 int n_dtd;
24250 xmlChar * elem; /* the element name */
24251 int n_elem;
24252 xmlChar * name; /* the attribute name */
24253 int n_name;
24254 xmlChar * prefix; /* the attribute namespace prefix */
24255 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024256
Daniel Veillard42595322004-11-08 10:52:06 +000024257 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24258 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24259 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24260 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24261 mem_base = xmlMemBlocks();
24262 dtd = gen_xmlDtdPtr(n_dtd, 0);
24263 elem = gen_const_xmlChar_ptr(n_elem, 1);
24264 name = gen_const_xmlChar_ptr(n_name, 2);
24265 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
24266
24267 ret_val = xmlGetDtdQAttrDesc(dtd, elem, name, prefix);
24268 desret_xmlAttributePtr(ret_val);
24269 call_tests++;
24270 des_xmlDtdPtr(n_dtd, dtd, 0);
24271 des_const_xmlChar_ptr(n_elem, elem, 1);
24272 des_const_xmlChar_ptr(n_name, name, 2);
24273 des_const_xmlChar_ptr(n_prefix, prefix, 3);
24274 xmlResetLastError();
24275 if (mem_base != xmlMemBlocks()) {
24276 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
24277 xmlMemBlocks() - mem_base);
24278 test_ret++;
24279 printf(" %d", n_dtd);
24280 printf(" %d", n_elem);
24281 printf(" %d", n_name);
24282 printf(" %d", n_prefix);
24283 printf("\n");
24284 }
24285 }
24286 }
24287 }
24288 }
Daniel Veillard42595322004-11-08 10:52:06 +000024289 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024290
Daniel Veillard42595322004-11-08 10:52:06 +000024291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024292}
24293
24294
24295static int
24296test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024298
Daniel Veillard42595322004-11-08 10:52:06 +000024299 int mem_base;
24300 xmlElementPtr ret_val;
24301 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24302 int n_dtd;
24303 xmlChar * name; /* the element name */
24304 int n_name;
24305 xmlChar * prefix; /* the element namespace prefix */
24306 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024307
Daniel Veillard42595322004-11-08 10:52:06 +000024308 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24309 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24310 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24311 mem_base = xmlMemBlocks();
24312 dtd = gen_xmlDtdPtr(n_dtd, 0);
24313 name = gen_const_xmlChar_ptr(n_name, 1);
24314 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24315
24316 ret_val = xmlGetDtdQElementDesc(dtd, name, prefix);
24317 desret_xmlElementPtr(ret_val);
24318 call_tests++;
24319 des_xmlDtdPtr(n_dtd, dtd, 0);
24320 des_const_xmlChar_ptr(n_name, name, 1);
24321 des_const_xmlChar_ptr(n_prefix, prefix, 2);
24322 xmlResetLastError();
24323 if (mem_base != xmlMemBlocks()) {
24324 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24325 xmlMemBlocks() - mem_base);
24326 test_ret++;
24327 printf(" %d", n_dtd);
24328 printf(" %d", n_name);
24329 printf(" %d", n_prefix);
24330 printf("\n");
24331 }
24332 }
24333 }
24334 }
Daniel Veillard42595322004-11-08 10:52:06 +000024335 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024336
Daniel Veillard42595322004-11-08 10:52:06 +000024337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024338}
24339
24340
24341static int
24342test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024344
Daniel Veillard57b25162004-11-06 14:50:18 +000024345 int mem_base;
24346 xmlAttrPtr ret_val;
24347 xmlDocPtr doc; /* pointer to the document */
24348 int n_doc;
24349 xmlChar * ID; /* the ID value */
24350 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024351
Daniel Veillard57b25162004-11-06 14:50:18 +000024352 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24353 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24354 mem_base = xmlMemBlocks();
24355 doc = gen_xmlDocPtr(n_doc, 0);
24356 ID = gen_const_xmlChar_ptr(n_ID, 1);
24357
24358 ret_val = xmlGetID(doc, ID);
24359 desret_xmlAttrPtr(ret_val);
24360 call_tests++;
24361 des_xmlDocPtr(n_doc, doc, 0);
24362 des_const_xmlChar_ptr(n_ID, ID, 1);
24363 xmlResetLastError();
24364 if (mem_base != xmlMemBlocks()) {
24365 printf("Leak of %d blocks found in xmlGetID",
24366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024367 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024368 printf(" %d", n_doc);
24369 printf(" %d", n_ID);
24370 printf("\n");
24371 }
24372 }
24373 }
Daniel Veillard57b25162004-11-06 14:50:18 +000024374 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024375
Daniel Veillard42595322004-11-08 10:52:06 +000024376 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024377}
24378
24379
24380static int
24381test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024382 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024383
24384
24385 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024386 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024387}
24388
24389
24390static int
24391test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024392 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024393
Daniel Veillardce244ad2004-11-05 10:03:46 +000024394 int mem_base;
24395 int ret_val;
24396 xmlDocPtr doc; /* the document */
24397 int n_doc;
24398 xmlNodePtr elem; /* the element carrying the attribute */
24399 int n_elem;
24400 xmlAttrPtr attr; /* the attribute */
24401 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024402
Daniel Veillardce244ad2004-11-05 10:03:46 +000024403 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24404 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24405 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24406 mem_base = xmlMemBlocks();
24407 doc = gen_xmlDocPtr(n_doc, 0);
24408 elem = gen_xmlNodePtr(n_elem, 1);
24409 attr = gen_xmlAttrPtr(n_attr, 2);
24410
24411 ret_val = xmlIsID(doc, elem, attr);
24412 desret_int(ret_val);
24413 call_tests++;
24414 des_xmlDocPtr(n_doc, doc, 0);
24415 des_xmlNodePtr(n_elem, elem, 1);
24416 des_xmlAttrPtr(n_attr, attr, 2);
24417 xmlResetLastError();
24418 if (mem_base != xmlMemBlocks()) {
24419 printf("Leak of %d blocks found in xmlIsID",
24420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024421 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024422 printf(" %d", n_doc);
24423 printf(" %d", n_elem);
24424 printf(" %d", n_attr);
24425 printf("\n");
24426 }
24427 }
24428 }
24429 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024430 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024431
Daniel Veillard42595322004-11-08 10:52:06 +000024432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024433}
24434
24435
24436static int
24437test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024438 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024439
24440 int mem_base;
24441 int ret_val;
24442 xmlDocPtr doc; /* the document */
24443 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024444 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024445 int n_name;
24446
24447 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24448 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24449 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024450 doc = gen_xmlDocPtr(n_doc, 0);
24451 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024452
24453 ret_val = xmlIsMixedElement(doc, name);
24454 desret_int(ret_val);
24455 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024456 des_xmlDocPtr(n_doc, doc, 0);
24457 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024458 xmlResetLastError();
24459 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024460 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024462 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024463 printf(" %d", n_doc);
24464 printf(" %d", n_name);
24465 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024466 }
24467 }
24468 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000024469 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024470
Daniel Veillard42595322004-11-08 10:52:06 +000024471 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024472}
24473
24474
24475static int
24476test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024477 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024478
Daniel Veillardce244ad2004-11-05 10:03:46 +000024479 int mem_base;
24480 int ret_val;
24481 xmlDocPtr doc; /* the document */
24482 int n_doc;
24483 xmlNodePtr elem; /* the element carrying the attribute */
24484 int n_elem;
24485 xmlAttrPtr attr; /* the attribute */
24486 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024487
Daniel Veillardce244ad2004-11-05 10:03:46 +000024488 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24489 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24490 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24491 mem_base = xmlMemBlocks();
24492 doc = gen_xmlDocPtr(n_doc, 0);
24493 elem = gen_xmlNodePtr(n_elem, 1);
24494 attr = gen_xmlAttrPtr(n_attr, 2);
24495
24496 ret_val = xmlIsRef(doc, elem, attr);
24497 desret_int(ret_val);
24498 call_tests++;
24499 des_xmlDocPtr(n_doc, doc, 0);
24500 des_xmlNodePtr(n_elem, elem, 1);
24501 des_xmlAttrPtr(n_attr, attr, 2);
24502 xmlResetLastError();
24503 if (mem_base != xmlMemBlocks()) {
24504 printf("Leak of %d blocks found in xmlIsRef",
24505 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024506 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024507 printf(" %d", n_doc);
24508 printf(" %d", n_elem);
24509 printf(" %d", n_attr);
24510 printf("\n");
24511 }
24512 }
24513 }
24514 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024515 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024516
Daniel Veillard42595322004-11-08 10:52:06 +000024517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024518}
24519
24520
24521static int
24522test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024524
24525
24526 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024528}
24529
24530
24531static int
24532test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024534
24535
24536 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024538}
24539
24540
24541static int
24542test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024544
Daniel Veillardce244ad2004-11-05 10:03:46 +000024545 int mem_base;
24546 int ret_val;
24547 xmlDocPtr doc; /* the document */
24548 int n_doc;
24549 xmlAttrPtr attr; /* the attribute */
24550 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024551
Daniel Veillardce244ad2004-11-05 10:03:46 +000024552 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24553 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24554 mem_base = xmlMemBlocks();
24555 doc = gen_xmlDocPtr(n_doc, 0);
24556 attr = gen_xmlAttrPtr(n_attr, 1);
24557
24558 ret_val = xmlRemoveID(doc, attr);
24559 desret_int(ret_val);
24560 call_tests++;
24561 des_xmlDocPtr(n_doc, doc, 0);
24562 des_xmlAttrPtr(n_attr, attr, 1);
24563 xmlResetLastError();
24564 if (mem_base != xmlMemBlocks()) {
24565 printf("Leak of %d blocks found in xmlRemoveID",
24566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024567 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024568 printf(" %d", n_doc);
24569 printf(" %d", n_attr);
24570 printf("\n");
24571 }
24572 }
24573 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024574 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024575
Daniel Veillard42595322004-11-08 10:52:06 +000024576 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024577}
24578
24579
24580static int
24581test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024583
Daniel Veillardce244ad2004-11-05 10:03:46 +000024584 int mem_base;
24585 int ret_val;
24586 xmlDocPtr doc; /* the document */
24587 int n_doc;
24588 xmlAttrPtr attr; /* the attribute */
24589 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024590
Daniel Veillardce244ad2004-11-05 10:03:46 +000024591 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24592 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24593 mem_base = xmlMemBlocks();
24594 doc = gen_xmlDocPtr(n_doc, 0);
24595 attr = gen_xmlAttrPtr(n_attr, 1);
24596
24597 ret_val = xmlRemoveRef(doc, attr);
24598 desret_int(ret_val);
24599 call_tests++;
24600 des_xmlDocPtr(n_doc, doc, 0);
24601 des_xmlAttrPtr(n_attr, attr, 1);
24602 xmlResetLastError();
24603 if (mem_base != xmlMemBlocks()) {
24604 printf("Leak of %d blocks found in xmlRemoveRef",
24605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024606 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024607 printf(" %d", n_doc);
24608 printf(" %d", n_attr);
24609 printf("\n");
24610 }
24611 }
24612 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024613 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024614
Daniel Veillard42595322004-11-08 10:52:06 +000024615 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024616}
24617
24618
24619static int
24620test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024621 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024622
Daniel Veillardce682bc2004-11-05 17:22:25 +000024623 int mem_base;
24624 char * buf; /* an output buffer */
24625 int n_buf;
24626 int size; /* the buffer size */
24627 int n_size;
24628 xmlElementContentPtr content; /* An element table */
24629 int n_content;
24630 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24631 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024632
Daniel Veillardce682bc2004-11-05 17:22:25 +000024633 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24634 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24635 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24636 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24637 mem_base = xmlMemBlocks();
24638 buf = gen_char_ptr(n_buf, 0);
24639 size = gen_int(n_size, 1);
24640 content = gen_xmlElementContentPtr(n_content, 2);
24641 glob = gen_int(n_glob, 3);
24642
24643 xmlSnprintfElementContent(buf, size, content, glob);
24644 call_tests++;
24645 des_char_ptr(n_buf, buf, 0);
24646 des_int(n_size, size, 1);
24647 des_xmlElementContentPtr(n_content, content, 2);
24648 des_int(n_glob, glob, 3);
24649 xmlResetLastError();
24650 if (mem_base != xmlMemBlocks()) {
24651 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24652 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024653 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024654 printf(" %d", n_buf);
24655 printf(" %d", n_size);
24656 printf(" %d", n_content);
24657 printf(" %d", n_glob);
24658 printf("\n");
24659 }
24660 }
24661 }
24662 }
24663 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000024664 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024665
Daniel Veillard42595322004-11-08 10:52:06 +000024666 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024667}
24668
24669
24670static int
24671test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024672 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024673
Daniel Veillarda521d282004-11-09 14:59:59 +000024674#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000024675 int mem_base;
24676 char * buf; /* an output buffer */
24677 int n_buf;
24678 xmlElementContentPtr content; /* An element table */
24679 int n_content;
24680 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24681 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024682
Daniel Veillardce682bc2004-11-05 17:22:25 +000024683 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24684 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24685 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24686 mem_base = xmlMemBlocks();
24687 buf = gen_char_ptr(n_buf, 0);
24688 content = gen_xmlElementContentPtr(n_content, 1);
24689 glob = gen_int(n_glob, 2);
24690
24691 xmlSprintfElementContent(buf, content, glob);
24692 call_tests++;
24693 des_char_ptr(n_buf, buf, 0);
24694 des_xmlElementContentPtr(n_content, content, 1);
24695 des_int(n_glob, glob, 2);
24696 xmlResetLastError();
24697 if (mem_base != xmlMemBlocks()) {
24698 printf("Leak of %d blocks found in xmlSprintfElementContent",
24699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024700 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024701 printf(" %d", n_buf);
24702 printf(" %d", n_content);
24703 printf(" %d", n_glob);
24704 printf("\n");
24705 }
24706 }
24707 }
24708 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024709 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024710#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000024711
Daniel Veillard42595322004-11-08 10:52:06 +000024712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024713}
24714
24715
24716static int
24717test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024719
Daniel Veillardce682bc2004-11-05 17:22:25 +000024720#ifdef LIBXML_REGEXP_ENABLED
24721 int mem_base;
24722 int ret_val;
24723 xmlValidCtxtPtr ctxt; /* a validation context */
24724 int n_ctxt;
24725 xmlElementPtr elem; /* an element declaration node */
24726 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024727
Daniel Veillardce682bc2004-11-05 17:22:25 +000024728 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24729 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24730 mem_base = xmlMemBlocks();
24731 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24732 elem = gen_xmlElementPtr(n_elem, 1);
24733
24734 ret_val = xmlValidBuildContentModel(ctxt, elem);
24735 desret_int(ret_val);
24736 call_tests++;
24737 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24738 des_xmlElementPtr(n_elem, elem, 1);
24739 xmlResetLastError();
24740 if (mem_base != xmlMemBlocks()) {
24741 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024743 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024744 printf(" %d", n_ctxt);
24745 printf(" %d", n_elem);
24746 printf("\n");
24747 }
24748 }
24749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024750 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024751#endif
24752
Daniel Veillard42595322004-11-08 10:52:06 +000024753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024754}
24755
24756
24757static int
24758test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024760
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024761#ifdef LIBXML_VALID_ENABLED
24762 int mem_base;
24763 xmlChar * ret_val;
24764 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24765 int n_ctxt;
24766 xmlDocPtr doc; /* the document */
24767 int n_doc;
24768 xmlNodePtr elem; /* the parent */
24769 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024770 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024771 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024772 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024773 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024774
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024775 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24776 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24777 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24778 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24779 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24780 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024781 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24782 doc = gen_xmlDocPtr(n_doc, 1);
24783 elem = gen_xmlNodePtr(n_elem, 2);
24784 name = gen_const_xmlChar_ptr(n_name, 3);
24785 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024786
24787 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, name, value);
24788 desret_xmlChar_ptr(ret_val);
24789 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024790 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24791 des_xmlDocPtr(n_doc, doc, 1);
24792 des_xmlNodePtr(n_elem, elem, 2);
24793 des_const_xmlChar_ptr(n_name, name, 3);
24794 des_const_xmlChar_ptr(n_value, value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024795 xmlResetLastError();
24796 if (mem_base != xmlMemBlocks()) {
24797 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024799 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024800 printf(" %d", n_ctxt);
24801 printf(" %d", n_doc);
24802 printf(" %d", n_elem);
24803 printf(" %d", n_name);
24804 printf(" %d", n_value);
24805 printf("\n");
24806 }
24807 }
24808 }
24809 }
24810 }
24811 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024812 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024813#endif
24814
Daniel Veillard42595322004-11-08 10:52:06 +000024815 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024816}
24817
24818
Daniel Veillardce682bc2004-11-05 17:22:25 +000024819#define gen_nb_xmlElementContent_ptr 1
24820static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24821 return(NULL);
24822}
24823static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24824}
24825
Daniel Veillardd93f6252004-11-02 15:53:51 +000024826static int
24827test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024829
Daniel Veillarda521d282004-11-09 14:59:59 +000024830#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024831 int mem_base;
24832 int ret_val;
24833 xmlElementContent * ctree; /* an element content tree */
24834 int n_ctree;
24835 xmlChar ** list; /* an array to store the list of child names */
24836 int n_list;
24837 int * len; /* a pointer to the number of element in the list */
24838 int n_len;
24839 int max; /* the size of the array */
24840 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024841
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024842 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24843 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24844 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24845 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24846 mem_base = xmlMemBlocks();
24847 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24848 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24849 len = gen_int_ptr(n_len, 2);
24850 max = gen_int(n_max, 3);
24851
24852 ret_val = xmlValidGetPotentialChildren(ctree, list, len, max);
24853 desret_int(ret_val);
24854 call_tests++;
24855 des_xmlElementContent_ptr(n_ctree, ctree, 0);
24856 des_const_xmlChar_ptr_ptr(n_list, list, 1);
24857 des_int_ptr(n_len, len, 2);
24858 des_int(n_max, max, 3);
24859 xmlResetLastError();
24860 if (mem_base != xmlMemBlocks()) {
24861 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024863 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024864 printf(" %d", n_ctree);
24865 printf(" %d", n_list);
24866 printf(" %d", n_len);
24867 printf(" %d", n_max);
24868 printf("\n");
24869 }
24870 }
24871 }
24872 }
24873 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024874 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024875#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024876
Daniel Veillard42595322004-11-08 10:52:06 +000024877 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024878}
24879
24880
24881static int
24882test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024883 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024884
Daniel Veillarda521d282004-11-09 14:59:59 +000024885#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024886 int mem_base;
24887 int ret_val;
24888 xmlNode * prev; /* an element to insert after */
24889 int n_prev;
24890 xmlNode * next; /* an element to insert next */
24891 int n_next;
24892 xmlChar ** names; /* an array to store the list of child names */
24893 int n_names;
24894 int max; /* the size of the array */
24895 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024896
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024897 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24898 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
24899 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
24900 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24901 mem_base = xmlMemBlocks();
24902 prev = gen_xmlNodePtr(n_prev, 0);
24903 next = gen_xmlNodePtr(n_next, 1);
24904 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
24905 max = gen_int(n_max, 3);
24906
24907 ret_val = xmlValidGetValidElements(prev, next, names, max);
24908 desret_int(ret_val);
24909 call_tests++;
24910 des_xmlNodePtr(n_prev, prev, 0);
24911 des_xmlNodePtr(n_next, next, 1);
24912 des_const_xmlChar_ptr_ptr(n_names, names, 2);
24913 des_int(n_max, max, 3);
24914 xmlResetLastError();
24915 if (mem_base != xmlMemBlocks()) {
24916 printf("Leak of %d blocks found in xmlValidGetValidElements",
24917 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024918 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024919 printf(" %d", n_prev);
24920 printf(" %d", n_next);
24921 printf(" %d", n_names);
24922 printf(" %d", n_max);
24923 printf("\n");
24924 }
24925 }
24926 }
24927 }
24928 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024929 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024930#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024931
Daniel Veillard42595322004-11-08 10:52:06 +000024932 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024933}
24934
24935
24936static int
24937test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024938 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024939
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024940#ifdef LIBXML_VALID_ENABLED
24941 int mem_base;
24942 xmlChar * ret_val;
24943 xmlDocPtr doc; /* the document */
24944 int n_doc;
24945 xmlNodePtr elem; /* the parent */
24946 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024947 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024948 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024949 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024950 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024951
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024952 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24953 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24954 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24955 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24956 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024957 doc = gen_xmlDocPtr(n_doc, 0);
24958 elem = gen_xmlNodePtr(n_elem, 1);
24959 name = gen_const_xmlChar_ptr(n_name, 2);
24960 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024961
24962 ret_val = xmlValidNormalizeAttributeValue(doc, elem, name, value);
24963 desret_xmlChar_ptr(ret_val);
24964 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024965 des_xmlDocPtr(n_doc, doc, 0);
24966 des_xmlNodePtr(n_elem, elem, 1);
24967 des_const_xmlChar_ptr(n_name, name, 2);
24968 des_const_xmlChar_ptr(n_value, value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024969 xmlResetLastError();
24970 if (mem_base != xmlMemBlocks()) {
24971 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
24972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024973 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024974 printf(" %d", n_doc);
24975 printf(" %d", n_elem);
24976 printf(" %d", n_name);
24977 printf(" %d", n_value);
24978 printf("\n");
24979 }
24980 }
24981 }
24982 }
24983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024984 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024985#endif
24986
Daniel Veillard42595322004-11-08 10:52:06 +000024987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024988}
24989
24990
24991static int
24992test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024994
Daniel Veillardce682bc2004-11-05 17:22:25 +000024995#ifdef LIBXML_VALID_ENABLED
24996 int mem_base;
24997 int ret_val;
24998 xmlValidCtxtPtr ctxt; /* the validation context */
24999 int n_ctxt;
25000 xmlDocPtr doc; /* a document instance */
25001 int n_doc;
25002 xmlAttributePtr attr; /* an attribute definition */
25003 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025004
Daniel Veillardce682bc2004-11-05 17:22:25 +000025005 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25006 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25007 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
25008 mem_base = xmlMemBlocks();
25009 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25010 doc = gen_xmlDocPtr(n_doc, 1);
25011 attr = gen_xmlAttributePtr(n_attr, 2);
25012
25013 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
25014 desret_int(ret_val);
25015 call_tests++;
25016 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25017 des_xmlDocPtr(n_doc, doc, 1);
25018 des_xmlAttributePtr(n_attr, attr, 2);
25019 xmlResetLastError();
25020 if (mem_base != xmlMemBlocks()) {
25021 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
25022 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025023 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025024 printf(" %d", n_ctxt);
25025 printf(" %d", n_doc);
25026 printf(" %d", n_attr);
25027 printf("\n");
25028 }
25029 }
25030 }
25031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025032 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025033#endif
25034
Daniel Veillard42595322004-11-08 10:52:06 +000025035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025036}
25037
25038
25039static int
25040test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025042
Daniel Veillard57b25162004-11-06 14:50:18 +000025043#ifdef LIBXML_VALID_ENABLED
25044 int mem_base;
25045 int ret_val;
25046 xmlAttributeType type; /* an attribute type */
25047 int n_type;
25048 xmlChar * value; /* an attribute value */
25049 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025050
Daniel Veillard57b25162004-11-06 14:50:18 +000025051 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
25052 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25053 mem_base = xmlMemBlocks();
25054 type = gen_xmlAttributeType(n_type, 0);
25055 value = gen_const_xmlChar_ptr(n_value, 1);
25056
25057 ret_val = xmlValidateAttributeValue(type, value);
25058 desret_int(ret_val);
25059 call_tests++;
25060 des_xmlAttributeType(n_type, type, 0);
25061 des_const_xmlChar_ptr(n_value, value, 1);
25062 xmlResetLastError();
25063 if (mem_base != xmlMemBlocks()) {
25064 printf("Leak of %d blocks found in xmlValidateAttributeValue",
25065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025066 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025067 printf(" %d", n_type);
25068 printf(" %d", n_value);
25069 printf("\n");
25070 }
25071 }
25072 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025073 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025074#endif
25075
Daniel Veillard42595322004-11-08 10:52:06 +000025076 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025077}
25078
25079
25080static int
25081test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025082 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025083
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025084#ifdef LIBXML_VALID_ENABLED
25085 int mem_base;
25086 int ret_val;
25087 xmlValidCtxtPtr ctxt; /* the validation context */
25088 int n_ctxt;
25089 xmlDocPtr doc; /* a document instance */
25090 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025091
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025092 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25093 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25094 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025095 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25096 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025097
25098 ret_val = xmlValidateDocument(ctxt, doc);
25099 desret_int(ret_val);
25100 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025101 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25102 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025103 xmlResetLastError();
25104 if (mem_base != xmlMemBlocks()) {
25105 printf("Leak of %d blocks found in xmlValidateDocument",
25106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025107 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025108 printf(" %d", n_ctxt);
25109 printf(" %d", n_doc);
25110 printf("\n");
25111 }
25112 }
25113 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025114 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025115#endif
25116
Daniel Veillard42595322004-11-08 10:52:06 +000025117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025118}
25119
25120
25121static int
25122test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025124
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025125#ifdef LIBXML_VALID_ENABLED
25126 int mem_base;
25127 int ret_val;
25128 xmlValidCtxtPtr ctxt; /* the validation context */
25129 int n_ctxt;
25130 xmlDocPtr doc; /* a document instance */
25131 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025132
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025133 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25134 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25135 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025136 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25137 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025138
25139 ret_val = xmlValidateDocumentFinal(ctxt, doc);
25140 desret_int(ret_val);
25141 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025142 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25143 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025144 xmlResetLastError();
25145 if (mem_base != xmlMemBlocks()) {
25146 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
25147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025148 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025149 printf(" %d", n_ctxt);
25150 printf(" %d", n_doc);
25151 printf("\n");
25152 }
25153 }
25154 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025155 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025156#endif
25157
Daniel Veillard42595322004-11-08 10:52:06 +000025158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025159}
25160
25161
25162static int
25163test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025164 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025165
Daniel Veillard27f20102004-11-05 11:50:11 +000025166#ifdef LIBXML_VALID_ENABLED
25167 int mem_base;
25168 int ret_val;
25169 xmlValidCtxtPtr ctxt; /* the validation context */
25170 int n_ctxt;
25171 xmlDocPtr doc; /* a document instance */
25172 int n_doc;
25173 xmlDtdPtr dtd; /* a dtd instance */
25174 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025175
Daniel Veillard27f20102004-11-05 11:50:11 +000025176 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25177 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25178 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25179 mem_base = xmlMemBlocks();
25180 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25181 doc = gen_xmlDocPtr(n_doc, 1);
25182 dtd = gen_xmlDtdPtr(n_dtd, 2);
25183
25184 ret_val = xmlValidateDtd(ctxt, doc, dtd);
25185 desret_int(ret_val);
25186 call_tests++;
25187 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25188 des_xmlDocPtr(n_doc, doc, 1);
25189 des_xmlDtdPtr(n_dtd, dtd, 2);
25190 xmlResetLastError();
25191 if (mem_base != xmlMemBlocks()) {
25192 printf("Leak of %d blocks found in xmlValidateDtd",
25193 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025194 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025195 printf(" %d", n_ctxt);
25196 printf(" %d", n_doc);
25197 printf(" %d", n_dtd);
25198 printf("\n");
25199 }
25200 }
25201 }
25202 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025203 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025204#endif
25205
Daniel Veillard42595322004-11-08 10:52:06 +000025206 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025207}
25208
25209
25210static int
25211test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025212 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025213
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025214#ifdef LIBXML_VALID_ENABLED
25215 int mem_base;
25216 int ret_val;
25217 xmlValidCtxtPtr ctxt; /* the validation context */
25218 int n_ctxt;
25219 xmlDocPtr doc; /* a document instance */
25220 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025221
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025222 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25223 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25224 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025225 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25226 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025227
25228 ret_val = xmlValidateDtdFinal(ctxt, doc);
25229 desret_int(ret_val);
25230 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025231 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25232 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025233 xmlResetLastError();
25234 if (mem_base != xmlMemBlocks()) {
25235 printf("Leak of %d blocks found in xmlValidateDtdFinal",
25236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025237 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025238 printf(" %d", n_ctxt);
25239 printf(" %d", n_doc);
25240 printf("\n");
25241 }
25242 }
25243 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025244 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025245#endif
25246
Daniel Veillard42595322004-11-08 10:52:06 +000025247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025248}
25249
25250
25251static int
25252test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025254
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025255#ifdef LIBXML_VALID_ENABLED
25256 int mem_base;
25257 int ret_val;
25258 xmlValidCtxtPtr ctxt; /* the validation context */
25259 int n_ctxt;
25260 xmlDocPtr doc; /* a document instance */
25261 int n_doc;
25262 xmlNodePtr elem; /* an element instance */
25263 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025264
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025265 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25266 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25267 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25268 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025269 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25270 doc = gen_xmlDocPtr(n_doc, 1);
25271 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025272
25273 ret_val = xmlValidateElement(ctxt, doc, elem);
25274 desret_int(ret_val);
25275 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025276 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25277 des_xmlDocPtr(n_doc, doc, 1);
25278 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025279 xmlResetLastError();
25280 if (mem_base != xmlMemBlocks()) {
25281 printf("Leak of %d blocks found in xmlValidateElement",
25282 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025283 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025284 printf(" %d", n_ctxt);
25285 printf(" %d", n_doc);
25286 printf(" %d", n_elem);
25287 printf("\n");
25288 }
25289 }
25290 }
25291 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025292 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025293#endif
25294
Daniel Veillard42595322004-11-08 10:52:06 +000025295 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025296}
25297
25298
25299static int
25300test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025301 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025302
Daniel Veillardce682bc2004-11-05 17:22:25 +000025303#ifdef LIBXML_VALID_ENABLED
25304 int mem_base;
25305 int ret_val;
25306 xmlValidCtxtPtr ctxt; /* the validation context */
25307 int n_ctxt;
25308 xmlDocPtr doc; /* a document instance */
25309 int n_doc;
25310 xmlElementPtr elem; /* an element definition */
25311 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025312
Daniel Veillardce682bc2004-11-05 17:22:25 +000025313 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25314 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25315 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25316 mem_base = xmlMemBlocks();
25317 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25318 doc = gen_xmlDocPtr(n_doc, 1);
25319 elem = gen_xmlElementPtr(n_elem, 2);
25320
25321 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25322 desret_int(ret_val);
25323 call_tests++;
25324 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25325 des_xmlDocPtr(n_doc, doc, 1);
25326 des_xmlElementPtr(n_elem, elem, 2);
25327 xmlResetLastError();
25328 if (mem_base != xmlMemBlocks()) {
25329 printf("Leak of %d blocks found in xmlValidateElementDecl",
25330 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025331 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025332 printf(" %d", n_ctxt);
25333 printf(" %d", n_doc);
25334 printf(" %d", n_elem);
25335 printf("\n");
25336 }
25337 }
25338 }
25339 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025340 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025341#endif
25342
Daniel Veillard42595322004-11-08 10:52:06 +000025343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025344}
25345
25346
25347static int
25348test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025350
25351#ifdef LIBXML_VALID_ENABLED
25352 int mem_base;
25353 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025354 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025355 int n_value;
25356
25357 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25358 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025359 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025360
25361 ret_val = xmlValidateNameValue(value);
25362 desret_int(ret_val);
25363 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025364 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025365 xmlResetLastError();
25366 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025367 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025368 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025369 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025370 printf(" %d", n_value);
25371 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025372 }
25373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025374 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025375#endif
25376
Daniel Veillard42595322004-11-08 10:52:06 +000025377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025378}
25379
25380
25381static int
25382test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025384
25385#ifdef LIBXML_VALID_ENABLED
25386 int mem_base;
25387 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025388 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025389 int n_value;
25390
25391 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25392 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025393 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025394
25395 ret_val = xmlValidateNamesValue(value);
25396 desret_int(ret_val);
25397 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025398 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025399 xmlResetLastError();
25400 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025401 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025403 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025404 printf(" %d", n_value);
25405 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025406 }
25407 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025408 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025409#endif
25410
Daniel Veillard42595322004-11-08 10:52:06 +000025411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025412}
25413
25414
25415static int
25416test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025418
25419#ifdef LIBXML_VALID_ENABLED
25420 int mem_base;
25421 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025422 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025423 int n_value;
25424
25425 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25426 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025427 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025428
25429 ret_val = xmlValidateNmtokenValue(value);
25430 desret_int(ret_val);
25431 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025432 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025433 xmlResetLastError();
25434 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025435 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025437 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025438 printf(" %d", n_value);
25439 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025440 }
25441 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025442 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025443#endif
25444
Daniel Veillard42595322004-11-08 10:52:06 +000025445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025446}
25447
25448
25449static int
25450test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025452
25453#ifdef LIBXML_VALID_ENABLED
25454 int mem_base;
25455 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025456 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025457 int n_value;
25458
25459 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25460 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025461 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025462
25463 ret_val = xmlValidateNmtokensValue(value);
25464 desret_int(ret_val);
25465 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025466 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025467 xmlResetLastError();
25468 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025469 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025471 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025472 printf(" %d", n_value);
25473 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025474 }
25475 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025476 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025477#endif
25478
Daniel Veillard42595322004-11-08 10:52:06 +000025479 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025480}
25481
25482
25483static int
25484test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025485 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025486
Daniel Veillardce682bc2004-11-05 17:22:25 +000025487#ifdef LIBXML_VALID_ENABLED
25488 int mem_base;
25489 int ret_val;
25490 xmlValidCtxtPtr ctxt; /* the validation context */
25491 int n_ctxt;
25492 xmlDocPtr doc; /* a document instance */
25493 int n_doc;
25494 xmlNotationPtr nota; /* a notation definition */
25495 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025496
Daniel Veillardce682bc2004-11-05 17:22:25 +000025497 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25498 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25499 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25500 mem_base = xmlMemBlocks();
25501 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25502 doc = gen_xmlDocPtr(n_doc, 1);
25503 nota = gen_xmlNotationPtr(n_nota, 2);
25504
25505 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25506 desret_int(ret_val);
25507 call_tests++;
25508 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25509 des_xmlDocPtr(n_doc, doc, 1);
25510 des_xmlNotationPtr(n_nota, nota, 2);
25511 xmlResetLastError();
25512 if (mem_base != xmlMemBlocks()) {
25513 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025515 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025516 printf(" %d", n_ctxt);
25517 printf(" %d", n_doc);
25518 printf(" %d", n_nota);
25519 printf("\n");
25520 }
25521 }
25522 }
25523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025524 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025525#endif
25526
Daniel Veillard42595322004-11-08 10:52:06 +000025527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025528}
25529
25530
25531static int
25532test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025534
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025535#ifdef LIBXML_VALID_ENABLED
25536 int mem_base;
25537 int ret_val;
25538 xmlValidCtxtPtr ctxt; /* the validation context */
25539 int n_ctxt;
25540 xmlDocPtr doc; /* the document */
25541 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025542 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025543 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025544
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025545 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25546 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25547 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25548 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025549 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25550 doc = gen_xmlDocPtr(n_doc, 1);
25551 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025552
25553 ret_val = xmlValidateNotationUse(ctxt, doc, notationName);
25554 desret_int(ret_val);
25555 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025556 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25557 des_xmlDocPtr(n_doc, doc, 1);
25558 des_const_xmlChar_ptr(n_notationName, notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025559 xmlResetLastError();
25560 if (mem_base != xmlMemBlocks()) {
25561 printf("Leak of %d blocks found in xmlValidateNotationUse",
25562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025563 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025564 printf(" %d", n_ctxt);
25565 printf(" %d", n_doc);
25566 printf(" %d", n_notationName);
25567 printf("\n");
25568 }
25569 }
25570 }
25571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025572 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025573#endif
25574
Daniel Veillard42595322004-11-08 10:52:06 +000025575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025576}
25577
25578
25579static int
25580test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025582
Daniel Veillardce244ad2004-11-05 10:03:46 +000025583#ifdef LIBXML_VALID_ENABLED
25584 int mem_base;
25585 int ret_val;
25586 xmlValidCtxtPtr ctxt; /* the validation context */
25587 int n_ctxt;
25588 xmlDocPtr doc; /* a document instance */
25589 int n_doc;
25590 xmlNodePtr elem; /* an element instance */
25591 int n_elem;
25592 xmlAttrPtr attr; /* an attribute instance */
25593 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025594 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025595 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025596
Daniel Veillardce244ad2004-11-05 10:03:46 +000025597 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25598 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25599 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25600 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25601 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25602 mem_base = xmlMemBlocks();
25603 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25604 doc = gen_xmlDocPtr(n_doc, 1);
25605 elem = gen_xmlNodePtr(n_elem, 2);
25606 attr = gen_xmlAttrPtr(n_attr, 3);
25607 value = gen_const_xmlChar_ptr(n_value, 4);
25608
25609 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
25610 desret_int(ret_val);
25611 call_tests++;
25612 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25613 des_xmlDocPtr(n_doc, doc, 1);
25614 des_xmlNodePtr(n_elem, elem, 2);
25615 des_xmlAttrPtr(n_attr, attr, 3);
25616 des_const_xmlChar_ptr(n_value, value, 4);
25617 xmlResetLastError();
25618 if (mem_base != xmlMemBlocks()) {
25619 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025621 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025622 printf(" %d", n_ctxt);
25623 printf(" %d", n_doc);
25624 printf(" %d", n_elem);
25625 printf(" %d", n_attr);
25626 printf(" %d", n_value);
25627 printf("\n");
25628 }
25629 }
25630 }
25631 }
25632 }
25633 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025634 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025635#endif
25636
Daniel Veillard42595322004-11-08 10:52:06 +000025637 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025638}
25639
25640
25641static int
25642test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025643 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025644
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025645#ifdef LIBXML_VALID_ENABLED
25646 int mem_base;
25647 int ret_val;
25648 xmlValidCtxtPtr ctxt; /* the validation context */
25649 int n_ctxt;
25650 xmlDocPtr doc; /* a document instance */
25651 int n_doc;
25652 xmlNodePtr elem; /* an element instance */
25653 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025654
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025655 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25656 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25657 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25658 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025659 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25660 doc = gen_xmlDocPtr(n_doc, 1);
25661 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025662
25663 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25664 desret_int(ret_val);
25665 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025666 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25667 des_xmlDocPtr(n_doc, doc, 1);
25668 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025669 xmlResetLastError();
25670 if (mem_base != xmlMemBlocks()) {
25671 printf("Leak of %d blocks found in xmlValidateOneElement",
25672 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025673 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025674 printf(" %d", n_ctxt);
25675 printf(" %d", n_doc);
25676 printf(" %d", n_elem);
25677 printf("\n");
25678 }
25679 }
25680 }
25681 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025682 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025683#endif
25684
Daniel Veillard42595322004-11-08 10:52:06 +000025685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025686}
25687
25688
25689static int
25690test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025692
Daniel Veillard27f20102004-11-05 11:50:11 +000025693#ifdef LIBXML_VALID_ENABLED
25694 int mem_base;
25695 int ret_val;
25696 xmlValidCtxtPtr ctxt; /* the validation context */
25697 int n_ctxt;
25698 xmlDocPtr doc; /* a document instance */
25699 int n_doc;
25700 xmlNodePtr elem; /* an element instance */
25701 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025702 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025703 int n_prefix;
25704 xmlNsPtr ns; /* an namespace declaration instance */
25705 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025706 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025707 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025708
Daniel Veillard27f20102004-11-05 11:50:11 +000025709 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25710 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25711 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25712 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25713 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25714 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25715 mem_base = xmlMemBlocks();
25716 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25717 doc = gen_xmlDocPtr(n_doc, 1);
25718 elem = gen_xmlNodePtr(n_elem, 2);
25719 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25720 ns = gen_xmlNsPtr(n_ns, 4);
25721 value = gen_const_xmlChar_ptr(n_value, 5);
25722
25723 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, prefix, ns, value);
25724 desret_int(ret_val);
25725 call_tests++;
25726 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25727 des_xmlDocPtr(n_doc, doc, 1);
25728 des_xmlNodePtr(n_elem, elem, 2);
25729 des_const_xmlChar_ptr(n_prefix, prefix, 3);
25730 des_xmlNsPtr(n_ns, ns, 4);
25731 des_const_xmlChar_ptr(n_value, value, 5);
25732 xmlResetLastError();
25733 if (mem_base != xmlMemBlocks()) {
25734 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025736 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025737 printf(" %d", n_ctxt);
25738 printf(" %d", n_doc);
25739 printf(" %d", n_elem);
25740 printf(" %d", n_prefix);
25741 printf(" %d", n_ns);
25742 printf(" %d", n_value);
25743 printf("\n");
25744 }
25745 }
25746 }
25747 }
25748 }
25749 }
25750 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025751 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025752#endif
25753
Daniel Veillard42595322004-11-08 10:52:06 +000025754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025755}
25756
25757
25758static int
25759test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025761
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025762#ifdef LIBXML_REGEXP_ENABLED
25763 int mem_base;
25764 int ret_val;
25765 xmlValidCtxtPtr ctxt; /* the validation context */
25766 int n_ctxt;
25767 xmlDocPtr doc; /* a document instance */
25768 int n_doc;
25769 xmlNodePtr elem; /* an element instance */
25770 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025771 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025772 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025773
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025774 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25775 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25776 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25777 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25778 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025779 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25780 doc = gen_xmlDocPtr(n_doc, 1);
25781 elem = gen_xmlNodePtr(n_elem, 2);
25782 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025783
25784 ret_val = xmlValidatePopElement(ctxt, doc, elem, qname);
25785 desret_int(ret_val);
25786 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025787 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25788 des_xmlDocPtr(n_doc, doc, 1);
25789 des_xmlNodePtr(n_elem, elem, 2);
25790 des_const_xmlChar_ptr(n_qname, qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025791 xmlResetLastError();
25792 if (mem_base != xmlMemBlocks()) {
25793 printf("Leak of %d blocks found in xmlValidatePopElement",
25794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025795 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025796 printf(" %d", n_ctxt);
25797 printf(" %d", n_doc);
25798 printf(" %d", n_elem);
25799 printf(" %d", n_qname);
25800 printf("\n");
25801 }
25802 }
25803 }
25804 }
25805 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025806 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025807#endif
25808
Daniel Veillard42595322004-11-08 10:52:06 +000025809 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025810}
25811
25812
25813static int
25814test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025816
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025817#ifdef LIBXML_REGEXP_ENABLED
25818 int mem_base;
25819 int ret_val;
25820 xmlValidCtxtPtr ctxt; /* the validation context */
25821 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025822 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025823 int n_data;
25824 int len; /* the lenght of the data */
25825 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025826
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025827 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25828 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25829 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25830 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025831 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25832 data = gen_const_xmlChar_ptr(n_data, 1);
25833 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025834
25835 ret_val = xmlValidatePushCData(ctxt, data, len);
25836 desret_int(ret_val);
25837 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025838 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25839 des_const_xmlChar_ptr(n_data, data, 1);
25840 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025841 xmlResetLastError();
25842 if (mem_base != xmlMemBlocks()) {
25843 printf("Leak of %d blocks found in xmlValidatePushCData",
25844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025845 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025846 printf(" %d", n_ctxt);
25847 printf(" %d", n_data);
25848 printf(" %d", n_len);
25849 printf("\n");
25850 }
25851 }
25852 }
25853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025854 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025855#endif
25856
Daniel Veillard42595322004-11-08 10:52:06 +000025857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025858}
25859
25860
25861static int
25862test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025864
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025865#ifdef LIBXML_REGEXP_ENABLED
25866 int mem_base;
25867 int ret_val;
25868 xmlValidCtxtPtr ctxt; /* the validation context */
25869 int n_ctxt;
25870 xmlDocPtr doc; /* a document instance */
25871 int n_doc;
25872 xmlNodePtr elem; /* an element instance */
25873 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025874 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025875 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025876
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025877 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25878 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25879 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25880 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25881 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025882 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25883 doc = gen_xmlDocPtr(n_doc, 1);
25884 elem = gen_xmlNodePtr(n_elem, 2);
25885 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025886
25887 ret_val = xmlValidatePushElement(ctxt, doc, elem, qname);
25888 desret_int(ret_val);
25889 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025890 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25891 des_xmlDocPtr(n_doc, doc, 1);
25892 des_xmlNodePtr(n_elem, elem, 2);
25893 des_const_xmlChar_ptr(n_qname, qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025894 xmlResetLastError();
25895 if (mem_base != xmlMemBlocks()) {
25896 printf("Leak of %d blocks found in xmlValidatePushElement",
25897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025898 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025899 printf(" %d", n_ctxt);
25900 printf(" %d", n_doc);
25901 printf(" %d", n_elem);
25902 printf(" %d", n_qname);
25903 printf("\n");
25904 }
25905 }
25906 }
25907 }
25908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025909 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025910#endif
25911
Daniel Veillard42595322004-11-08 10:52:06 +000025912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025913}
25914
25915
25916static int
25917test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025919
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025920#ifdef LIBXML_VALID_ENABLED
25921 int mem_base;
25922 int ret_val;
25923 xmlValidCtxtPtr ctxt; /* the validation context */
25924 int n_ctxt;
25925 xmlDocPtr doc; /* a document instance */
25926 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025927
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025928 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25929 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25930 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025931 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25932 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025933
25934 ret_val = xmlValidateRoot(ctxt, doc);
25935 desret_int(ret_val);
25936 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025937 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25938 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025939 xmlResetLastError();
25940 if (mem_base != xmlMemBlocks()) {
25941 printf("Leak of %d blocks found in xmlValidateRoot",
25942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025943 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025944 printf(" %d", n_ctxt);
25945 printf(" %d", n_doc);
25946 printf("\n");
25947 }
25948 }
25949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025950 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025951#endif
25952
Daniel Veillard42595322004-11-08 10:52:06 +000025953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025954}
25955
25956static int
25957test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025958 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025959
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025960 if (quiet == 0) printf("Testing valid : 46 of 67 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000025961 test_ret += test_xmlAddAttributeDecl();
25962 test_ret += test_xmlAddElementDecl();
25963 test_ret += test_xmlAddID();
25964 test_ret += test_xmlAddNotationDecl();
25965 test_ret += test_xmlAddRef();
25966 test_ret += test_xmlCopyAttributeTable();
25967 test_ret += test_xmlCopyElementContent();
25968 test_ret += test_xmlCopyElementTable();
25969 test_ret += test_xmlCopyEnumeration();
25970 test_ret += test_xmlCopyNotationTable();
25971 test_ret += test_xmlCreateEnumeration();
25972 test_ret += test_xmlDumpAttributeDecl();
25973 test_ret += test_xmlDumpAttributeTable();
25974 test_ret += test_xmlDumpElementDecl();
25975 test_ret += test_xmlDumpElementTable();
25976 test_ret += test_xmlDumpNotationDecl();
25977 test_ret += test_xmlDumpNotationTable();
25978 test_ret += test_xmlGetDtdAttrDesc();
25979 test_ret += test_xmlGetDtdElementDesc();
25980 test_ret += test_xmlGetDtdNotationDesc();
25981 test_ret += test_xmlGetDtdQAttrDesc();
25982 test_ret += test_xmlGetDtdQElementDesc();
25983 test_ret += test_xmlGetID();
25984 test_ret += test_xmlGetRefs();
25985 test_ret += test_xmlIsID();
25986 test_ret += test_xmlIsMixedElement();
25987 test_ret += test_xmlIsRef();
25988 test_ret += test_xmlNewElementContent();
25989 test_ret += test_xmlNewValidCtxt();
25990 test_ret += test_xmlRemoveID();
25991 test_ret += test_xmlRemoveRef();
25992 test_ret += test_xmlSnprintfElementContent();
25993 test_ret += test_xmlSprintfElementContent();
25994 test_ret += test_xmlValidBuildContentModel();
25995 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
25996 test_ret += test_xmlValidGetPotentialChildren();
25997 test_ret += test_xmlValidGetValidElements();
25998 test_ret += test_xmlValidNormalizeAttributeValue();
25999 test_ret += test_xmlValidateAttributeDecl();
26000 test_ret += test_xmlValidateAttributeValue();
26001 test_ret += test_xmlValidateDocument();
26002 test_ret += test_xmlValidateDocumentFinal();
26003 test_ret += test_xmlValidateDtd();
26004 test_ret += test_xmlValidateDtdFinal();
26005 test_ret += test_xmlValidateElement();
26006 test_ret += test_xmlValidateElementDecl();
26007 test_ret += test_xmlValidateNameValue();
26008 test_ret += test_xmlValidateNamesValue();
26009 test_ret += test_xmlValidateNmtokenValue();
26010 test_ret += test_xmlValidateNmtokensValue();
26011 test_ret += test_xmlValidateNotationDecl();
26012 test_ret += test_xmlValidateNotationUse();
26013 test_ret += test_xmlValidateOneAttribute();
26014 test_ret += test_xmlValidateOneElement();
26015 test_ret += test_xmlValidateOneNamespace();
26016 test_ret += test_xmlValidatePopElement();
26017 test_ret += test_xmlValidatePushCData();
26018 test_ret += test_xmlValidatePushElement();
26019 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026020
Daniel Veillard42595322004-11-08 10:52:06 +000026021 if (test_ret != 0)
26022 printf("Module valid: %d errors\n", test_ret);
26023 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026024}
26025
26026static int
26027test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026028 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026029
26030
26031 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026033}
26034
26035
26036static int
26037test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026039
26040#ifdef LIBXML_XINCLUDE_ENABLED
26041 int mem_base;
26042 int ret_val;
26043 xmlDocPtr doc; /* an XML document */
26044 int n_doc;
26045
26046 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26047 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026048 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026049
26050 ret_val = xmlXIncludeProcess(doc);
26051 desret_int(ret_val);
26052 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026053 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026054 xmlResetLastError();
26055 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026056 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026058 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026059 printf(" %d", n_doc);
26060 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026061 }
26062 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026063 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026064#endif
26065
Daniel Veillard42595322004-11-08 10:52:06 +000026066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026067}
26068
26069
26070static int
26071test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026073
26074#ifdef LIBXML_XINCLUDE_ENABLED
26075 int mem_base;
26076 int ret_val;
26077 xmlDocPtr doc; /* an XML document */
26078 int n_doc;
26079 int flags; /* a set of xmlParserOption used for parsing XML includes */
26080 int n_flags;
26081
26082 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26083 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26084 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026085 doc = gen_xmlDocPtr(n_doc, 0);
26086 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026087
26088 ret_val = xmlXIncludeProcessFlags(doc, flags);
26089 desret_int(ret_val);
26090 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026091 des_xmlDocPtr(n_doc, doc, 0);
26092 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026093 xmlResetLastError();
26094 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026095 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026097 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026098 printf(" %d", n_doc);
26099 printf(" %d", n_flags);
26100 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026101 }
26102 }
26103 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026104 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026105#endif
26106
Daniel Veillard42595322004-11-08 10:52:06 +000026107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026108}
26109
Daniel Veillarda521d282004-11-09 14:59:59 +000026110#ifdef LIBXML_XINCLUDE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000026111
Daniel Veillardce682bc2004-11-05 17:22:25 +000026112#define gen_nb_xmlXIncludeCtxtPtr 1
26113static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26114 return(NULL);
26115}
26116static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26117}
Daniel Veillarda521d282004-11-09 14:59:59 +000026118#endif
26119
Daniel Veillardce682bc2004-11-05 17:22:25 +000026120
Daniel Veillardd93f6252004-11-02 15:53:51 +000026121static int
26122test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026124
Daniel Veillardce682bc2004-11-05 17:22:25 +000026125#ifdef LIBXML_XINCLUDE_ENABLED
26126 int mem_base;
26127 int ret_val;
26128 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
26129 int n_ctxt;
26130 xmlNodePtr node; /* a node in an XML document */
26131 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026132
Daniel Veillardce682bc2004-11-05 17:22:25 +000026133 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26134 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
26135 mem_base = xmlMemBlocks();
26136 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26137 node = gen_xmlNodePtr(n_node, 1);
26138
26139 ret_val = xmlXIncludeProcessNode(ctxt, node);
26140 desret_int(ret_val);
26141 call_tests++;
26142 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26143 des_xmlNodePtr(n_node, node, 1);
26144 xmlResetLastError();
26145 if (mem_base != xmlMemBlocks()) {
26146 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
26147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026148 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026149 printf(" %d", n_ctxt);
26150 printf(" %d", n_node);
26151 printf("\n");
26152 }
26153 }
26154 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026155 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026156#endif
26157
Daniel Veillard42595322004-11-08 10:52:06 +000026158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026159}
26160
26161
26162static int
26163test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026164 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026165
26166#ifdef LIBXML_XINCLUDE_ENABLED
26167 int mem_base;
26168 int ret_val;
26169 xmlNodePtr tree; /* a node in an XML document */
26170 int n_tree;
26171
26172 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26173 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026174 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026175
26176 ret_val = xmlXIncludeProcessTree(tree);
26177 desret_int(ret_val);
26178 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026179 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026180 xmlResetLastError();
26181 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026182 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026183 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026184 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026185 printf(" %d", n_tree);
26186 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026187 }
26188 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026189 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026190#endif
26191
Daniel Veillard42595322004-11-08 10:52:06 +000026192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026193}
26194
26195
26196static int
26197test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026198 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026199
26200#ifdef LIBXML_XINCLUDE_ENABLED
26201 int mem_base;
26202 int ret_val;
26203 xmlNodePtr tree; /* a node in an XML document */
26204 int n_tree;
26205 int flags; /* a set of xmlParserOption used for parsing XML includes */
26206 int n_flags;
26207
26208 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26209 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26210 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026211 tree = gen_xmlNodePtr(n_tree, 0);
26212 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026213
26214 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
26215 desret_int(ret_val);
26216 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026217 des_xmlNodePtr(n_tree, tree, 0);
26218 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026219 xmlResetLastError();
26220 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026221 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026222 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026223 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026224 printf(" %d", n_tree);
26225 printf(" %d", n_flags);
26226 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026227 }
26228 }
26229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026230 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026231#endif
26232
Daniel Veillard42595322004-11-08 10:52:06 +000026233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026234}
26235
26236
26237static int
26238test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026240
Daniel Veillardce682bc2004-11-05 17:22:25 +000026241#ifdef LIBXML_XINCLUDE_ENABLED
26242 int mem_base;
26243 int ret_val;
26244 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
26245 int n_ctxt;
26246 int flags; /* a set of xmlParserOption used for parsing XML includes */
26247 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026248
Daniel Veillardce682bc2004-11-05 17:22:25 +000026249 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26250 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26251 mem_base = xmlMemBlocks();
26252 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26253 flags = gen_int(n_flags, 1);
26254
26255 ret_val = xmlXIncludeSetFlags(ctxt, flags);
26256 desret_int(ret_val);
26257 call_tests++;
26258 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26259 des_int(n_flags, flags, 1);
26260 xmlResetLastError();
26261 if (mem_base != xmlMemBlocks()) {
26262 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
26263 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026264 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026265 printf(" %d", n_ctxt);
26266 printf(" %d", n_flags);
26267 printf("\n");
26268 }
26269 }
26270 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026271 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026272#endif
26273
Daniel Veillard42595322004-11-08 10:52:06 +000026274 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026275}
26276
26277static int
26278test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026280
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026281 if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026282 test_ret += test_xmlXIncludeNewContext();
26283 test_ret += test_xmlXIncludeProcess();
26284 test_ret += test_xmlXIncludeProcessFlags();
26285 test_ret += test_xmlXIncludeProcessNode();
26286 test_ret += test_xmlXIncludeProcessTree();
26287 test_ret += test_xmlXIncludeProcessTreeFlags();
26288 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026289
Daniel Veillard42595322004-11-08 10:52:06 +000026290 if (test_ret != 0)
26291 printf("Module xinclude: %d errors\n", test_ret);
26292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026293}
26294
26295static int
26296test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026298
Daniel Veillard3d95c732004-11-06 22:25:14 +000026299#ifdef LIBXML_OUTPUT_ENABLED
26300 int mem_base;
26301 xmlOutputBufferPtr ret_val;
26302 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26303 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026304
Daniel Veillard3d95c732004-11-06 22:25:14 +000026305 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26306 mem_base = xmlMemBlocks();
26307 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26308
26309 ret_val = xmlAllocOutputBuffer(encoder);
26310 desret_xmlOutputBufferPtr(ret_val);
26311 call_tests++;
26312 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26313 xmlResetLastError();
26314 if (mem_base != xmlMemBlocks()) {
26315 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26316 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026317 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026318 printf(" %d", n_encoder);
26319 printf("\n");
26320 }
26321 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026322 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026323#endif
26324
Daniel Veillard42595322004-11-08 10:52:06 +000026325 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026326}
26327
26328
26329static int
26330test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026331 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026332
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026333 int mem_base;
26334 xmlParserInputBufferPtr ret_val;
26335 xmlCharEncoding enc; /* the charset encoding if known */
26336 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026337
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026338 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26339 mem_base = xmlMemBlocks();
26340 enc = gen_xmlCharEncoding(n_enc, 0);
26341
26342 ret_val = xmlAllocParserInputBuffer(enc);
26343 desret_xmlParserInputBufferPtr(ret_val);
26344 call_tests++;
26345 des_xmlCharEncoding(n_enc, enc, 0);
26346 xmlResetLastError();
26347 if (mem_base != xmlMemBlocks()) {
26348 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026350 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026351 printf(" %d", n_enc);
26352 printf("\n");
26353 }
26354 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026355 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026356
Daniel Veillard42595322004-11-08 10:52:06 +000026357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026358}
26359
26360
26361static int
26362test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026364
26365 int mem_base;
26366 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026367 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026368 int n_path;
26369
26370 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26371 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026372 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026373
26374 ret_val = xmlCheckFilename(path);
26375 desret_int(ret_val);
26376 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026377 des_const_char_ptr(n_path, path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026378 xmlResetLastError();
26379 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026380 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026382 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026383 printf(" %d", n_path);
26384 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026385 }
26386 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026387 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026388
Daniel Veillard42595322004-11-08 10:52:06 +000026389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026390}
26391
26392
26393static int
26394test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026395 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026396
Daniel Veillard42595322004-11-08 10:52:06 +000026397 int mem_base;
26398 xmlParserInputPtr ret_val;
26399 xmlParserCtxtPtr ctxt; /* an XML parser context */
26400 int n_ctxt;
26401 xmlParserInputPtr ret; /* an XML parser input */
26402 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026403
Daniel Veillard42595322004-11-08 10:52:06 +000026404 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26405 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26406 mem_base = xmlMemBlocks();
26407 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26408 ret = gen_xmlParserInputPtr(n_ret, 1);
26409
26410 ret_val = xmlCheckHTTPInput(ctxt, ret);
26411 desret_xmlParserInputPtr(ret_val);
26412 call_tests++;
26413 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26414 des_xmlParserInputPtr(n_ret, ret, 1);
26415 xmlResetLastError();
26416 if (mem_base != xmlMemBlocks()) {
26417 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26418 xmlMemBlocks() - mem_base);
26419 test_ret++;
26420 printf(" %d", n_ctxt);
26421 printf(" %d", n_ret);
26422 printf("\n");
26423 }
26424 }
26425 }
Daniel Veillard42595322004-11-08 10:52:06 +000026426 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026427
Daniel Veillard42595322004-11-08 10:52:06 +000026428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026429}
26430
26431
26432static int
26433test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026435
26436 int mem_base;
26437
26438 mem_base = xmlMemBlocks();
26439
26440 xmlCleanupInputCallbacks();
26441 call_tests++;
26442 xmlResetLastError();
26443 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026444 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026445 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026446 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026447 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026448 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026449 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026450
Daniel Veillard42595322004-11-08 10:52:06 +000026451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026452}
26453
26454
26455static int
26456test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026458
26459#ifdef LIBXML_OUTPUT_ENABLED
26460 int mem_base;
26461
26462 mem_base = xmlMemBlocks();
26463
26464 xmlCleanupOutputCallbacks();
26465 call_tests++;
26466 xmlResetLastError();
26467 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026468 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026469 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026470 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026471 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026472 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026473 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026474#endif
26475
Daniel Veillard42595322004-11-08 10:52:06 +000026476 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026477}
26478
26479
26480static int
26481test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026482 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026483
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026484 int mem_base;
26485 int ret_val;
26486 void * context; /* the I/O context */
26487 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026488
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026489 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26490 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026491 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026492
26493 ret_val = xmlFileClose(context);
26494 desret_int(ret_val);
26495 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026496 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026497 xmlResetLastError();
26498 if (mem_base != xmlMemBlocks()) {
26499 printf("Leak of %d blocks found in xmlFileClose",
26500 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026501 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026502 printf(" %d", n_context);
26503 printf("\n");
26504 }
26505 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026506 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026507
Daniel Veillard42595322004-11-08 10:52:06 +000026508 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026509}
26510
26511
26512static int
26513test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026515
26516 int mem_base;
26517 int ret_val;
26518 const char * filename; /* the URI for matching */
26519 int n_filename;
26520
26521 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26522 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026523 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026524
26525 ret_val = xmlFileMatch(filename);
26526 desret_int(ret_val);
26527 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026528 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026529 xmlResetLastError();
26530 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026531 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026533 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026534 printf(" %d", n_filename);
26535 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026536 }
26537 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026538 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026539
Daniel Veillard42595322004-11-08 10:52:06 +000026540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026541}
26542
26543
26544static int
26545test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026547
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026548 int mem_base;
26549 void * ret_val;
26550 const char * filename; /* the URI for matching */
26551 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026552
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026553 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26554 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026555 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026556
26557 ret_val = xmlFileOpen(filename);
26558 desret_void_ptr(ret_val);
26559 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026560 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026561 xmlResetLastError();
26562 if (mem_base != xmlMemBlocks()) {
26563 printf("Leak of %d blocks found in xmlFileOpen",
26564 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026565 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026566 printf(" %d", n_filename);
26567 printf("\n");
26568 }
26569 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026570 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026571
Daniel Veillard42595322004-11-08 10:52:06 +000026572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026573}
26574
26575
26576static int
26577test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026578 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026579
Daniel Veillardce682bc2004-11-05 17:22:25 +000026580 int mem_base;
26581 int ret_val;
26582 void * context; /* the I/O context */
26583 int n_context;
26584 char * buffer; /* where to drop data */
26585 int n_buffer;
26586 int len; /* number of bytes to write */
26587 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026588
Daniel Veillardce682bc2004-11-05 17:22:25 +000026589 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26590 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26591 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26592 mem_base = xmlMemBlocks();
26593 context = gen_void_ptr(n_context, 0);
26594 buffer = gen_char_ptr(n_buffer, 1);
26595 len = gen_int(n_len, 2);
26596
26597 ret_val = xmlFileRead(context, buffer, len);
26598 desret_int(ret_val);
26599 call_tests++;
26600 des_void_ptr(n_context, context, 0);
26601 des_char_ptr(n_buffer, buffer, 1);
26602 des_int(n_len, len, 2);
26603 xmlResetLastError();
26604 if (mem_base != xmlMemBlocks()) {
26605 printf("Leak of %d blocks found in xmlFileRead",
26606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026607 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026608 printf(" %d", n_context);
26609 printf(" %d", n_buffer);
26610 printf(" %d", n_len);
26611 printf("\n");
26612 }
26613 }
26614 }
26615 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000026616 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026617
Daniel Veillard42595322004-11-08 10:52:06 +000026618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026619}
26620
26621
26622static int
26623test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026624 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026625
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026626#ifdef LIBXML_FTP_ENABLED
26627 int mem_base;
26628 int ret_val;
26629 void * context; /* the I/O context */
26630 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026631
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026632 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26633 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026634 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026635
26636 ret_val = xmlIOFTPClose(context);
26637 desret_int(ret_val);
26638 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026639 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026640 xmlResetLastError();
26641 if (mem_base != xmlMemBlocks()) {
26642 printf("Leak of %d blocks found in xmlIOFTPClose",
26643 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026644 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026645 printf(" %d", n_context);
26646 printf("\n");
26647 }
26648 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026649 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026650#endif
26651
Daniel Veillard42595322004-11-08 10:52:06 +000026652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026653}
26654
26655
26656static int
26657test_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026659
26660#ifdef LIBXML_FTP_ENABLED
26661 int mem_base;
26662 int ret_val;
26663 const char * filename; /* the URI for matching */
26664 int n_filename;
26665
26666 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26667 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026668 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026669
26670 ret_val = xmlIOFTPMatch(filename);
26671 desret_int(ret_val);
26672 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026673 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026674 xmlResetLastError();
26675 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026676 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026677 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026678 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026679 printf(" %d", n_filename);
26680 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026681 }
26682 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026683 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026684#endif
26685
Daniel Veillard42595322004-11-08 10:52:06 +000026686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026687}
26688
26689
26690static int
26691test_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026693
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026694#ifdef LIBXML_FTP_ENABLED
26695 int mem_base;
26696 void * ret_val;
26697 const char * filename; /* the URI for matching */
26698 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026699
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026700 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26701 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026702 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026703
26704 ret_val = xmlIOFTPOpen(filename);
26705 desret_void_ptr(ret_val);
26706 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026707 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026708 xmlResetLastError();
26709 if (mem_base != xmlMemBlocks()) {
26710 printf("Leak of %d blocks found in xmlIOFTPOpen",
26711 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026712 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026713 printf(" %d", n_filename);
26714 printf("\n");
26715 }
26716 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026717 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026718#endif
26719
Daniel Veillard42595322004-11-08 10:52:06 +000026720 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026721}
26722
26723
26724static int
26725test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026726 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026727
Daniel Veillardce682bc2004-11-05 17:22:25 +000026728#ifdef LIBXML_FTP_ENABLED
26729 int mem_base;
26730 int ret_val;
26731 void * context; /* the I/O context */
26732 int n_context;
26733 char * buffer; /* where to drop data */
26734 int n_buffer;
26735 int len; /* number of bytes to write */
26736 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026737
Daniel Veillardce682bc2004-11-05 17:22:25 +000026738 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26739 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26740 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26741 mem_base = xmlMemBlocks();
26742 context = gen_void_ptr(n_context, 0);
26743 buffer = gen_char_ptr(n_buffer, 1);
26744 len = gen_int(n_len, 2);
26745
26746 ret_val = xmlIOFTPRead(context, buffer, len);
26747 desret_int(ret_val);
26748 call_tests++;
26749 des_void_ptr(n_context, context, 0);
26750 des_char_ptr(n_buffer, buffer, 1);
26751 des_int(n_len, len, 2);
26752 xmlResetLastError();
26753 if (mem_base != xmlMemBlocks()) {
26754 printf("Leak of %d blocks found in xmlIOFTPRead",
26755 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026756 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026757 printf(" %d", n_context);
26758 printf(" %d", n_buffer);
26759 printf(" %d", n_len);
26760 printf("\n");
26761 }
26762 }
26763 }
26764 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026765 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026766#endif
26767
Daniel Veillard42595322004-11-08 10:52:06 +000026768 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026769}
26770
26771
26772static int
26773test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026774 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026775
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026776#ifdef LIBXML_HTTP_ENABLED
26777 int mem_base;
26778 int ret_val;
26779 void * context; /* the I/O context */
26780 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026781
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026782 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26783 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026784 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026785
26786 ret_val = xmlIOHTTPClose(context);
26787 desret_int(ret_val);
26788 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026789 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026790 xmlResetLastError();
26791 if (mem_base != xmlMemBlocks()) {
26792 printf("Leak of %d blocks found in xmlIOHTTPClose",
26793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026794 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026795 printf(" %d", n_context);
26796 printf("\n");
26797 }
26798 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026799 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026800#endif
26801
Daniel Veillard42595322004-11-08 10:52:06 +000026802 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026803}
26804
26805
26806static int
26807test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026808 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026809
26810#ifdef LIBXML_HTTP_ENABLED
26811 int mem_base;
26812 int ret_val;
26813 const char * filename; /* the URI for matching */
26814 int n_filename;
26815
26816 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26817 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026818 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026819
26820 ret_val = xmlIOHTTPMatch(filename);
26821 desret_int(ret_val);
26822 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026823 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026824 xmlResetLastError();
26825 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026826 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026828 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026829 printf(" %d", n_filename);
26830 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026831 }
26832 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026833 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026834#endif
26835
Daniel Veillard42595322004-11-08 10:52:06 +000026836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026837}
26838
26839
26840static int
26841test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026843
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026844#ifdef LIBXML_HTTP_ENABLED
26845 int mem_base;
26846 void * ret_val;
26847 const char * filename; /* the URI for matching */
26848 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026849
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026850 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26851 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026852 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026853
26854 ret_val = xmlIOHTTPOpen(filename);
26855 desret_void_ptr(ret_val);
26856 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026857 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026858 xmlResetLastError();
26859 if (mem_base != xmlMemBlocks()) {
26860 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026862 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026863 printf(" %d", n_filename);
26864 printf("\n");
26865 }
26866 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026867 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026868#endif
26869
Daniel Veillard42595322004-11-08 10:52:06 +000026870 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026871}
26872
26873
26874static int
26875test_xmlIOHTTPOpenW(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026876 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026877
26878
26879 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026880 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026881}
26882
26883
26884static int
26885test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026886 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026887
Daniel Veillardce682bc2004-11-05 17:22:25 +000026888#ifdef LIBXML_HTTP_ENABLED
26889 int mem_base;
26890 int ret_val;
26891 void * context; /* the I/O context */
26892 int n_context;
26893 char * buffer; /* where to drop data */
26894 int n_buffer;
26895 int len; /* number of bytes to write */
26896 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026897
Daniel Veillardce682bc2004-11-05 17:22:25 +000026898 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26899 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26900 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26901 mem_base = xmlMemBlocks();
26902 context = gen_void_ptr(n_context, 0);
26903 buffer = gen_char_ptr(n_buffer, 1);
26904 len = gen_int(n_len, 2);
26905
26906 ret_val = xmlIOHTTPRead(context, buffer, len);
26907 desret_int(ret_val);
26908 call_tests++;
26909 des_void_ptr(n_context, context, 0);
26910 des_char_ptr(n_buffer, buffer, 1);
26911 des_int(n_len, len, 2);
26912 xmlResetLastError();
26913 if (mem_base != xmlMemBlocks()) {
26914 printf("Leak of %d blocks found in xmlIOHTTPRead",
26915 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026916 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026917 printf(" %d", n_context);
26918 printf(" %d", n_buffer);
26919 printf(" %d", n_len);
26920 printf("\n");
26921 }
26922 }
26923 }
26924 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026925 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026926#endif
26927
Daniel Veillard42595322004-11-08 10:52:06 +000026928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026929}
26930
26931
26932static int
26933test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026935
Daniel Veillard42595322004-11-08 10:52:06 +000026936 int mem_base;
26937 xmlParserInputPtr ret_val;
26938 const char * URL; /* the URL for the entity to load */
26939 int n_URL;
26940 char * ID; /* the System ID for the entity to load */
26941 int n_ID;
26942 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
26943 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026944
Daniel Veillard42595322004-11-08 10:52:06 +000026945 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
26946 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
26947 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26948 mem_base = xmlMemBlocks();
26949 URL = gen_filepath(n_URL, 0);
26950 ID = gen_const_char_ptr(n_ID, 1);
26951 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
26952
26953 ret_val = xmlNoNetExternalEntityLoader(URL, ID, ctxt);
26954 desret_xmlParserInputPtr(ret_val);
26955 call_tests++;
26956 des_filepath(n_URL, URL, 0);
26957 des_const_char_ptr(n_ID, ID, 1);
26958 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
26959 xmlResetLastError();
26960 if (mem_base != xmlMemBlocks()) {
26961 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
26962 xmlMemBlocks() - mem_base);
26963 test_ret++;
26964 printf(" %d", n_URL);
26965 printf(" %d", n_ID);
26966 printf(" %d", n_ctxt);
26967 printf("\n");
26968 }
26969 }
26970 }
26971 }
Daniel Veillard42595322004-11-08 10:52:06 +000026972 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026973
Daniel Veillard42595322004-11-08 10:52:06 +000026974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026975}
26976
26977
26978static int
26979test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026981
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026982 int mem_base;
26983 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026984 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026985 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026986
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026987 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
26988 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026989 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026990
26991 ret_val = xmlNormalizeWindowsPath(path);
26992 desret_xmlChar_ptr(ret_val);
26993 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026994 des_const_xmlChar_ptr(n_path, path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026995 xmlResetLastError();
26996 if (mem_base != xmlMemBlocks()) {
26997 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
26998 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026999 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027000 printf(" %d", n_path);
27001 printf("\n");
27002 }
27003 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027004 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027005
Daniel Veillard42595322004-11-08 10:52:06 +000027006 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027007}
27008
27009
27010static int
27011test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027012 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027013
Daniel Veillard3d95c732004-11-06 22:25:14 +000027014#ifdef LIBXML_OUTPUT_ENABLED
27015 int mem_base;
27016 xmlOutputBufferPtr ret_val;
27017 int fd; /* a file descriptor number */
27018 int n_fd;
27019 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27020 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027021
Daniel Veillard3d95c732004-11-06 22:25:14 +000027022 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27023 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27024 mem_base = xmlMemBlocks();
27025 fd = gen_int(n_fd, 0);
27026 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27027
27028 ret_val = xmlOutputBufferCreateFd(fd, encoder);
27029 desret_xmlOutputBufferPtr(ret_val);
27030 call_tests++;
27031 des_int(n_fd, fd, 0);
27032 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27033 xmlResetLastError();
27034 if (mem_base != xmlMemBlocks()) {
27035 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
27036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027037 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027038 printf(" %d", n_fd);
27039 printf(" %d", n_encoder);
27040 printf("\n");
27041 }
27042 }
27043 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027044 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027045#endif
27046
Daniel Veillard42595322004-11-08 10:52:06 +000027047 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027048}
27049
27050
27051static int
27052test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027053 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027054
Daniel Veillard3d95c732004-11-06 22:25:14 +000027055#ifdef LIBXML_OUTPUT_ENABLED
27056 int mem_base;
27057 xmlOutputBufferPtr ret_val;
27058 FILE * file; /* a FILE* */
27059 int n_file;
27060 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27061 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027062
Daniel Veillard3d95c732004-11-06 22:25:14 +000027063 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27064 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27065 mem_base = xmlMemBlocks();
27066 file = gen_FILE_ptr(n_file, 0);
27067 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27068
27069 ret_val = xmlOutputBufferCreateFile(file, encoder);
27070 desret_xmlOutputBufferPtr(ret_val);
27071 call_tests++;
27072 des_FILE_ptr(n_file, file, 0);
27073 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27074 xmlResetLastError();
27075 if (mem_base != xmlMemBlocks()) {
27076 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
27077 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027078 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027079 printf(" %d", n_file);
27080 printf(" %d", n_encoder);
27081 printf("\n");
27082 }
27083 }
27084 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027085 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027086#endif
27087
Daniel Veillard42595322004-11-08 10:52:06 +000027088 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027089}
27090
27091
27092static int
27093test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027094 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027095
Daniel Veillard3d95c732004-11-06 22:25:14 +000027096#ifdef LIBXML_OUTPUT_ENABLED
27097 int mem_base;
27098 xmlOutputBufferPtr ret_val;
27099 const char * URI; /* a C string containing the URI or filename */
27100 int n_URI;
27101 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27102 int n_encoder;
27103 int compression; /* the compression ration (0 none, 9 max). */
27104 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027105
Daniel Veillard42595322004-11-08 10:52:06 +000027106 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000027107 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27108 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
27109 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027110 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027111 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27112 compression = gen_int(n_compression, 2);
27113
27114 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
27115 desret_xmlOutputBufferPtr(ret_val);
27116 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027117 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027118 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27119 des_int(n_compression, compression, 2);
27120 xmlResetLastError();
27121 if (mem_base != xmlMemBlocks()) {
27122 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
27123 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027124 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027125 printf(" %d", n_URI);
27126 printf(" %d", n_encoder);
27127 printf(" %d", n_compression);
27128 printf("\n");
27129 }
27130 }
27131 }
27132 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027133 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027134#endif
27135
Daniel Veillard42595322004-11-08 10:52:06 +000027136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027137}
27138
27139
27140static int
27141test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027143
Daniel Veillard3d97e662004-11-04 10:49:00 +000027144#ifdef LIBXML_OUTPUT_ENABLED
27145 int mem_base;
27146 int ret_val;
27147 xmlOutputBufferPtr out; /* a buffered output */
27148 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027149
Daniel Veillard3d97e662004-11-04 10:49:00 +000027150 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27151 mem_base = xmlMemBlocks();
27152 out = gen_xmlOutputBufferPtr(n_out, 0);
27153
27154 ret_val = xmlOutputBufferFlush(out);
27155 desret_int(ret_val);
27156 call_tests++;
27157 des_xmlOutputBufferPtr(n_out, out, 0);
27158 xmlResetLastError();
27159 if (mem_base != xmlMemBlocks()) {
27160 printf("Leak of %d blocks found in xmlOutputBufferFlush",
27161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027162 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027163 printf(" %d", n_out);
27164 printf("\n");
27165 }
27166 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027167 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027168#endif
27169
Daniel Veillard42595322004-11-08 10:52:06 +000027170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027171}
27172
27173
27174static int
27175test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027177
Daniel Veillard3d97e662004-11-04 10:49:00 +000027178#ifdef LIBXML_OUTPUT_ENABLED
27179 int mem_base;
27180 int ret_val;
27181 xmlOutputBufferPtr out; /* a buffered parser output */
27182 int n_out;
27183 int len; /* the size in bytes of the array. */
27184 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027185 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027186 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027187
Daniel Veillard3d97e662004-11-04 10:49:00 +000027188 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27189 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27190 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27191 mem_base = xmlMemBlocks();
27192 out = gen_xmlOutputBufferPtr(n_out, 0);
27193 len = gen_int(n_len, 1);
27194 buf = gen_const_char_ptr(n_buf, 2);
27195
27196 ret_val = xmlOutputBufferWrite(out, len, buf);
27197 desret_int(ret_val);
27198 call_tests++;
27199 des_xmlOutputBufferPtr(n_out, out, 0);
27200 des_int(n_len, len, 1);
27201 des_const_char_ptr(n_buf, buf, 2);
27202 xmlResetLastError();
27203 if (mem_base != xmlMemBlocks()) {
27204 printf("Leak of %d blocks found in xmlOutputBufferWrite",
27205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027206 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027207 printf(" %d", n_out);
27208 printf(" %d", n_len);
27209 printf(" %d", n_buf);
27210 printf("\n");
27211 }
27212 }
27213 }
27214 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027215 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027216#endif
27217
Daniel Veillard42595322004-11-08 10:52:06 +000027218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027219}
27220
27221
27222static int
27223test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027225
27226
27227 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027228 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027229}
27230
27231
27232static int
27233test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027235
Daniel Veillard3d97e662004-11-04 10:49:00 +000027236#ifdef LIBXML_OUTPUT_ENABLED
27237 int mem_base;
27238 int ret_val;
27239 xmlOutputBufferPtr out; /* a buffered parser output */
27240 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027241 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027242 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027243
Daniel Veillard3d97e662004-11-04 10:49:00 +000027244 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27245 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
27246 mem_base = xmlMemBlocks();
27247 out = gen_xmlOutputBufferPtr(n_out, 0);
27248 str = gen_const_char_ptr(n_str, 1);
27249
27250 ret_val = xmlOutputBufferWriteString(out, str);
27251 desret_int(ret_val);
27252 call_tests++;
27253 des_xmlOutputBufferPtr(n_out, out, 0);
27254 des_const_char_ptr(n_str, str, 1);
27255 xmlResetLastError();
27256 if (mem_base != xmlMemBlocks()) {
27257 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
27258 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027259 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027260 printf(" %d", n_out);
27261 printf(" %d", n_str);
27262 printf("\n");
27263 }
27264 }
27265 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027266 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027267#endif
27268
Daniel Veillard42595322004-11-08 10:52:06 +000027269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027270}
27271
27272
27273static int
27274test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027276
27277
27278 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027279 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027280}
27281
27282
27283static int
27284test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027285 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027286
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027287 int mem_base;
27288 xmlParserInputBufferPtr ret_val;
27289 int fd; /* a file descriptor number */
27290 int n_fd;
27291 xmlCharEncoding enc; /* the charset encoding if known */
27292 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027293
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027294 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27295 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27296 mem_base = xmlMemBlocks();
27297 fd = gen_int(n_fd, 0);
27298 enc = gen_xmlCharEncoding(n_enc, 1);
27299 if (fd >= 0) fd = -1;
27300
27301 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27302 desret_xmlParserInputBufferPtr(ret_val);
27303 call_tests++;
27304 des_int(n_fd, fd, 0);
27305 des_xmlCharEncoding(n_enc, enc, 1);
27306 xmlResetLastError();
27307 if (mem_base != xmlMemBlocks()) {
27308 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27309 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027310 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027311 printf(" %d", n_fd);
27312 printf(" %d", n_enc);
27313 printf("\n");
27314 }
27315 }
27316 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027317 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027318
Daniel Veillard42595322004-11-08 10:52:06 +000027319 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027320}
27321
27322
27323static int
27324test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027325 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027326
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027327 int mem_base;
27328 xmlParserInputBufferPtr ret_val;
27329 FILE * file; /* a FILE* */
27330 int n_file;
27331 xmlCharEncoding enc; /* the charset encoding if known */
27332 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027333
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027334 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27335 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27336 mem_base = xmlMemBlocks();
27337 file = gen_FILE_ptr(n_file, 0);
27338 enc = gen_xmlCharEncoding(n_enc, 1);
27339
27340 ret_val = xmlParserInputBufferCreateFile(file, enc);
27341 desret_xmlParserInputBufferPtr(ret_val);
27342 call_tests++;
27343 des_FILE_ptr(n_file, file, 0);
27344 des_xmlCharEncoding(n_enc, enc, 1);
27345 xmlResetLastError();
27346 if (mem_base != xmlMemBlocks()) {
27347 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27348 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027349 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027350 printf(" %d", n_file);
27351 printf(" %d", n_enc);
27352 printf("\n");
27353 }
27354 }
27355 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027356 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027357
Daniel Veillard42595322004-11-08 10:52:06 +000027358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027359}
27360
27361
27362static int
27363test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027365
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027366 int mem_base;
27367 xmlParserInputBufferPtr ret_val;
27368 const char * URI; /* a C string containing the URI or filename */
27369 int n_URI;
27370 xmlCharEncoding enc; /* the charset encoding if known */
27371 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027372
Daniel Veillard42595322004-11-08 10:52:06 +000027373 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027374 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27375 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027376 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027377 enc = gen_xmlCharEncoding(n_enc, 1);
27378
27379 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27380 desret_xmlParserInputBufferPtr(ret_val);
27381 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027382 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027383 des_xmlCharEncoding(n_enc, enc, 1);
27384 xmlResetLastError();
27385 if (mem_base != xmlMemBlocks()) {
27386 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27387 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027388 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027389 printf(" %d", n_URI);
27390 printf(" %d", n_enc);
27391 printf("\n");
27392 }
27393 }
27394 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027395 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027396
Daniel Veillard42595322004-11-08 10:52:06 +000027397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027398}
27399
27400
27401static int
27402test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027404
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027405 int mem_base;
27406 xmlParserInputBufferPtr ret_val;
27407 char * mem; /* the memory input */
27408 int n_mem;
27409 int size; /* the length of the memory block */
27410 int n_size;
27411 xmlCharEncoding enc; /* the charset encoding if known */
27412 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027413
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027414 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27415 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27416 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27417 mem_base = xmlMemBlocks();
27418 mem = gen_const_char_ptr(n_mem, 0);
27419 size = gen_int(n_size, 1);
27420 enc = gen_xmlCharEncoding(n_enc, 2);
27421
27422 ret_val = xmlParserInputBufferCreateMem(mem, size, enc);
27423 desret_xmlParserInputBufferPtr(ret_val);
27424 call_tests++;
27425 des_const_char_ptr(n_mem, mem, 0);
27426 des_int(n_size, size, 1);
27427 des_xmlCharEncoding(n_enc, enc, 2);
27428 xmlResetLastError();
27429 if (mem_base != xmlMemBlocks()) {
27430 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27431 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027432 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027433 printf(" %d", n_mem);
27434 printf(" %d", n_size);
27435 printf(" %d", n_enc);
27436 printf("\n");
27437 }
27438 }
27439 }
27440 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027441 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027442
Daniel Veillard42595322004-11-08 10:52:06 +000027443 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027444}
27445
27446
27447static int
27448test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027449 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027450
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027451 int mem_base;
27452 xmlParserInputBufferPtr ret_val;
27453 char * mem; /* the memory input */
27454 int n_mem;
27455 int size; /* the length of the memory block */
27456 int n_size;
27457 xmlCharEncoding enc; /* the charset encoding if known */
27458 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027459
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027460 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27461 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27462 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27463 mem_base = xmlMemBlocks();
27464 mem = gen_const_char_ptr(n_mem, 0);
27465 size = gen_int(n_size, 1);
27466 enc = gen_xmlCharEncoding(n_enc, 2);
27467
27468 ret_val = xmlParserInputBufferCreateStatic(mem, size, enc);
27469 desret_xmlParserInputBufferPtr(ret_val);
27470 call_tests++;
27471 des_const_char_ptr(n_mem, mem, 0);
27472 des_int(n_size, size, 1);
27473 des_xmlCharEncoding(n_enc, enc, 2);
27474 xmlResetLastError();
27475 if (mem_base != xmlMemBlocks()) {
27476 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27477 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027478 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027479 printf(" %d", n_mem);
27480 printf(" %d", n_size);
27481 printf(" %d", n_enc);
27482 printf("\n");
27483 }
27484 }
27485 }
27486 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027487 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027488
Daniel Veillard42595322004-11-08 10:52:06 +000027489 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027490}
27491
27492
27493static int
27494test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027496
Daniel Veillard34099b42004-11-04 17:34:35 +000027497 int mem_base;
27498 int ret_val;
27499 xmlParserInputBufferPtr in; /* a buffered parser input */
27500 int n_in;
27501 int len; /* indicative value of the amount of chars to read */
27502 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027503
Daniel Veillard34099b42004-11-04 17:34:35 +000027504 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27505 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27506 mem_base = xmlMemBlocks();
27507 in = gen_xmlParserInputBufferPtr(n_in, 0);
27508 len = gen_int(n_len, 1);
27509
27510 ret_val = xmlParserInputBufferGrow(in, len);
27511 desret_int(ret_val);
27512 call_tests++;
27513 des_xmlParserInputBufferPtr(n_in, in, 0);
27514 des_int(n_len, len, 1);
27515 xmlResetLastError();
27516 if (mem_base != xmlMemBlocks()) {
27517 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027519 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027520 printf(" %d", n_in);
27521 printf(" %d", n_len);
27522 printf("\n");
27523 }
27524 }
27525 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027526 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027527
Daniel Veillard42595322004-11-08 10:52:06 +000027528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027529}
27530
27531
27532static int
27533test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027535
Daniel Veillard34099b42004-11-04 17:34:35 +000027536 int mem_base;
27537 int ret_val;
27538 xmlParserInputBufferPtr in; /* a buffered parser input */
27539 int n_in;
27540 int len; /* the size in bytes of the array. */
27541 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027542 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027543 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027544
Daniel Veillard34099b42004-11-04 17:34:35 +000027545 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27546 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27547 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27548 mem_base = xmlMemBlocks();
27549 in = gen_xmlParserInputBufferPtr(n_in, 0);
27550 len = gen_int(n_len, 1);
27551 buf = gen_const_char_ptr(n_buf, 2);
27552
27553 ret_val = xmlParserInputBufferPush(in, len, buf);
27554 desret_int(ret_val);
27555 call_tests++;
27556 des_xmlParserInputBufferPtr(n_in, in, 0);
27557 des_int(n_len, len, 1);
27558 des_const_char_ptr(n_buf, buf, 2);
27559 xmlResetLastError();
27560 if (mem_base != xmlMemBlocks()) {
27561 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027563 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027564 printf(" %d", n_in);
27565 printf(" %d", n_len);
27566 printf(" %d", n_buf);
27567 printf("\n");
27568 }
27569 }
27570 }
27571 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027572 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027573
Daniel Veillard42595322004-11-08 10:52:06 +000027574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027575}
27576
27577
27578static int
27579test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027580 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027581
Daniel Veillard34099b42004-11-04 17:34:35 +000027582 int mem_base;
27583 int ret_val;
27584 xmlParserInputBufferPtr in; /* a buffered parser input */
27585 int n_in;
27586 int len; /* indicative value of the amount of chars to read */
27587 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027588
Daniel Veillard34099b42004-11-04 17:34:35 +000027589 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27590 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27591 mem_base = xmlMemBlocks();
27592 in = gen_xmlParserInputBufferPtr(n_in, 0);
27593 len = gen_int(n_len, 1);
27594
27595 ret_val = xmlParserInputBufferRead(in, len);
27596 desret_int(ret_val);
27597 call_tests++;
27598 des_xmlParserInputBufferPtr(n_in, in, 0);
27599 des_int(n_len, len, 1);
27600 xmlResetLastError();
27601 if (mem_base != xmlMemBlocks()) {
27602 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27603 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027604 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027605 printf(" %d", n_in);
27606 printf(" %d", n_len);
27607 printf("\n");
27608 }
27609 }
27610 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027611 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027612
Daniel Veillard42595322004-11-08 10:52:06 +000027613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027614}
27615
27616
27617static int
27618test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027620
27621 int mem_base;
27622 int ret_val;
27623
27624 mem_base = xmlMemBlocks();
27625
27626 ret_val = xmlPopInputCallbacks();
27627 desret_int(ret_val);
27628 call_tests++;
27629 xmlResetLastError();
27630 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027631 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027633 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027634 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027635 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027636 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027637
Daniel Veillard42595322004-11-08 10:52:06 +000027638 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027639}
27640
27641
27642static int
27643test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027644 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027645
27646 int mem_base;
27647
27648 mem_base = xmlMemBlocks();
27649
27650 xmlRegisterDefaultInputCallbacks();
27651 call_tests++;
27652 xmlResetLastError();
27653 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027654 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027655 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027656 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027657 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027658 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027659 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027660
Daniel Veillard42595322004-11-08 10:52:06 +000027661 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027662}
27663
27664
27665static int
27666test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027667 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027668
27669#ifdef LIBXML_OUTPUT_ENABLED
27670 int mem_base;
27671
27672 mem_base = xmlMemBlocks();
27673
27674 xmlRegisterDefaultOutputCallbacks();
27675 call_tests++;
27676 xmlResetLastError();
27677 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027678 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027680 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027681 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027682 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027683 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027684#endif
27685
Daniel Veillard42595322004-11-08 10:52:06 +000027686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027687}
27688
27689
27690static int
27691test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027693
27694#ifdef LIBXML_HTTP_ENABLED
27695 int mem_base;
27696
27697 mem_base = xmlMemBlocks();
27698
27699 xmlRegisterHTTPPostCallbacks();
27700 call_tests++;
27701 xmlResetLastError();
27702 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027703 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027704 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027705 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027706 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027707 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027708 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027709#endif
27710
Daniel Veillard42595322004-11-08 10:52:06 +000027711 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027712}
27713
27714static int
27715test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027716 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027717
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027718 if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000027719 test_ret += test_xmlAllocOutputBuffer();
27720 test_ret += test_xmlAllocParserInputBuffer();
27721 test_ret += test_xmlCheckFilename();
27722 test_ret += test_xmlCheckHTTPInput();
27723 test_ret += test_xmlCleanupInputCallbacks();
27724 test_ret += test_xmlCleanupOutputCallbacks();
27725 test_ret += test_xmlFileClose();
27726 test_ret += test_xmlFileMatch();
27727 test_ret += test_xmlFileOpen();
27728 test_ret += test_xmlFileRead();
27729 test_ret += test_xmlIOFTPClose();
27730 test_ret += test_xmlIOFTPMatch();
27731 test_ret += test_xmlIOFTPOpen();
27732 test_ret += test_xmlIOFTPRead();
27733 test_ret += test_xmlIOHTTPClose();
27734 test_ret += test_xmlIOHTTPMatch();
27735 test_ret += test_xmlIOHTTPOpen();
27736 test_ret += test_xmlIOHTTPOpenW();
27737 test_ret += test_xmlIOHTTPRead();
27738 test_ret += test_xmlNoNetExternalEntityLoader();
27739 test_ret += test_xmlNormalizeWindowsPath();
27740 test_ret += test_xmlOutputBufferCreateFd();
27741 test_ret += test_xmlOutputBufferCreateFile();
27742 test_ret += test_xmlOutputBufferCreateFilename();
27743 test_ret += test_xmlOutputBufferFlush();
27744 test_ret += test_xmlOutputBufferWrite();
27745 test_ret += test_xmlOutputBufferWriteEscape();
27746 test_ret += test_xmlOutputBufferWriteString();
27747 test_ret += test_xmlParserGetDirectory();
27748 test_ret += test_xmlParserInputBufferCreateFd();
27749 test_ret += test_xmlParserInputBufferCreateFile();
27750 test_ret += test_xmlParserInputBufferCreateFilename();
27751 test_ret += test_xmlParserInputBufferCreateMem();
27752 test_ret += test_xmlParserInputBufferCreateStatic();
27753 test_ret += test_xmlParserInputBufferGrow();
27754 test_ret += test_xmlParserInputBufferPush();
27755 test_ret += test_xmlParserInputBufferRead();
27756 test_ret += test_xmlPopInputCallbacks();
27757 test_ret += test_xmlRegisterDefaultInputCallbacks();
27758 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27759 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027760
Daniel Veillard42595322004-11-08 10:52:06 +000027761 if (test_ret != 0)
27762 printf("Module xmlIO: %d errors\n", test_ret);
27763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027764}
Daniel Veillarda521d282004-11-09 14:59:59 +000027765#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000027766
Daniel Veillarda82b1822004-11-08 16:24:57 +000027767#define gen_nb_xmlAutomataPtr 1
27768static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27769 return(NULL);
27770}
27771static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27772}
Daniel Veillarda521d282004-11-09 14:59:59 +000027773#endif
27774
Daniel Veillarda82b1822004-11-08 16:24:57 +000027775
27776static int
27777test_xmlAutomataCompile(void) {
27778 int test_ret = 0;
27779
27780
27781 /* missing type support */
27782 return(test_ret);
27783}
27784
27785
27786static int
27787test_xmlAutomataGetInitState(void) {
27788 int test_ret = 0;
27789
27790
27791 /* missing type support */
27792 return(test_ret);
27793}
27794
27795
27796static int
27797test_xmlAutomataIsDeterminist(void) {
27798 int test_ret = 0;
27799
27800#ifdef LIBXML_AUTOMATA_ENABLED
27801 int mem_base;
27802 int ret_val;
27803 xmlAutomataPtr am; /* an automata */
27804 int n_am;
27805
27806 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27807 mem_base = xmlMemBlocks();
27808 am = gen_xmlAutomataPtr(n_am, 0);
27809
27810 ret_val = xmlAutomataIsDeterminist(am);
27811 desret_int(ret_val);
27812 call_tests++;
27813 des_xmlAutomataPtr(n_am, am, 0);
27814 xmlResetLastError();
27815 if (mem_base != xmlMemBlocks()) {
27816 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27817 xmlMemBlocks() - mem_base);
27818 test_ret++;
27819 printf(" %d", n_am);
27820 printf("\n");
27821 }
27822 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027823 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027824#endif
27825
Daniel Veillarda82b1822004-11-08 16:24:57 +000027826 return(test_ret);
27827}
27828
Daniel Veillarda521d282004-11-09 14:59:59 +000027829#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000027830
27831#define gen_nb_xmlAutomataStatePtr 1
27832static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27833 return(NULL);
27834}
27835static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27836}
Daniel Veillarda521d282004-11-09 14:59:59 +000027837#endif
27838
Daniel Veillarda82b1822004-11-08 16:24:57 +000027839
27840static int
27841test_xmlAutomataNewAllTrans(void) {
27842 int test_ret = 0;
27843
27844
27845 /* missing type support */
27846 return(test_ret);
27847}
27848
27849
27850static int
27851test_xmlAutomataNewCountTrans(void) {
27852 int test_ret = 0;
27853
27854
27855 /* missing type support */
27856 return(test_ret);
27857}
27858
27859
27860static int
27861test_xmlAutomataNewCountTrans2(void) {
27862 int test_ret = 0;
27863
27864
27865 /* missing type support */
27866 return(test_ret);
27867}
27868
27869
27870static int
27871test_xmlAutomataNewCountedTrans(void) {
27872 int test_ret = 0;
27873
27874
27875 /* missing type support */
27876 return(test_ret);
27877}
27878
27879
27880static int
27881test_xmlAutomataNewCounter(void) {
27882 int test_ret = 0;
27883
27884#ifdef LIBXML_AUTOMATA_ENABLED
27885 int mem_base;
27886 int ret_val;
27887 xmlAutomataPtr am; /* an automata */
27888 int n_am;
27889 int min; /* the minimal value on the counter */
27890 int n_min;
27891 int max; /* the maximal value on the counter */
27892 int n_max;
27893
27894 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27895 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27896 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27897 mem_base = xmlMemBlocks();
27898 am = gen_xmlAutomataPtr(n_am, 0);
27899 min = gen_int(n_min, 1);
27900 max = gen_int(n_max, 2);
27901
27902 ret_val = xmlAutomataNewCounter(am, min, max);
27903 desret_int(ret_val);
27904 call_tests++;
27905 des_xmlAutomataPtr(n_am, am, 0);
27906 des_int(n_min, min, 1);
27907 des_int(n_max, max, 2);
27908 xmlResetLastError();
27909 if (mem_base != xmlMemBlocks()) {
27910 printf("Leak of %d blocks found in xmlAutomataNewCounter",
27911 xmlMemBlocks() - mem_base);
27912 test_ret++;
27913 printf(" %d", n_am);
27914 printf(" %d", n_min);
27915 printf(" %d", n_max);
27916 printf("\n");
27917 }
27918 }
27919 }
27920 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027921 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027922#endif
27923
Daniel Veillarda82b1822004-11-08 16:24:57 +000027924 return(test_ret);
27925}
27926
27927
27928static int
27929test_xmlAutomataNewCounterTrans(void) {
27930 int test_ret = 0;
27931
27932
27933 /* missing type support */
27934 return(test_ret);
27935}
27936
27937
27938static int
27939test_xmlAutomataNewEpsilon(void) {
27940 int test_ret = 0;
27941
27942
27943 /* missing type support */
27944 return(test_ret);
27945}
27946
27947
27948static int
27949test_xmlAutomataNewOnceTrans(void) {
27950 int test_ret = 0;
27951
27952
27953 /* missing type support */
27954 return(test_ret);
27955}
27956
27957
27958static int
27959test_xmlAutomataNewOnceTrans2(void) {
27960 int test_ret = 0;
27961
27962
27963 /* missing type support */
27964 return(test_ret);
27965}
27966
27967
27968static int
27969test_xmlAutomataNewState(void) {
27970 int test_ret = 0;
27971
27972
27973 /* missing type support */
27974 return(test_ret);
27975}
27976
27977
27978static int
27979test_xmlAutomataNewTransition(void) {
27980 int test_ret = 0;
27981
27982
27983 /* missing type support */
27984 return(test_ret);
27985}
27986
27987
27988static int
27989test_xmlAutomataNewTransition2(void) {
27990 int test_ret = 0;
27991
27992
27993 /* missing type support */
27994 return(test_ret);
27995}
27996
27997
27998static int
27999test_xmlAutomataSetFinalState(void) {
28000 int test_ret = 0;
28001
28002#ifdef LIBXML_AUTOMATA_ENABLED
28003 int mem_base;
28004 int ret_val;
28005 xmlAutomataPtr am; /* an automata */
28006 int n_am;
28007 xmlAutomataStatePtr state; /* a state in this automata */
28008 int n_state;
28009
28010 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
28011 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
28012 mem_base = xmlMemBlocks();
28013 am = gen_xmlAutomataPtr(n_am, 0);
28014 state = gen_xmlAutomataStatePtr(n_state, 1);
28015
28016 ret_val = xmlAutomataSetFinalState(am, state);
28017 desret_int(ret_val);
28018 call_tests++;
28019 des_xmlAutomataPtr(n_am, am, 0);
28020 des_xmlAutomataStatePtr(n_state, state, 1);
28021 xmlResetLastError();
28022 if (mem_base != xmlMemBlocks()) {
28023 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
28024 xmlMemBlocks() - mem_base);
28025 test_ret++;
28026 printf(" %d", n_am);
28027 printf(" %d", n_state);
28028 printf("\n");
28029 }
28030 }
28031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028032 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000028033#endif
28034
Daniel Veillarda82b1822004-11-08 16:24:57 +000028035 return(test_ret);
28036}
28037
28038
28039static int
28040test_xmlNewAutomata(void) {
28041 int test_ret = 0;
28042
28043
28044 /* missing type support */
28045 return(test_ret);
28046}
28047
28048static int
28049test_xmlautomata(void) {
28050 int test_ret = 0;
28051
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028052 if (quiet == 0) printf("Testing xmlautomata : 3 of 18 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000028053 test_ret += test_xmlAutomataCompile();
28054 test_ret += test_xmlAutomataGetInitState();
28055 test_ret += test_xmlAutomataIsDeterminist();
28056 test_ret += test_xmlAutomataNewAllTrans();
28057 test_ret += test_xmlAutomataNewCountTrans();
28058 test_ret += test_xmlAutomataNewCountTrans2();
28059 test_ret += test_xmlAutomataNewCountedTrans();
28060 test_ret += test_xmlAutomataNewCounter();
28061 test_ret += test_xmlAutomataNewCounterTrans();
28062 test_ret += test_xmlAutomataNewEpsilon();
28063 test_ret += test_xmlAutomataNewOnceTrans();
28064 test_ret += test_xmlAutomataNewOnceTrans2();
28065 test_ret += test_xmlAutomataNewState();
28066 test_ret += test_xmlAutomataNewTransition();
28067 test_ret += test_xmlAutomataNewTransition2();
28068 test_ret += test_xmlAutomataSetFinalState();
28069 test_ret += test_xmlNewAutomata();
28070
28071 if (test_ret != 0)
28072 printf("Module xmlautomata: %d errors\n", test_ret);
28073 return(test_ret);
28074}
28075
Daniel Veillardce682bc2004-11-05 17:22:25 +000028076#define gen_nb_xmlGenericErrorFunc_ptr 1
28077static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28078 return(NULL);
28079}
28080static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28081}
28082
Daniel Veillardd93f6252004-11-02 15:53:51 +000028083static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028084test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028086
Daniel Veillardce682bc2004-11-05 17:22:25 +000028087 int mem_base;
28088 xmlGenericErrorFunc * handler; /* the handler */
28089 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028090
Daniel Veillardce682bc2004-11-05 17:22:25 +000028091 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
28092 mem_base = xmlMemBlocks();
28093 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
28094
28095 initGenericErrorDefaultFunc(handler);
28096 call_tests++;
28097 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
28098 xmlResetLastError();
28099 if (mem_base != xmlMemBlocks()) {
28100 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
28101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028102 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028103 printf(" %d", n_handler);
28104 printf("\n");
28105 }
28106 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028107 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028108
Daniel Veillard42595322004-11-08 10:52:06 +000028109 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028110}
28111
28112
Daniel Veillardce682bc2004-11-05 17:22:25 +000028113#define gen_nb_xmlErrorPtr 1
28114static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28115 return(NULL);
28116}
28117static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28118}
28119
Daniel Veillardd93f6252004-11-02 15:53:51 +000028120static int
28121test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028123
Daniel Veillardce682bc2004-11-05 17:22:25 +000028124 int mem_base;
28125 int ret_val;
28126 xmlErrorPtr from; /* a source error */
28127 int n_from;
28128 xmlErrorPtr to; /* a target error */
28129 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028130
Daniel Veillardce682bc2004-11-05 17:22:25 +000028131 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
28132 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
28133 mem_base = xmlMemBlocks();
28134 from = gen_xmlErrorPtr(n_from, 0);
28135 to = gen_xmlErrorPtr(n_to, 1);
28136
28137 ret_val = xmlCopyError(from, to);
28138 desret_int(ret_val);
28139 call_tests++;
28140 des_xmlErrorPtr(n_from, from, 0);
28141 des_xmlErrorPtr(n_to, to, 1);
28142 xmlResetLastError();
28143 if (mem_base != xmlMemBlocks()) {
28144 printf("Leak of %d blocks found in xmlCopyError",
28145 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028146 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028147 printf(" %d", n_from);
28148 printf(" %d", n_to);
28149 printf("\n");
28150 }
28151 }
28152 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028153 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028154
Daniel Veillard42595322004-11-08 10:52:06 +000028155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028156}
28157
28158
28159static int
28160test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028162
28163
28164 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028166}
28167
28168
28169static int
28170test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028172
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028173 int mem_base;
28174 void * ctx; /* an XML parser context */
28175 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028176
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028177 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
28178 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028179 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028180
28181 xmlCtxtResetLastError(ctx);
28182 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028183 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028184 xmlResetLastError();
28185 if (mem_base != xmlMemBlocks()) {
28186 printf("Leak of %d blocks found in xmlCtxtResetLastError",
28187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028188 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028189 printf(" %d", n_ctx);
28190 printf("\n");
28191 }
28192 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000028193 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028194
Daniel Veillard42595322004-11-08 10:52:06 +000028195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028196}
28197
28198
28199static int
28200test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028202
28203
28204 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028206}
28207
28208
28209static int
28210test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028212
28213
28214 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028216}
28217
28218
28219static int
28220test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028222
Daniel Veillardce682bc2004-11-05 17:22:25 +000028223 int mem_base;
28224 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28225 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028226
Daniel Veillardce682bc2004-11-05 17:22:25 +000028227 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28228 mem_base = xmlMemBlocks();
28229 input = gen_xmlParserInputPtr(n_input, 0);
28230
28231 xmlParserPrintFileContext(input);
28232 call_tests++;
28233 des_xmlParserInputPtr(n_input, input, 0);
28234 xmlResetLastError();
28235 if (mem_base != xmlMemBlocks()) {
28236 printf("Leak of %d blocks found in xmlParserPrintFileContext",
28237 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028238 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028239 printf(" %d", n_input);
28240 printf("\n");
28241 }
28242 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028243 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028244
Daniel Veillard42595322004-11-08 10:52:06 +000028245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028246}
28247
28248
28249static int
28250test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028252
Daniel Veillardce682bc2004-11-05 17:22:25 +000028253 int mem_base;
28254 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28255 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028256
Daniel Veillardce682bc2004-11-05 17:22:25 +000028257 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28258 mem_base = xmlMemBlocks();
28259 input = gen_xmlParserInputPtr(n_input, 0);
28260
28261 xmlParserPrintFileInfo(input);
28262 call_tests++;
28263 des_xmlParserInputPtr(n_input, input, 0);
28264 xmlResetLastError();
28265 if (mem_base != xmlMemBlocks()) {
28266 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
28267 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028268 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028269 printf(" %d", n_input);
28270 printf("\n");
28271 }
28272 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028273 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028274
Daniel Veillard42595322004-11-08 10:52:06 +000028275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028276}
28277
28278
28279static int
28280test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028282
28283
28284 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028285 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028286}
28287
28288
28289static int
28290test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028292
28293
28294 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028295 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028296}
28297
28298
28299static int
28300test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028301 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028302
28303
28304 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028305 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028306}
28307
28308
28309static int
28310test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028311 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028312
Daniel Veillardce682bc2004-11-05 17:22:25 +000028313 int mem_base;
28314 xmlErrorPtr err; /* pointer to the error. */
28315 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028316
Daniel Veillardce682bc2004-11-05 17:22:25 +000028317 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28318 mem_base = xmlMemBlocks();
28319 err = gen_xmlErrorPtr(n_err, 0);
28320
28321 xmlResetError(err);
28322 call_tests++;
28323 des_xmlErrorPtr(n_err, err, 0);
28324 xmlResetLastError();
28325 if (mem_base != xmlMemBlocks()) {
28326 printf("Leak of %d blocks found in xmlResetError",
28327 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028328 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028329 printf(" %d", n_err);
28330 printf("\n");
28331 }
28332 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028333 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028334
Daniel Veillard42595322004-11-08 10:52:06 +000028335 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028336}
28337
28338
28339static int
28340test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028341 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028342
28343
28344
28345 xmlResetLastError();
28346 call_tests++;
28347 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028348 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028349
Daniel Veillard42595322004-11-08 10:52:06 +000028350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028351}
28352
28353
28354static int
28355test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028357
28358
28359 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028361}
28362
28363
28364static int
28365test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028367
28368
28369 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028371}
28372
28373static int
28374test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028376
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028377 if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028378 test_ret += test_initGenericErrorDefaultFunc();
28379 test_ret += test_xmlCopyError();
28380 test_ret += test_xmlCtxtGetLastError();
28381 test_ret += test_xmlCtxtResetLastError();
28382 test_ret += test_xmlGetLastError();
28383 test_ret += test_xmlParserError();
28384 test_ret += test_xmlParserPrintFileContext();
28385 test_ret += test_xmlParserPrintFileInfo();
28386 test_ret += test_xmlParserValidityError();
28387 test_ret += test_xmlParserValidityWarning();
28388 test_ret += test_xmlParserWarning();
28389 test_ret += test_xmlResetError();
28390 test_ret += test_xmlResetLastError();
28391 test_ret += test_xmlSetGenericErrorFunc();
28392 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028393
Daniel Veillard42595322004-11-08 10:52:06 +000028394 if (test_ret != 0)
28395 printf("Module xmlerror: %d errors\n", test_ret);
28396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028397}
Daniel Veillardd93f6252004-11-02 15:53:51 +000028398
28399static int
28400test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028401 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028402
Daniel Veillard34099b42004-11-04 17:34:35 +000028403#ifdef LIBXML_READER_ENABLED
28404 int mem_base;
28405 xmlTextReaderPtr ret_val;
28406 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28407 int n_input;
28408 const char * URI; /* the URI information for the source if available */
28409 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028410
Daniel Veillard34099b42004-11-04 17:34:35 +000028411 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28412 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28413 mem_base = xmlMemBlocks();
28414 input = gen_xmlParserInputBufferPtr(n_input, 0);
28415 URI = gen_filepath(n_URI, 1);
28416
28417 ret_val = xmlNewTextReader(input, URI);
28418 desret_xmlTextReaderPtr(ret_val);
28419 call_tests++;
28420 des_xmlParserInputBufferPtr(n_input, input, 0);
28421 des_filepath(n_URI, URI, 1);
28422 xmlResetLastError();
28423 if (mem_base != xmlMemBlocks()) {
28424 printf("Leak of %d blocks found in xmlNewTextReader",
28425 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028426 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028427 printf(" %d", n_input);
28428 printf(" %d", n_URI);
28429 printf("\n");
28430 }
28431 }
28432 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028433 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028434#endif
28435
Daniel Veillard42595322004-11-08 10:52:06 +000028436 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028437}
28438
28439
28440static int
28441test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028442 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028443
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028444#ifdef LIBXML_READER_ENABLED
28445 int mem_base;
28446 xmlTextReaderPtr ret_val;
28447 const char * URI; /* the URI of the resource to process */
28448 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028449
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028450 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28451 mem_base = xmlMemBlocks();
28452 URI = gen_filepath(n_URI, 0);
28453
28454 ret_val = xmlNewTextReaderFilename(URI);
28455 desret_xmlTextReaderPtr(ret_val);
28456 call_tests++;
28457 des_filepath(n_URI, URI, 0);
28458 xmlResetLastError();
28459 if (mem_base != xmlMemBlocks()) {
28460 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028462 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028463 printf(" %d", n_URI);
28464 printf("\n");
28465 }
28466 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028467 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028468#endif
28469
Daniel Veillard42595322004-11-08 10:52:06 +000028470 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028471}
28472
28473
28474static int
28475test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028476 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028477
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028478#ifdef LIBXML_READER_ENABLED
28479 int mem_base;
28480 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028481 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028482 int n_cur;
28483 const char * URL; /* the base URL to use for the document */
28484 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028485 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028486 int n_encoding;
28487 int options; /* a combination of xmlParserOption */
28488 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028489
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028490 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28491 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28492 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028493 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028494 mem_base = xmlMemBlocks();
28495 cur = gen_const_xmlChar_ptr(n_cur, 0);
28496 URL = gen_filepath(n_URL, 1);
28497 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028498 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028499
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028500 ret_val = xmlReaderForDoc(cur, URL, encoding, options);
28501 desret_xmlTextReaderPtr(ret_val);
28502 call_tests++;
28503 des_const_xmlChar_ptr(n_cur, cur, 0);
28504 des_filepath(n_URL, URL, 1);
28505 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028506 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028507 xmlResetLastError();
28508 if (mem_base != xmlMemBlocks()) {
28509 printf("Leak of %d blocks found in xmlReaderForDoc",
28510 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028511 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028512 printf(" %d", n_cur);
28513 printf(" %d", n_URL);
28514 printf(" %d", n_encoding);
28515 printf(" %d", n_options);
28516 printf("\n");
28517 }
28518 }
28519 }
28520 }
28521 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028522 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028523#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028524
Daniel Veillard42595322004-11-08 10:52:06 +000028525 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028526}
28527
28528
28529static int
28530test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028531 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028532
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028533#ifdef LIBXML_READER_ENABLED
28534 int mem_base;
28535 xmlTextReaderPtr ret_val;
28536 const char * filename; /* a file or URL */
28537 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028538 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028539 int n_encoding;
28540 int options; /* a combination of xmlParserOption */
28541 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028542
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028543 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28544 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028545 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028546 mem_base = xmlMemBlocks();
28547 filename = gen_filepath(n_filename, 0);
28548 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028549 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028550
28551 ret_val = xmlReaderForFile(filename, encoding, options);
28552 desret_xmlTextReaderPtr(ret_val);
28553 call_tests++;
28554 des_filepath(n_filename, filename, 0);
28555 des_const_char_ptr(n_encoding, encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028556 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028557 xmlResetLastError();
28558 if (mem_base != xmlMemBlocks()) {
28559 printf("Leak of %d blocks found in xmlReaderForFile",
28560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028561 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028562 printf(" %d", n_filename);
28563 printf(" %d", n_encoding);
28564 printf(" %d", n_options);
28565 printf("\n");
28566 }
28567 }
28568 }
28569 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028570 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028571#endif
28572
Daniel Veillard42595322004-11-08 10:52:06 +000028573 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028574}
28575
28576
28577static int
28578test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028579 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028580
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028581#ifdef LIBXML_READER_ENABLED
28582 int mem_base;
28583 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028584 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028585 int n_buffer;
28586 int size; /* the size of the array */
28587 int n_size;
28588 const char * URL; /* the base URL to use for the document */
28589 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028590 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028591 int n_encoding;
28592 int options; /* a combination of xmlParserOption */
28593 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028594
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028595 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28596 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28597 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28598 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028599 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028600 mem_base = xmlMemBlocks();
28601 buffer = gen_const_char_ptr(n_buffer, 0);
28602 size = gen_int(n_size, 1);
28603 URL = gen_filepath(n_URL, 2);
28604 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028605 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028606
28607 ret_val = xmlReaderForMemory(buffer, size, URL, encoding, options);
28608 desret_xmlTextReaderPtr(ret_val);
28609 call_tests++;
28610 des_const_char_ptr(n_buffer, buffer, 0);
28611 des_int(n_size, size, 1);
28612 des_filepath(n_URL, URL, 2);
28613 des_const_char_ptr(n_encoding, encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028614 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028615 xmlResetLastError();
28616 if (mem_base != xmlMemBlocks()) {
28617 printf("Leak of %d blocks found in xmlReaderForMemory",
28618 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028619 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028620 printf(" %d", n_buffer);
28621 printf(" %d", n_size);
28622 printf(" %d", n_URL);
28623 printf(" %d", n_encoding);
28624 printf(" %d", n_options);
28625 printf("\n");
28626 }
28627 }
28628 }
28629 }
28630 }
28631 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028632 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028633#endif
28634
Daniel Veillard42595322004-11-08 10:52:06 +000028635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028636}
28637
28638
28639static int
28640test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028642
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028643#ifdef LIBXML_READER_ENABLED
28644 int mem_base;
28645 int ret_val;
28646 xmlTextReaderPtr reader; /* an XML reader */
28647 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028648 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028649 int n_cur;
28650 const char * URL; /* the base URL to use for the document */
28651 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028652 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028653 int n_encoding;
28654 int options; /* a combination of xmlParserOption */
28655 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028656
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028657 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28658 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28659 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28660 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028661 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028662 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028663 reader = gen_xmlTextReaderPtr(n_reader, 0);
28664 cur = gen_const_xmlChar_ptr(n_cur, 1);
28665 URL = gen_filepath(n_URL, 2);
28666 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028667 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028668
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028669 ret_val = xmlReaderNewDoc(reader, cur, URL, encoding, options);
28670 desret_int(ret_val);
28671 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028672 des_xmlTextReaderPtr(n_reader, reader, 0);
28673 des_const_xmlChar_ptr(n_cur, cur, 1);
28674 des_filepath(n_URL, URL, 2);
28675 des_const_char_ptr(n_encoding, encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028676 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028677 xmlResetLastError();
28678 if (mem_base != xmlMemBlocks()) {
28679 printf("Leak of %d blocks found in xmlReaderNewDoc",
28680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028681 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028682 printf(" %d", n_reader);
28683 printf(" %d", n_cur);
28684 printf(" %d", n_URL);
28685 printf(" %d", n_encoding);
28686 printf(" %d", n_options);
28687 printf("\n");
28688 }
28689 }
28690 }
28691 }
28692 }
28693 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028694 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028695#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028696
Daniel Veillard42595322004-11-08 10:52:06 +000028697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028698}
28699
28700
28701static int
28702test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028704
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028705#ifdef LIBXML_READER_ENABLED
28706 int mem_base;
28707 int ret_val;
28708 xmlTextReaderPtr reader; /* an XML reader */
28709 int n_reader;
28710 const char * filename; /* a file or URL */
28711 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028712 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028713 int n_encoding;
28714 int options; /* a combination of xmlParserOption */
28715 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028716
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028717 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28718 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28719 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028720 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028721 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028722 reader = gen_xmlTextReaderPtr(n_reader, 0);
28723 filename = gen_filepath(n_filename, 1);
28724 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028725 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028726
28727 ret_val = xmlReaderNewFile(reader, filename, encoding, options);
28728 desret_int(ret_val);
28729 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028730 des_xmlTextReaderPtr(n_reader, reader, 0);
28731 des_filepath(n_filename, filename, 1);
28732 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028733 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028734 xmlResetLastError();
28735 if (mem_base != xmlMemBlocks()) {
28736 printf("Leak of %d blocks found in xmlReaderNewFile",
28737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028738 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028739 printf(" %d", n_reader);
28740 printf(" %d", n_filename);
28741 printf(" %d", n_encoding);
28742 printf(" %d", n_options);
28743 printf("\n");
28744 }
28745 }
28746 }
28747 }
28748 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028749 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028750#endif
28751
Daniel Veillard42595322004-11-08 10:52:06 +000028752 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028753}
28754
28755
28756static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028757test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028759
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028760#ifdef LIBXML_READER_ENABLED
28761 int mem_base;
28762 int ret_val;
28763 xmlTextReaderPtr reader; /* an XML reader */
28764 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028765 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028766 int n_buffer;
28767 int size; /* the size of the array */
28768 int n_size;
28769 const char * URL; /* the base URL to use for the document */
28770 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028771 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028772 int n_encoding;
28773 int options; /* a combination of xmlParserOption */
28774 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028775
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028776 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28777 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28778 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28779 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28780 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028781 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028782 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028783 reader = gen_xmlTextReaderPtr(n_reader, 0);
28784 buffer = gen_const_char_ptr(n_buffer, 1);
28785 size = gen_int(n_size, 2);
28786 URL = gen_filepath(n_URL, 3);
28787 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028788 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028789
28790 ret_val = xmlReaderNewMemory(reader, buffer, size, URL, encoding, options);
28791 desret_int(ret_val);
28792 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028793 des_xmlTextReaderPtr(n_reader, reader, 0);
28794 des_const_char_ptr(n_buffer, buffer, 1);
28795 des_int(n_size, size, 2);
28796 des_filepath(n_URL, URL, 3);
28797 des_const_char_ptr(n_encoding, encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028798 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028799 xmlResetLastError();
28800 if (mem_base != xmlMemBlocks()) {
28801 printf("Leak of %d blocks found in xmlReaderNewMemory",
28802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028803 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028804 printf(" %d", n_reader);
28805 printf(" %d", n_buffer);
28806 printf(" %d", n_size);
28807 printf(" %d", n_URL);
28808 printf(" %d", n_encoding);
28809 printf(" %d", n_options);
28810 printf("\n");
28811 }
28812 }
28813 }
28814 }
28815 }
28816 }
28817 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028818 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028819#endif
28820
Daniel Veillard42595322004-11-08 10:52:06 +000028821 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028822}
28823
28824
28825static int
28826test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028827 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028828
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028829#ifdef LIBXML_READER_ENABLED
28830 int mem_base;
28831 int ret_val;
28832 xmlTextReaderPtr reader; /* an XML reader */
28833 int n_reader;
28834 xmlDocPtr doc; /* a preparsed document */
28835 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028836
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028837 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28838 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28839 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028840 reader = gen_xmlTextReaderPtr(n_reader, 0);
28841 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028842
28843 ret_val = xmlReaderNewWalker(reader, doc);
28844 desret_int(ret_val);
28845 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028846 des_xmlTextReaderPtr(n_reader, reader, 0);
28847 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028848 xmlResetLastError();
28849 if (mem_base != xmlMemBlocks()) {
28850 printf("Leak of %d blocks found in xmlReaderNewWalker",
28851 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028852 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028853 printf(" %d", n_reader);
28854 printf(" %d", n_doc);
28855 printf("\n");
28856 }
28857 }
28858 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028859 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028860#endif
28861
Daniel Veillard42595322004-11-08 10:52:06 +000028862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028863}
28864
28865
28866static int
28867test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028869
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028870#ifdef LIBXML_READER_ENABLED
28871 int mem_base;
28872 xmlTextReaderPtr ret_val;
28873 xmlDocPtr doc; /* a preparsed document */
28874 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028875
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028876 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28877 mem_base = xmlMemBlocks();
28878 doc = gen_xmlDocPtr(n_doc, 0);
28879
28880 ret_val = xmlReaderWalker(doc);
28881 desret_xmlTextReaderPtr(ret_val);
28882 call_tests++;
28883 des_xmlDocPtr(n_doc, doc, 0);
28884 xmlResetLastError();
28885 if (mem_base != xmlMemBlocks()) {
28886 printf("Leak of %d blocks found in xmlReaderWalker",
28887 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028888 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028889 printf(" %d", n_doc);
28890 printf("\n");
28891 }
28892 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028893 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028894#endif
28895
Daniel Veillard42595322004-11-08 10:52:06 +000028896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028897}
28898
28899
28900static int
28901test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028902 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028903
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028904#ifdef LIBXML_READER_ENABLED
28905 int mem_base;
28906 int ret_val;
28907 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28908 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028909
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028910 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28911 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028912 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028913
28914 ret_val = xmlTextReaderAttributeCount(reader);
28915 desret_int(ret_val);
28916 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028917 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028918 xmlResetLastError();
28919 if (mem_base != xmlMemBlocks()) {
28920 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
28921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028922 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028923 printf(" %d", n_reader);
28924 printf("\n");
28925 }
28926 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028927 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028928#endif
28929
Daniel Veillard42595322004-11-08 10:52:06 +000028930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028931}
28932
28933
28934static int
28935test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028937
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028938#ifdef LIBXML_READER_ENABLED
28939 int mem_base;
28940 xmlChar * ret_val;
28941 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28942 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028943
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028944 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28945 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028946 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028947
28948 ret_val = xmlTextReaderBaseUri(reader);
28949 desret_xmlChar_ptr(ret_val);
28950 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028951 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028952 xmlResetLastError();
28953 if (mem_base != xmlMemBlocks()) {
28954 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
28955 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028956 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028957 printf(" %d", n_reader);
28958 printf("\n");
28959 }
28960 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028961 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028962#endif
28963
Daniel Veillard42595322004-11-08 10:52:06 +000028964 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028965}
28966
28967
28968static int
28969test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028970 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028971
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028972#ifdef LIBXML_READER_ENABLED
28973 int mem_base;
28974 int ret_val;
28975 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28976 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028977
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028978 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28979 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028980 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028981
28982 ret_val = xmlTextReaderClose(reader);
28983 desret_int(ret_val);
28984 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028985 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028986 xmlResetLastError();
28987 if (mem_base != xmlMemBlocks()) {
28988 printf("Leak of %d blocks found in xmlTextReaderClose",
28989 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028990 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028991 printf(" %d", n_reader);
28992 printf("\n");
28993 }
28994 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028995 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028996#endif
28997
Daniel Veillard42595322004-11-08 10:52:06 +000028998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028999}
29000
29001
29002static int
29003test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029005
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029006#ifdef LIBXML_READER_ENABLED
29007 int mem_base;
29008 const xmlChar * ret_val;
29009 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29010 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029011
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029012 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29013 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029014 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029015
29016 ret_val = xmlTextReaderConstBaseUri(reader);
29017 desret_const_xmlChar_ptr(ret_val);
29018 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029019 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029020 xmlResetLastError();
29021 if (mem_base != xmlMemBlocks()) {
29022 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
29023 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029024 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029025 printf(" %d", n_reader);
29026 printf("\n");
29027 }
29028 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029029 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029030#endif
29031
Daniel Veillard42595322004-11-08 10:52:06 +000029032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029033}
29034
29035
29036static int
29037test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029039
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029040#ifdef LIBXML_READER_ENABLED
29041 int mem_base;
29042 const xmlChar * ret_val;
29043 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29044 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029045
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029046 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29047 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029048 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029049
29050 ret_val = xmlTextReaderConstEncoding(reader);
29051 desret_const_xmlChar_ptr(ret_val);
29052 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029053 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029054 xmlResetLastError();
29055 if (mem_base != xmlMemBlocks()) {
29056 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
29057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029058 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029059 printf(" %d", n_reader);
29060 printf("\n");
29061 }
29062 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029063 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029064#endif
29065
Daniel Veillard42595322004-11-08 10:52:06 +000029066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029067}
29068
29069
29070static int
29071test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029073
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029074#ifdef LIBXML_READER_ENABLED
29075 int mem_base;
29076 const xmlChar * ret_val;
29077 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29078 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029079
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029080 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29081 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029082 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029083
29084 ret_val = xmlTextReaderConstLocalName(reader);
29085 desret_const_xmlChar_ptr(ret_val);
29086 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029087 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029088 xmlResetLastError();
29089 if (mem_base != xmlMemBlocks()) {
29090 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
29091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029092 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029093 printf(" %d", n_reader);
29094 printf("\n");
29095 }
29096 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029097 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029098#endif
29099
Daniel Veillard42595322004-11-08 10:52:06 +000029100 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029101}
29102
29103
29104static int
29105test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029106 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029107
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029108#ifdef LIBXML_READER_ENABLED
29109 int mem_base;
29110 const xmlChar * ret_val;
29111 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29112 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029113
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029114 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29115 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029116 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029117
29118 ret_val = xmlTextReaderConstName(reader);
29119 desret_const_xmlChar_ptr(ret_val);
29120 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029121 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029122 xmlResetLastError();
29123 if (mem_base != xmlMemBlocks()) {
29124 printf("Leak of %d blocks found in xmlTextReaderConstName",
29125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029126 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029127 printf(" %d", n_reader);
29128 printf("\n");
29129 }
29130 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029131 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029132#endif
29133
Daniel Veillard42595322004-11-08 10:52:06 +000029134 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029135}
29136
29137
29138static int
29139test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029140 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029141
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029142#ifdef LIBXML_READER_ENABLED
29143 int mem_base;
29144 const xmlChar * ret_val;
29145 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29146 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029147
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029148 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29149 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029150 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029151
29152 ret_val = xmlTextReaderConstNamespaceUri(reader);
29153 desret_const_xmlChar_ptr(ret_val);
29154 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029155 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029156 xmlResetLastError();
29157 if (mem_base != xmlMemBlocks()) {
29158 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
29159 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029160 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029161 printf(" %d", n_reader);
29162 printf("\n");
29163 }
29164 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029165 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029166#endif
29167
Daniel Veillard42595322004-11-08 10:52:06 +000029168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029169}
29170
29171
29172static int
29173test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029175
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029176#ifdef LIBXML_READER_ENABLED
29177 int mem_base;
29178 const xmlChar * ret_val;
29179 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29180 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029181
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029182 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29183 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029184 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029185
29186 ret_val = xmlTextReaderConstPrefix(reader);
29187 desret_const_xmlChar_ptr(ret_val);
29188 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029189 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029190 xmlResetLastError();
29191 if (mem_base != xmlMemBlocks()) {
29192 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
29193 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029194 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029195 printf(" %d", n_reader);
29196 printf("\n");
29197 }
29198 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029199 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029200#endif
29201
Daniel Veillard42595322004-11-08 10:52:06 +000029202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029203}
29204
29205
29206static int
29207test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029209
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029210#ifdef LIBXML_READER_ENABLED
29211 int mem_base;
29212 const xmlChar * ret_val;
29213 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29214 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029215 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029216 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029217
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029218 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29219 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
29220 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029221 reader = gen_xmlTextReaderPtr(n_reader, 0);
29222 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029223
29224 ret_val = xmlTextReaderConstString(reader, str);
29225 desret_const_xmlChar_ptr(ret_val);
29226 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029227 des_xmlTextReaderPtr(n_reader, reader, 0);
29228 des_const_xmlChar_ptr(n_str, str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029229 xmlResetLastError();
29230 if (mem_base != xmlMemBlocks()) {
29231 printf("Leak of %d blocks found in xmlTextReaderConstString",
29232 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029233 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029234 printf(" %d", n_reader);
29235 printf(" %d", n_str);
29236 printf("\n");
29237 }
29238 }
29239 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029240 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029241#endif
29242
Daniel Veillard42595322004-11-08 10:52:06 +000029243 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029244}
29245
29246
29247static int
29248test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029249 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029250
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029251#ifdef LIBXML_READER_ENABLED
29252 int mem_base;
29253 const xmlChar * ret_val;
29254 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29255 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029256
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029257 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29258 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029259 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029260
29261 ret_val = xmlTextReaderConstValue(reader);
29262 desret_const_xmlChar_ptr(ret_val);
29263 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029264 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029265 xmlResetLastError();
29266 if (mem_base != xmlMemBlocks()) {
29267 printf("Leak of %d blocks found in xmlTextReaderConstValue",
29268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029269 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029270 printf(" %d", n_reader);
29271 printf("\n");
29272 }
29273 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029274 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029275#endif
29276
Daniel Veillard42595322004-11-08 10:52:06 +000029277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029278}
29279
29280
29281static int
29282test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029284
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029285#ifdef LIBXML_READER_ENABLED
29286 int mem_base;
29287 const xmlChar * ret_val;
29288 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29289 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029290
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029291 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29292 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029293 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029294
29295 ret_val = xmlTextReaderConstXmlLang(reader);
29296 desret_const_xmlChar_ptr(ret_val);
29297 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029298 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029299 xmlResetLastError();
29300 if (mem_base != xmlMemBlocks()) {
29301 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029303 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029304 printf(" %d", n_reader);
29305 printf("\n");
29306 }
29307 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029308 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029309#endif
29310
Daniel Veillard42595322004-11-08 10:52:06 +000029311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029312}
29313
29314
29315static int
29316test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029318
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029319#ifdef LIBXML_READER_ENABLED
29320 int mem_base;
29321 const xmlChar * ret_val;
29322 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29323 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029324
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029325 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29326 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029327 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029328
29329 ret_val = xmlTextReaderConstXmlVersion(reader);
29330 desret_const_xmlChar_ptr(ret_val);
29331 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029332 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029333 xmlResetLastError();
29334 if (mem_base != xmlMemBlocks()) {
29335 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029337 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029338 printf(" %d", n_reader);
29339 printf("\n");
29340 }
29341 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029342 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029343#endif
29344
Daniel Veillard42595322004-11-08 10:52:06 +000029345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029346}
29347
29348
29349static int
29350test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029351 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029352
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029353#ifdef LIBXML_READER_ENABLED
29354 int mem_base;
29355 xmlDocPtr ret_val;
29356 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29357 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029358
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029359 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29360 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029361 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029362
29363 ret_val = xmlTextReaderCurrentDoc(reader);
29364 desret_xmlDocPtr(ret_val);
29365 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029366 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029367 xmlResetLastError();
29368 if (mem_base != xmlMemBlocks()) {
29369 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29370 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029371 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029372 printf(" %d", n_reader);
29373 printf("\n");
29374 }
29375 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029376 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029377#endif
29378
Daniel Veillard42595322004-11-08 10:52:06 +000029379 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029380}
29381
29382
29383static int
29384test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029385 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029386
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029387#ifdef LIBXML_READER_ENABLED
29388 int mem_base;
29389 xmlNodePtr ret_val;
29390 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29391 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029392
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029393 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29394 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029395 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029396
29397 ret_val = xmlTextReaderCurrentNode(reader);
29398 desret_xmlNodePtr(ret_val);
29399 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029400 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029401 xmlResetLastError();
29402 if (mem_base != xmlMemBlocks()) {
29403 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029405 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029406 printf(" %d", n_reader);
29407 printf("\n");
29408 }
29409 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029410 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029411#endif
29412
Daniel Veillard42595322004-11-08 10:52:06 +000029413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029414}
29415
29416
29417static int
29418test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029420
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029421#ifdef LIBXML_READER_ENABLED
29422 int mem_base;
29423 int ret_val;
29424 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29425 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029426
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029427 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29428 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029429 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029430
29431 ret_val = xmlTextReaderDepth(reader);
29432 desret_int(ret_val);
29433 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029434 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029435 xmlResetLastError();
29436 if (mem_base != xmlMemBlocks()) {
29437 printf("Leak of %d blocks found in xmlTextReaderDepth",
29438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029439 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029440 printf(" %d", n_reader);
29441 printf("\n");
29442 }
29443 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029444 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029445#endif
29446
Daniel Veillard42595322004-11-08 10:52:06 +000029447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029448}
29449
29450
29451static int
29452test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029454
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029455#ifdef LIBXML_READER_ENABLED
29456 int mem_base;
29457 xmlNodePtr ret_val;
29458 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29459 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029460
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029461 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29462 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029463 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029464
29465 ret_val = xmlTextReaderExpand(reader);
29466 desret_xmlNodePtr(ret_val);
29467 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029468 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029469 xmlResetLastError();
29470 if (mem_base != xmlMemBlocks()) {
29471 printf("Leak of %d blocks found in xmlTextReaderExpand",
29472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029473 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029474 printf(" %d", n_reader);
29475 printf("\n");
29476 }
29477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029478 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029479#endif
29480
Daniel Veillard42595322004-11-08 10:52:06 +000029481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029482}
29483
29484
29485static int
29486test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029488
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029489#ifdef LIBXML_READER_ENABLED
29490 int mem_base;
29491 xmlChar * ret_val;
29492 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29493 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029494 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029495 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029496
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029497 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29498 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29499 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029500 reader = gen_xmlTextReaderPtr(n_reader, 0);
29501 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029502
29503 ret_val = xmlTextReaderGetAttribute(reader, name);
29504 desret_xmlChar_ptr(ret_val);
29505 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029506 des_xmlTextReaderPtr(n_reader, reader, 0);
29507 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029508 xmlResetLastError();
29509 if (mem_base != xmlMemBlocks()) {
29510 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29511 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029512 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029513 printf(" %d", n_reader);
29514 printf(" %d", n_name);
29515 printf("\n");
29516 }
29517 }
29518 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029519 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029520#endif
29521
Daniel Veillard42595322004-11-08 10:52:06 +000029522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029523}
29524
29525
29526static int
29527test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029529
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029530#ifdef LIBXML_READER_ENABLED
29531 int mem_base;
29532 xmlChar * ret_val;
29533 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29534 int n_reader;
29535 int no; /* the zero-based index of the attribute relative to the containing element */
29536 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029537
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029538 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29539 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29540 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029541 reader = gen_xmlTextReaderPtr(n_reader, 0);
29542 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029543
29544 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29545 desret_xmlChar_ptr(ret_val);
29546 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029547 des_xmlTextReaderPtr(n_reader, reader, 0);
29548 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029549 xmlResetLastError();
29550 if (mem_base != xmlMemBlocks()) {
29551 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029553 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029554 printf(" %d", n_reader);
29555 printf(" %d", n_no);
29556 printf("\n");
29557 }
29558 }
29559 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029560 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029561#endif
29562
Daniel Veillard42595322004-11-08 10:52:06 +000029563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029564}
29565
29566
29567static int
29568test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029570
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029571#ifdef LIBXML_READER_ENABLED
29572 int mem_base;
29573 xmlChar * ret_val;
29574 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29575 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029576 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029577 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029578 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029579 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029580
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029581 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29582 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29583 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29584 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029585 reader = gen_xmlTextReaderPtr(n_reader, 0);
29586 localName = gen_const_xmlChar_ptr(n_localName, 1);
29587 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029588
29589 ret_val = xmlTextReaderGetAttributeNs(reader, localName, namespaceURI);
29590 desret_xmlChar_ptr(ret_val);
29591 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029592 des_xmlTextReaderPtr(n_reader, reader, 0);
29593 des_const_xmlChar_ptr(n_localName, localName, 1);
29594 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029595 xmlResetLastError();
29596 if (mem_base != xmlMemBlocks()) {
29597 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029599 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029600 printf(" %d", n_reader);
29601 printf(" %d", n_localName);
29602 printf(" %d", n_namespaceURI);
29603 printf("\n");
29604 }
29605 }
29606 }
29607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029608 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029609#endif
29610
Daniel Veillard42595322004-11-08 10:52:06 +000029611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029612}
29613
Daniel Veillarda521d282004-11-09 14:59:59 +000029614#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029615
Daniel Veillardce682bc2004-11-05 17:22:25 +000029616#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29617static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29618 return(NULL);
29619}
29620static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29621}
Daniel Veillarda521d282004-11-09 14:59:59 +000029622#endif
29623
Daniel Veillardce682bc2004-11-05 17:22:25 +000029624
Daniel Veillardd93f6252004-11-02 15:53:51 +000029625static int
29626test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029628
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029629#ifdef LIBXML_READER_ENABLED
29630 int mem_base;
29631 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29632 int n_reader;
29633 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29634 int n_f;
29635 void ** arg; /* a user argument */
29636 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029637
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029638 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29639 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29640 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29641 mem_base = xmlMemBlocks();
29642 reader = gen_xmlTextReaderPtr(n_reader, 0);
29643 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29644 arg = gen_void_ptr_ptr(n_arg, 2);
29645
29646 xmlTextReaderGetErrorHandler(reader, f, arg);
29647 call_tests++;
29648 des_xmlTextReaderPtr(n_reader, reader, 0);
29649 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29650 des_void_ptr_ptr(n_arg, arg, 2);
29651 xmlResetLastError();
29652 if (mem_base != xmlMemBlocks()) {
29653 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029655 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029656 printf(" %d", n_reader);
29657 printf(" %d", n_f);
29658 printf(" %d", n_arg);
29659 printf("\n");
29660 }
29661 }
29662 }
29663 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029664 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029665#endif
29666
Daniel Veillard42595322004-11-08 10:52:06 +000029667 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029668}
29669
29670
29671static int
29672test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029673 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029674
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029675#ifdef LIBXML_READER_ENABLED
29676 int mem_base;
29677 int ret_val;
29678 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29679 int n_reader;
29680 int prop; /* the xmlParserProperties to get */
29681 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029682
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029683 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29684 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29685 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029686 reader = gen_xmlTextReaderPtr(n_reader, 0);
29687 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029688
29689 ret_val = xmlTextReaderGetParserProp(reader, prop);
29690 desret_int(ret_val);
29691 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029692 des_xmlTextReaderPtr(n_reader, reader, 0);
29693 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029694 xmlResetLastError();
29695 if (mem_base != xmlMemBlocks()) {
29696 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
29697 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029698 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029699 printf(" %d", n_reader);
29700 printf(" %d", n_prop);
29701 printf("\n");
29702 }
29703 }
29704 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029705 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029706#endif
29707
Daniel Veillard42595322004-11-08 10:52:06 +000029708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029709}
29710
29711
29712static int
29713test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029715
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029716#ifdef LIBXML_READER_ENABLED
29717 int mem_base;
29718 xmlParserInputBufferPtr ret_val;
29719 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29720 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029721
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029722 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29723 mem_base = xmlMemBlocks();
29724 reader = gen_xmlTextReaderPtr(n_reader, 0);
29725
29726 ret_val = xmlTextReaderGetRemainder(reader);
29727 desret_xmlParserInputBufferPtr(ret_val);
29728 call_tests++;
29729 des_xmlTextReaderPtr(n_reader, reader, 0);
29730 xmlResetLastError();
29731 if (mem_base != xmlMemBlocks()) {
29732 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
29733 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029734 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029735 printf(" %d", n_reader);
29736 printf("\n");
29737 }
29738 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029739 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029740#endif
29741
Daniel Veillard42595322004-11-08 10:52:06 +000029742 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029743}
29744
29745
29746static int
29747test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029748 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029749
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029750#ifdef LIBXML_READER_ENABLED
29751 int mem_base;
29752 int ret_val;
29753 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29754 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029755
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029756 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29757 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029758 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029759
29760 ret_val = xmlTextReaderHasAttributes(reader);
29761 desret_int(ret_val);
29762 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029763 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029764 xmlResetLastError();
29765 if (mem_base != xmlMemBlocks()) {
29766 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
29767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029768 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029769 printf(" %d", n_reader);
29770 printf("\n");
29771 }
29772 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029773 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029774#endif
29775
Daniel Veillard42595322004-11-08 10:52:06 +000029776 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029777}
29778
29779
29780static int
29781test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029782 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029783
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029784#ifdef LIBXML_READER_ENABLED
29785 int mem_base;
29786 int ret_val;
29787 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29788 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029789
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029790 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29791 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029792 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029793
29794 ret_val = xmlTextReaderHasValue(reader);
29795 desret_int(ret_val);
29796 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029797 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029798 xmlResetLastError();
29799 if (mem_base != xmlMemBlocks()) {
29800 printf("Leak of %d blocks found in xmlTextReaderHasValue",
29801 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029802 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029803 printf(" %d", n_reader);
29804 printf("\n");
29805 }
29806 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029807 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029808#endif
29809
Daniel Veillard42595322004-11-08 10:52:06 +000029810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029811}
29812
29813
29814static int
29815test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029817
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029818#ifdef LIBXML_READER_ENABLED
29819 int mem_base;
29820 int ret_val;
29821 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29822 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029823
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029824 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29825 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029826 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029827
29828 ret_val = xmlTextReaderIsDefault(reader);
29829 desret_int(ret_val);
29830 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029831 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029832 xmlResetLastError();
29833 if (mem_base != xmlMemBlocks()) {
29834 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
29835 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029836 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029837 printf(" %d", n_reader);
29838 printf("\n");
29839 }
29840 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029841 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029842#endif
29843
Daniel Veillard42595322004-11-08 10:52:06 +000029844 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029845}
29846
29847
29848static int
29849test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029851
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029852#ifdef LIBXML_READER_ENABLED
29853 int mem_base;
29854 int ret_val;
29855 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29856 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029857
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029858 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29859 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029860 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029861
29862 ret_val = xmlTextReaderIsEmptyElement(reader);
29863 desret_int(ret_val);
29864 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029865 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029866 xmlResetLastError();
29867 if (mem_base != xmlMemBlocks()) {
29868 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
29869 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029870 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029871 printf(" %d", n_reader);
29872 printf("\n");
29873 }
29874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029875 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029876#endif
29877
Daniel Veillard42595322004-11-08 10:52:06 +000029878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029879}
29880
29881
29882static int
29883test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029885
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029886#ifdef LIBXML_READER_ENABLED
29887 int mem_base;
29888 int ret_val;
29889 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29890 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029891
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029892 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29893 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029894 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029895
29896 ret_val = xmlTextReaderIsNamespaceDecl(reader);
29897 desret_int(ret_val);
29898 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029899 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029900 xmlResetLastError();
29901 if (mem_base != xmlMemBlocks()) {
29902 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
29903 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029904 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029905 printf(" %d", n_reader);
29906 printf("\n");
29907 }
29908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029909 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029910#endif
29911
Daniel Veillard42595322004-11-08 10:52:06 +000029912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029913}
29914
29915
29916static int
29917test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029919
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029920#ifdef LIBXML_READER_ENABLED
29921 int mem_base;
29922 int ret_val;
29923 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29924 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029925
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029926 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29927 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029928 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029929
29930 ret_val = xmlTextReaderIsValid(reader);
29931 desret_int(ret_val);
29932 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029933 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029934 xmlResetLastError();
29935 if (mem_base != xmlMemBlocks()) {
29936 printf("Leak of %d blocks found in xmlTextReaderIsValid",
29937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029938 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029939 printf(" %d", n_reader);
29940 printf("\n");
29941 }
29942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029943 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029944#endif
29945
Daniel Veillard42595322004-11-08 10:52:06 +000029946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029947}
29948
29949
29950static int
29951test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029952 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029953
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029954#ifdef LIBXML_READER_ENABLED
29955 int mem_base;
29956 xmlChar * ret_val;
29957 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29958 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029959
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029960 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29961 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029962 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029963
29964 ret_val = xmlTextReaderLocalName(reader);
29965 desret_xmlChar_ptr(ret_val);
29966 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029967 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029968 xmlResetLastError();
29969 if (mem_base != xmlMemBlocks()) {
29970 printf("Leak of %d blocks found in xmlTextReaderLocalName",
29971 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029972 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029973 printf(" %d", n_reader);
29974 printf("\n");
29975 }
29976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029977 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029978#endif
29979
Daniel Veillard42595322004-11-08 10:52:06 +000029980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029981}
29982
Daniel Veillarda521d282004-11-09 14:59:59 +000029983#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029984
Daniel Veillardce682bc2004-11-05 17:22:25 +000029985#define gen_nb_xmlTextReaderLocatorPtr 1
29986static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29987 return(NULL);
29988}
29989static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29990}
Daniel Veillarda521d282004-11-09 14:59:59 +000029991#endif
29992
Daniel Veillardce682bc2004-11-05 17:22:25 +000029993
Daniel Veillardd93f6252004-11-02 15:53:51 +000029994static int
29995test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029997
Daniel Veillardce682bc2004-11-05 17:22:25 +000029998#ifdef LIBXML_READER_ENABLED
29999 int mem_base;
30000 xmlChar * ret_val;
30001 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30002 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030003
Daniel Veillardce682bc2004-11-05 17:22:25 +000030004 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30005 mem_base = xmlMemBlocks();
30006 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30007
30008 ret_val = xmlTextReaderLocatorBaseURI(locator);
30009 desret_xmlChar_ptr(ret_val);
30010 call_tests++;
30011 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30012 xmlResetLastError();
30013 if (mem_base != xmlMemBlocks()) {
30014 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
30015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030016 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030017 printf(" %d", n_locator);
30018 printf("\n");
30019 }
30020 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030021 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030022#endif
30023
Daniel Veillard42595322004-11-08 10:52:06 +000030024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030025}
30026
30027
30028static int
30029test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030031
Daniel Veillardce682bc2004-11-05 17:22:25 +000030032#ifdef LIBXML_READER_ENABLED
30033 int mem_base;
30034 int ret_val;
30035 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30036 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030037
Daniel Veillardce682bc2004-11-05 17:22:25 +000030038 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30039 mem_base = xmlMemBlocks();
30040 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30041
30042 ret_val = xmlTextReaderLocatorLineNumber(locator);
30043 desret_int(ret_val);
30044 call_tests++;
30045 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30046 xmlResetLastError();
30047 if (mem_base != xmlMemBlocks()) {
30048 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
30049 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030050 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030051 printf(" %d", n_locator);
30052 printf("\n");
30053 }
30054 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030055 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030056#endif
30057
Daniel Veillard42595322004-11-08 10:52:06 +000030058 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030059}
30060
30061
30062static int
30063test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030064 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030065
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030066#ifdef LIBXML_READER_ENABLED
30067 int mem_base;
30068 xmlChar * ret_val;
30069 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30070 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030071 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 +000030072 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030073
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030074 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30075 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
30076 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030077 reader = gen_xmlTextReaderPtr(n_reader, 0);
30078 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030079
30080 ret_val = xmlTextReaderLookupNamespace(reader, prefix);
30081 desret_xmlChar_ptr(ret_val);
30082 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030083 des_xmlTextReaderPtr(n_reader, reader, 0);
30084 des_const_xmlChar_ptr(n_prefix, prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030085 xmlResetLastError();
30086 if (mem_base != xmlMemBlocks()) {
30087 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
30088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030089 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030090 printf(" %d", n_reader);
30091 printf(" %d", n_prefix);
30092 printf("\n");
30093 }
30094 }
30095 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030096 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030097#endif
30098
Daniel Veillard42595322004-11-08 10:52:06 +000030099 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030100}
30101
30102
30103static int
30104test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030105 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030106
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030107#ifdef LIBXML_READER_ENABLED
30108 int mem_base;
30109 int ret_val;
30110 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30111 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030112 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030113 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030114
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030115 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30116 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
30117 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030118 reader = gen_xmlTextReaderPtr(n_reader, 0);
30119 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030120
30121 ret_val = xmlTextReaderMoveToAttribute(reader, name);
30122 desret_int(ret_val);
30123 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030124 des_xmlTextReaderPtr(n_reader, reader, 0);
30125 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030126 xmlResetLastError();
30127 if (mem_base != xmlMemBlocks()) {
30128 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
30129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030130 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030131 printf(" %d", n_reader);
30132 printf(" %d", n_name);
30133 printf("\n");
30134 }
30135 }
30136 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030137 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030138#endif
30139
Daniel Veillard42595322004-11-08 10:52:06 +000030140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030141}
30142
30143
30144static int
30145test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030147
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030148#ifdef LIBXML_READER_ENABLED
30149 int mem_base;
30150 int ret_val;
30151 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30152 int n_reader;
30153 int no; /* the zero-based index of the attribute relative to the containing element. */
30154 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030155
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030156 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30157 for (n_no = 0;n_no < gen_nb_int;n_no++) {
30158 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030159 reader = gen_xmlTextReaderPtr(n_reader, 0);
30160 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030161
30162 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
30163 desret_int(ret_val);
30164 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030165 des_xmlTextReaderPtr(n_reader, reader, 0);
30166 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030167 xmlResetLastError();
30168 if (mem_base != xmlMemBlocks()) {
30169 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
30170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030171 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030172 printf(" %d", n_reader);
30173 printf(" %d", n_no);
30174 printf("\n");
30175 }
30176 }
30177 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030178 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030179#endif
30180
Daniel Veillard42595322004-11-08 10:52:06 +000030181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030182}
30183
30184
30185static int
30186test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030188
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030189#ifdef LIBXML_READER_ENABLED
30190 int mem_base;
30191 int ret_val;
30192 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30193 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030194 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030195 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030196 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030197 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030198
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030199 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30200 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
30201 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
30202 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030203 reader = gen_xmlTextReaderPtr(n_reader, 0);
30204 localName = gen_const_xmlChar_ptr(n_localName, 1);
30205 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030206
30207 ret_val = xmlTextReaderMoveToAttributeNs(reader, localName, namespaceURI);
30208 desret_int(ret_val);
30209 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030210 des_xmlTextReaderPtr(n_reader, reader, 0);
30211 des_const_xmlChar_ptr(n_localName, localName, 1);
30212 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030213 xmlResetLastError();
30214 if (mem_base != xmlMemBlocks()) {
30215 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
30216 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030217 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030218 printf(" %d", n_reader);
30219 printf(" %d", n_localName);
30220 printf(" %d", n_namespaceURI);
30221 printf("\n");
30222 }
30223 }
30224 }
30225 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030226 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030227#endif
30228
Daniel Veillard42595322004-11-08 10:52:06 +000030229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030230}
30231
30232
30233static int
30234test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030236
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030237#ifdef LIBXML_READER_ENABLED
30238 int mem_base;
30239 int ret_val;
30240 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30241 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030242
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030243 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30244 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030245 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030246
30247 ret_val = xmlTextReaderMoveToElement(reader);
30248 desret_int(ret_val);
30249 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030250 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030251 xmlResetLastError();
30252 if (mem_base != xmlMemBlocks()) {
30253 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030255 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030256 printf(" %d", n_reader);
30257 printf("\n");
30258 }
30259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030260 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030261#endif
30262
Daniel Veillard42595322004-11-08 10:52:06 +000030263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030264}
30265
30266
30267static int
30268test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030269 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030270
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030271#ifdef LIBXML_READER_ENABLED
30272 int mem_base;
30273 int ret_val;
30274 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30275 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030276
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030277 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30278 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030279 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030280
30281 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30282 desret_int(ret_val);
30283 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030284 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030285 xmlResetLastError();
30286 if (mem_base != xmlMemBlocks()) {
30287 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30288 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030289 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030290 printf(" %d", n_reader);
30291 printf("\n");
30292 }
30293 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030294 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030295#endif
30296
Daniel Veillard42595322004-11-08 10:52:06 +000030297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030298}
30299
30300
30301static int
30302test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030304
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030305#ifdef LIBXML_READER_ENABLED
30306 int mem_base;
30307 int ret_val;
30308 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30309 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030310
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030311 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30312 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030313 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030314
30315 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30316 desret_int(ret_val);
30317 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030318 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030319 xmlResetLastError();
30320 if (mem_base != xmlMemBlocks()) {
30321 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030323 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030324 printf(" %d", n_reader);
30325 printf("\n");
30326 }
30327 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030328 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030329#endif
30330
Daniel Veillard42595322004-11-08 10:52:06 +000030331 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030332}
30333
30334
30335static int
30336test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030337 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030338
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030339#ifdef LIBXML_READER_ENABLED
30340 int mem_base;
30341 xmlChar * ret_val;
30342 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30343 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030344
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030345 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30346 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030347 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030348
30349 ret_val = xmlTextReaderName(reader);
30350 desret_xmlChar_ptr(ret_val);
30351 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030352 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030353 xmlResetLastError();
30354 if (mem_base != xmlMemBlocks()) {
30355 printf("Leak of %d blocks found in xmlTextReaderName",
30356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030357 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030358 printf(" %d", n_reader);
30359 printf("\n");
30360 }
30361 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030362 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030363#endif
30364
Daniel Veillard42595322004-11-08 10:52:06 +000030365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030366}
30367
30368
30369static int
30370test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030371 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030372
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030373#ifdef LIBXML_READER_ENABLED
30374 int mem_base;
30375 xmlChar * ret_val;
30376 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30377 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030378
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030379 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30380 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030381 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030382
30383 ret_val = xmlTextReaderNamespaceUri(reader);
30384 desret_xmlChar_ptr(ret_val);
30385 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030386 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030387 xmlResetLastError();
30388 if (mem_base != xmlMemBlocks()) {
30389 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030391 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030392 printf(" %d", n_reader);
30393 printf("\n");
30394 }
30395 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030396 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030397#endif
30398
Daniel Veillard42595322004-11-08 10:52:06 +000030399 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030400}
30401
30402
30403static int
30404test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030405 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030406
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030407#ifdef LIBXML_READER_ENABLED
30408 int mem_base;
30409 int ret_val;
30410 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30411 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030412
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030413 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30414 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030415 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030416
30417 ret_val = xmlTextReaderNext(reader);
30418 desret_int(ret_val);
30419 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030420 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030421 xmlResetLastError();
30422 if (mem_base != xmlMemBlocks()) {
30423 printf("Leak of %d blocks found in xmlTextReaderNext",
30424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030425 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030426 printf(" %d", n_reader);
30427 printf("\n");
30428 }
30429 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030430 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030431#endif
30432
Daniel Veillard42595322004-11-08 10:52:06 +000030433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030434}
30435
30436
30437static int
30438test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030439 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030440
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030441#ifdef LIBXML_READER_ENABLED
30442 int mem_base;
30443 int ret_val;
30444 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30445 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030446
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030447 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30448 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030449 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030450
30451 ret_val = xmlTextReaderNextSibling(reader);
30452 desret_int(ret_val);
30453 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030454 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030455 xmlResetLastError();
30456 if (mem_base != xmlMemBlocks()) {
30457 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030459 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030460 printf(" %d", n_reader);
30461 printf("\n");
30462 }
30463 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030464 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030465#endif
30466
Daniel Veillard42595322004-11-08 10:52:06 +000030467 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030468}
30469
30470
30471static int
30472test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030473 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030474
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030475#ifdef LIBXML_READER_ENABLED
30476 int mem_base;
30477 int ret_val;
30478 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30479 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030480
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030481 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30482 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030483 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030484
30485 ret_val = xmlTextReaderNodeType(reader);
30486 desret_int(ret_val);
30487 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030488 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030489 xmlResetLastError();
30490 if (mem_base != xmlMemBlocks()) {
30491 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030493 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030494 printf(" %d", n_reader);
30495 printf("\n");
30496 }
30497 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030498 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030499#endif
30500
Daniel Veillard42595322004-11-08 10:52:06 +000030501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030502}
30503
30504
30505static int
30506test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030507 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030508
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030509#ifdef LIBXML_READER_ENABLED
30510 int mem_base;
30511 int ret_val;
30512 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30513 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030514
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030515 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30516 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030517 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030518
30519 ret_val = xmlTextReaderNormalization(reader);
30520 desret_int(ret_val);
30521 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030522 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030523 xmlResetLastError();
30524 if (mem_base != xmlMemBlocks()) {
30525 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030527 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030528 printf(" %d", n_reader);
30529 printf("\n");
30530 }
30531 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030532 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030533#endif
30534
Daniel Veillard42595322004-11-08 10:52:06 +000030535 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030536}
30537
30538
30539static int
30540test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030541 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030542
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030543#ifdef LIBXML_READER_ENABLED
30544 int mem_base;
30545 xmlChar * ret_val;
30546 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30547 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030548
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030549 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30550 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030551 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030552
30553 ret_val = xmlTextReaderPrefix(reader);
30554 desret_xmlChar_ptr(ret_val);
30555 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030556 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030557 xmlResetLastError();
30558 if (mem_base != xmlMemBlocks()) {
30559 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030561 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030562 printf(" %d", n_reader);
30563 printf("\n");
30564 }
30565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030566 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030567#endif
30568
Daniel Veillard42595322004-11-08 10:52:06 +000030569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030570}
30571
30572
30573static int
30574test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030576
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030577#ifdef LIBXML_READER_ENABLED
30578 int mem_base;
30579 xmlNodePtr ret_val;
30580 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30581 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030582
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030583 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30584 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030585 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030586
30587 ret_val = xmlTextReaderPreserve(reader);
30588 desret_xmlNodePtr(ret_val);
30589 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030590 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030591 xmlResetLastError();
30592 if (mem_base != xmlMemBlocks()) {
30593 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030595 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030596 printf(" %d", n_reader);
30597 printf("\n");
30598 }
30599 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030600 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030601#endif
30602
Daniel Veillard42595322004-11-08 10:52:06 +000030603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030604}
30605
30606
30607static int
30608test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030610
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030611#ifdef LIBXML_READER_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030612#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030613 int mem_base;
30614 int ret_val;
30615 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30616 int n_reader;
30617 xmlChar * pattern; /* an XPath subset pattern */
30618 int n_pattern;
30619 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30620 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030621
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030622 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30623 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30624 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30625 mem_base = xmlMemBlocks();
30626 reader = gen_xmlTextReaderPtr(n_reader, 0);
30627 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30628 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30629
30630 ret_val = xmlTextReaderPreservePattern(reader, pattern, namespaces);
30631 desret_int(ret_val);
30632 call_tests++;
30633 des_xmlTextReaderPtr(n_reader, reader, 0);
30634 des_const_xmlChar_ptr(n_pattern, pattern, 1);
30635 des_const_xmlChar_ptr_ptr(n_namespaces, namespaces, 2);
30636 xmlResetLastError();
30637 if (mem_base != xmlMemBlocks()) {
30638 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030640 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030641 printf(" %d", n_reader);
30642 printf(" %d", n_pattern);
30643 printf(" %d", n_namespaces);
30644 printf("\n");
30645 }
30646 }
30647 }
30648 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030649 function_tests++;
30650#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030651#endif
30652
Daniel Veillard42595322004-11-08 10:52:06 +000030653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030654}
30655
30656
30657static int
30658test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030660
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030661#ifdef LIBXML_READER_ENABLED
30662 int mem_base;
30663 int ret_val;
30664 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30665 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030666
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030667 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30668 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030669 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030670
30671 ret_val = xmlTextReaderQuoteChar(reader);
30672 desret_int(ret_val);
30673 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030674 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030675 xmlResetLastError();
30676 if (mem_base != xmlMemBlocks()) {
30677 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030679 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030680 printf(" %d", n_reader);
30681 printf("\n");
30682 }
30683 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030684 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030685#endif
30686
Daniel Veillard42595322004-11-08 10:52:06 +000030687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030688}
30689
30690
30691static int
30692test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030694
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030695#ifdef LIBXML_READER_ENABLED
30696 int mem_base;
30697 int ret_val;
30698 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30699 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030700
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030701 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30702 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030703 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030704
30705 ret_val = xmlTextReaderRead(reader);
30706 desret_int(ret_val);
30707 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030708 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030709 xmlResetLastError();
30710 if (mem_base != xmlMemBlocks()) {
30711 printf("Leak of %d blocks found in xmlTextReaderRead",
30712 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030713 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030714 printf(" %d", n_reader);
30715 printf("\n");
30716 }
30717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030718 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030719#endif
30720
Daniel Veillard42595322004-11-08 10:52:06 +000030721 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030722}
30723
30724
30725static int
30726test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030727 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030728
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030729#ifdef LIBXML_READER_ENABLED
30730 int mem_base;
30731 int ret_val;
30732 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30733 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030734
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030735 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30736 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030737 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030738
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030739 ret_val = xmlTextReaderReadAttributeValue(reader);
30740 desret_int(ret_val);
30741 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030742 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030743 xmlResetLastError();
30744 if (mem_base != xmlMemBlocks()) {
30745 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
30746 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030747 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030748 printf(" %d", n_reader);
30749 printf("\n");
30750 }
30751 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030752 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030753#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030754
Daniel Veillard42595322004-11-08 10:52:06 +000030755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030756}
30757
30758
30759static int
30760test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030762
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030763#ifdef LIBXML_READER_ENABLED
30764 int mem_base;
30765 int ret_val;
30766 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30767 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030768
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030769 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30770 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030771 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030772
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030773 ret_val = xmlTextReaderReadState(reader);
30774 desret_int(ret_val);
30775 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030776 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030777 xmlResetLastError();
30778 if (mem_base != xmlMemBlocks()) {
30779 printf("Leak of %d blocks found in xmlTextReaderReadState",
30780 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030781 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030782 printf(" %d", n_reader);
30783 printf("\n");
30784 }
30785 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030786 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030787#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030788
Daniel Veillard42595322004-11-08 10:52:06 +000030789 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030790}
30791
30792
30793static int
30794test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030795 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030796
Daniel Veillardce682bc2004-11-05 17:22:25 +000030797#ifdef LIBXML_READER_ENABLED
30798#ifdef LIBXML_SCHEMAS_ENABLED
30799 int mem_base;
30800 int ret_val;
30801 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30802 int n_reader;
30803 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
30804 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030805
Daniel Veillardce682bc2004-11-05 17:22:25 +000030806 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30807 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
30808 mem_base = xmlMemBlocks();
30809 reader = gen_xmlTextReaderPtr(n_reader, 0);
30810 schema = gen_xmlRelaxNGPtr(n_schema, 1);
30811
30812 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
30813 desret_int(ret_val);
30814 call_tests++;
30815 des_xmlTextReaderPtr(n_reader, reader, 0);
30816 des_xmlRelaxNGPtr(n_schema, schema, 1);
30817 xmlResetLastError();
30818 if (mem_base != xmlMemBlocks()) {
30819 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
30820 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030821 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030822 printf(" %d", n_reader);
30823 printf(" %d", n_schema);
30824 printf("\n");
30825 }
30826 }
30827 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030828 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030829#endif
30830#endif
30831
Daniel Veillard42595322004-11-08 10:52:06 +000030832 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030833}
30834
30835
30836static int
30837test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030838 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030839
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030840#ifdef LIBXML_READER_ENABLED
30841#ifdef LIBXML_SCHEMAS_ENABLED
30842 int mem_base;
30843 int ret_val;
30844 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30845 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030846 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030847 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030848
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030849 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30850 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
30851 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030852 reader = gen_xmlTextReaderPtr(n_reader, 0);
30853 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030854
30855 ret_val = xmlTextReaderRelaxNGValidate(reader, rng);
30856 desret_int(ret_val);
30857 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030858 des_xmlTextReaderPtr(n_reader, reader, 0);
30859 des_const_char_ptr(n_rng, rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030860 xmlResetLastError();
30861 if (mem_base != xmlMemBlocks()) {
30862 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
30863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030864 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030865 printf(" %d", n_reader);
30866 printf(" %d", n_rng);
30867 printf("\n");
30868 }
30869 }
30870 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030871 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030872#endif
30873#endif
30874
Daniel Veillard42595322004-11-08 10:52:06 +000030875 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030876}
30877
30878
30879static int
30880test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030881 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030882
30883
30884 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030885 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030886}
30887
30888
30889static int
30890test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030892
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030893#ifdef LIBXML_READER_ENABLED
30894 int mem_base;
30895 int ret_val;
30896 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30897 int n_reader;
30898 int prop; /* the xmlParserProperties to set */
30899 int n_prop;
30900 int value; /* usually 0 or 1 to (de)activate it */
30901 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030902
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030903 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30904 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
30905 for (n_value = 0;n_value < gen_nb_int;n_value++) {
30906 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030907 reader = gen_xmlTextReaderPtr(n_reader, 0);
30908 prop = gen_int(n_prop, 1);
30909 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030910
30911 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
30912 desret_int(ret_val);
30913 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030914 des_xmlTextReaderPtr(n_reader, reader, 0);
30915 des_int(n_prop, prop, 1);
30916 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030917 xmlResetLastError();
30918 if (mem_base != xmlMemBlocks()) {
30919 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
30920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030921 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030922 printf(" %d", n_reader);
30923 printf(" %d", n_prop);
30924 printf(" %d", n_value);
30925 printf("\n");
30926 }
30927 }
30928 }
30929 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030930 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030931#endif
30932
Daniel Veillard42595322004-11-08 10:52:06 +000030933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030934}
30935
30936
30937static int
30938test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030940
30941
30942 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030943 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030944}
30945
30946
30947static int
30948test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030950
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030951#ifdef LIBXML_READER_ENABLED
30952 int mem_base;
30953 int ret_val;
30954 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30955 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030956
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030957 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30958 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030959 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030960
30961 ret_val = xmlTextReaderStandalone(reader);
30962 desret_int(ret_val);
30963 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030964 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030965 xmlResetLastError();
30966 if (mem_base != xmlMemBlocks()) {
30967 printf("Leak of %d blocks found in xmlTextReaderStandalone",
30968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030969 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030970 printf(" %d", n_reader);
30971 printf("\n");
30972 }
30973 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030974 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030975#endif
30976
Daniel Veillard42595322004-11-08 10:52:06 +000030977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030978}
30979
30980
30981static int
30982test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030984
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030985#ifdef LIBXML_READER_ENABLED
30986 int mem_base;
30987 xmlChar * ret_val;
30988 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30989 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030990
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030991 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30992 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030993 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030994
30995 ret_val = xmlTextReaderValue(reader);
30996 desret_xmlChar_ptr(ret_val);
30997 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030998 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030999 xmlResetLastError();
31000 if (mem_base != xmlMemBlocks()) {
31001 printf("Leak of %d blocks found in xmlTextReaderValue",
31002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031003 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031004 printf(" %d", n_reader);
31005 printf("\n");
31006 }
31007 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031008 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031009#endif
31010
Daniel Veillard42595322004-11-08 10:52:06 +000031011 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031012}
31013
31014
31015static int
31016test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031018
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031019#ifdef LIBXML_READER_ENABLED
31020 int mem_base;
31021 xmlChar * ret_val;
31022 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31023 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031024
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031025 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31026 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031027 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031028
31029 ret_val = xmlTextReaderXmlLang(reader);
31030 desret_xmlChar_ptr(ret_val);
31031 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031032 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031033 xmlResetLastError();
31034 if (mem_base != xmlMemBlocks()) {
31035 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
31036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031037 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031038 printf(" %d", n_reader);
31039 printf("\n");
31040 }
31041 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031042 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031043#endif
31044
Daniel Veillard42595322004-11-08 10:52:06 +000031045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031046}
31047
31048static int
31049test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031050 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031051
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031052 if (quiet == 0) printf("Testing xmlreader : 68 of 78 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031053 test_ret += test_xmlNewTextReader();
31054 test_ret += test_xmlNewTextReaderFilename();
31055 test_ret += test_xmlReaderForDoc();
31056 test_ret += test_xmlReaderForFile();
31057 test_ret += test_xmlReaderForMemory();
31058 test_ret += test_xmlReaderNewDoc();
31059 test_ret += test_xmlReaderNewFile();
31060 test_ret += test_xmlReaderNewMemory();
31061 test_ret += test_xmlReaderNewWalker();
31062 test_ret += test_xmlReaderWalker();
31063 test_ret += test_xmlTextReaderAttributeCount();
31064 test_ret += test_xmlTextReaderBaseUri();
31065 test_ret += test_xmlTextReaderClose();
31066 test_ret += test_xmlTextReaderConstBaseUri();
31067 test_ret += test_xmlTextReaderConstEncoding();
31068 test_ret += test_xmlTextReaderConstLocalName();
31069 test_ret += test_xmlTextReaderConstName();
31070 test_ret += test_xmlTextReaderConstNamespaceUri();
31071 test_ret += test_xmlTextReaderConstPrefix();
31072 test_ret += test_xmlTextReaderConstString();
31073 test_ret += test_xmlTextReaderConstValue();
31074 test_ret += test_xmlTextReaderConstXmlLang();
31075 test_ret += test_xmlTextReaderConstXmlVersion();
31076 test_ret += test_xmlTextReaderCurrentDoc();
31077 test_ret += test_xmlTextReaderCurrentNode();
31078 test_ret += test_xmlTextReaderDepth();
31079 test_ret += test_xmlTextReaderExpand();
31080 test_ret += test_xmlTextReaderGetAttribute();
31081 test_ret += test_xmlTextReaderGetAttributeNo();
31082 test_ret += test_xmlTextReaderGetAttributeNs();
31083 test_ret += test_xmlTextReaderGetErrorHandler();
31084 test_ret += test_xmlTextReaderGetParserProp();
31085 test_ret += test_xmlTextReaderGetRemainder();
31086 test_ret += test_xmlTextReaderHasAttributes();
31087 test_ret += test_xmlTextReaderHasValue();
31088 test_ret += test_xmlTextReaderIsDefault();
31089 test_ret += test_xmlTextReaderIsEmptyElement();
31090 test_ret += test_xmlTextReaderIsNamespaceDecl();
31091 test_ret += test_xmlTextReaderIsValid();
31092 test_ret += test_xmlTextReaderLocalName();
31093 test_ret += test_xmlTextReaderLocatorBaseURI();
31094 test_ret += test_xmlTextReaderLocatorLineNumber();
31095 test_ret += test_xmlTextReaderLookupNamespace();
31096 test_ret += test_xmlTextReaderMoveToAttribute();
31097 test_ret += test_xmlTextReaderMoveToAttributeNo();
31098 test_ret += test_xmlTextReaderMoveToAttributeNs();
31099 test_ret += test_xmlTextReaderMoveToElement();
31100 test_ret += test_xmlTextReaderMoveToFirstAttribute();
31101 test_ret += test_xmlTextReaderMoveToNextAttribute();
31102 test_ret += test_xmlTextReaderName();
31103 test_ret += test_xmlTextReaderNamespaceUri();
31104 test_ret += test_xmlTextReaderNext();
31105 test_ret += test_xmlTextReaderNextSibling();
31106 test_ret += test_xmlTextReaderNodeType();
31107 test_ret += test_xmlTextReaderNormalization();
31108 test_ret += test_xmlTextReaderPrefix();
31109 test_ret += test_xmlTextReaderPreserve();
31110 test_ret += test_xmlTextReaderPreservePattern();
31111 test_ret += test_xmlTextReaderQuoteChar();
31112 test_ret += test_xmlTextReaderRead();
31113 test_ret += test_xmlTextReaderReadAttributeValue();
31114 test_ret += test_xmlTextReaderReadState();
31115 test_ret += test_xmlTextReaderRelaxNGSetSchema();
31116 test_ret += test_xmlTextReaderRelaxNGValidate();
31117 test_ret += test_xmlTextReaderSetErrorHandler();
31118 test_ret += test_xmlTextReaderSetParserProp();
31119 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
31120 test_ret += test_xmlTextReaderStandalone();
31121 test_ret += test_xmlTextReaderValue();
31122 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031123
Daniel Veillard42595322004-11-08 10:52:06 +000031124 if (test_ret != 0)
31125 printf("Module xmlreader: %d errors\n", test_ret);
31126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031127}
Daniel Veillarda521d282004-11-09 14:59:59 +000031128#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031129
Daniel Veillarda82b1822004-11-08 16:24:57 +000031130#define gen_nb_xmlRegExecCtxtPtr 1
31131static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31132 return(NULL);
31133}
31134static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31135}
Daniel Veillarda521d282004-11-09 14:59:59 +000031136#endif
31137
Daniel Veillarda82b1822004-11-08 16:24:57 +000031138
31139static int
31140test_xmlRegExecPushString(void) {
31141 int test_ret = 0;
31142
31143#ifdef LIBXML_REGEXP_ENABLED
31144 int mem_base;
31145 int ret_val;
31146 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31147 int n_exec;
31148 xmlChar * value; /* a string token input */
31149 int n_value;
31150 void * data; /* data associated to the token to reuse in callbacks */
31151 int n_data;
31152
31153 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31154 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31155 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31156 mem_base = xmlMemBlocks();
31157 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31158 value = gen_const_xmlChar_ptr(n_value, 1);
31159 data = gen_userdata(n_data, 2);
31160
31161 ret_val = xmlRegExecPushString(exec, value, data);
31162 desret_int(ret_val);
31163 call_tests++;
31164 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31165 des_const_xmlChar_ptr(n_value, value, 1);
31166 des_userdata(n_data, data, 2);
31167 xmlResetLastError();
31168 if (mem_base != xmlMemBlocks()) {
31169 printf("Leak of %d blocks found in xmlRegExecPushString",
31170 xmlMemBlocks() - mem_base);
31171 test_ret++;
31172 printf(" %d", n_exec);
31173 printf(" %d", n_value);
31174 printf(" %d", n_data);
31175 printf("\n");
31176 }
31177 }
31178 }
31179 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031180 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031181#endif
31182
Daniel Veillarda82b1822004-11-08 16:24:57 +000031183 return(test_ret);
31184}
31185
31186
31187static int
31188test_xmlRegExecPushString2(void) {
31189 int test_ret = 0;
31190
31191#ifdef LIBXML_REGEXP_ENABLED
31192 int mem_base;
31193 int ret_val;
31194 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31195 int n_exec;
31196 xmlChar * value; /* the first string token input */
31197 int n_value;
31198 xmlChar * value2; /* the second string token input */
31199 int n_value2;
31200 void * data; /* data associated to the token to reuse in callbacks */
31201 int n_data;
31202
31203 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31204 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31205 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
31206 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31207 mem_base = xmlMemBlocks();
31208 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31209 value = gen_const_xmlChar_ptr(n_value, 1);
31210 value2 = gen_const_xmlChar_ptr(n_value2, 2);
31211 data = gen_userdata(n_data, 3);
31212
31213 ret_val = xmlRegExecPushString2(exec, value, value2, data);
31214 desret_int(ret_val);
31215 call_tests++;
31216 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31217 des_const_xmlChar_ptr(n_value, value, 1);
31218 des_const_xmlChar_ptr(n_value2, value2, 2);
31219 des_userdata(n_data, data, 3);
31220 xmlResetLastError();
31221 if (mem_base != xmlMemBlocks()) {
31222 printf("Leak of %d blocks found in xmlRegExecPushString2",
31223 xmlMemBlocks() - mem_base);
31224 test_ret++;
31225 printf(" %d", n_exec);
31226 printf(" %d", n_value);
31227 printf(" %d", n_value2);
31228 printf(" %d", n_data);
31229 printf("\n");
31230 }
31231 }
31232 }
31233 }
31234 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031235 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031236#endif
31237
Daniel Veillarda82b1822004-11-08 16:24:57 +000031238 return(test_ret);
31239}
31240
Daniel Veillarda521d282004-11-09 14:59:59 +000031241#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031242
31243#define gen_nb_xmlRegexpPtr 1
31244static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31245 return(NULL);
31246}
31247static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31248}
Daniel Veillarda521d282004-11-09 14:59:59 +000031249#endif
31250
Daniel Veillarda82b1822004-11-08 16:24:57 +000031251
31252static int
31253test_xmlRegNewExecCtxt(void) {
31254 int test_ret = 0;
31255
31256
31257 /* missing type support */
31258 return(test_ret);
31259}
31260
31261
31262static int
31263test_xmlRegexpCompile(void) {
31264 int test_ret = 0;
31265
31266
31267 /* missing type support */
31268 return(test_ret);
31269}
31270
31271
31272static int
31273test_xmlRegexpExec(void) {
31274 int test_ret = 0;
31275
31276#ifdef LIBXML_REGEXP_ENABLED
31277 int mem_base;
31278 int ret_val;
31279 xmlRegexpPtr comp; /* the compiled regular expression */
31280 int n_comp;
31281 xmlChar * content; /* the value to check against the regular expression */
31282 int n_content;
31283
31284 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31285 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31286 mem_base = xmlMemBlocks();
31287 comp = gen_xmlRegexpPtr(n_comp, 0);
31288 content = gen_const_xmlChar_ptr(n_content, 1);
31289
31290 ret_val = xmlRegexpExec(comp, content);
31291 desret_int(ret_val);
31292 call_tests++;
31293 des_xmlRegexpPtr(n_comp, comp, 0);
31294 des_const_xmlChar_ptr(n_content, content, 1);
31295 xmlResetLastError();
31296 if (mem_base != xmlMemBlocks()) {
31297 printf("Leak of %d blocks found in xmlRegexpExec",
31298 xmlMemBlocks() - mem_base);
31299 test_ret++;
31300 printf(" %d", n_comp);
31301 printf(" %d", n_content);
31302 printf("\n");
31303 }
31304 }
31305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031306 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031307#endif
31308
Daniel Veillarda82b1822004-11-08 16:24:57 +000031309 return(test_ret);
31310}
31311
31312
31313static int
31314test_xmlRegexpIsDeterminist(void) {
31315 int test_ret = 0;
31316
31317#ifdef LIBXML_REGEXP_ENABLED
31318 int mem_base;
31319 int ret_val;
31320 xmlRegexpPtr comp; /* the compiled regular expression */
31321 int n_comp;
31322
31323 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31324 mem_base = xmlMemBlocks();
31325 comp = gen_xmlRegexpPtr(n_comp, 0);
31326
31327 ret_val = xmlRegexpIsDeterminist(comp);
31328 desret_int(ret_val);
31329 call_tests++;
31330 des_xmlRegexpPtr(n_comp, comp, 0);
31331 xmlResetLastError();
31332 if (mem_base != xmlMemBlocks()) {
31333 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31334 xmlMemBlocks() - mem_base);
31335 test_ret++;
31336 printf(" %d", n_comp);
31337 printf("\n");
31338 }
31339 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031340 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031341#endif
31342
Daniel Veillarda82b1822004-11-08 16:24:57 +000031343 return(test_ret);
31344}
31345
31346
31347static int
31348test_xmlRegexpPrint(void) {
31349 int test_ret = 0;
31350
31351#ifdef LIBXML_REGEXP_ENABLED
31352 int mem_base;
31353 FILE * output; /* the file for the output debug */
31354 int n_output;
31355 xmlRegexpPtr regexp; /* the compiled regexp */
31356 int n_regexp;
31357
31358 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31359 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31360 mem_base = xmlMemBlocks();
31361 output = gen_FILE_ptr(n_output, 0);
31362 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31363
31364 xmlRegexpPrint(output, regexp);
31365 call_tests++;
31366 des_FILE_ptr(n_output, output, 0);
31367 des_xmlRegexpPtr(n_regexp, regexp, 1);
31368 xmlResetLastError();
31369 if (mem_base != xmlMemBlocks()) {
31370 printf("Leak of %d blocks found in xmlRegexpPrint",
31371 xmlMemBlocks() - mem_base);
31372 test_ret++;
31373 printf(" %d", n_output);
31374 printf(" %d", n_regexp);
31375 printf("\n");
31376 }
31377 }
31378 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031379 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031380#endif
31381
Daniel Veillarda82b1822004-11-08 16:24:57 +000031382 return(test_ret);
31383}
31384
31385static int
31386test_xmlregexp(void) {
31387 int test_ret = 0;
31388
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031389 if (quiet == 0) printf("Testing xmlregexp : 5 of 9 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000031390 test_ret += test_xmlRegExecPushString();
31391 test_ret += test_xmlRegExecPushString2();
31392 test_ret += test_xmlRegNewExecCtxt();
31393 test_ret += test_xmlRegexpCompile();
31394 test_ret += test_xmlRegexpExec();
31395 test_ret += test_xmlRegexpIsDeterminist();
31396 test_ret += test_xmlRegexpPrint();
31397
31398 if (test_ret != 0)
31399 printf("Module xmlregexp: %d errors\n", test_ret);
31400 return(test_ret);
31401}
Daniel Veillarda521d282004-11-09 14:59:59 +000031402#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031403
Daniel Veillardce682bc2004-11-05 17:22:25 +000031404#define gen_nb_xmlSaveCtxtPtr 1
31405static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31406 return(NULL);
31407}
31408static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31409}
Daniel Veillarda521d282004-11-09 14:59:59 +000031410#endif
31411
Daniel Veillardce682bc2004-11-05 17:22:25 +000031412
Daniel Veillardd93f6252004-11-02 15:53:51 +000031413static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031414test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031415 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031416
Daniel Veillardce682bc2004-11-05 17:22:25 +000031417#ifdef LIBXML_OUTPUT_ENABLED
31418 int mem_base;
31419 int ret_val;
31420 xmlSaveCtxtPtr ctxt; /* a document saving context */
31421 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031422
Daniel Veillardce682bc2004-11-05 17:22:25 +000031423 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31424 mem_base = xmlMemBlocks();
31425 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31426
31427 ret_val = xmlSaveClose(ctxt);
31428 desret_int(ret_val);
31429 call_tests++;
31430 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31431 xmlResetLastError();
31432 if (mem_base != xmlMemBlocks()) {
31433 printf("Leak of %d blocks found in xmlSaveClose",
31434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031435 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031436 printf(" %d", n_ctxt);
31437 printf("\n");
31438 }
31439 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031440 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031441#endif
31442
Daniel Veillard42595322004-11-08 10:52:06 +000031443 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031444}
31445
31446
31447static int
31448test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031449 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031450
Daniel Veillardce682bc2004-11-05 17:22:25 +000031451#ifdef LIBXML_OUTPUT_ENABLED
31452 int mem_base;
31453 long ret_val;
31454 xmlSaveCtxtPtr ctxt; /* a document saving context */
31455 int n_ctxt;
31456 xmlDocPtr doc; /* a document */
31457 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031458
Daniel Veillardce682bc2004-11-05 17:22:25 +000031459 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31460 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31461 mem_base = xmlMemBlocks();
31462 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31463 doc = gen_xmlDocPtr(n_doc, 1);
31464
31465 ret_val = xmlSaveDoc(ctxt, doc);
31466 desret_long(ret_val);
31467 call_tests++;
31468 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31469 des_xmlDocPtr(n_doc, doc, 1);
31470 xmlResetLastError();
31471 if (mem_base != xmlMemBlocks()) {
31472 printf("Leak of %d blocks found in xmlSaveDoc",
31473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031474 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031475 printf(" %d", n_ctxt);
31476 printf(" %d", n_doc);
31477 printf("\n");
31478 }
31479 }
31480 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031481 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031482#endif
31483
Daniel Veillard42595322004-11-08 10:52:06 +000031484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031485}
31486
31487
31488static int
31489test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031491
Daniel Veillardce682bc2004-11-05 17:22:25 +000031492#ifdef LIBXML_OUTPUT_ENABLED
31493 int mem_base;
31494 int ret_val;
31495 xmlSaveCtxtPtr ctxt; /* a document saving context */
31496 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031497
Daniel Veillardce682bc2004-11-05 17:22:25 +000031498 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31499 mem_base = xmlMemBlocks();
31500 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31501
31502 ret_val = xmlSaveFlush(ctxt);
31503 desret_int(ret_val);
31504 call_tests++;
31505 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31506 xmlResetLastError();
31507 if (mem_base != xmlMemBlocks()) {
31508 printf("Leak of %d blocks found in xmlSaveFlush",
31509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031510 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031511 printf(" %d", n_ctxt);
31512 printf("\n");
31513 }
31514 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031515 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031516#endif
31517
Daniel Veillard42595322004-11-08 10:52:06 +000031518 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031519}
31520
31521
31522static int
31523test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031524 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031525
31526
31527 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031529}
31530
31531
31532static int
31533test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031535
31536
31537 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031539}
31540
31541
31542static int
31543test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031545
31546
31547 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031549}
31550
31551
31552static int
31553test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031555
31556
31557 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031559}
31560
31561
31562static int
31563test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031565
Daniel Veillardce682bc2004-11-05 17:22:25 +000031566#ifdef LIBXML_OUTPUT_ENABLED
31567 int mem_base;
31568 long ret_val;
31569 xmlSaveCtxtPtr ctxt; /* a document saving context */
31570 int n_ctxt;
31571 xmlNodePtr node; /* a document */
31572 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031573
Daniel Veillardce682bc2004-11-05 17:22:25 +000031574 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31575 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31576 mem_base = xmlMemBlocks();
31577 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31578 node = gen_xmlNodePtr(n_node, 1);
31579
31580 ret_val = xmlSaveTree(ctxt, node);
31581 desret_long(ret_val);
31582 call_tests++;
31583 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31584 des_xmlNodePtr(n_node, node, 1);
31585 xmlResetLastError();
31586 if (mem_base != xmlMemBlocks()) {
31587 printf("Leak of %d blocks found in xmlSaveTree",
31588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031589 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031590 printf(" %d", n_ctxt);
31591 printf(" %d", n_node);
31592 printf("\n");
31593 }
31594 }
31595 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031596 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031597#endif
31598
Daniel Veillard42595322004-11-08 10:52:06 +000031599 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031600}
31601
31602static int
31603test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031605
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031606 if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031607 test_ret += test_xmlSaveClose();
31608 test_ret += test_xmlSaveDoc();
31609 test_ret += test_xmlSaveFlush();
31610 test_ret += test_xmlSaveSetAttrEscape();
31611 test_ret += test_xmlSaveSetEscape();
31612 test_ret += test_xmlSaveToFd();
31613 test_ret += test_xmlSaveToFilename();
31614 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031615
Daniel Veillard42595322004-11-08 10:52:06 +000031616 if (test_ret != 0)
31617 printf("Module xmlsave: %d errors\n", test_ret);
31618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031619}
Daniel Veillarda521d282004-11-09 14:59:59 +000031620#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031621
Daniel Veillardce682bc2004-11-05 17:22:25 +000031622#define gen_nb_xmlSchemaPtr 1
31623static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31624 return(NULL);
31625}
31626static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31627}
Daniel Veillarda521d282004-11-09 14:59:59 +000031628#endif
31629
Daniel Veillardce682bc2004-11-05 17:22:25 +000031630
Daniel Veillardd93f6252004-11-02 15:53:51 +000031631static int
31632test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031633 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031634
Daniel Veillardce682bc2004-11-05 17:22:25 +000031635#ifdef LIBXML_SCHEMAS_ENABLED
31636#ifdef LIBXML_OUTPUT_ENABLED
31637 int mem_base;
31638 FILE * output; /* the file output */
31639 int n_output;
31640 xmlSchemaPtr schema; /* a schema structure */
31641 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031642
Daniel Veillardce682bc2004-11-05 17:22:25 +000031643 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31644 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
31645 mem_base = xmlMemBlocks();
31646 output = gen_FILE_ptr(n_output, 0);
31647 schema = gen_xmlSchemaPtr(n_schema, 1);
31648
31649 xmlSchemaDump(output, schema);
31650 call_tests++;
31651 des_FILE_ptr(n_output, output, 0);
31652 des_xmlSchemaPtr(n_schema, schema, 1);
31653 xmlResetLastError();
31654 if (mem_base != xmlMemBlocks()) {
31655 printf("Leak of %d blocks found in xmlSchemaDump",
31656 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031657 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031658 printf(" %d", n_output);
31659 printf(" %d", n_schema);
31660 printf("\n");
31661 }
31662 }
31663 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031664 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031665#endif
31666#endif
31667
Daniel Veillard42595322004-11-08 10:52:06 +000031668 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031669}
31670
Daniel Veillarda521d282004-11-09 14:59:59 +000031671#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031672
Daniel Veillardce682bc2004-11-05 17:22:25 +000031673#define gen_nb_xmlSchemaParserCtxtPtr 1
31674static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31675 return(NULL);
31676}
31677static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31678}
Daniel Veillarda521d282004-11-09 14:59:59 +000031679#endif
31680
31681#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031682
31683#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
31684static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31685 return(NULL);
31686}
31687static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31688}
Daniel Veillarda521d282004-11-09 14:59:59 +000031689#endif
31690
31691#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031692
31693#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
31694static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31695 return(NULL);
31696}
31697static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31698}
Daniel Veillarda521d282004-11-09 14:59:59 +000031699#endif
31700
Daniel Veillardce682bc2004-11-05 17:22:25 +000031701
Daniel Veillardd93f6252004-11-02 15:53:51 +000031702static int
31703test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031704 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031705
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031706#ifdef LIBXML_SCHEMAS_ENABLED
31707 int mem_base;
31708 int ret_val;
31709 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
31710 int n_ctxt;
31711 xmlSchemaValidityErrorFunc * err; /* the error callback result */
31712 int n_err;
31713 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
31714 int n_warn;
31715 void ** ctx; /* contextual data for the callbacks result */
31716 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031717
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031718 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
31719 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31720 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31721 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31722 mem_base = xmlMemBlocks();
31723 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
31724 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31725 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31726 ctx = gen_void_ptr_ptr(n_ctx, 3);
31727
31728 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
31729 desret_int(ret_val);
31730 call_tests++;
31731 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
31732 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31733 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31734 des_void_ptr_ptr(n_ctx, ctx, 3);
31735 xmlResetLastError();
31736 if (mem_base != xmlMemBlocks()) {
31737 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
31738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031739 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031740 printf(" %d", n_ctxt);
31741 printf(" %d", n_err);
31742 printf(" %d", n_warn);
31743 printf(" %d", n_ctx);
31744 printf("\n");
31745 }
31746 }
31747 }
31748 }
31749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031750 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031751#endif
31752
Daniel Veillard42595322004-11-08 10:52:06 +000031753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031754}
31755
Daniel Veillarda521d282004-11-09 14:59:59 +000031756#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031757
Daniel Veillardce682bc2004-11-05 17:22:25 +000031758#define gen_nb_xmlSchemaValidCtxtPtr 1
31759static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31760 return(NULL);
31761}
31762static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31763}
Daniel Veillarda521d282004-11-09 14:59:59 +000031764#endif
31765
Daniel Veillardce682bc2004-11-05 17:22:25 +000031766
Daniel Veillardd93f6252004-11-02 15:53:51 +000031767static int
31768test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031769 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031770
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031771#ifdef LIBXML_SCHEMAS_ENABLED
31772 int mem_base;
31773 int ret_val;
31774 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
31775 int n_ctxt;
31776 xmlSchemaValidityErrorFunc * err; /* the error function result */
31777 int n_err;
31778 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
31779 int n_warn;
31780 void ** ctx; /* the functions context result */
31781 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031782
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031783 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31784 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31785 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31786 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31787 mem_base = xmlMemBlocks();
31788 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31789 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31790 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31791 ctx = gen_void_ptr_ptr(n_ctx, 3);
31792
31793 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
31794 desret_int(ret_val);
31795 call_tests++;
31796 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31797 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31798 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31799 des_void_ptr_ptr(n_ctx, ctx, 3);
31800 xmlResetLastError();
31801 if (mem_base != xmlMemBlocks()) {
31802 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
31803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031804 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031805 printf(" %d", n_ctxt);
31806 printf(" %d", n_err);
31807 printf(" %d", n_warn);
31808 printf(" %d", n_ctx);
31809 printf("\n");
31810 }
31811 }
31812 }
31813 }
31814 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031815 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031816#endif
31817
Daniel Veillard42595322004-11-08 10:52:06 +000031818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031819}
31820
31821
31822static int
31823test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031825
Daniel Veillard42595322004-11-08 10:52:06 +000031826#ifdef LIBXML_SCHEMAS_ENABLED
31827 int mem_base;
31828 xmlSchemaParserCtxtPtr ret_val;
31829 xmlDocPtr doc; /* a preparsed document tree */
31830 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031831
Daniel Veillard42595322004-11-08 10:52:06 +000031832 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31833 mem_base = xmlMemBlocks();
31834 doc = gen_xmlDocPtr(n_doc, 0);
31835
31836 ret_val = xmlSchemaNewDocParserCtxt(doc);
31837 desret_xmlSchemaParserCtxtPtr(ret_val);
31838 call_tests++;
31839 des_xmlDocPtr(n_doc, doc, 0);
31840 xmlResetLastError();
31841 if (mem_base != xmlMemBlocks()) {
31842 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
31843 xmlMemBlocks() - mem_base);
31844 test_ret++;
31845 printf(" %d", n_doc);
31846 printf("\n");
31847 }
31848 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031849 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031850#endif
31851
Daniel Veillard42595322004-11-08 10:52:06 +000031852 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031853}
31854
31855
31856static int
31857test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031858 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031859
Daniel Veillard42595322004-11-08 10:52:06 +000031860#ifdef LIBXML_SCHEMAS_ENABLED
31861 int mem_base;
31862 xmlSchemaParserCtxtPtr ret_val;
31863 char * buffer; /* a pointer to a char array containing the schemas */
31864 int n_buffer;
31865 int size; /* the size of the array */
31866 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031867
Daniel Veillard42595322004-11-08 10:52:06 +000031868 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
31869 for (n_size = 0;n_size < gen_nb_int;n_size++) {
31870 mem_base = xmlMemBlocks();
31871 buffer = gen_const_char_ptr(n_buffer, 0);
31872 size = gen_int(n_size, 1);
31873
31874 ret_val = xmlSchemaNewMemParserCtxt(buffer, size);
31875 desret_xmlSchemaParserCtxtPtr(ret_val);
31876 call_tests++;
31877 des_const_char_ptr(n_buffer, buffer, 0);
31878 des_int(n_size, size, 1);
31879 xmlResetLastError();
31880 if (mem_base != xmlMemBlocks()) {
31881 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
31882 xmlMemBlocks() - mem_base);
31883 test_ret++;
31884 printf(" %d", n_buffer);
31885 printf(" %d", n_size);
31886 printf("\n");
31887 }
31888 }
31889 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031890 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031891#endif
31892
Daniel Veillard42595322004-11-08 10:52:06 +000031893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031894}
31895
31896
31897static int
31898test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031900
Daniel Veillard42595322004-11-08 10:52:06 +000031901#ifdef LIBXML_SCHEMAS_ENABLED
31902 int mem_base;
31903 xmlSchemaParserCtxtPtr ret_val;
31904 char * URL; /* the location of the schema */
31905 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031906
Daniel Veillard42595322004-11-08 10:52:06 +000031907 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
31908 mem_base = xmlMemBlocks();
31909 URL = gen_const_char_ptr(n_URL, 0);
31910
31911 ret_val = xmlSchemaNewParserCtxt(URL);
31912 desret_xmlSchemaParserCtxtPtr(ret_val);
31913 call_tests++;
31914 des_const_char_ptr(n_URL, URL, 0);
31915 xmlResetLastError();
31916 if (mem_base != xmlMemBlocks()) {
31917 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
31918 xmlMemBlocks() - mem_base);
31919 test_ret++;
31920 printf(" %d", n_URL);
31921 printf("\n");
31922 }
31923 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031924 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031925#endif
31926
Daniel Veillard42595322004-11-08 10:52:06 +000031927 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031928}
31929
31930
31931static int
31932test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031933 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031934
31935
31936 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031938}
31939
31940
31941static int
31942test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031944
31945
31946 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031948}
31949
31950
31951static int
31952test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031954
31955
31956 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031958}
31959
31960
31961static int
31962test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031964
31965
31966 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031967 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031968}
31969
31970
31971static int
31972test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031973 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031974
Daniel Veillardce682bc2004-11-05 17:22:25 +000031975#ifdef LIBXML_SCHEMAS_ENABLED
31976 int mem_base;
31977 int ret_val;
31978 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31979 int n_ctxt;
31980 int options; /* a combination of xmlSchemaValidOption */
31981 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031982
Daniel Veillardce682bc2004-11-05 17:22:25 +000031983 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31984 for (n_options = 0;n_options < gen_nb_int;n_options++) {
31985 mem_base = xmlMemBlocks();
31986 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31987 options = gen_int(n_options, 1);
31988
31989 ret_val = xmlSchemaSetValidOptions(ctxt, options);
31990 desret_int(ret_val);
31991 call_tests++;
31992 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31993 des_int(n_options, options, 1);
31994 xmlResetLastError();
31995 if (mem_base != xmlMemBlocks()) {
31996 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
31997 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031998 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031999 printf(" %d", n_ctxt);
32000 printf(" %d", n_options);
32001 printf("\n");
32002 }
32003 }
32004 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032005 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032006#endif
32007
Daniel Veillard42595322004-11-08 10:52:06 +000032008 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032009}
32010
32011
32012static int
32013test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032015
Daniel Veillardce682bc2004-11-05 17:22:25 +000032016#ifdef LIBXML_SCHEMAS_ENABLED
32017 int mem_base;
32018 int ret_val;
32019 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32020 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032021
Daniel Veillardce682bc2004-11-05 17:22:25 +000032022 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32023 mem_base = xmlMemBlocks();
32024 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32025
32026 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
32027 desret_int(ret_val);
32028 call_tests++;
32029 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32030 xmlResetLastError();
32031 if (mem_base != xmlMemBlocks()) {
32032 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
32033 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032034 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032035 printf(" %d", n_ctxt);
32036 printf("\n");
32037 }
32038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032039 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032040#endif
32041
Daniel Veillard42595322004-11-08 10:52:06 +000032042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032043}
32044
32045
32046static int
32047test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032049
Daniel Veillardce682bc2004-11-05 17:22:25 +000032050#ifdef LIBXML_SCHEMAS_ENABLED
32051 int mem_base;
32052 int ret_val;
32053 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32054 int n_ctxt;
32055 xmlDocPtr doc; /* a parsed document tree */
32056 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032057
Daniel Veillardce682bc2004-11-05 17:22:25 +000032058 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32059 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32060 mem_base = xmlMemBlocks();
32061 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32062 doc = gen_xmlDocPtr(n_doc, 1);
32063
32064 ret_val = xmlSchemaValidateDoc(ctxt, doc);
32065 desret_int(ret_val);
32066 call_tests++;
32067 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32068 des_xmlDocPtr(n_doc, doc, 1);
32069 xmlResetLastError();
32070 if (mem_base != xmlMemBlocks()) {
32071 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
32072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032073 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032074 printf(" %d", n_ctxt);
32075 printf(" %d", n_doc);
32076 printf("\n");
32077 }
32078 }
32079 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032080 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032081#endif
32082
Daniel Veillard42595322004-11-08 10:52:06 +000032083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032084}
32085
32086
32087static int
32088test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032090
Daniel Veillardce682bc2004-11-05 17:22:25 +000032091#ifdef LIBXML_SCHEMAS_ENABLED
32092 int mem_base;
32093 int ret_val;
32094 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32095 int n_ctxt;
32096 xmlNodePtr elem; /* an element node */
32097 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032098
Daniel Veillardce682bc2004-11-05 17:22:25 +000032099 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32100 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
32101 mem_base = xmlMemBlocks();
32102 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32103 elem = gen_xmlNodePtr(n_elem, 1);
32104
32105 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
32106 desret_int(ret_val);
32107 call_tests++;
32108 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32109 des_xmlNodePtr(n_elem, elem, 1);
32110 xmlResetLastError();
32111 if (mem_base != xmlMemBlocks()) {
32112 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
32113 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032114 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032115 printf(" %d", n_ctxt);
32116 printf(" %d", n_elem);
32117 printf("\n");
32118 }
32119 }
32120 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032121 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032122#endif
32123
Daniel Veillard42595322004-11-08 10:52:06 +000032124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032125}
32126
32127
32128static int
32129test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032131
Daniel Veillardce682bc2004-11-05 17:22:25 +000032132#ifdef LIBXML_SCHEMAS_ENABLED
32133 int mem_base;
32134 int ret_val;
32135 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32136 int n_ctxt;
32137 xmlParserInputBufferPtr input; /* the input to use for reading the data */
32138 int n_input;
32139 xmlCharEncoding enc; /* an optional encoding information */
32140 int n_enc;
32141 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
32142 int n_sax;
32143 void * user_data; /* the context to provide to the SAX handler. */
32144 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032145
Daniel Veillardce682bc2004-11-05 17:22:25 +000032146 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32147 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
32148 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
32149 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
32150 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
32151 mem_base = xmlMemBlocks();
32152 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32153 input = gen_xmlParserInputBufferPtr(n_input, 1);
32154 enc = gen_xmlCharEncoding(n_enc, 2);
32155 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
32156 user_data = gen_userdata(n_user_data, 4);
32157
32158 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
32159 desret_int(ret_val);
32160 call_tests++;
32161 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32162 des_xmlParserInputBufferPtr(n_input, input, 1);
32163 des_xmlCharEncoding(n_enc, enc, 2);
32164 des_xmlSAXHandlerPtr(n_sax, sax, 3);
32165 des_userdata(n_user_data, user_data, 4);
32166 xmlResetLastError();
32167 if (mem_base != xmlMemBlocks()) {
32168 printf("Leak of %d blocks found in xmlSchemaValidateStream",
32169 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032170 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032171 printf(" %d", n_ctxt);
32172 printf(" %d", n_input);
32173 printf(" %d", n_enc);
32174 printf(" %d", n_sax);
32175 printf(" %d", n_user_data);
32176 printf("\n");
32177 }
32178 }
32179 }
32180 }
32181 }
32182 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032183 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032184#endif
32185
Daniel Veillard42595322004-11-08 10:52:06 +000032186 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032187}
32188
32189static int
32190test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032192
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032193 if (quiet == 0) printf("Testing xmlschemas : 11 of 18 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032194 test_ret += test_xmlSchemaDump();
32195 test_ret += test_xmlSchemaGetParserErrors();
32196 test_ret += test_xmlSchemaGetValidErrors();
32197 test_ret += test_xmlSchemaNewDocParserCtxt();
32198 test_ret += test_xmlSchemaNewMemParserCtxt();
32199 test_ret += test_xmlSchemaNewParserCtxt();
32200 test_ret += test_xmlSchemaNewValidCtxt();
32201 test_ret += test_xmlSchemaParse();
32202 test_ret += test_xmlSchemaSetParserErrors();
32203 test_ret += test_xmlSchemaSetValidErrors();
32204 test_ret += test_xmlSchemaSetValidOptions();
32205 test_ret += test_xmlSchemaValidCtxtGetOptions();
32206 test_ret += test_xmlSchemaValidateDoc();
32207 test_ret += test_xmlSchemaValidateOneElement();
32208 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032209
Daniel Veillard42595322004-11-08 10:52:06 +000032210 if (test_ret != 0)
32211 printf("Module xmlschemas: %d errors\n", test_ret);
32212 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032213}
Daniel Veillarda521d282004-11-09 14:59:59 +000032214#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032215
Daniel Veillardce682bc2004-11-05 17:22:25 +000032216#define gen_nb_xmlSchemaFacetPtr 1
32217static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32218 return(NULL);
32219}
32220static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32221}
Daniel Veillarda521d282004-11-09 14:59:59 +000032222#endif
32223
32224#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032225
32226#define gen_nb_xmlSchemaTypePtr 1
32227static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32228 return(NULL);
32229}
32230static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32231}
Daniel Veillarda521d282004-11-09 14:59:59 +000032232#endif
32233
Daniel Veillardce682bc2004-11-05 17:22:25 +000032234
Daniel Veillardd93f6252004-11-02 15:53:51 +000032235static int
32236test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032238
Daniel Veillardce682bc2004-11-05 17:22:25 +000032239#ifdef LIBXML_SCHEMAS_ENABLED
32240 int mem_base;
32241 int ret_val;
32242 xmlSchemaFacetPtr facet; /* the facet */
32243 int n_facet;
32244 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32245 int n_typeDecl;
32246 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
32247 int n_ctxt;
32248 xmlChar * name; /* name of the type */
32249 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032250
Daniel Veillardce682bc2004-11-05 17:22:25 +000032251 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32252 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
32253 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32254 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32255 mem_base = xmlMemBlocks();
32256 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32257 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
32258 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
32259 name = gen_const_xmlChar_ptr(n_name, 3);
32260
32261 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, name);
32262 desret_int(ret_val);
32263 call_tests++;
32264 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32265 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
32266 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
32267 des_const_xmlChar_ptr(n_name, name, 3);
32268 xmlResetLastError();
32269 if (mem_base != xmlMemBlocks()) {
32270 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32271 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032272 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032273 printf(" %d", n_facet);
32274 printf(" %d", n_typeDecl);
32275 printf(" %d", n_ctxt);
32276 printf(" %d", n_name);
32277 printf("\n");
32278 }
32279 }
32280 }
32281 }
32282 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032283 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032284#endif
32285
Daniel Veillard42595322004-11-08 10:52:06 +000032286 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032287}
32288
32289
32290static int
32291test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032292 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032293
32294#ifdef LIBXML_SCHEMAS_ENABLED
32295 int mem_base;
32296
32297 mem_base = xmlMemBlocks();
32298
32299 xmlSchemaCleanupTypes();
32300 call_tests++;
32301 xmlResetLastError();
32302 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032303 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032305 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032306 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032307 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032308 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032309#endif
32310
Daniel Veillard42595322004-11-08 10:52:06 +000032311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032312}
32313
32314
32315static int
32316test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032318
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032319#ifdef LIBXML_SCHEMAS_ENABLED
32320 int mem_base;
32321 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032322 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032323 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032324
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032325 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32326 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032327 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032328
32329 ret_val = xmlSchemaCollapseString(value);
32330 desret_xmlChar_ptr(ret_val);
32331 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032332 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032333 xmlResetLastError();
32334 if (mem_base != xmlMemBlocks()) {
32335 printf("Leak of %d blocks found in xmlSchemaCollapseString",
32336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032337 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032338 printf(" %d", n_value);
32339 printf("\n");
32340 }
32341 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032342 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032343#endif
32344
Daniel Veillard42595322004-11-08 10:52:06 +000032345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032346}
32347
Daniel Veillarda521d282004-11-09 14:59:59 +000032348#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032349
Daniel Veillardce682bc2004-11-05 17:22:25 +000032350#define gen_nb_xmlSchemaValPtr 1
32351static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32352 return(NULL);
32353}
32354static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32355}
Daniel Veillarda521d282004-11-09 14:59:59 +000032356#endif
32357
Daniel Veillardce682bc2004-11-05 17:22:25 +000032358
Daniel Veillardd93f6252004-11-02 15:53:51 +000032359static int
32360test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032361 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032362
Daniel Veillardce682bc2004-11-05 17:22:25 +000032363#ifdef LIBXML_SCHEMAS_ENABLED
32364 int mem_base;
32365 int ret_val;
32366 xmlSchemaValPtr x; /* a first value */
32367 int n_x;
32368 xmlSchemaValPtr y; /* a second value */
32369 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032370
Daniel Veillardce682bc2004-11-05 17:22:25 +000032371 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32372 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32373 mem_base = xmlMemBlocks();
32374 x = gen_xmlSchemaValPtr(n_x, 0);
32375 y = gen_xmlSchemaValPtr(n_y, 1);
32376
32377 ret_val = xmlSchemaCompareValues(x, y);
32378 desret_int(ret_val);
32379 call_tests++;
32380 des_xmlSchemaValPtr(n_x, x, 0);
32381 des_xmlSchemaValPtr(n_y, y, 1);
32382 xmlResetLastError();
32383 if (mem_base != xmlMemBlocks()) {
32384 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32385 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032386 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032387 printf(" %d", n_x);
32388 printf(" %d", n_y);
32389 printf("\n");
32390 }
32391 }
32392 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032393 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032394#endif
32395
Daniel Veillard42595322004-11-08 10:52:06 +000032396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032397}
32398
32399
32400static int
32401test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032403
Daniel Veillard42595322004-11-08 10:52:06 +000032404#ifdef LIBXML_SCHEMAS_ENABLED
32405 int mem_base;
32406 xmlSchemaTypePtr ret_val;
32407 xmlSchemaTypePtr type; /* the built-in simple type. */
32408 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032409
Daniel Veillard42595322004-11-08 10:52:06 +000032410 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32411 mem_base = xmlMemBlocks();
32412 type = gen_xmlSchemaTypePtr(n_type, 0);
32413
32414 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32415 desret_xmlSchemaTypePtr(ret_val);
32416 call_tests++;
32417 des_xmlSchemaTypePtr(n_type, type, 0);
32418 xmlResetLastError();
32419 if (mem_base != xmlMemBlocks()) {
32420 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32421 xmlMemBlocks() - mem_base);
32422 test_ret++;
32423 printf(" %d", n_type);
32424 printf("\n");
32425 }
32426 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032427 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032428#endif
32429
Daniel Veillard42595322004-11-08 10:52:06 +000032430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032431}
32432
32433
32434static int
32435test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032436 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032437
Daniel Veillard42595322004-11-08 10:52:06 +000032438#ifdef LIBXML_SCHEMAS_ENABLED
32439 xmlSchemaTypePtr ret_val;
32440 xmlSchemaValType type; /* the type of the built in type */
32441 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032442
Daniel Veillard42595322004-11-08 10:52:06 +000032443 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32444 type = gen_xmlSchemaValType(n_type, 0);
32445
32446 ret_val = xmlSchemaGetBuiltInType(type);
32447 desret_xmlSchemaTypePtr(ret_val);
32448 call_tests++;
32449 des_xmlSchemaValType(n_type, type, 0);
32450 xmlResetLastError();
32451 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032452 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032453#endif
32454
Daniel Veillard42595322004-11-08 10:52:06 +000032455 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032456}
32457
32458
32459static int
32460test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032461 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032462
32463
32464 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032465 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032466}
32467
32468
32469static int
32470test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032471 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032472
Daniel Veillard42595322004-11-08 10:52:06 +000032473#ifdef LIBXML_SCHEMAS_ENABLED
32474 int mem_base;
32475 xmlSchemaTypePtr ret_val;
32476 xmlChar * name; /* the type name */
32477 int n_name;
32478 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
32479 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032480
Daniel Veillard42595322004-11-08 10:52:06 +000032481 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32482 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
32483 mem_base = xmlMemBlocks();
32484 name = gen_const_xmlChar_ptr(n_name, 0);
32485 ns = gen_const_xmlChar_ptr(n_ns, 1);
32486
32487 ret_val = xmlSchemaGetPredefinedType(name, ns);
32488 desret_xmlSchemaTypePtr(ret_val);
32489 call_tests++;
32490 des_const_xmlChar_ptr(n_name, name, 0);
32491 des_const_xmlChar_ptr(n_ns, ns, 1);
32492 xmlResetLastError();
32493 if (mem_base != xmlMemBlocks()) {
32494 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
32495 xmlMemBlocks() - mem_base);
32496 test_ret++;
32497 printf(" %d", n_name);
32498 printf(" %d", n_ns);
32499 printf("\n");
32500 }
32501 }
32502 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032503 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032504#endif
32505
Daniel Veillard42595322004-11-08 10:52:06 +000032506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032507}
32508
32509
32510static int
32511test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032513
32514#ifdef LIBXML_SCHEMAS_ENABLED
32515
32516
32517 xmlSchemaInitTypes();
32518 call_tests++;
32519 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032520 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032521#endif
32522
Daniel Veillard42595322004-11-08 10:52:06 +000032523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032524}
32525
32526
32527static int
32528test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032530
Daniel Veillardce682bc2004-11-05 17:22:25 +000032531#ifdef LIBXML_SCHEMAS_ENABLED
32532 int mem_base;
32533 int ret_val;
32534 xmlSchemaTypePtr type; /* the built-in type */
32535 int n_type;
32536 int facetType; /* the facet type */
32537 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032538
Daniel Veillardce682bc2004-11-05 17:22:25 +000032539 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32540 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
32541 mem_base = xmlMemBlocks();
32542 type = gen_xmlSchemaTypePtr(n_type, 0);
32543 facetType = gen_int(n_facetType, 1);
32544
32545 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
32546 desret_int(ret_val);
32547 call_tests++;
32548 des_xmlSchemaTypePtr(n_type, type, 0);
32549 des_int(n_facetType, facetType, 1);
32550 xmlResetLastError();
32551 if (mem_base != xmlMemBlocks()) {
32552 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
32553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032554 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032555 printf(" %d", n_type);
32556 printf(" %d", n_facetType);
32557 printf("\n");
32558 }
32559 }
32560 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032561 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032562#endif
32563
Daniel Veillard42595322004-11-08 10:52:06 +000032564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032565}
32566
32567
32568static int
32569test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032571
32572
32573 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032575}
32576
Daniel Veillarda521d282004-11-09 14:59:59 +000032577#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032578
Daniel Veillardce682bc2004-11-05 17:22:25 +000032579#define gen_nb_xmlSchemaValPtr_ptr 1
32580static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32581 return(NULL);
32582}
32583static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32584}
Daniel Veillarda521d282004-11-09 14:59:59 +000032585#endif
32586
Daniel Veillardce682bc2004-11-05 17:22:25 +000032587
Daniel Veillardd93f6252004-11-02 15:53:51 +000032588static int
32589test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032591
Daniel Veillardce682bc2004-11-05 17:22:25 +000032592#ifdef LIBXML_SCHEMAS_ENABLED
32593 int mem_base;
32594 int ret_val;
32595 xmlSchemaTypePtr type; /* the predefined type */
32596 int n_type;
32597 xmlChar * value; /* the value to check */
32598 int n_value;
32599 xmlSchemaValPtr * val; /* the return computed value */
32600 int n_val;
32601 xmlNodePtr node; /* the node containing the value */
32602 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032603
Daniel Veillardce682bc2004-11-05 17:22:25 +000032604 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32605 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32606 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32607 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32608 mem_base = xmlMemBlocks();
32609 type = gen_xmlSchemaTypePtr(n_type, 0);
32610 value = gen_const_xmlChar_ptr(n_value, 1);
32611 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32612 node = gen_xmlNodePtr(n_node, 3);
32613
32614 ret_val = xmlSchemaValPredefTypeNode(type, value, val, node);
32615 desret_int(ret_val);
32616 call_tests++;
32617 des_xmlSchemaTypePtr(n_type, type, 0);
32618 des_const_xmlChar_ptr(n_value, value, 1);
32619 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32620 des_xmlNodePtr(n_node, node, 3);
32621 xmlResetLastError();
32622 if (mem_base != xmlMemBlocks()) {
32623 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
32624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032625 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032626 printf(" %d", n_type);
32627 printf(" %d", n_value);
32628 printf(" %d", n_val);
32629 printf(" %d", n_node);
32630 printf("\n");
32631 }
32632 }
32633 }
32634 }
32635 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032636 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032637#endif
32638
Daniel Veillard42595322004-11-08 10:52:06 +000032639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032640}
32641
32642
32643static int
32644test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032645 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032646
Daniel Veillardce682bc2004-11-05 17:22:25 +000032647#ifdef LIBXML_SCHEMAS_ENABLED
32648 int mem_base;
32649 int ret_val;
32650 xmlSchemaTypePtr type; /* the predefined type */
32651 int n_type;
32652 xmlChar * value; /* the value to check */
32653 int n_value;
32654 xmlSchemaValPtr * val; /* the return computed value */
32655 int n_val;
32656 xmlNodePtr node; /* the node containing the value */
32657 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032658
Daniel Veillardce682bc2004-11-05 17:22:25 +000032659 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32660 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32661 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32662 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32663 mem_base = xmlMemBlocks();
32664 type = gen_xmlSchemaTypePtr(n_type, 0);
32665 value = gen_const_xmlChar_ptr(n_value, 1);
32666 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32667 node = gen_xmlNodePtr(n_node, 3);
32668
32669 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, value, val, node);
32670 desret_int(ret_val);
32671 call_tests++;
32672 des_xmlSchemaTypePtr(n_type, type, 0);
32673 des_const_xmlChar_ptr(n_value, value, 1);
32674 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32675 des_xmlNodePtr(n_node, node, 3);
32676 xmlResetLastError();
32677 if (mem_base != xmlMemBlocks()) {
32678 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
32679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032680 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032681 printf(" %d", n_type);
32682 printf(" %d", n_value);
32683 printf(" %d", n_val);
32684 printf(" %d", n_node);
32685 printf("\n");
32686 }
32687 }
32688 }
32689 }
32690 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032691 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032692#endif
32693
Daniel Veillard42595322004-11-08 10:52:06 +000032694 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032695}
32696
32697
32698static int
32699test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032700 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032701
Daniel Veillardce682bc2004-11-05 17:22:25 +000032702#ifdef LIBXML_SCHEMAS_ENABLED
32703 int mem_base;
32704 int ret_val;
32705 xmlSchemaTypePtr base; /* the base type */
32706 int n_base;
32707 xmlSchemaFacetPtr facet; /* the facet to check */
32708 int n_facet;
32709 xmlChar * value; /* the lexical repr of the value to validate */
32710 int n_value;
32711 xmlSchemaValPtr val; /* the precomputed value */
32712 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032713
Daniel Veillardce682bc2004-11-05 17:22:25 +000032714 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
32715 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32716 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32717 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32718 mem_base = xmlMemBlocks();
32719 base = gen_xmlSchemaTypePtr(n_base, 0);
32720 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32721 value = gen_const_xmlChar_ptr(n_value, 2);
32722 val = gen_xmlSchemaValPtr(n_val, 3);
32723
32724 ret_val = xmlSchemaValidateFacet(base, facet, value, val);
32725 desret_int(ret_val);
32726 call_tests++;
32727 des_xmlSchemaTypePtr(n_base, base, 0);
32728 des_xmlSchemaFacetPtr(n_facet, facet, 1);
32729 des_const_xmlChar_ptr(n_value, value, 2);
32730 des_xmlSchemaValPtr(n_val, val, 3);
32731 xmlResetLastError();
32732 if (mem_base != xmlMemBlocks()) {
32733 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
32734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032735 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032736 printf(" %d", n_base);
32737 printf(" %d", n_facet);
32738 printf(" %d", n_value);
32739 printf(" %d", n_val);
32740 printf("\n");
32741 }
32742 }
32743 }
32744 }
32745 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032746 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032747#endif
32748
Daniel Veillard42595322004-11-08 10:52:06 +000032749 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032750}
32751
32752
32753static int
32754test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032755 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032756
Daniel Veillardce682bc2004-11-05 17:22:25 +000032757#ifdef LIBXML_SCHEMAS_ENABLED
32758 int mem_base;
32759 int ret_val;
32760 xmlSchemaTypePtr type; /* the built-in type */
32761 int n_type;
32762 xmlSchemaFacetPtr facet; /* the facet to check */
32763 int n_facet;
32764 xmlChar * value; /* the lexical repr. of the value to be validated */
32765 int n_value;
32766 xmlSchemaValPtr val; /* the precomputed value */
32767 int n_val;
32768 unsigned long * length; /* the actual length of the value */
32769 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032770
Daniel Veillardce682bc2004-11-05 17:22:25 +000032771 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32772 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32773 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32774 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32775 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
32776 mem_base = xmlMemBlocks();
32777 type = gen_xmlSchemaTypePtr(n_type, 0);
32778 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32779 value = gen_const_xmlChar_ptr(n_value, 2);
32780 val = gen_xmlSchemaValPtr(n_val, 3);
32781 length = gen_unsigned_long_ptr(n_length, 4);
32782
32783 ret_val = xmlSchemaValidateLengthFacet(type, facet, value, val, length);
32784 desret_int(ret_val);
32785 call_tests++;
32786 des_xmlSchemaTypePtr(n_type, type, 0);
32787 des_xmlSchemaFacetPtr(n_facet, facet, 1);
32788 des_const_xmlChar_ptr(n_value, value, 2);
32789 des_xmlSchemaValPtr(n_val, val, 3);
32790 des_unsigned_long_ptr(n_length, length, 4);
32791 xmlResetLastError();
32792 if (mem_base != xmlMemBlocks()) {
32793 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
32794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032795 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032796 printf(" %d", n_type);
32797 printf(" %d", n_facet);
32798 printf(" %d", n_value);
32799 printf(" %d", n_val);
32800 printf(" %d", n_length);
32801 printf("\n");
32802 }
32803 }
32804 }
32805 }
32806 }
32807 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032808 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032809#endif
32810
Daniel Veillard42595322004-11-08 10:52:06 +000032811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032812}
32813
32814
32815static int
32816test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032818
Daniel Veillardce682bc2004-11-05 17:22:25 +000032819#ifdef LIBXML_SCHEMAS_ENABLED
32820 int mem_base;
32821 int ret_val;
32822 xmlSchemaFacetPtr facet; /* the facet to check */
32823 int n_facet;
32824 xmlChar * value; /* the lexical repr of the value to validate */
32825 int n_value;
32826 unsigned long actualLen; /* the number of list items */
32827 int n_actualLen;
32828 unsigned long * expectedLen; /* the resulting expected number of list items */
32829 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032830
Daniel Veillardce682bc2004-11-05 17:22:25 +000032831 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32832 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32833 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
32834 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
32835 mem_base = xmlMemBlocks();
32836 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32837 value = gen_const_xmlChar_ptr(n_value, 1);
32838 actualLen = gen_unsigned_long(n_actualLen, 2);
32839 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
32840
32841 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, value, actualLen, expectedLen);
32842 desret_int(ret_val);
32843 call_tests++;
32844 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32845 des_const_xmlChar_ptr(n_value, value, 1);
32846 des_unsigned_long(n_actualLen, actualLen, 2);
32847 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
32848 xmlResetLastError();
32849 if (mem_base != xmlMemBlocks()) {
32850 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
32851 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032852 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032853 printf(" %d", n_facet);
32854 printf(" %d", n_value);
32855 printf(" %d", n_actualLen);
32856 printf(" %d", n_expectedLen);
32857 printf("\n");
32858 }
32859 }
32860 }
32861 }
32862 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032863 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032864#endif
32865
Daniel Veillard42595322004-11-08 10:52:06 +000032866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032867}
32868
32869
32870static int
32871test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032872 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032873
Daniel Veillardce682bc2004-11-05 17:22:25 +000032874#ifdef LIBXML_SCHEMAS_ENABLED
32875 int mem_base;
32876 int ret_val;
32877 xmlSchemaTypePtr type; /* the predefined type */
32878 int n_type;
32879 xmlChar * value; /* the value to check */
32880 int n_value;
32881 xmlSchemaValPtr * val; /* the return computed value */
32882 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032883
Daniel Veillardce682bc2004-11-05 17:22:25 +000032884 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32885 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32886 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32887 mem_base = xmlMemBlocks();
32888 type = gen_xmlSchemaTypePtr(n_type, 0);
32889 value = gen_const_xmlChar_ptr(n_value, 1);
32890 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32891
32892 ret_val = xmlSchemaValidatePredefinedType(type, value, val);
32893 desret_int(ret_val);
32894 call_tests++;
32895 des_xmlSchemaTypePtr(n_type, type, 0);
32896 des_const_xmlChar_ptr(n_value, value, 1);
32897 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32898 xmlResetLastError();
32899 if (mem_base != xmlMemBlocks()) {
32900 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
32901 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032902 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032903 printf(" %d", n_type);
32904 printf(" %d", n_value);
32905 printf(" %d", n_val);
32906 printf("\n");
32907 }
32908 }
32909 }
32910 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032911 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032912#endif
32913
Daniel Veillard42595322004-11-08 10:52:06 +000032914 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032915}
32916
32917static int
32918test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032919 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032920
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032921 if (quiet == 0) printf("Testing xmlschemastypes : 15 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032922 test_ret += test_xmlSchemaCheckFacet();
32923 test_ret += test_xmlSchemaCleanupTypes();
32924 test_ret += test_xmlSchemaCollapseString();
32925 test_ret += test_xmlSchemaCompareValues();
32926 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
32927 test_ret += test_xmlSchemaGetBuiltInType();
32928 test_ret += test_xmlSchemaGetFacetValueAsULong();
32929 test_ret += test_xmlSchemaGetPredefinedType();
32930 test_ret += test_xmlSchemaInitTypes();
32931 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
32932 test_ret += test_xmlSchemaNewFacet();
32933 test_ret += test_xmlSchemaValPredefTypeNode();
32934 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
32935 test_ret += test_xmlSchemaValidateFacet();
32936 test_ret += test_xmlSchemaValidateLengthFacet();
32937 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
32938 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032939
Daniel Veillard42595322004-11-08 10:52:06 +000032940 if (test_ret != 0)
32941 printf("Module xmlschemastypes: %d errors\n", test_ret);
32942 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032943}
32944
32945static int
32946test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032947 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032948
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032949 int mem_base;
32950 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032951 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032952 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032953
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032954 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
32955 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032956 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032957
32958 ret_val = xmlCharStrdup(cur);
32959 desret_xmlChar_ptr(ret_val);
32960 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032961 des_const_char_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032962 xmlResetLastError();
32963 if (mem_base != xmlMemBlocks()) {
32964 printf("Leak of %d blocks found in xmlCharStrdup",
32965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032966 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032967 printf(" %d", n_cur);
32968 printf("\n");
32969 }
32970 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000032971 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032972
Daniel Veillard42595322004-11-08 10:52:06 +000032973 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032974}
32975
32976
32977static int
32978test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032979 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032980
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032981 int mem_base;
32982 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032983 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032984 int n_cur;
32985 int len; /* the len of @cur */
32986 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032987
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032988 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
32989 for (n_len = 0;n_len < gen_nb_int;n_len++) {
32990 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032991 cur = gen_const_char_ptr(n_cur, 0);
32992 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032993
32994 ret_val = xmlCharStrndup(cur, len);
32995 desret_xmlChar_ptr(ret_val);
32996 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032997 des_const_char_ptr(n_cur, cur, 0);
32998 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032999 xmlResetLastError();
33000 if (mem_base != xmlMemBlocks()) {
33001 printf("Leak of %d blocks found in xmlCharStrndup",
33002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033003 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033004 printf(" %d", n_cur);
33005 printf(" %d", n_len);
33006 printf("\n");
33007 }
33008 }
33009 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033010 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033011
Daniel Veillard42595322004-11-08 10:52:06 +000033012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033013}
33014
33015
33016static int
33017test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033019
Daniel Veillardce682bc2004-11-05 17:22:25 +000033020 int mem_base;
33021 int ret_val;
33022 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
33023 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033024
Daniel Veillardce682bc2004-11-05 17:22:25 +000033025 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33026 mem_base = xmlMemBlocks();
33027 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33028
33029 ret_val = xmlCheckUTF8(utf);
33030 desret_int(ret_val);
33031 call_tests++;
33032 des_const_unsigned_char_ptr(n_utf, utf, 0);
33033 xmlResetLastError();
33034 if (mem_base != xmlMemBlocks()) {
33035 printf("Leak of %d blocks found in xmlCheckUTF8",
33036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033037 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033038 printf(" %d", n_utf);
33039 printf("\n");
33040 }
33041 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033042 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033043
Daniel Veillard42595322004-11-08 10:52:06 +000033044 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033045}
33046
33047
33048static int
33049test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033050 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033051
Daniel Veillardce682bc2004-11-05 17:22:25 +000033052 int mem_base;
33053 int ret_val;
33054 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
33055 int n_utf;
33056 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. */
33057 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033058
Daniel Veillardce682bc2004-11-05 17:22:25 +000033059 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33060 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
33061 mem_base = xmlMemBlocks();
33062 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33063 len = gen_int_ptr(n_len, 1);
33064
33065 ret_val = xmlGetUTF8Char(utf, len);
33066 desret_int(ret_val);
33067 call_tests++;
33068 des_const_unsigned_char_ptr(n_utf, utf, 0);
33069 des_int_ptr(n_len, len, 1);
33070 xmlResetLastError();
33071 if (mem_base != xmlMemBlocks()) {
33072 printf("Leak of %d blocks found in xmlGetUTF8Char",
33073 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033074 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033075 printf(" %d", n_utf);
33076 printf(" %d", n_len);
33077 printf("\n");
33078 }
33079 }
33080 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033081 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033082
Daniel Veillard42595322004-11-08 10:52:06 +000033083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033084}
33085
33086
33087static int
33088test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033090
33091 int mem_base;
33092 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033093 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033094 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033095 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033096 int n_str2;
33097
33098 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33099 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33100 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033101 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33102 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033103
33104 ret_val = xmlStrEqual(str1, str2);
33105 desret_int(ret_val);
33106 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033107 des_const_xmlChar_ptr(n_str1, str1, 0);
33108 des_const_xmlChar_ptr(n_str2, str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033109 xmlResetLastError();
33110 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033111 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033112 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033113 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033114 printf(" %d", n_str1);
33115 printf(" %d", n_str2);
33116 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033117 }
33118 }
33119 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033120 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033121
Daniel Veillard42595322004-11-08 10:52:06 +000033122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033123}
33124
33125
33126static int
33127test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033129
33130
33131 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033133}
33134
33135
33136static int
33137test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033139
33140 int mem_base;
33141 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033142 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033143 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033144 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033145 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033146 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033147 int n_str;
33148
33149 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
33150 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33151 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33152 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033153 pref = gen_const_xmlChar_ptr(n_pref, 0);
33154 name = gen_const_xmlChar_ptr(n_name, 1);
33155 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033156
33157 ret_val = xmlStrQEqual(pref, name, str);
33158 desret_int(ret_val);
33159 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033160 des_const_xmlChar_ptr(n_pref, pref, 0);
33161 des_const_xmlChar_ptr(n_name, name, 1);
33162 des_const_xmlChar_ptr(n_str, str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033163 xmlResetLastError();
33164 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033165 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033166 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033167 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033168 printf(" %d", n_pref);
33169 printf(" %d", n_name);
33170 printf(" %d", n_str);
33171 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033172 }
33173 }
33174 }
33175 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033176 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033177
Daniel Veillard42595322004-11-08 10:52:06 +000033178 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033179}
33180
33181
33182static int
33183test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033184 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033185
33186
33187 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033188 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033189}
33190
33191
33192static int
33193test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033195
33196 int mem_base;
33197 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033198 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033199 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033200 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033201 int n_str2;
33202
33203 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33204 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33205 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033206 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33207 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033208
33209 ret_val = xmlStrcasecmp(str1, str2);
33210 desret_int(ret_val);
33211 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033212 des_const_xmlChar_ptr(n_str1, str1, 0);
33213 des_const_xmlChar_ptr(n_str2, str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033214 xmlResetLastError();
33215 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033216 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033218 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033219 printf(" %d", n_str1);
33220 printf(" %d", n_str2);
33221 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033222 }
33223 }
33224 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033225 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033226
Daniel Veillard42595322004-11-08 10:52:06 +000033227 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033228}
33229
33230
33231static int
33232test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033234
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033235 int mem_base;
33236 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033237 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033238 int n_str;
33239 xmlChar * val; /* the xmlChar to search (needle) */
33240 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033241
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033242 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33243 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
33244 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033245 str = gen_const_xmlChar_ptr(n_str, 0);
33246 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033247
33248 ret_val = xmlStrcasestr(str, val);
33249 desret_const_xmlChar_ptr(ret_val);
33250 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033251 des_const_xmlChar_ptr(n_str, str, 0);
33252 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033253 xmlResetLastError();
33254 if (mem_base != xmlMemBlocks()) {
33255 printf("Leak of %d blocks found in xmlStrcasestr",
33256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033257 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033258 printf(" %d", n_str);
33259 printf(" %d", n_val);
33260 printf("\n");
33261 }
33262 }
33263 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033264 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033265
Daniel Veillard42595322004-11-08 10:52:06 +000033266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033267}
33268
33269
33270static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033271test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033273
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033274 int mem_base;
33275 const xmlChar * ret_val;
33276 xmlChar * str; /* the xmlChar * array */
33277 int n_str;
33278 xmlChar val; /* the xmlChar to search */
33279 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033280
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033281 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33282 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
33283 mem_base = xmlMemBlocks();
33284 str = gen_const_xmlChar_ptr(n_str, 0);
33285 val = gen_xmlChar(n_val, 1);
33286
33287 ret_val = xmlStrchr(str, val);
33288 desret_const_xmlChar_ptr(ret_val);
33289 call_tests++;
33290 des_const_xmlChar_ptr(n_str, str, 0);
33291 des_xmlChar(n_val, val, 1);
33292 xmlResetLastError();
33293 if (mem_base != xmlMemBlocks()) {
33294 printf("Leak of %d blocks found in xmlStrchr",
33295 xmlMemBlocks() - mem_base);
33296 test_ret++;
33297 printf(" %d", n_str);
33298 printf(" %d", n_val);
33299 printf("\n");
33300 }
33301 }
33302 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033303 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033304
Daniel Veillard42595322004-11-08 10:52:06 +000033305 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033306}
33307
33308
33309static int
33310test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033311 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033312
33313 int mem_base;
33314 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033315 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033316 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033317 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033318 int n_str2;
33319
33320 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33321 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33322 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033323 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33324 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033325
33326 ret_val = xmlStrcmp(str1, str2);
33327 desret_int(ret_val);
33328 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033329 des_const_xmlChar_ptr(n_str1, str1, 0);
33330 des_const_xmlChar_ptr(n_str2, str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033331 xmlResetLastError();
33332 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033333 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033335 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033336 printf(" %d", n_str1);
33337 printf(" %d", n_str2);
33338 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033339 }
33340 }
33341 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033342 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033343
Daniel Veillard42595322004-11-08 10:52:06 +000033344 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033345}
33346
33347
33348static int
33349test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033350 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033351
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033352 int mem_base;
33353 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033354 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033355 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033356
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033357 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33358 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033359 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033360
33361 ret_val = xmlStrdup(cur);
33362 desret_xmlChar_ptr(ret_val);
33363 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033364 des_const_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033365 xmlResetLastError();
33366 if (mem_base != xmlMemBlocks()) {
33367 printf("Leak of %d blocks found in xmlStrdup",
33368 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033369 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033370 printf(" %d", n_cur);
33371 printf("\n");
33372 }
33373 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033374 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033375
Daniel Veillard42595322004-11-08 10:52:06 +000033376 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033377}
33378
33379
33380static int
33381test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033382 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033383
33384 int mem_base;
33385 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033386 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033387 int n_str;
33388
33389 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33390 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033391 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033392
33393 ret_val = xmlStrlen(str);
33394 desret_int(ret_val);
33395 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033396 des_const_xmlChar_ptr(n_str, str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033397 xmlResetLastError();
33398 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033399 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033401 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033402 printf(" %d", n_str);
33403 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033404 }
33405 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033406 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033407
Daniel Veillard42595322004-11-08 10:52:06 +000033408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033409}
33410
33411
33412static int
33413test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033415
33416 int mem_base;
33417 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033418 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033419 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033420 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033421 int n_str2;
33422 int len; /* the max comparison length */
33423 int n_len;
33424
33425 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33426 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33427 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33428 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033429 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33430 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33431 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033432
33433 ret_val = xmlStrncasecmp(str1, str2, len);
33434 desret_int(ret_val);
33435 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033436 des_const_xmlChar_ptr(n_str1, str1, 0);
33437 des_const_xmlChar_ptr(n_str2, str2, 1);
33438 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033439 xmlResetLastError();
33440 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033441 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033443 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033444 printf(" %d", n_str1);
33445 printf(" %d", n_str2);
33446 printf(" %d", n_len);
33447 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033448 }
33449 }
33450 }
33451 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033452 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033453
Daniel Veillard42595322004-11-08 10:52:06 +000033454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033455}
33456
33457
33458static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033459test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033461
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033462 int mem_base;
33463 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033464 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033465 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033466 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033467 int n_str2;
33468 int len; /* the len of @str2 */
33469 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033470
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033471 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33472 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33473 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33474 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033475 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33476 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33477 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033478
33479 ret_val = xmlStrncatNew(str1, str2, len);
33480 desret_xmlChar_ptr(ret_val);
33481 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033482 des_const_xmlChar_ptr(n_str1, str1, 0);
33483 des_const_xmlChar_ptr(n_str2, str2, 1);
33484 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033485 xmlResetLastError();
33486 if (mem_base != xmlMemBlocks()) {
33487 printf("Leak of %d blocks found in xmlStrncatNew",
33488 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033489 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033490 printf(" %d", n_str1);
33491 printf(" %d", n_str2);
33492 printf(" %d", n_len);
33493 printf("\n");
33494 }
33495 }
33496 }
33497 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033498 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033499
Daniel Veillard42595322004-11-08 10:52:06 +000033500 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033501}
33502
33503
33504static int
33505test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033506 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033507
33508 int mem_base;
33509 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033510 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033511 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033512 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033513 int n_str2;
33514 int len; /* the max comparison length */
33515 int n_len;
33516
33517 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33518 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33519 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33520 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033521 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33522 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33523 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033524
33525 ret_val = xmlStrncmp(str1, str2, len);
33526 desret_int(ret_val);
33527 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033528 des_const_xmlChar_ptr(n_str1, str1, 0);
33529 des_const_xmlChar_ptr(n_str2, str2, 1);
33530 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033531 xmlResetLastError();
33532 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033533 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033534 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033535 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033536 printf(" %d", n_str1);
33537 printf(" %d", n_str2);
33538 printf(" %d", n_len);
33539 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033540 }
33541 }
33542 }
33543 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033544 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033545
Daniel Veillard42595322004-11-08 10:52:06 +000033546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033547}
33548
33549
33550static int
33551test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033553
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033554 int mem_base;
33555 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033556 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033557 int n_cur;
33558 int len; /* the len of @cur */
33559 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033560
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033561 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33562 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33563 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033564 cur = gen_const_xmlChar_ptr(n_cur, 0);
33565 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033566
33567 ret_val = xmlStrndup(cur, len);
33568 desret_xmlChar_ptr(ret_val);
33569 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033570 des_const_xmlChar_ptr(n_cur, cur, 0);
33571 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033572 xmlResetLastError();
33573 if (mem_base != xmlMemBlocks()) {
33574 printf("Leak of %d blocks found in xmlStrndup",
33575 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033576 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033577 printf(" %d", n_cur);
33578 printf(" %d", n_len);
33579 printf("\n");
33580 }
33581 }
33582 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033583 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033584
Daniel Veillard42595322004-11-08 10:52:06 +000033585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033586}
33587
33588
33589static int
33590test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033592
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033593 int mem_base;
33594 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033595 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033596 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033597 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033598 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033599
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033600 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33601 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
33602 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033603 str = gen_const_xmlChar_ptr(n_str, 0);
33604 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033605
33606 ret_val = xmlStrstr(str, val);
33607 desret_const_xmlChar_ptr(ret_val);
33608 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033609 des_const_xmlChar_ptr(n_str, str, 0);
33610 des_const_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033611 xmlResetLastError();
33612 if (mem_base != xmlMemBlocks()) {
33613 printf("Leak of %d blocks found in xmlStrstr",
33614 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033615 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033616 printf(" %d", n_str);
33617 printf(" %d", n_val);
33618 printf("\n");
33619 }
33620 }
33621 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033622 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033623
Daniel Veillard42595322004-11-08 10:52:06 +000033624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033625}
33626
33627
33628static int
33629test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033631
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033632 int mem_base;
33633 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033634 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033635 int n_str;
33636 int start; /* the index of the first char (zero based) */
33637 int n_start;
33638 int len; /* the length of the substring */
33639 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033640
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033641 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33642 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33643 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33644 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033645 str = gen_const_xmlChar_ptr(n_str, 0);
33646 start = gen_int(n_start, 1);
33647 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033648
33649 ret_val = xmlStrsub(str, start, len);
33650 desret_xmlChar_ptr(ret_val);
33651 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033652 des_const_xmlChar_ptr(n_str, str, 0);
33653 des_int(n_start, start, 1);
33654 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033655 xmlResetLastError();
33656 if (mem_base != xmlMemBlocks()) {
33657 printf("Leak of %d blocks found in xmlStrsub",
33658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033659 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033660 printf(" %d", n_str);
33661 printf(" %d", n_start);
33662 printf(" %d", n_len);
33663 printf("\n");
33664 }
33665 }
33666 }
33667 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033668 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033669
Daniel Veillard42595322004-11-08 10:52:06 +000033670 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033671}
33672
33673
33674static int
33675test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033676 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033677
33678 int mem_base;
33679 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033680 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033681 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033682 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033683 int n_utf2;
33684
33685 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
33686 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
33687 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033688 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
33689 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033690
33691 ret_val = xmlUTF8Charcmp(utf1, utf2);
33692 desret_int(ret_val);
33693 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033694 des_const_xmlChar_ptr(n_utf1, utf1, 0);
33695 des_const_xmlChar_ptr(n_utf2, utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033696 xmlResetLastError();
33697 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033698 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033700 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033701 printf(" %d", n_utf1);
33702 printf(" %d", n_utf2);
33703 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033704 }
33705 }
33706 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033707 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033708
Daniel Veillard42595322004-11-08 10:52:06 +000033709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033710}
33711
33712
33713static int
33714test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033715 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033716
33717 int mem_base;
33718 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033719 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033720 int n_utf;
33721
33722 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33723 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033724 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033725
33726 ret_val = xmlUTF8Size(utf);
33727 desret_int(ret_val);
33728 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033729 des_const_xmlChar_ptr(n_utf, utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033730 xmlResetLastError();
33731 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033732 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033733 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033734 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033735 printf(" %d", n_utf);
33736 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033737 }
33738 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033739 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033740
Daniel Veillard42595322004-11-08 10:52:06 +000033741 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033742}
33743
33744
33745static int
33746test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033747 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033748
33749 int mem_base;
33750 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033751 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033752 int n_utf;
33753
33754 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33755 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033756 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033757
33758 ret_val = xmlUTF8Strlen(utf);
33759 desret_int(ret_val);
33760 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033761 des_const_xmlChar_ptr(n_utf, utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033762 xmlResetLastError();
33763 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033764 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033765 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033766 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033767 printf(" %d", n_utf);
33768 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033769 }
33770 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033771 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033772
Daniel Veillard42595322004-11-08 10:52:06 +000033773 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033774}
33775
33776
33777static int
33778test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033779 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033780
33781 int mem_base;
33782 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033783 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033784 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033785 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033786 int n_utfchar;
33787
33788 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33789 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
33790 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033791 utf = gen_const_xmlChar_ptr(n_utf, 0);
33792 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033793
33794 ret_val = xmlUTF8Strloc(utf, utfchar);
33795 desret_int(ret_val);
33796 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033797 des_const_xmlChar_ptr(n_utf, utf, 0);
33798 des_const_xmlChar_ptr(n_utfchar, utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033799 xmlResetLastError();
33800 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033801 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033803 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033804 printf(" %d", n_utf);
33805 printf(" %d", n_utfchar);
33806 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033807 }
33808 }
33809 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033810 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033811
Daniel Veillard42595322004-11-08 10:52:06 +000033812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033813}
33814
33815
33816static int
33817test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033819
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033820 int mem_base;
33821 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033822 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033823 int n_utf;
33824 int len; /* the len of @utf (in chars) */
33825 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033826
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033827 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33828 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33829 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033830 utf = gen_const_xmlChar_ptr(n_utf, 0);
33831 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033832
33833 ret_val = xmlUTF8Strndup(utf, len);
33834 desret_xmlChar_ptr(ret_val);
33835 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033836 des_const_xmlChar_ptr(n_utf, utf, 0);
33837 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033838 xmlResetLastError();
33839 if (mem_base != xmlMemBlocks()) {
33840 printf("Leak of %d blocks found in xmlUTF8Strndup",
33841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033842 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033843 printf(" %d", n_utf);
33844 printf(" %d", n_len);
33845 printf("\n");
33846 }
33847 }
33848 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033849 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033850
Daniel Veillard42595322004-11-08 10:52:06 +000033851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033852}
33853
33854
33855static int
33856test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033858
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033859 int mem_base;
33860 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033861 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033862 int n_utf;
33863 int pos; /* the position of the desired UTF8 char (in chars) */
33864 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033865
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033866 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33867 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
33868 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033869 utf = gen_const_xmlChar_ptr(n_utf, 0);
33870 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033871
33872 ret_val = xmlUTF8Strpos(utf, pos);
33873 desret_const_xmlChar_ptr(ret_val);
33874 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033875 des_const_xmlChar_ptr(n_utf, utf, 0);
33876 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033877 xmlResetLastError();
33878 if (mem_base != xmlMemBlocks()) {
33879 printf("Leak of %d blocks found in xmlUTF8Strpos",
33880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033881 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033882 printf(" %d", n_utf);
33883 printf(" %d", n_pos);
33884 printf("\n");
33885 }
33886 }
33887 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033888 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033889
Daniel Veillard42595322004-11-08 10:52:06 +000033890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033891}
33892
33893
33894static int
33895test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033896 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033897
33898 int mem_base;
33899 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033900 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033901 int n_utf;
33902 int len; /* the number of characters in the array */
33903 int n_len;
33904
33905 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33906 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33907 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033908 utf = gen_const_xmlChar_ptr(n_utf, 0);
33909 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033910
33911 ret_val = xmlUTF8Strsize(utf, len);
33912 desret_int(ret_val);
33913 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033914 des_const_xmlChar_ptr(n_utf, utf, 0);
33915 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033916 xmlResetLastError();
33917 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033918 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033919 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033920 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033921 printf(" %d", n_utf);
33922 printf(" %d", n_len);
33923 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033924 }
33925 }
33926 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033927 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033928
Daniel Veillard42595322004-11-08 10:52:06 +000033929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033930}
33931
33932
33933static int
33934test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033936
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033937 int mem_base;
33938 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033939 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033940 int n_utf;
33941 int start; /* relative pos of first char */
33942 int n_start;
33943 int len; /* total number to copy */
33944 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033945
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033946 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33947 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33948 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33949 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033950 utf = gen_const_xmlChar_ptr(n_utf, 0);
33951 start = gen_int(n_start, 1);
33952 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033953
33954 ret_val = xmlUTF8Strsub(utf, start, len);
33955 desret_xmlChar_ptr(ret_val);
33956 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033957 des_const_xmlChar_ptr(n_utf, utf, 0);
33958 des_int(n_start, start, 1);
33959 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033960 xmlResetLastError();
33961 if (mem_base != xmlMemBlocks()) {
33962 printf("Leak of %d blocks found in xmlUTF8Strsub",
33963 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033964 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033965 printf(" %d", n_utf);
33966 printf(" %d", n_start);
33967 printf(" %d", n_len);
33968 printf("\n");
33969 }
33970 }
33971 }
33972 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033973 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033974
Daniel Veillard42595322004-11-08 10:52:06 +000033975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033976}
33977
33978static int
33979test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033981
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033982 if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000033983 test_ret += test_xmlCharStrdup();
33984 test_ret += test_xmlCharStrndup();
33985 test_ret += test_xmlCheckUTF8();
33986 test_ret += test_xmlGetUTF8Char();
33987 test_ret += test_xmlStrEqual();
33988 test_ret += test_xmlStrPrintf();
33989 test_ret += test_xmlStrQEqual();
33990 test_ret += test_xmlStrVPrintf();
33991 test_ret += test_xmlStrcasecmp();
33992 test_ret += test_xmlStrcasestr();
33993 test_ret += test_xmlStrchr();
33994 test_ret += test_xmlStrcmp();
33995 test_ret += test_xmlStrdup();
33996 test_ret += test_xmlStrlen();
33997 test_ret += test_xmlStrncasecmp();
33998 test_ret += test_xmlStrncatNew();
33999 test_ret += test_xmlStrncmp();
34000 test_ret += test_xmlStrndup();
34001 test_ret += test_xmlStrstr();
34002 test_ret += test_xmlStrsub();
34003 test_ret += test_xmlUTF8Charcmp();
34004 test_ret += test_xmlUTF8Size();
34005 test_ret += test_xmlUTF8Strlen();
34006 test_ret += test_xmlUTF8Strloc();
34007 test_ret += test_xmlUTF8Strndup();
34008 test_ret += test_xmlUTF8Strpos();
34009 test_ret += test_xmlUTF8Strsize();
34010 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000034011
Daniel Veillard42595322004-11-08 10:52:06 +000034012 if (test_ret != 0)
34013 printf("Module xmlstring: %d errors\n", test_ret);
34014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034015}
34016
34017static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034018test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034019 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034020
34021#ifdef LIBXML_UNICODE_ENABLED
34022 int mem_base;
34023 int ret_val;
34024 int code; /* UCS code point */
34025 int n_code;
34026
34027 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34028 mem_base = xmlMemBlocks();
34029 code = gen_int(n_code, 0);
34030
34031 ret_val = xmlUCSIsAegeanNumbers(code);
34032 desret_int(ret_val);
34033 call_tests++;
34034 des_int(n_code, code, 0);
34035 xmlResetLastError();
34036 if (mem_base != xmlMemBlocks()) {
34037 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
34038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034039 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034040 printf(" %d", n_code);
34041 printf("\n");
34042 }
34043 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034044 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034045#endif
34046
Daniel Veillard42595322004-11-08 10:52:06 +000034047 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034048}
34049
34050
34051static int
34052test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034053 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034054
34055#ifdef LIBXML_UNICODE_ENABLED
34056 int mem_base;
34057 int ret_val;
34058 int code; /* UCS code point */
34059 int n_code;
34060
34061 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34062 mem_base = xmlMemBlocks();
34063 code = gen_int(n_code, 0);
34064
34065 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
34066 desret_int(ret_val);
34067 call_tests++;
34068 des_int(n_code, code, 0);
34069 xmlResetLastError();
34070 if (mem_base != xmlMemBlocks()) {
34071 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
34072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034073 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034074 printf(" %d", n_code);
34075 printf("\n");
34076 }
34077 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034078 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034079#endif
34080
Daniel Veillard42595322004-11-08 10:52:06 +000034081 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034082}
34083
34084
34085static int
34086test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034087 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034088
34089#ifdef LIBXML_UNICODE_ENABLED
34090 int mem_base;
34091 int ret_val;
34092 int code; /* UCS code point */
34093 int n_code;
34094
34095 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34096 mem_base = xmlMemBlocks();
34097 code = gen_int(n_code, 0);
34098
34099 ret_val = xmlUCSIsArabic(code);
34100 desret_int(ret_val);
34101 call_tests++;
34102 des_int(n_code, code, 0);
34103 xmlResetLastError();
34104 if (mem_base != xmlMemBlocks()) {
34105 printf("Leak of %d blocks found in xmlUCSIsArabic",
34106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034107 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034108 printf(" %d", n_code);
34109 printf("\n");
34110 }
34111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034112 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034113#endif
34114
Daniel Veillard42595322004-11-08 10:52:06 +000034115 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034116}
34117
34118
34119static int
34120test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034121 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034122
34123#ifdef LIBXML_UNICODE_ENABLED
34124 int mem_base;
34125 int ret_val;
34126 int code; /* UCS code point */
34127 int n_code;
34128
34129 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34130 mem_base = xmlMemBlocks();
34131 code = gen_int(n_code, 0);
34132
34133 ret_val = xmlUCSIsArabicPresentationFormsA(code);
34134 desret_int(ret_val);
34135 call_tests++;
34136 des_int(n_code, code, 0);
34137 xmlResetLastError();
34138 if (mem_base != xmlMemBlocks()) {
34139 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
34140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034141 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034142 printf(" %d", n_code);
34143 printf("\n");
34144 }
34145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034146 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034147#endif
34148
Daniel Veillard42595322004-11-08 10:52:06 +000034149 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034150}
34151
34152
34153static int
34154test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034155 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034156
34157#ifdef LIBXML_UNICODE_ENABLED
34158 int mem_base;
34159 int ret_val;
34160 int code; /* UCS code point */
34161 int n_code;
34162
34163 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34164 mem_base = xmlMemBlocks();
34165 code = gen_int(n_code, 0);
34166
34167 ret_val = xmlUCSIsArabicPresentationFormsB(code);
34168 desret_int(ret_val);
34169 call_tests++;
34170 des_int(n_code, code, 0);
34171 xmlResetLastError();
34172 if (mem_base != xmlMemBlocks()) {
34173 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
34174 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034175 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034176 printf(" %d", n_code);
34177 printf("\n");
34178 }
34179 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034180 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034181#endif
34182
Daniel Veillard42595322004-11-08 10:52:06 +000034183 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034184}
34185
34186
34187static int
34188test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034189 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034190
34191#ifdef LIBXML_UNICODE_ENABLED
34192 int mem_base;
34193 int ret_val;
34194 int code; /* UCS code point */
34195 int n_code;
34196
34197 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34198 mem_base = xmlMemBlocks();
34199 code = gen_int(n_code, 0);
34200
34201 ret_val = xmlUCSIsArmenian(code);
34202 desret_int(ret_val);
34203 call_tests++;
34204 des_int(n_code, code, 0);
34205 xmlResetLastError();
34206 if (mem_base != xmlMemBlocks()) {
34207 printf("Leak of %d blocks found in xmlUCSIsArmenian",
34208 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034209 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034210 printf(" %d", n_code);
34211 printf("\n");
34212 }
34213 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034214 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034215#endif
34216
Daniel Veillard42595322004-11-08 10:52:06 +000034217 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034218}
34219
34220
34221static int
34222test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034223 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034224
34225#ifdef LIBXML_UNICODE_ENABLED
34226 int mem_base;
34227 int ret_val;
34228 int code; /* UCS code point */
34229 int n_code;
34230
34231 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34232 mem_base = xmlMemBlocks();
34233 code = gen_int(n_code, 0);
34234
34235 ret_val = xmlUCSIsArrows(code);
34236 desret_int(ret_val);
34237 call_tests++;
34238 des_int(n_code, code, 0);
34239 xmlResetLastError();
34240 if (mem_base != xmlMemBlocks()) {
34241 printf("Leak of %d blocks found in xmlUCSIsArrows",
34242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034243 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034244 printf(" %d", n_code);
34245 printf("\n");
34246 }
34247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034248 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034249#endif
34250
Daniel Veillard42595322004-11-08 10:52:06 +000034251 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034252}
34253
34254
34255static int
34256test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034257 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034258
34259#ifdef LIBXML_UNICODE_ENABLED
34260 int mem_base;
34261 int ret_val;
34262 int code; /* UCS code point */
34263 int n_code;
34264
34265 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34266 mem_base = xmlMemBlocks();
34267 code = gen_int(n_code, 0);
34268
34269 ret_val = xmlUCSIsBasicLatin(code);
34270 desret_int(ret_val);
34271 call_tests++;
34272 des_int(n_code, code, 0);
34273 xmlResetLastError();
34274 if (mem_base != xmlMemBlocks()) {
34275 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
34276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034277 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034278 printf(" %d", n_code);
34279 printf("\n");
34280 }
34281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034282 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034283#endif
34284
Daniel Veillard42595322004-11-08 10:52:06 +000034285 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034286}
34287
34288
34289static int
34290test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034291 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034292
34293#ifdef LIBXML_UNICODE_ENABLED
34294 int mem_base;
34295 int ret_val;
34296 int code; /* UCS code point */
34297 int n_code;
34298
34299 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34300 mem_base = xmlMemBlocks();
34301 code = gen_int(n_code, 0);
34302
34303 ret_val = xmlUCSIsBengali(code);
34304 desret_int(ret_val);
34305 call_tests++;
34306 des_int(n_code, code, 0);
34307 xmlResetLastError();
34308 if (mem_base != xmlMemBlocks()) {
34309 printf("Leak of %d blocks found in xmlUCSIsBengali",
34310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034311 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034312 printf(" %d", n_code);
34313 printf("\n");
34314 }
34315 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034316 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034317#endif
34318
Daniel Veillard42595322004-11-08 10:52:06 +000034319 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034320}
34321
34322
34323static int
34324test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034325 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034326
34327#ifdef LIBXML_UNICODE_ENABLED
34328 int mem_base;
34329 int ret_val;
34330 int code; /* UCS code point */
34331 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034332 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034333 int n_block;
34334
34335 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34336 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
34337 mem_base = xmlMemBlocks();
34338 code = gen_int(n_code, 0);
34339 block = gen_const_char_ptr(n_block, 1);
34340
34341 ret_val = xmlUCSIsBlock(code, block);
34342 desret_int(ret_val);
34343 call_tests++;
34344 des_int(n_code, code, 0);
34345 des_const_char_ptr(n_block, block, 1);
34346 xmlResetLastError();
34347 if (mem_base != xmlMemBlocks()) {
34348 printf("Leak of %d blocks found in xmlUCSIsBlock",
34349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034350 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034351 printf(" %d", n_code);
34352 printf(" %d", n_block);
34353 printf("\n");
34354 }
34355 }
34356 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034357 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034358#endif
34359
Daniel Veillard42595322004-11-08 10:52:06 +000034360 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034361}
34362
34363
34364static int
34365test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034366 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034367
34368#ifdef LIBXML_UNICODE_ENABLED
34369 int mem_base;
34370 int ret_val;
34371 int code; /* UCS code point */
34372 int n_code;
34373
34374 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34375 mem_base = xmlMemBlocks();
34376 code = gen_int(n_code, 0);
34377
34378 ret_val = xmlUCSIsBlockElements(code);
34379 desret_int(ret_val);
34380 call_tests++;
34381 des_int(n_code, code, 0);
34382 xmlResetLastError();
34383 if (mem_base != xmlMemBlocks()) {
34384 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
34385 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034386 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034387 printf(" %d", n_code);
34388 printf("\n");
34389 }
34390 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034391 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034392#endif
34393
Daniel Veillard42595322004-11-08 10:52:06 +000034394 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034395}
34396
34397
34398static int
34399test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034400 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034401
34402#ifdef LIBXML_UNICODE_ENABLED
34403 int mem_base;
34404 int ret_val;
34405 int code; /* UCS code point */
34406 int n_code;
34407
34408 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34409 mem_base = xmlMemBlocks();
34410 code = gen_int(n_code, 0);
34411
34412 ret_val = xmlUCSIsBopomofo(code);
34413 desret_int(ret_val);
34414 call_tests++;
34415 des_int(n_code, code, 0);
34416 xmlResetLastError();
34417 if (mem_base != xmlMemBlocks()) {
34418 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
34419 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034420 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034421 printf(" %d", n_code);
34422 printf("\n");
34423 }
34424 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034425 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034426#endif
34427
Daniel Veillard42595322004-11-08 10:52:06 +000034428 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034429}
34430
34431
34432static int
34433test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034434 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034435
34436#ifdef LIBXML_UNICODE_ENABLED
34437 int mem_base;
34438 int ret_val;
34439 int code; /* UCS code point */
34440 int n_code;
34441
34442 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34443 mem_base = xmlMemBlocks();
34444 code = gen_int(n_code, 0);
34445
34446 ret_val = xmlUCSIsBopomofoExtended(code);
34447 desret_int(ret_val);
34448 call_tests++;
34449 des_int(n_code, code, 0);
34450 xmlResetLastError();
34451 if (mem_base != xmlMemBlocks()) {
34452 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
34453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034454 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034455 printf(" %d", n_code);
34456 printf("\n");
34457 }
34458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034459 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034460#endif
34461
Daniel Veillard42595322004-11-08 10:52:06 +000034462 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034463}
34464
34465
34466static int
34467test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034468 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034469
34470#ifdef LIBXML_UNICODE_ENABLED
34471 int mem_base;
34472 int ret_val;
34473 int code; /* UCS code point */
34474 int n_code;
34475
34476 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34477 mem_base = xmlMemBlocks();
34478 code = gen_int(n_code, 0);
34479
34480 ret_val = xmlUCSIsBoxDrawing(code);
34481 desret_int(ret_val);
34482 call_tests++;
34483 des_int(n_code, code, 0);
34484 xmlResetLastError();
34485 if (mem_base != xmlMemBlocks()) {
34486 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
34487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034488 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034489 printf(" %d", n_code);
34490 printf("\n");
34491 }
34492 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034493 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034494#endif
34495
Daniel Veillard42595322004-11-08 10:52:06 +000034496 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034497}
34498
34499
34500static int
34501test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034502 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034503
34504#ifdef LIBXML_UNICODE_ENABLED
34505 int mem_base;
34506 int ret_val;
34507 int code; /* UCS code point */
34508 int n_code;
34509
34510 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34511 mem_base = xmlMemBlocks();
34512 code = gen_int(n_code, 0);
34513
34514 ret_val = xmlUCSIsBraillePatterns(code);
34515 desret_int(ret_val);
34516 call_tests++;
34517 des_int(n_code, code, 0);
34518 xmlResetLastError();
34519 if (mem_base != xmlMemBlocks()) {
34520 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
34521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034522 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034523 printf(" %d", n_code);
34524 printf("\n");
34525 }
34526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034527 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034528#endif
34529
Daniel Veillard42595322004-11-08 10:52:06 +000034530 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034531}
34532
34533
34534static int
34535test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034536 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034537
34538#ifdef LIBXML_UNICODE_ENABLED
34539 int mem_base;
34540 int ret_val;
34541 int code; /* UCS code point */
34542 int n_code;
34543
34544 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34545 mem_base = xmlMemBlocks();
34546 code = gen_int(n_code, 0);
34547
34548 ret_val = xmlUCSIsBuhid(code);
34549 desret_int(ret_val);
34550 call_tests++;
34551 des_int(n_code, code, 0);
34552 xmlResetLastError();
34553 if (mem_base != xmlMemBlocks()) {
34554 printf("Leak of %d blocks found in xmlUCSIsBuhid",
34555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034556 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034557 printf(" %d", n_code);
34558 printf("\n");
34559 }
34560 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034561 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034562#endif
34563
Daniel Veillard42595322004-11-08 10:52:06 +000034564 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034565}
34566
34567
34568static int
34569test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034570 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034571
34572#ifdef LIBXML_UNICODE_ENABLED
34573 int mem_base;
34574 int ret_val;
34575 int code; /* UCS code point */
34576 int n_code;
34577
34578 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34579 mem_base = xmlMemBlocks();
34580 code = gen_int(n_code, 0);
34581
34582 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
34583 desret_int(ret_val);
34584 call_tests++;
34585 des_int(n_code, code, 0);
34586 xmlResetLastError();
34587 if (mem_base != xmlMemBlocks()) {
34588 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
34589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034590 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034591 printf(" %d", n_code);
34592 printf("\n");
34593 }
34594 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034595 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034596#endif
34597
Daniel Veillard42595322004-11-08 10:52:06 +000034598 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034599}
34600
34601
34602static int
34603test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034604 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034605
34606#ifdef LIBXML_UNICODE_ENABLED
34607 int mem_base;
34608 int ret_val;
34609 int code; /* UCS code point */
34610 int n_code;
34611
34612 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34613 mem_base = xmlMemBlocks();
34614 code = gen_int(n_code, 0);
34615
34616 ret_val = xmlUCSIsCJKCompatibility(code);
34617 desret_int(ret_val);
34618 call_tests++;
34619 des_int(n_code, code, 0);
34620 xmlResetLastError();
34621 if (mem_base != xmlMemBlocks()) {
34622 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
34623 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034624 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034625 printf(" %d", n_code);
34626 printf("\n");
34627 }
34628 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034629 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034630#endif
34631
Daniel Veillard42595322004-11-08 10:52:06 +000034632 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034633}
34634
34635
34636static int
34637test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034638 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034639
34640#ifdef LIBXML_UNICODE_ENABLED
34641 int mem_base;
34642 int ret_val;
34643 int code; /* UCS code point */
34644 int n_code;
34645
34646 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34647 mem_base = xmlMemBlocks();
34648 code = gen_int(n_code, 0);
34649
34650 ret_val = xmlUCSIsCJKCompatibilityForms(code);
34651 desret_int(ret_val);
34652 call_tests++;
34653 des_int(n_code, code, 0);
34654 xmlResetLastError();
34655 if (mem_base != xmlMemBlocks()) {
34656 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
34657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034658 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034659 printf(" %d", n_code);
34660 printf("\n");
34661 }
34662 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034663 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034664#endif
34665
Daniel Veillard42595322004-11-08 10:52:06 +000034666 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034667}
34668
34669
34670static int
34671test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034672 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034673
34674#ifdef LIBXML_UNICODE_ENABLED
34675 int mem_base;
34676 int ret_val;
34677 int code; /* UCS code point */
34678 int n_code;
34679
34680 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34681 mem_base = xmlMemBlocks();
34682 code = gen_int(n_code, 0);
34683
34684 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
34685 desret_int(ret_val);
34686 call_tests++;
34687 des_int(n_code, code, 0);
34688 xmlResetLastError();
34689 if (mem_base != xmlMemBlocks()) {
34690 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
34691 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034692 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034693 printf(" %d", n_code);
34694 printf("\n");
34695 }
34696 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034697 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034698#endif
34699
Daniel Veillard42595322004-11-08 10:52:06 +000034700 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034701}
34702
34703
34704static int
34705test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034706 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034707
34708#ifdef LIBXML_UNICODE_ENABLED
34709 int mem_base;
34710 int ret_val;
34711 int code; /* UCS code point */
34712 int n_code;
34713
34714 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34715 mem_base = xmlMemBlocks();
34716 code = gen_int(n_code, 0);
34717
34718 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
34719 desret_int(ret_val);
34720 call_tests++;
34721 des_int(n_code, code, 0);
34722 xmlResetLastError();
34723 if (mem_base != xmlMemBlocks()) {
34724 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
34725 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034726 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034727 printf(" %d", n_code);
34728 printf("\n");
34729 }
34730 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034731 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034732#endif
34733
Daniel Veillard42595322004-11-08 10:52:06 +000034734 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034735}
34736
34737
34738static int
34739test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034740 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034741
34742#ifdef LIBXML_UNICODE_ENABLED
34743 int mem_base;
34744 int ret_val;
34745 int code; /* UCS code point */
34746 int n_code;
34747
34748 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34749 mem_base = xmlMemBlocks();
34750 code = gen_int(n_code, 0);
34751
34752 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
34753 desret_int(ret_val);
34754 call_tests++;
34755 des_int(n_code, code, 0);
34756 xmlResetLastError();
34757 if (mem_base != xmlMemBlocks()) {
34758 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
34759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034760 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034761 printf(" %d", n_code);
34762 printf("\n");
34763 }
34764 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034765 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034766#endif
34767
Daniel Veillard42595322004-11-08 10:52:06 +000034768 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034769}
34770
34771
34772static int
34773test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034774 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034775
34776#ifdef LIBXML_UNICODE_ENABLED
34777 int mem_base;
34778 int ret_val;
34779 int code; /* UCS code point */
34780 int n_code;
34781
34782 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34783 mem_base = xmlMemBlocks();
34784 code = gen_int(n_code, 0);
34785
34786 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
34787 desret_int(ret_val);
34788 call_tests++;
34789 des_int(n_code, code, 0);
34790 xmlResetLastError();
34791 if (mem_base != xmlMemBlocks()) {
34792 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
34793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034794 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034795 printf(" %d", n_code);
34796 printf("\n");
34797 }
34798 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034799 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034800#endif
34801
Daniel Veillard42595322004-11-08 10:52:06 +000034802 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034803}
34804
34805
34806static int
34807test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034808 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034809
34810#ifdef LIBXML_UNICODE_ENABLED
34811 int mem_base;
34812 int ret_val;
34813 int code; /* UCS code point */
34814 int n_code;
34815
34816 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34817 mem_base = xmlMemBlocks();
34818 code = gen_int(n_code, 0);
34819
34820 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
34821 desret_int(ret_val);
34822 call_tests++;
34823 des_int(n_code, code, 0);
34824 xmlResetLastError();
34825 if (mem_base != xmlMemBlocks()) {
34826 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
34827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034828 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034829 printf(" %d", n_code);
34830 printf("\n");
34831 }
34832 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034833 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034834#endif
34835
Daniel Veillard42595322004-11-08 10:52:06 +000034836 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034837}
34838
34839
34840static int
34841test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034842 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034843
34844#ifdef LIBXML_UNICODE_ENABLED
34845 int mem_base;
34846 int ret_val;
34847 int code; /* UCS code point */
34848 int n_code;
34849
34850 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34851 mem_base = xmlMemBlocks();
34852 code = gen_int(n_code, 0);
34853
34854 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
34855 desret_int(ret_val);
34856 call_tests++;
34857 des_int(n_code, code, 0);
34858 xmlResetLastError();
34859 if (mem_base != xmlMemBlocks()) {
34860 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
34861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034862 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034863 printf(" %d", n_code);
34864 printf("\n");
34865 }
34866 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034867 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034868#endif
34869
Daniel Veillard42595322004-11-08 10:52:06 +000034870 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034871}
34872
34873
34874static int
34875test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034876 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034877
34878#ifdef LIBXML_UNICODE_ENABLED
34879 int mem_base;
34880 int ret_val;
34881 int code; /* UCS code point */
34882 int n_code;
34883
34884 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34885 mem_base = xmlMemBlocks();
34886 code = gen_int(n_code, 0);
34887
34888 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
34889 desret_int(ret_val);
34890 call_tests++;
34891 des_int(n_code, code, 0);
34892 xmlResetLastError();
34893 if (mem_base != xmlMemBlocks()) {
34894 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
34895 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034896 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034897 printf(" %d", n_code);
34898 printf("\n");
34899 }
34900 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034901 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034902#endif
34903
Daniel Veillard42595322004-11-08 10:52:06 +000034904 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034905}
34906
34907
34908static int
34909test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034910 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034911
34912#ifdef LIBXML_UNICODE_ENABLED
34913 int mem_base;
34914 int ret_val;
34915 int code; /* UCS code point */
34916 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034917 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034918 int n_cat;
34919
34920 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34921 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
34922 mem_base = xmlMemBlocks();
34923 code = gen_int(n_code, 0);
34924 cat = gen_const_char_ptr(n_cat, 1);
34925
34926 ret_val = xmlUCSIsCat(code, cat);
34927 desret_int(ret_val);
34928 call_tests++;
34929 des_int(n_code, code, 0);
34930 des_const_char_ptr(n_cat, cat, 1);
34931 xmlResetLastError();
34932 if (mem_base != xmlMemBlocks()) {
34933 printf("Leak of %d blocks found in xmlUCSIsCat",
34934 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034935 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034936 printf(" %d", n_code);
34937 printf(" %d", n_cat);
34938 printf("\n");
34939 }
34940 }
34941 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034942 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034943#endif
34944
Daniel Veillard42595322004-11-08 10:52:06 +000034945 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034946}
34947
34948
34949static int
34950test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034951 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034952
34953#ifdef LIBXML_UNICODE_ENABLED
34954 int mem_base;
34955 int ret_val;
34956 int code; /* UCS code point */
34957 int n_code;
34958
34959 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34960 mem_base = xmlMemBlocks();
34961 code = gen_int(n_code, 0);
34962
34963 ret_val = xmlUCSIsCatC(code);
34964 desret_int(ret_val);
34965 call_tests++;
34966 des_int(n_code, code, 0);
34967 xmlResetLastError();
34968 if (mem_base != xmlMemBlocks()) {
34969 printf("Leak of %d blocks found in xmlUCSIsCatC",
34970 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034971 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034972 printf(" %d", n_code);
34973 printf("\n");
34974 }
34975 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034976 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034977#endif
34978
Daniel Veillard42595322004-11-08 10:52:06 +000034979 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034980}
34981
34982
34983static int
34984test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034985 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034986
34987#ifdef LIBXML_UNICODE_ENABLED
34988 int mem_base;
34989 int ret_val;
34990 int code; /* UCS code point */
34991 int n_code;
34992
34993 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34994 mem_base = xmlMemBlocks();
34995 code = gen_int(n_code, 0);
34996
34997 ret_val = xmlUCSIsCatCc(code);
34998 desret_int(ret_val);
34999 call_tests++;
35000 des_int(n_code, code, 0);
35001 xmlResetLastError();
35002 if (mem_base != xmlMemBlocks()) {
35003 printf("Leak of %d blocks found in xmlUCSIsCatCc",
35004 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035005 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035006 printf(" %d", n_code);
35007 printf("\n");
35008 }
35009 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035010 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035011#endif
35012
Daniel Veillard42595322004-11-08 10:52:06 +000035013 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035014}
35015
35016
35017static int
35018test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035019 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035020
35021#ifdef LIBXML_UNICODE_ENABLED
35022 int mem_base;
35023 int ret_val;
35024 int code; /* UCS code point */
35025 int n_code;
35026
35027 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35028 mem_base = xmlMemBlocks();
35029 code = gen_int(n_code, 0);
35030
35031 ret_val = xmlUCSIsCatCf(code);
35032 desret_int(ret_val);
35033 call_tests++;
35034 des_int(n_code, code, 0);
35035 xmlResetLastError();
35036 if (mem_base != xmlMemBlocks()) {
35037 printf("Leak of %d blocks found in xmlUCSIsCatCf",
35038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035039 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035040 printf(" %d", n_code);
35041 printf("\n");
35042 }
35043 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035044 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035045#endif
35046
Daniel Veillard42595322004-11-08 10:52:06 +000035047 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035048}
35049
35050
35051static int
35052test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035053 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035054
35055#ifdef LIBXML_UNICODE_ENABLED
35056 int mem_base;
35057 int ret_val;
35058 int code; /* UCS code point */
35059 int n_code;
35060
35061 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35062 mem_base = xmlMemBlocks();
35063 code = gen_int(n_code, 0);
35064
35065 ret_val = xmlUCSIsCatCo(code);
35066 desret_int(ret_val);
35067 call_tests++;
35068 des_int(n_code, code, 0);
35069 xmlResetLastError();
35070 if (mem_base != xmlMemBlocks()) {
35071 printf("Leak of %d blocks found in xmlUCSIsCatCo",
35072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035073 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035074 printf(" %d", n_code);
35075 printf("\n");
35076 }
35077 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035078 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035079#endif
35080
Daniel Veillard42595322004-11-08 10:52:06 +000035081 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035082}
35083
35084
35085static int
35086test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035087 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035088
35089#ifdef LIBXML_UNICODE_ENABLED
35090 int mem_base;
35091 int ret_val;
35092 int code; /* UCS code point */
35093 int n_code;
35094
35095 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35096 mem_base = xmlMemBlocks();
35097 code = gen_int(n_code, 0);
35098
35099 ret_val = xmlUCSIsCatCs(code);
35100 desret_int(ret_val);
35101 call_tests++;
35102 des_int(n_code, code, 0);
35103 xmlResetLastError();
35104 if (mem_base != xmlMemBlocks()) {
35105 printf("Leak of %d blocks found in xmlUCSIsCatCs",
35106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035107 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035108 printf(" %d", n_code);
35109 printf("\n");
35110 }
35111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035112 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035113#endif
35114
Daniel Veillard42595322004-11-08 10:52:06 +000035115 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035116}
35117
35118
35119static int
35120test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035121 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035122
35123#ifdef LIBXML_UNICODE_ENABLED
35124 int mem_base;
35125 int ret_val;
35126 int code; /* UCS code point */
35127 int n_code;
35128
35129 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35130 mem_base = xmlMemBlocks();
35131 code = gen_int(n_code, 0);
35132
35133 ret_val = xmlUCSIsCatL(code);
35134 desret_int(ret_val);
35135 call_tests++;
35136 des_int(n_code, code, 0);
35137 xmlResetLastError();
35138 if (mem_base != xmlMemBlocks()) {
35139 printf("Leak of %d blocks found in xmlUCSIsCatL",
35140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035141 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035142 printf(" %d", n_code);
35143 printf("\n");
35144 }
35145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035146 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035147#endif
35148
Daniel Veillard42595322004-11-08 10:52:06 +000035149 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035150}
35151
35152
35153static int
35154test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035155 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035156
35157#ifdef LIBXML_UNICODE_ENABLED
35158 int mem_base;
35159 int ret_val;
35160 int code; /* UCS code point */
35161 int n_code;
35162
35163 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35164 mem_base = xmlMemBlocks();
35165 code = gen_int(n_code, 0);
35166
35167 ret_val = xmlUCSIsCatLl(code);
35168 desret_int(ret_val);
35169 call_tests++;
35170 des_int(n_code, code, 0);
35171 xmlResetLastError();
35172 if (mem_base != xmlMemBlocks()) {
35173 printf("Leak of %d blocks found in xmlUCSIsCatLl",
35174 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035175 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035176 printf(" %d", n_code);
35177 printf("\n");
35178 }
35179 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035180 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035181#endif
35182
Daniel Veillard42595322004-11-08 10:52:06 +000035183 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035184}
35185
35186
35187static int
35188test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035189 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035190
35191#ifdef LIBXML_UNICODE_ENABLED
35192 int mem_base;
35193 int ret_val;
35194 int code; /* UCS code point */
35195 int n_code;
35196
35197 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35198 mem_base = xmlMemBlocks();
35199 code = gen_int(n_code, 0);
35200
35201 ret_val = xmlUCSIsCatLm(code);
35202 desret_int(ret_val);
35203 call_tests++;
35204 des_int(n_code, code, 0);
35205 xmlResetLastError();
35206 if (mem_base != xmlMemBlocks()) {
35207 printf("Leak of %d blocks found in xmlUCSIsCatLm",
35208 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035209 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035210 printf(" %d", n_code);
35211 printf("\n");
35212 }
35213 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035214 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035215#endif
35216
Daniel Veillard42595322004-11-08 10:52:06 +000035217 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035218}
35219
35220
35221static int
35222test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035223 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035224
35225#ifdef LIBXML_UNICODE_ENABLED
35226 int mem_base;
35227 int ret_val;
35228 int code; /* UCS code point */
35229 int n_code;
35230
35231 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35232 mem_base = xmlMemBlocks();
35233 code = gen_int(n_code, 0);
35234
35235 ret_val = xmlUCSIsCatLo(code);
35236 desret_int(ret_val);
35237 call_tests++;
35238 des_int(n_code, code, 0);
35239 xmlResetLastError();
35240 if (mem_base != xmlMemBlocks()) {
35241 printf("Leak of %d blocks found in xmlUCSIsCatLo",
35242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035243 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035244 printf(" %d", n_code);
35245 printf("\n");
35246 }
35247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035248 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035249#endif
35250
Daniel Veillard42595322004-11-08 10:52:06 +000035251 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035252}
35253
35254
35255static int
35256test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035257 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035258
35259#ifdef LIBXML_UNICODE_ENABLED
35260 int mem_base;
35261 int ret_val;
35262 int code; /* UCS code point */
35263 int n_code;
35264
35265 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35266 mem_base = xmlMemBlocks();
35267 code = gen_int(n_code, 0);
35268
35269 ret_val = xmlUCSIsCatLt(code);
35270 desret_int(ret_val);
35271 call_tests++;
35272 des_int(n_code, code, 0);
35273 xmlResetLastError();
35274 if (mem_base != xmlMemBlocks()) {
35275 printf("Leak of %d blocks found in xmlUCSIsCatLt",
35276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035277 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035278 printf(" %d", n_code);
35279 printf("\n");
35280 }
35281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035282 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035283#endif
35284
Daniel Veillard42595322004-11-08 10:52:06 +000035285 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035286}
35287
35288
35289static int
35290test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035291 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035292
35293#ifdef LIBXML_UNICODE_ENABLED
35294 int mem_base;
35295 int ret_val;
35296 int code; /* UCS code point */
35297 int n_code;
35298
35299 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35300 mem_base = xmlMemBlocks();
35301 code = gen_int(n_code, 0);
35302
35303 ret_val = xmlUCSIsCatLu(code);
35304 desret_int(ret_val);
35305 call_tests++;
35306 des_int(n_code, code, 0);
35307 xmlResetLastError();
35308 if (mem_base != xmlMemBlocks()) {
35309 printf("Leak of %d blocks found in xmlUCSIsCatLu",
35310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035311 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035312 printf(" %d", n_code);
35313 printf("\n");
35314 }
35315 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035316 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035317#endif
35318
Daniel Veillard42595322004-11-08 10:52:06 +000035319 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035320}
35321
35322
35323static int
35324test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035325 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035326
35327#ifdef LIBXML_UNICODE_ENABLED
35328 int mem_base;
35329 int ret_val;
35330 int code; /* UCS code point */
35331 int n_code;
35332
35333 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35334 mem_base = xmlMemBlocks();
35335 code = gen_int(n_code, 0);
35336
35337 ret_val = xmlUCSIsCatM(code);
35338 desret_int(ret_val);
35339 call_tests++;
35340 des_int(n_code, code, 0);
35341 xmlResetLastError();
35342 if (mem_base != xmlMemBlocks()) {
35343 printf("Leak of %d blocks found in xmlUCSIsCatM",
35344 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035345 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035346 printf(" %d", n_code);
35347 printf("\n");
35348 }
35349 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035350 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035351#endif
35352
Daniel Veillard42595322004-11-08 10:52:06 +000035353 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035354}
35355
35356
35357static int
35358test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035359 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035360
35361#ifdef LIBXML_UNICODE_ENABLED
35362 int mem_base;
35363 int ret_val;
35364 int code; /* UCS code point */
35365 int n_code;
35366
35367 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35368 mem_base = xmlMemBlocks();
35369 code = gen_int(n_code, 0);
35370
35371 ret_val = xmlUCSIsCatMc(code);
35372 desret_int(ret_val);
35373 call_tests++;
35374 des_int(n_code, code, 0);
35375 xmlResetLastError();
35376 if (mem_base != xmlMemBlocks()) {
35377 printf("Leak of %d blocks found in xmlUCSIsCatMc",
35378 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035379 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035380 printf(" %d", n_code);
35381 printf("\n");
35382 }
35383 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035384 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035385#endif
35386
Daniel Veillard42595322004-11-08 10:52:06 +000035387 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035388}
35389
35390
35391static int
35392test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035393 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035394
35395#ifdef LIBXML_UNICODE_ENABLED
35396 int mem_base;
35397 int ret_val;
35398 int code; /* UCS code point */
35399 int n_code;
35400
35401 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35402 mem_base = xmlMemBlocks();
35403 code = gen_int(n_code, 0);
35404
35405 ret_val = xmlUCSIsCatMe(code);
35406 desret_int(ret_val);
35407 call_tests++;
35408 des_int(n_code, code, 0);
35409 xmlResetLastError();
35410 if (mem_base != xmlMemBlocks()) {
35411 printf("Leak of %d blocks found in xmlUCSIsCatMe",
35412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035413 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035414 printf(" %d", n_code);
35415 printf("\n");
35416 }
35417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035418 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035419#endif
35420
Daniel Veillard42595322004-11-08 10:52:06 +000035421 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035422}
35423
35424
35425static int
35426test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035427 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035428
35429#ifdef LIBXML_UNICODE_ENABLED
35430 int mem_base;
35431 int ret_val;
35432 int code; /* UCS code point */
35433 int n_code;
35434
35435 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35436 mem_base = xmlMemBlocks();
35437 code = gen_int(n_code, 0);
35438
35439 ret_val = xmlUCSIsCatMn(code);
35440 desret_int(ret_val);
35441 call_tests++;
35442 des_int(n_code, code, 0);
35443 xmlResetLastError();
35444 if (mem_base != xmlMemBlocks()) {
35445 printf("Leak of %d blocks found in xmlUCSIsCatMn",
35446 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035447 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035448 printf(" %d", n_code);
35449 printf("\n");
35450 }
35451 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035452 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035453#endif
35454
Daniel Veillard42595322004-11-08 10:52:06 +000035455 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035456}
35457
35458
35459static int
35460test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035461 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035462
35463#ifdef LIBXML_UNICODE_ENABLED
35464 int mem_base;
35465 int ret_val;
35466 int code; /* UCS code point */
35467 int n_code;
35468
35469 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35470 mem_base = xmlMemBlocks();
35471 code = gen_int(n_code, 0);
35472
35473 ret_val = xmlUCSIsCatN(code);
35474 desret_int(ret_val);
35475 call_tests++;
35476 des_int(n_code, code, 0);
35477 xmlResetLastError();
35478 if (mem_base != xmlMemBlocks()) {
35479 printf("Leak of %d blocks found in xmlUCSIsCatN",
35480 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035481 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035482 printf(" %d", n_code);
35483 printf("\n");
35484 }
35485 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035486 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035487#endif
35488
Daniel Veillard42595322004-11-08 10:52:06 +000035489 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035490}
35491
35492
35493static int
35494test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035495 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035496
35497#ifdef LIBXML_UNICODE_ENABLED
35498 int mem_base;
35499 int ret_val;
35500 int code; /* UCS code point */
35501 int n_code;
35502
35503 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35504 mem_base = xmlMemBlocks();
35505 code = gen_int(n_code, 0);
35506
35507 ret_val = xmlUCSIsCatNd(code);
35508 desret_int(ret_val);
35509 call_tests++;
35510 des_int(n_code, code, 0);
35511 xmlResetLastError();
35512 if (mem_base != xmlMemBlocks()) {
35513 printf("Leak of %d blocks found in xmlUCSIsCatNd",
35514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035515 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035516 printf(" %d", n_code);
35517 printf("\n");
35518 }
35519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035520 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035521#endif
35522
Daniel Veillard42595322004-11-08 10:52:06 +000035523 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035524}
35525
35526
35527static int
35528test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035529 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035530
35531#ifdef LIBXML_UNICODE_ENABLED
35532 int mem_base;
35533 int ret_val;
35534 int code; /* UCS code point */
35535 int n_code;
35536
35537 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35538 mem_base = xmlMemBlocks();
35539 code = gen_int(n_code, 0);
35540
35541 ret_val = xmlUCSIsCatNl(code);
35542 desret_int(ret_val);
35543 call_tests++;
35544 des_int(n_code, code, 0);
35545 xmlResetLastError();
35546 if (mem_base != xmlMemBlocks()) {
35547 printf("Leak of %d blocks found in xmlUCSIsCatNl",
35548 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035549 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035550 printf(" %d", n_code);
35551 printf("\n");
35552 }
35553 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035554 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035555#endif
35556
Daniel Veillard42595322004-11-08 10:52:06 +000035557 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035558}
35559
35560
35561static int
35562test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035563 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035564
35565#ifdef LIBXML_UNICODE_ENABLED
35566 int mem_base;
35567 int ret_val;
35568 int code; /* UCS code point */
35569 int n_code;
35570
35571 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35572 mem_base = xmlMemBlocks();
35573 code = gen_int(n_code, 0);
35574
35575 ret_val = xmlUCSIsCatNo(code);
35576 desret_int(ret_val);
35577 call_tests++;
35578 des_int(n_code, code, 0);
35579 xmlResetLastError();
35580 if (mem_base != xmlMemBlocks()) {
35581 printf("Leak of %d blocks found in xmlUCSIsCatNo",
35582 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035583 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035584 printf(" %d", n_code);
35585 printf("\n");
35586 }
35587 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035588 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035589#endif
35590
Daniel Veillard42595322004-11-08 10:52:06 +000035591 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035592}
35593
35594
35595static int
35596test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035597 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035598
35599#ifdef LIBXML_UNICODE_ENABLED
35600 int mem_base;
35601 int ret_val;
35602 int code; /* UCS code point */
35603 int n_code;
35604
35605 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35606 mem_base = xmlMemBlocks();
35607 code = gen_int(n_code, 0);
35608
35609 ret_val = xmlUCSIsCatP(code);
35610 desret_int(ret_val);
35611 call_tests++;
35612 des_int(n_code, code, 0);
35613 xmlResetLastError();
35614 if (mem_base != xmlMemBlocks()) {
35615 printf("Leak of %d blocks found in xmlUCSIsCatP",
35616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035617 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035618 printf(" %d", n_code);
35619 printf("\n");
35620 }
35621 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035622 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035623#endif
35624
Daniel Veillard42595322004-11-08 10:52:06 +000035625 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035626}
35627
35628
35629static int
35630test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035631 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035632
35633#ifdef LIBXML_UNICODE_ENABLED
35634 int mem_base;
35635 int ret_val;
35636 int code; /* UCS code point */
35637 int n_code;
35638
35639 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35640 mem_base = xmlMemBlocks();
35641 code = gen_int(n_code, 0);
35642
35643 ret_val = xmlUCSIsCatPc(code);
35644 desret_int(ret_val);
35645 call_tests++;
35646 des_int(n_code, code, 0);
35647 xmlResetLastError();
35648 if (mem_base != xmlMemBlocks()) {
35649 printf("Leak of %d blocks found in xmlUCSIsCatPc",
35650 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035651 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035652 printf(" %d", n_code);
35653 printf("\n");
35654 }
35655 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035656 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035657#endif
35658
Daniel Veillard42595322004-11-08 10:52:06 +000035659 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035660}
35661
35662
35663static int
35664test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035665 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035666
35667#ifdef LIBXML_UNICODE_ENABLED
35668 int mem_base;
35669 int ret_val;
35670 int code; /* UCS code point */
35671 int n_code;
35672
35673 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35674 mem_base = xmlMemBlocks();
35675 code = gen_int(n_code, 0);
35676
35677 ret_val = xmlUCSIsCatPd(code);
35678 desret_int(ret_val);
35679 call_tests++;
35680 des_int(n_code, code, 0);
35681 xmlResetLastError();
35682 if (mem_base != xmlMemBlocks()) {
35683 printf("Leak of %d blocks found in xmlUCSIsCatPd",
35684 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035685 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035686 printf(" %d", n_code);
35687 printf("\n");
35688 }
35689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035690 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035691#endif
35692
Daniel Veillard42595322004-11-08 10:52:06 +000035693 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035694}
35695
35696
35697static int
35698test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035699 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035700
35701#ifdef LIBXML_UNICODE_ENABLED
35702 int mem_base;
35703 int ret_val;
35704 int code; /* UCS code point */
35705 int n_code;
35706
35707 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35708 mem_base = xmlMemBlocks();
35709 code = gen_int(n_code, 0);
35710
35711 ret_val = xmlUCSIsCatPe(code);
35712 desret_int(ret_val);
35713 call_tests++;
35714 des_int(n_code, code, 0);
35715 xmlResetLastError();
35716 if (mem_base != xmlMemBlocks()) {
35717 printf("Leak of %d blocks found in xmlUCSIsCatPe",
35718 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035719 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035720 printf(" %d", n_code);
35721 printf("\n");
35722 }
35723 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035724 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035725#endif
35726
Daniel Veillard42595322004-11-08 10:52:06 +000035727 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035728}
35729
35730
35731static int
35732test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035733 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035734
35735#ifdef LIBXML_UNICODE_ENABLED
35736 int mem_base;
35737 int ret_val;
35738 int code; /* UCS code point */
35739 int n_code;
35740
35741 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35742 mem_base = xmlMemBlocks();
35743 code = gen_int(n_code, 0);
35744
35745 ret_val = xmlUCSIsCatPf(code);
35746 desret_int(ret_val);
35747 call_tests++;
35748 des_int(n_code, code, 0);
35749 xmlResetLastError();
35750 if (mem_base != xmlMemBlocks()) {
35751 printf("Leak of %d blocks found in xmlUCSIsCatPf",
35752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035753 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035754 printf(" %d", n_code);
35755 printf("\n");
35756 }
35757 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035758 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035759#endif
35760
Daniel Veillard42595322004-11-08 10:52:06 +000035761 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035762}
35763
35764
35765static int
35766test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035767 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035768
35769#ifdef LIBXML_UNICODE_ENABLED
35770 int mem_base;
35771 int ret_val;
35772 int code; /* UCS code point */
35773 int n_code;
35774
35775 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35776 mem_base = xmlMemBlocks();
35777 code = gen_int(n_code, 0);
35778
35779 ret_val = xmlUCSIsCatPi(code);
35780 desret_int(ret_val);
35781 call_tests++;
35782 des_int(n_code, code, 0);
35783 xmlResetLastError();
35784 if (mem_base != xmlMemBlocks()) {
35785 printf("Leak of %d blocks found in xmlUCSIsCatPi",
35786 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035787 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035788 printf(" %d", n_code);
35789 printf("\n");
35790 }
35791 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035792 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035793#endif
35794
Daniel Veillard42595322004-11-08 10:52:06 +000035795 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035796}
35797
35798
35799static int
35800test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035801 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035802
35803#ifdef LIBXML_UNICODE_ENABLED
35804 int mem_base;
35805 int ret_val;
35806 int code; /* UCS code point */
35807 int n_code;
35808
35809 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35810 mem_base = xmlMemBlocks();
35811 code = gen_int(n_code, 0);
35812
35813 ret_val = xmlUCSIsCatPo(code);
35814 desret_int(ret_val);
35815 call_tests++;
35816 des_int(n_code, code, 0);
35817 xmlResetLastError();
35818 if (mem_base != xmlMemBlocks()) {
35819 printf("Leak of %d blocks found in xmlUCSIsCatPo",
35820 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035821 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035822 printf(" %d", n_code);
35823 printf("\n");
35824 }
35825 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035826 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035827#endif
35828
Daniel Veillard42595322004-11-08 10:52:06 +000035829 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035830}
35831
35832
35833static int
35834test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035835 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035836
35837#ifdef LIBXML_UNICODE_ENABLED
35838 int mem_base;
35839 int ret_val;
35840 int code; /* UCS code point */
35841 int n_code;
35842
35843 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35844 mem_base = xmlMemBlocks();
35845 code = gen_int(n_code, 0);
35846
35847 ret_val = xmlUCSIsCatPs(code);
35848 desret_int(ret_val);
35849 call_tests++;
35850 des_int(n_code, code, 0);
35851 xmlResetLastError();
35852 if (mem_base != xmlMemBlocks()) {
35853 printf("Leak of %d blocks found in xmlUCSIsCatPs",
35854 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035855 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035856 printf(" %d", n_code);
35857 printf("\n");
35858 }
35859 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035860 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035861#endif
35862
Daniel Veillard42595322004-11-08 10:52:06 +000035863 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035864}
35865
35866
35867static int
35868test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035869 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035870
35871#ifdef LIBXML_UNICODE_ENABLED
35872 int mem_base;
35873 int ret_val;
35874 int code; /* UCS code point */
35875 int n_code;
35876
35877 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35878 mem_base = xmlMemBlocks();
35879 code = gen_int(n_code, 0);
35880
35881 ret_val = xmlUCSIsCatS(code);
35882 desret_int(ret_val);
35883 call_tests++;
35884 des_int(n_code, code, 0);
35885 xmlResetLastError();
35886 if (mem_base != xmlMemBlocks()) {
35887 printf("Leak of %d blocks found in xmlUCSIsCatS",
35888 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035889 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035890 printf(" %d", n_code);
35891 printf("\n");
35892 }
35893 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035894 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035895#endif
35896
Daniel Veillard42595322004-11-08 10:52:06 +000035897 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035898}
35899
35900
35901static int
35902test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035903 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035904
35905#ifdef LIBXML_UNICODE_ENABLED
35906 int mem_base;
35907 int ret_val;
35908 int code; /* UCS code point */
35909 int n_code;
35910
35911 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35912 mem_base = xmlMemBlocks();
35913 code = gen_int(n_code, 0);
35914
35915 ret_val = xmlUCSIsCatSc(code);
35916 desret_int(ret_val);
35917 call_tests++;
35918 des_int(n_code, code, 0);
35919 xmlResetLastError();
35920 if (mem_base != xmlMemBlocks()) {
35921 printf("Leak of %d blocks found in xmlUCSIsCatSc",
35922 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035923 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035924 printf(" %d", n_code);
35925 printf("\n");
35926 }
35927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035928 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035929#endif
35930
Daniel Veillard42595322004-11-08 10:52:06 +000035931 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035932}
35933
35934
35935static int
35936test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035937 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035938
35939#ifdef LIBXML_UNICODE_ENABLED
35940 int mem_base;
35941 int ret_val;
35942 int code; /* UCS code point */
35943 int n_code;
35944
35945 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35946 mem_base = xmlMemBlocks();
35947 code = gen_int(n_code, 0);
35948
35949 ret_val = xmlUCSIsCatSk(code);
35950 desret_int(ret_val);
35951 call_tests++;
35952 des_int(n_code, code, 0);
35953 xmlResetLastError();
35954 if (mem_base != xmlMemBlocks()) {
35955 printf("Leak of %d blocks found in xmlUCSIsCatSk",
35956 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035957 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035958 printf(" %d", n_code);
35959 printf("\n");
35960 }
35961 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035962 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035963#endif
35964
Daniel Veillard42595322004-11-08 10:52:06 +000035965 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035966}
35967
35968
35969static int
35970test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035971 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035972
35973#ifdef LIBXML_UNICODE_ENABLED
35974 int mem_base;
35975 int ret_val;
35976 int code; /* UCS code point */
35977 int n_code;
35978
35979 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35980 mem_base = xmlMemBlocks();
35981 code = gen_int(n_code, 0);
35982
35983 ret_val = xmlUCSIsCatSm(code);
35984 desret_int(ret_val);
35985 call_tests++;
35986 des_int(n_code, code, 0);
35987 xmlResetLastError();
35988 if (mem_base != xmlMemBlocks()) {
35989 printf("Leak of %d blocks found in xmlUCSIsCatSm",
35990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035991 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035992 printf(" %d", n_code);
35993 printf("\n");
35994 }
35995 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035996 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035997#endif
35998
Daniel Veillard42595322004-11-08 10:52:06 +000035999 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036000}
36001
36002
36003static int
36004test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036005 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036006
36007#ifdef LIBXML_UNICODE_ENABLED
36008 int mem_base;
36009 int ret_val;
36010 int code; /* UCS code point */
36011 int n_code;
36012
36013 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36014 mem_base = xmlMemBlocks();
36015 code = gen_int(n_code, 0);
36016
36017 ret_val = xmlUCSIsCatSo(code);
36018 desret_int(ret_val);
36019 call_tests++;
36020 des_int(n_code, code, 0);
36021 xmlResetLastError();
36022 if (mem_base != xmlMemBlocks()) {
36023 printf("Leak of %d blocks found in xmlUCSIsCatSo",
36024 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036025 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036026 printf(" %d", n_code);
36027 printf("\n");
36028 }
36029 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036030 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036031#endif
36032
Daniel Veillard42595322004-11-08 10:52:06 +000036033 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036034}
36035
36036
36037static int
36038test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036039 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036040
36041#ifdef LIBXML_UNICODE_ENABLED
36042 int mem_base;
36043 int ret_val;
36044 int code; /* UCS code point */
36045 int n_code;
36046
36047 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36048 mem_base = xmlMemBlocks();
36049 code = gen_int(n_code, 0);
36050
36051 ret_val = xmlUCSIsCatZ(code);
36052 desret_int(ret_val);
36053 call_tests++;
36054 des_int(n_code, code, 0);
36055 xmlResetLastError();
36056 if (mem_base != xmlMemBlocks()) {
36057 printf("Leak of %d blocks found in xmlUCSIsCatZ",
36058 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036059 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036060 printf(" %d", n_code);
36061 printf("\n");
36062 }
36063 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036064 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036065#endif
36066
Daniel Veillard42595322004-11-08 10:52:06 +000036067 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036068}
36069
36070
36071static int
36072test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036073 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036074
36075#ifdef LIBXML_UNICODE_ENABLED
36076 int mem_base;
36077 int ret_val;
36078 int code; /* UCS code point */
36079 int n_code;
36080
36081 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36082 mem_base = xmlMemBlocks();
36083 code = gen_int(n_code, 0);
36084
36085 ret_val = xmlUCSIsCatZl(code);
36086 desret_int(ret_val);
36087 call_tests++;
36088 des_int(n_code, code, 0);
36089 xmlResetLastError();
36090 if (mem_base != xmlMemBlocks()) {
36091 printf("Leak of %d blocks found in xmlUCSIsCatZl",
36092 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036093 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036094 printf(" %d", n_code);
36095 printf("\n");
36096 }
36097 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036098 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036099#endif
36100
Daniel Veillard42595322004-11-08 10:52:06 +000036101 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036102}
36103
36104
36105static int
36106test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036107 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036108
36109#ifdef LIBXML_UNICODE_ENABLED
36110 int mem_base;
36111 int ret_val;
36112 int code; /* UCS code point */
36113 int n_code;
36114
36115 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36116 mem_base = xmlMemBlocks();
36117 code = gen_int(n_code, 0);
36118
36119 ret_val = xmlUCSIsCatZp(code);
36120 desret_int(ret_val);
36121 call_tests++;
36122 des_int(n_code, code, 0);
36123 xmlResetLastError();
36124 if (mem_base != xmlMemBlocks()) {
36125 printf("Leak of %d blocks found in xmlUCSIsCatZp",
36126 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036127 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036128 printf(" %d", n_code);
36129 printf("\n");
36130 }
36131 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036132 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036133#endif
36134
Daniel Veillard42595322004-11-08 10:52:06 +000036135 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036136}
36137
36138
36139static int
36140test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036141 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036142
36143#ifdef LIBXML_UNICODE_ENABLED
36144 int mem_base;
36145 int ret_val;
36146 int code; /* UCS code point */
36147 int n_code;
36148
36149 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36150 mem_base = xmlMemBlocks();
36151 code = gen_int(n_code, 0);
36152
36153 ret_val = xmlUCSIsCatZs(code);
36154 desret_int(ret_val);
36155 call_tests++;
36156 des_int(n_code, code, 0);
36157 xmlResetLastError();
36158 if (mem_base != xmlMemBlocks()) {
36159 printf("Leak of %d blocks found in xmlUCSIsCatZs",
36160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036161 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036162 printf(" %d", n_code);
36163 printf("\n");
36164 }
36165 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036166 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036167#endif
36168
Daniel Veillard42595322004-11-08 10:52:06 +000036169 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036170}
36171
36172
36173static int
36174test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036175 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036176
36177#ifdef LIBXML_UNICODE_ENABLED
36178 int mem_base;
36179 int ret_val;
36180 int code; /* UCS code point */
36181 int n_code;
36182
36183 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36184 mem_base = xmlMemBlocks();
36185 code = gen_int(n_code, 0);
36186
36187 ret_val = xmlUCSIsCherokee(code);
36188 desret_int(ret_val);
36189 call_tests++;
36190 des_int(n_code, code, 0);
36191 xmlResetLastError();
36192 if (mem_base != xmlMemBlocks()) {
36193 printf("Leak of %d blocks found in xmlUCSIsCherokee",
36194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036195 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036196 printf(" %d", n_code);
36197 printf("\n");
36198 }
36199 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036200 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036201#endif
36202
Daniel Veillard42595322004-11-08 10:52:06 +000036203 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036204}
36205
36206
36207static int
36208test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036209 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036210
36211#ifdef LIBXML_UNICODE_ENABLED
36212 int mem_base;
36213 int ret_val;
36214 int code; /* UCS code point */
36215 int n_code;
36216
36217 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36218 mem_base = xmlMemBlocks();
36219 code = gen_int(n_code, 0);
36220
36221 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
36222 desret_int(ret_val);
36223 call_tests++;
36224 des_int(n_code, code, 0);
36225 xmlResetLastError();
36226 if (mem_base != xmlMemBlocks()) {
36227 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
36228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036229 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036230 printf(" %d", n_code);
36231 printf("\n");
36232 }
36233 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036234 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036235#endif
36236
Daniel Veillard42595322004-11-08 10:52:06 +000036237 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036238}
36239
36240
36241static int
36242test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036243 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036244
36245#ifdef LIBXML_UNICODE_ENABLED
36246 int mem_base;
36247 int ret_val;
36248 int code; /* UCS code point */
36249 int n_code;
36250
36251 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36252 mem_base = xmlMemBlocks();
36253 code = gen_int(n_code, 0);
36254
36255 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
36256 desret_int(ret_val);
36257 call_tests++;
36258 des_int(n_code, code, 0);
36259 xmlResetLastError();
36260 if (mem_base != xmlMemBlocks()) {
36261 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
36262 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036263 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036264 printf(" %d", n_code);
36265 printf("\n");
36266 }
36267 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036268 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036269#endif
36270
Daniel Veillard42595322004-11-08 10:52:06 +000036271 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036272}
36273
36274
36275static int
36276test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036277 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036278
36279#ifdef LIBXML_UNICODE_ENABLED
36280 int mem_base;
36281 int ret_val;
36282 int code; /* UCS code point */
36283 int n_code;
36284
36285 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36286 mem_base = xmlMemBlocks();
36287 code = gen_int(n_code, 0);
36288
36289 ret_val = xmlUCSIsCombiningHalfMarks(code);
36290 desret_int(ret_val);
36291 call_tests++;
36292 des_int(n_code, code, 0);
36293 xmlResetLastError();
36294 if (mem_base != xmlMemBlocks()) {
36295 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
36296 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036297 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036298 printf(" %d", n_code);
36299 printf("\n");
36300 }
36301 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036302 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036303#endif
36304
Daniel Veillard42595322004-11-08 10:52:06 +000036305 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036306}
36307
36308
36309static int
36310test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036311 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036312
36313#ifdef LIBXML_UNICODE_ENABLED
36314 int mem_base;
36315 int ret_val;
36316 int code; /* UCS code point */
36317 int n_code;
36318
36319 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36320 mem_base = xmlMemBlocks();
36321 code = gen_int(n_code, 0);
36322
36323 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
36324 desret_int(ret_val);
36325 call_tests++;
36326 des_int(n_code, code, 0);
36327 xmlResetLastError();
36328 if (mem_base != xmlMemBlocks()) {
36329 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
36330 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036331 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036332 printf(" %d", n_code);
36333 printf("\n");
36334 }
36335 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036336 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036337#endif
36338
Daniel Veillard42595322004-11-08 10:52:06 +000036339 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036340}
36341
36342
36343static int
36344test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036345 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036346
36347#ifdef LIBXML_UNICODE_ENABLED
36348 int mem_base;
36349 int ret_val;
36350 int code; /* UCS code point */
36351 int n_code;
36352
36353 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36354 mem_base = xmlMemBlocks();
36355 code = gen_int(n_code, 0);
36356
36357 ret_val = xmlUCSIsControlPictures(code);
36358 desret_int(ret_val);
36359 call_tests++;
36360 des_int(n_code, code, 0);
36361 xmlResetLastError();
36362 if (mem_base != xmlMemBlocks()) {
36363 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
36364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036365 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036366 printf(" %d", n_code);
36367 printf("\n");
36368 }
36369 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036370 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036371#endif
36372
Daniel Veillard42595322004-11-08 10:52:06 +000036373 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036374}
36375
36376
36377static int
36378test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036379 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036380
36381#ifdef LIBXML_UNICODE_ENABLED
36382 int mem_base;
36383 int ret_val;
36384 int code; /* UCS code point */
36385 int n_code;
36386
36387 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36388 mem_base = xmlMemBlocks();
36389 code = gen_int(n_code, 0);
36390
36391 ret_val = xmlUCSIsCurrencySymbols(code);
36392 desret_int(ret_val);
36393 call_tests++;
36394 des_int(n_code, code, 0);
36395 xmlResetLastError();
36396 if (mem_base != xmlMemBlocks()) {
36397 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
36398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036399 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036400 printf(" %d", n_code);
36401 printf("\n");
36402 }
36403 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036404 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036405#endif
36406
Daniel Veillard42595322004-11-08 10:52:06 +000036407 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036408}
36409
36410
36411static int
36412test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036413 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036414
36415#ifdef LIBXML_UNICODE_ENABLED
36416 int mem_base;
36417 int ret_val;
36418 int code; /* UCS code point */
36419 int n_code;
36420
36421 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36422 mem_base = xmlMemBlocks();
36423 code = gen_int(n_code, 0);
36424
36425 ret_val = xmlUCSIsCypriotSyllabary(code);
36426 desret_int(ret_val);
36427 call_tests++;
36428 des_int(n_code, code, 0);
36429 xmlResetLastError();
36430 if (mem_base != xmlMemBlocks()) {
36431 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
36432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036433 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036434 printf(" %d", n_code);
36435 printf("\n");
36436 }
36437 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036438 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036439#endif
36440
Daniel Veillard42595322004-11-08 10:52:06 +000036441 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036442}
36443
36444
36445static int
36446test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036447 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036448
36449#ifdef LIBXML_UNICODE_ENABLED
36450 int mem_base;
36451 int ret_val;
36452 int code; /* UCS code point */
36453 int n_code;
36454
36455 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36456 mem_base = xmlMemBlocks();
36457 code = gen_int(n_code, 0);
36458
36459 ret_val = xmlUCSIsCyrillic(code);
36460 desret_int(ret_val);
36461 call_tests++;
36462 des_int(n_code, code, 0);
36463 xmlResetLastError();
36464 if (mem_base != xmlMemBlocks()) {
36465 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
36466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036467 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036468 printf(" %d", n_code);
36469 printf("\n");
36470 }
36471 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036472 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036473#endif
36474
Daniel Veillard42595322004-11-08 10:52:06 +000036475 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036476}
36477
36478
36479static int
36480test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036481 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036482
36483#ifdef LIBXML_UNICODE_ENABLED
36484 int mem_base;
36485 int ret_val;
36486 int code; /* UCS code point */
36487 int n_code;
36488
36489 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36490 mem_base = xmlMemBlocks();
36491 code = gen_int(n_code, 0);
36492
36493 ret_val = xmlUCSIsCyrillicSupplement(code);
36494 desret_int(ret_val);
36495 call_tests++;
36496 des_int(n_code, code, 0);
36497 xmlResetLastError();
36498 if (mem_base != xmlMemBlocks()) {
36499 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
36500 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036501 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036502 printf(" %d", n_code);
36503 printf("\n");
36504 }
36505 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036506 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036507#endif
36508
Daniel Veillard42595322004-11-08 10:52:06 +000036509 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036510}
36511
36512
36513static int
36514test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036515 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036516
36517#ifdef LIBXML_UNICODE_ENABLED
36518 int mem_base;
36519 int ret_val;
36520 int code; /* UCS code point */
36521 int n_code;
36522
36523 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36524 mem_base = xmlMemBlocks();
36525 code = gen_int(n_code, 0);
36526
36527 ret_val = xmlUCSIsDeseret(code);
36528 desret_int(ret_val);
36529 call_tests++;
36530 des_int(n_code, code, 0);
36531 xmlResetLastError();
36532 if (mem_base != xmlMemBlocks()) {
36533 printf("Leak of %d blocks found in xmlUCSIsDeseret",
36534 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036535 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036536 printf(" %d", n_code);
36537 printf("\n");
36538 }
36539 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036540 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036541#endif
36542
Daniel Veillard42595322004-11-08 10:52:06 +000036543 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036544}
36545
36546
36547static int
36548test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036549 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036550
36551#ifdef LIBXML_UNICODE_ENABLED
36552 int mem_base;
36553 int ret_val;
36554 int code; /* UCS code point */
36555 int n_code;
36556
36557 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36558 mem_base = xmlMemBlocks();
36559 code = gen_int(n_code, 0);
36560
36561 ret_val = xmlUCSIsDevanagari(code);
36562 desret_int(ret_val);
36563 call_tests++;
36564 des_int(n_code, code, 0);
36565 xmlResetLastError();
36566 if (mem_base != xmlMemBlocks()) {
36567 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
36568 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036569 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036570 printf(" %d", n_code);
36571 printf("\n");
36572 }
36573 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036574 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036575#endif
36576
Daniel Veillard42595322004-11-08 10:52:06 +000036577 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036578}
36579
36580
36581static int
36582test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036583 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036584
36585#ifdef LIBXML_UNICODE_ENABLED
36586 int mem_base;
36587 int ret_val;
36588 int code; /* UCS code point */
36589 int n_code;
36590
36591 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36592 mem_base = xmlMemBlocks();
36593 code = gen_int(n_code, 0);
36594
36595 ret_val = xmlUCSIsDingbats(code);
36596 desret_int(ret_val);
36597 call_tests++;
36598 des_int(n_code, code, 0);
36599 xmlResetLastError();
36600 if (mem_base != xmlMemBlocks()) {
36601 printf("Leak of %d blocks found in xmlUCSIsDingbats",
36602 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036603 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036604 printf(" %d", n_code);
36605 printf("\n");
36606 }
36607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036608 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036609#endif
36610
Daniel Veillard42595322004-11-08 10:52:06 +000036611 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036612}
36613
36614
36615static int
36616test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036617 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036618
36619#ifdef LIBXML_UNICODE_ENABLED
36620 int mem_base;
36621 int ret_val;
36622 int code; /* UCS code point */
36623 int n_code;
36624
36625 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36626 mem_base = xmlMemBlocks();
36627 code = gen_int(n_code, 0);
36628
36629 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
36630 desret_int(ret_val);
36631 call_tests++;
36632 des_int(n_code, code, 0);
36633 xmlResetLastError();
36634 if (mem_base != xmlMemBlocks()) {
36635 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
36636 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036637 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036638 printf(" %d", n_code);
36639 printf("\n");
36640 }
36641 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036642 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036643#endif
36644
Daniel Veillard42595322004-11-08 10:52:06 +000036645 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036646}
36647
36648
36649static int
36650test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036651 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036652
36653#ifdef LIBXML_UNICODE_ENABLED
36654 int mem_base;
36655 int ret_val;
36656 int code; /* UCS code point */
36657 int n_code;
36658
36659 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36660 mem_base = xmlMemBlocks();
36661 code = gen_int(n_code, 0);
36662
36663 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
36664 desret_int(ret_val);
36665 call_tests++;
36666 des_int(n_code, code, 0);
36667 xmlResetLastError();
36668 if (mem_base != xmlMemBlocks()) {
36669 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
36670 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036671 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036672 printf(" %d", n_code);
36673 printf("\n");
36674 }
36675 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036676 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036677#endif
36678
Daniel Veillard42595322004-11-08 10:52:06 +000036679 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036680}
36681
36682
36683static int
36684test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036685 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036686
36687#ifdef LIBXML_UNICODE_ENABLED
36688 int mem_base;
36689 int ret_val;
36690 int code; /* UCS code point */
36691 int n_code;
36692
36693 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36694 mem_base = xmlMemBlocks();
36695 code = gen_int(n_code, 0);
36696
36697 ret_val = xmlUCSIsEthiopic(code);
36698 desret_int(ret_val);
36699 call_tests++;
36700 des_int(n_code, code, 0);
36701 xmlResetLastError();
36702 if (mem_base != xmlMemBlocks()) {
36703 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
36704 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036705 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036706 printf(" %d", n_code);
36707 printf("\n");
36708 }
36709 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036710 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036711#endif
36712
Daniel Veillard42595322004-11-08 10:52:06 +000036713 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036714}
36715
36716
36717static int
36718test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036719 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036720
36721#ifdef LIBXML_UNICODE_ENABLED
36722 int mem_base;
36723 int ret_val;
36724 int code; /* UCS code point */
36725 int n_code;
36726
36727 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36728 mem_base = xmlMemBlocks();
36729 code = gen_int(n_code, 0);
36730
36731 ret_val = xmlUCSIsGeneralPunctuation(code);
36732 desret_int(ret_val);
36733 call_tests++;
36734 des_int(n_code, code, 0);
36735 xmlResetLastError();
36736 if (mem_base != xmlMemBlocks()) {
36737 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
36738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036739 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036740 printf(" %d", n_code);
36741 printf("\n");
36742 }
36743 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036744 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036745#endif
36746
Daniel Veillard42595322004-11-08 10:52:06 +000036747 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036748}
36749
36750
36751static int
36752test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036753 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036754
36755#ifdef LIBXML_UNICODE_ENABLED
36756 int mem_base;
36757 int ret_val;
36758 int code; /* UCS code point */
36759 int n_code;
36760
36761 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36762 mem_base = xmlMemBlocks();
36763 code = gen_int(n_code, 0);
36764
36765 ret_val = xmlUCSIsGeometricShapes(code);
36766 desret_int(ret_val);
36767 call_tests++;
36768 des_int(n_code, code, 0);
36769 xmlResetLastError();
36770 if (mem_base != xmlMemBlocks()) {
36771 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
36772 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036773 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036774 printf(" %d", n_code);
36775 printf("\n");
36776 }
36777 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036778 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036779#endif
36780
Daniel Veillard42595322004-11-08 10:52:06 +000036781 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036782}
36783
36784
36785static int
36786test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036787 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036788
36789#ifdef LIBXML_UNICODE_ENABLED
36790 int mem_base;
36791 int ret_val;
36792 int code; /* UCS code point */
36793 int n_code;
36794
36795 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36796 mem_base = xmlMemBlocks();
36797 code = gen_int(n_code, 0);
36798
36799 ret_val = xmlUCSIsGeorgian(code);
36800 desret_int(ret_val);
36801 call_tests++;
36802 des_int(n_code, code, 0);
36803 xmlResetLastError();
36804 if (mem_base != xmlMemBlocks()) {
36805 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
36806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036807 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036808 printf(" %d", n_code);
36809 printf("\n");
36810 }
36811 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036812 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036813#endif
36814
Daniel Veillard42595322004-11-08 10:52:06 +000036815 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036816}
36817
36818
36819static int
36820test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036821 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036822
36823#ifdef LIBXML_UNICODE_ENABLED
36824 int mem_base;
36825 int ret_val;
36826 int code; /* UCS code point */
36827 int n_code;
36828
36829 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36830 mem_base = xmlMemBlocks();
36831 code = gen_int(n_code, 0);
36832
36833 ret_val = xmlUCSIsGothic(code);
36834 desret_int(ret_val);
36835 call_tests++;
36836 des_int(n_code, code, 0);
36837 xmlResetLastError();
36838 if (mem_base != xmlMemBlocks()) {
36839 printf("Leak of %d blocks found in xmlUCSIsGothic",
36840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036841 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036842 printf(" %d", n_code);
36843 printf("\n");
36844 }
36845 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036846 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036847#endif
36848
Daniel Veillard42595322004-11-08 10:52:06 +000036849 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036850}
36851
36852
36853static int
36854test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036855 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036856
36857#ifdef LIBXML_UNICODE_ENABLED
36858 int mem_base;
36859 int ret_val;
36860 int code; /* UCS code point */
36861 int n_code;
36862
36863 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36864 mem_base = xmlMemBlocks();
36865 code = gen_int(n_code, 0);
36866
36867 ret_val = xmlUCSIsGreek(code);
36868 desret_int(ret_val);
36869 call_tests++;
36870 des_int(n_code, code, 0);
36871 xmlResetLastError();
36872 if (mem_base != xmlMemBlocks()) {
36873 printf("Leak of %d blocks found in xmlUCSIsGreek",
36874 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036875 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036876 printf(" %d", n_code);
36877 printf("\n");
36878 }
36879 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036880 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036881#endif
36882
Daniel Veillard42595322004-11-08 10:52:06 +000036883 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036884}
36885
36886
36887static int
36888test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036889 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036890
36891#ifdef LIBXML_UNICODE_ENABLED
36892 int mem_base;
36893 int ret_val;
36894 int code; /* UCS code point */
36895 int n_code;
36896
36897 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36898 mem_base = xmlMemBlocks();
36899 code = gen_int(n_code, 0);
36900
36901 ret_val = xmlUCSIsGreekExtended(code);
36902 desret_int(ret_val);
36903 call_tests++;
36904 des_int(n_code, code, 0);
36905 xmlResetLastError();
36906 if (mem_base != xmlMemBlocks()) {
36907 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
36908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036909 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036910 printf(" %d", n_code);
36911 printf("\n");
36912 }
36913 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036914 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036915#endif
36916
Daniel Veillard42595322004-11-08 10:52:06 +000036917 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036918}
36919
36920
36921static int
36922test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036923 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036924
36925#ifdef LIBXML_UNICODE_ENABLED
36926 int mem_base;
36927 int ret_val;
36928 int code; /* UCS code point */
36929 int n_code;
36930
36931 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36932 mem_base = xmlMemBlocks();
36933 code = gen_int(n_code, 0);
36934
36935 ret_val = xmlUCSIsGreekandCoptic(code);
36936 desret_int(ret_val);
36937 call_tests++;
36938 des_int(n_code, code, 0);
36939 xmlResetLastError();
36940 if (mem_base != xmlMemBlocks()) {
36941 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
36942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036943 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036944 printf(" %d", n_code);
36945 printf("\n");
36946 }
36947 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036948 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036949#endif
36950
Daniel Veillard42595322004-11-08 10:52:06 +000036951 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036952}
36953
36954
36955static int
36956test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036957 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036958
36959#ifdef LIBXML_UNICODE_ENABLED
36960 int mem_base;
36961 int ret_val;
36962 int code; /* UCS code point */
36963 int n_code;
36964
36965 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36966 mem_base = xmlMemBlocks();
36967 code = gen_int(n_code, 0);
36968
36969 ret_val = xmlUCSIsGujarati(code);
36970 desret_int(ret_val);
36971 call_tests++;
36972 des_int(n_code, code, 0);
36973 xmlResetLastError();
36974 if (mem_base != xmlMemBlocks()) {
36975 printf("Leak of %d blocks found in xmlUCSIsGujarati",
36976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036977 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036978 printf(" %d", n_code);
36979 printf("\n");
36980 }
36981 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036982 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036983#endif
36984
Daniel Veillard42595322004-11-08 10:52:06 +000036985 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036986}
36987
36988
36989static int
36990test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036991 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036992
36993#ifdef LIBXML_UNICODE_ENABLED
36994 int mem_base;
36995 int ret_val;
36996 int code; /* UCS code point */
36997 int n_code;
36998
36999 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37000 mem_base = xmlMemBlocks();
37001 code = gen_int(n_code, 0);
37002
37003 ret_val = xmlUCSIsGurmukhi(code);
37004 desret_int(ret_val);
37005 call_tests++;
37006 des_int(n_code, code, 0);
37007 xmlResetLastError();
37008 if (mem_base != xmlMemBlocks()) {
37009 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
37010 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037011 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037012 printf(" %d", n_code);
37013 printf("\n");
37014 }
37015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037016 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037017#endif
37018
Daniel Veillard42595322004-11-08 10:52:06 +000037019 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037020}
37021
37022
37023static int
37024test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037025 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037026
37027#ifdef LIBXML_UNICODE_ENABLED
37028 int mem_base;
37029 int ret_val;
37030 int code; /* UCS code point */
37031 int n_code;
37032
37033 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37034 mem_base = xmlMemBlocks();
37035 code = gen_int(n_code, 0);
37036
37037 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
37038 desret_int(ret_val);
37039 call_tests++;
37040 des_int(n_code, code, 0);
37041 xmlResetLastError();
37042 if (mem_base != xmlMemBlocks()) {
37043 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
37044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037045 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037046 printf(" %d", n_code);
37047 printf("\n");
37048 }
37049 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037050 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037051#endif
37052
Daniel Veillard42595322004-11-08 10:52:06 +000037053 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037054}
37055
37056
37057static int
37058test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037059 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037060
37061#ifdef LIBXML_UNICODE_ENABLED
37062 int mem_base;
37063 int ret_val;
37064 int code; /* UCS code point */
37065 int n_code;
37066
37067 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37068 mem_base = xmlMemBlocks();
37069 code = gen_int(n_code, 0);
37070
37071 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
37072 desret_int(ret_val);
37073 call_tests++;
37074 des_int(n_code, code, 0);
37075 xmlResetLastError();
37076 if (mem_base != xmlMemBlocks()) {
37077 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
37078 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037079 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037080 printf(" %d", n_code);
37081 printf("\n");
37082 }
37083 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037084 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037085#endif
37086
Daniel Veillard42595322004-11-08 10:52:06 +000037087 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037088}
37089
37090
37091static int
37092test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037093 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037094
37095#ifdef LIBXML_UNICODE_ENABLED
37096 int mem_base;
37097 int ret_val;
37098 int code; /* UCS code point */
37099 int n_code;
37100
37101 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37102 mem_base = xmlMemBlocks();
37103 code = gen_int(n_code, 0);
37104
37105 ret_val = xmlUCSIsHangulJamo(code);
37106 desret_int(ret_val);
37107 call_tests++;
37108 des_int(n_code, code, 0);
37109 xmlResetLastError();
37110 if (mem_base != xmlMemBlocks()) {
37111 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
37112 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037113 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037114 printf(" %d", n_code);
37115 printf("\n");
37116 }
37117 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037118 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037119#endif
37120
Daniel Veillard42595322004-11-08 10:52:06 +000037121 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037122}
37123
37124
37125static int
37126test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037127 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037128
37129#ifdef LIBXML_UNICODE_ENABLED
37130 int mem_base;
37131 int ret_val;
37132 int code; /* UCS code point */
37133 int n_code;
37134
37135 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37136 mem_base = xmlMemBlocks();
37137 code = gen_int(n_code, 0);
37138
37139 ret_val = xmlUCSIsHangulSyllables(code);
37140 desret_int(ret_val);
37141 call_tests++;
37142 des_int(n_code, code, 0);
37143 xmlResetLastError();
37144 if (mem_base != xmlMemBlocks()) {
37145 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
37146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037147 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037148 printf(" %d", n_code);
37149 printf("\n");
37150 }
37151 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037152 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037153#endif
37154
Daniel Veillard42595322004-11-08 10:52:06 +000037155 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037156}
37157
37158
37159static int
37160test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037161 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037162
37163#ifdef LIBXML_UNICODE_ENABLED
37164 int mem_base;
37165 int ret_val;
37166 int code; /* UCS code point */
37167 int n_code;
37168
37169 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37170 mem_base = xmlMemBlocks();
37171 code = gen_int(n_code, 0);
37172
37173 ret_val = xmlUCSIsHanunoo(code);
37174 desret_int(ret_val);
37175 call_tests++;
37176 des_int(n_code, code, 0);
37177 xmlResetLastError();
37178 if (mem_base != xmlMemBlocks()) {
37179 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
37180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037181 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037182 printf(" %d", n_code);
37183 printf("\n");
37184 }
37185 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037186 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037187#endif
37188
Daniel Veillard42595322004-11-08 10:52:06 +000037189 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037190}
37191
37192
37193static int
37194test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037195 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037196
37197#ifdef LIBXML_UNICODE_ENABLED
37198 int mem_base;
37199 int ret_val;
37200 int code; /* UCS code point */
37201 int n_code;
37202
37203 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37204 mem_base = xmlMemBlocks();
37205 code = gen_int(n_code, 0);
37206
37207 ret_val = xmlUCSIsHebrew(code);
37208 desret_int(ret_val);
37209 call_tests++;
37210 des_int(n_code, code, 0);
37211 xmlResetLastError();
37212 if (mem_base != xmlMemBlocks()) {
37213 printf("Leak of %d blocks found in xmlUCSIsHebrew",
37214 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037215 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037216 printf(" %d", n_code);
37217 printf("\n");
37218 }
37219 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037220 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037221#endif
37222
Daniel Veillard42595322004-11-08 10:52:06 +000037223 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037224}
37225
37226
37227static int
37228test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037229 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037230
37231#ifdef LIBXML_UNICODE_ENABLED
37232 int mem_base;
37233 int ret_val;
37234 int code; /* UCS code point */
37235 int n_code;
37236
37237 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37238 mem_base = xmlMemBlocks();
37239 code = gen_int(n_code, 0);
37240
37241 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
37242 desret_int(ret_val);
37243 call_tests++;
37244 des_int(n_code, code, 0);
37245 xmlResetLastError();
37246 if (mem_base != xmlMemBlocks()) {
37247 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
37248 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037249 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037250 printf(" %d", n_code);
37251 printf("\n");
37252 }
37253 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037254 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037255#endif
37256
Daniel Veillard42595322004-11-08 10:52:06 +000037257 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037258}
37259
37260
37261static int
37262test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037263 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037264
37265#ifdef LIBXML_UNICODE_ENABLED
37266 int mem_base;
37267 int ret_val;
37268 int code; /* UCS code point */
37269 int n_code;
37270
37271 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37272 mem_base = xmlMemBlocks();
37273 code = gen_int(n_code, 0);
37274
37275 ret_val = xmlUCSIsHighSurrogates(code);
37276 desret_int(ret_val);
37277 call_tests++;
37278 des_int(n_code, code, 0);
37279 xmlResetLastError();
37280 if (mem_base != xmlMemBlocks()) {
37281 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
37282 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037283 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037284 printf(" %d", n_code);
37285 printf("\n");
37286 }
37287 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037288 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037289#endif
37290
Daniel Veillard42595322004-11-08 10:52:06 +000037291 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037292}
37293
37294
37295static int
37296test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037297 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037298
37299#ifdef LIBXML_UNICODE_ENABLED
37300 int mem_base;
37301 int ret_val;
37302 int code; /* UCS code point */
37303 int n_code;
37304
37305 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37306 mem_base = xmlMemBlocks();
37307 code = gen_int(n_code, 0);
37308
37309 ret_val = xmlUCSIsHiragana(code);
37310 desret_int(ret_val);
37311 call_tests++;
37312 des_int(n_code, code, 0);
37313 xmlResetLastError();
37314 if (mem_base != xmlMemBlocks()) {
37315 printf("Leak of %d blocks found in xmlUCSIsHiragana",
37316 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037317 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037318 printf(" %d", n_code);
37319 printf("\n");
37320 }
37321 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037322 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037323#endif
37324
Daniel Veillard42595322004-11-08 10:52:06 +000037325 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037326}
37327
37328
37329static int
37330test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037331 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037332
37333#ifdef LIBXML_UNICODE_ENABLED
37334 int mem_base;
37335 int ret_val;
37336 int code; /* UCS code point */
37337 int n_code;
37338
37339 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37340 mem_base = xmlMemBlocks();
37341 code = gen_int(n_code, 0);
37342
37343 ret_val = xmlUCSIsIPAExtensions(code);
37344 desret_int(ret_val);
37345 call_tests++;
37346 des_int(n_code, code, 0);
37347 xmlResetLastError();
37348 if (mem_base != xmlMemBlocks()) {
37349 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
37350 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037351 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037352 printf(" %d", n_code);
37353 printf("\n");
37354 }
37355 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037356 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037357#endif
37358
Daniel Veillard42595322004-11-08 10:52:06 +000037359 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037360}
37361
37362
37363static int
37364test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037365 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037366
37367#ifdef LIBXML_UNICODE_ENABLED
37368 int mem_base;
37369 int ret_val;
37370 int code; /* UCS code point */
37371 int n_code;
37372
37373 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37374 mem_base = xmlMemBlocks();
37375 code = gen_int(n_code, 0);
37376
37377 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
37378 desret_int(ret_val);
37379 call_tests++;
37380 des_int(n_code, code, 0);
37381 xmlResetLastError();
37382 if (mem_base != xmlMemBlocks()) {
37383 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
37384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037385 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037386 printf(" %d", n_code);
37387 printf("\n");
37388 }
37389 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037390 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037391#endif
37392
Daniel Veillard42595322004-11-08 10:52:06 +000037393 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037394}
37395
37396
37397static int
37398test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037399 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037400
37401#ifdef LIBXML_UNICODE_ENABLED
37402 int mem_base;
37403 int ret_val;
37404 int code; /* UCS code point */
37405 int n_code;
37406
37407 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37408 mem_base = xmlMemBlocks();
37409 code = gen_int(n_code, 0);
37410
37411 ret_val = xmlUCSIsKanbun(code);
37412 desret_int(ret_val);
37413 call_tests++;
37414 des_int(n_code, code, 0);
37415 xmlResetLastError();
37416 if (mem_base != xmlMemBlocks()) {
37417 printf("Leak of %d blocks found in xmlUCSIsKanbun",
37418 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037419 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037420 printf(" %d", n_code);
37421 printf("\n");
37422 }
37423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037424 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037425#endif
37426
Daniel Veillard42595322004-11-08 10:52:06 +000037427 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037428}
37429
37430
37431static int
37432test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037433 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037434
37435#ifdef LIBXML_UNICODE_ENABLED
37436 int mem_base;
37437 int ret_val;
37438 int code; /* UCS code point */
37439 int n_code;
37440
37441 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37442 mem_base = xmlMemBlocks();
37443 code = gen_int(n_code, 0);
37444
37445 ret_val = xmlUCSIsKangxiRadicals(code);
37446 desret_int(ret_val);
37447 call_tests++;
37448 des_int(n_code, code, 0);
37449 xmlResetLastError();
37450 if (mem_base != xmlMemBlocks()) {
37451 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
37452 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037453 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037454 printf(" %d", n_code);
37455 printf("\n");
37456 }
37457 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037458 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037459#endif
37460
Daniel Veillard42595322004-11-08 10:52:06 +000037461 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037462}
37463
37464
37465static int
37466test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037467 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037468
37469#ifdef LIBXML_UNICODE_ENABLED
37470 int mem_base;
37471 int ret_val;
37472 int code; /* UCS code point */
37473 int n_code;
37474
37475 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37476 mem_base = xmlMemBlocks();
37477 code = gen_int(n_code, 0);
37478
37479 ret_val = xmlUCSIsKannada(code);
37480 desret_int(ret_val);
37481 call_tests++;
37482 des_int(n_code, code, 0);
37483 xmlResetLastError();
37484 if (mem_base != xmlMemBlocks()) {
37485 printf("Leak of %d blocks found in xmlUCSIsKannada",
37486 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037487 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037488 printf(" %d", n_code);
37489 printf("\n");
37490 }
37491 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037492 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037493#endif
37494
Daniel Veillard42595322004-11-08 10:52:06 +000037495 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037496}
37497
37498
37499static int
37500test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037501 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037502
37503#ifdef LIBXML_UNICODE_ENABLED
37504 int mem_base;
37505 int ret_val;
37506 int code; /* UCS code point */
37507 int n_code;
37508
37509 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37510 mem_base = xmlMemBlocks();
37511 code = gen_int(n_code, 0);
37512
37513 ret_val = xmlUCSIsKatakana(code);
37514 desret_int(ret_val);
37515 call_tests++;
37516 des_int(n_code, code, 0);
37517 xmlResetLastError();
37518 if (mem_base != xmlMemBlocks()) {
37519 printf("Leak of %d blocks found in xmlUCSIsKatakana",
37520 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037521 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037522 printf(" %d", n_code);
37523 printf("\n");
37524 }
37525 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037526 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037527#endif
37528
Daniel Veillard42595322004-11-08 10:52:06 +000037529 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037530}
37531
37532
37533static int
37534test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037535 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037536
37537#ifdef LIBXML_UNICODE_ENABLED
37538 int mem_base;
37539 int ret_val;
37540 int code; /* UCS code point */
37541 int n_code;
37542
37543 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37544 mem_base = xmlMemBlocks();
37545 code = gen_int(n_code, 0);
37546
37547 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
37548 desret_int(ret_val);
37549 call_tests++;
37550 des_int(n_code, code, 0);
37551 xmlResetLastError();
37552 if (mem_base != xmlMemBlocks()) {
37553 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
37554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037555 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037556 printf(" %d", n_code);
37557 printf("\n");
37558 }
37559 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037560 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037561#endif
37562
Daniel Veillard42595322004-11-08 10:52:06 +000037563 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037564}
37565
37566
37567static int
37568test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037569 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037570
37571#ifdef LIBXML_UNICODE_ENABLED
37572 int mem_base;
37573 int ret_val;
37574 int code; /* UCS code point */
37575 int n_code;
37576
37577 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37578 mem_base = xmlMemBlocks();
37579 code = gen_int(n_code, 0);
37580
37581 ret_val = xmlUCSIsKhmer(code);
37582 desret_int(ret_val);
37583 call_tests++;
37584 des_int(n_code, code, 0);
37585 xmlResetLastError();
37586 if (mem_base != xmlMemBlocks()) {
37587 printf("Leak of %d blocks found in xmlUCSIsKhmer",
37588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037589 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037590 printf(" %d", n_code);
37591 printf("\n");
37592 }
37593 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037594 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037595#endif
37596
Daniel Veillard42595322004-11-08 10:52:06 +000037597 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037598}
37599
37600
37601static int
37602test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037603 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037604
37605#ifdef LIBXML_UNICODE_ENABLED
37606 int mem_base;
37607 int ret_val;
37608 int code; /* UCS code point */
37609 int n_code;
37610
37611 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37612 mem_base = xmlMemBlocks();
37613 code = gen_int(n_code, 0);
37614
37615 ret_val = xmlUCSIsKhmerSymbols(code);
37616 desret_int(ret_val);
37617 call_tests++;
37618 des_int(n_code, code, 0);
37619 xmlResetLastError();
37620 if (mem_base != xmlMemBlocks()) {
37621 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
37622 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037623 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037624 printf(" %d", n_code);
37625 printf("\n");
37626 }
37627 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037628 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037629#endif
37630
Daniel Veillard42595322004-11-08 10:52:06 +000037631 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037632}
37633
37634
37635static int
37636test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037637 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037638
37639#ifdef LIBXML_UNICODE_ENABLED
37640 int mem_base;
37641 int ret_val;
37642 int code; /* UCS code point */
37643 int n_code;
37644
37645 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37646 mem_base = xmlMemBlocks();
37647 code = gen_int(n_code, 0);
37648
37649 ret_val = xmlUCSIsLao(code);
37650 desret_int(ret_val);
37651 call_tests++;
37652 des_int(n_code, code, 0);
37653 xmlResetLastError();
37654 if (mem_base != xmlMemBlocks()) {
37655 printf("Leak of %d blocks found in xmlUCSIsLao",
37656 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037657 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037658 printf(" %d", n_code);
37659 printf("\n");
37660 }
37661 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037662 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037663#endif
37664
Daniel Veillard42595322004-11-08 10:52:06 +000037665 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037666}
37667
37668
37669static int
37670test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037671 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037672
37673#ifdef LIBXML_UNICODE_ENABLED
37674 int mem_base;
37675 int ret_val;
37676 int code; /* UCS code point */
37677 int n_code;
37678
37679 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37680 mem_base = xmlMemBlocks();
37681 code = gen_int(n_code, 0);
37682
37683 ret_val = xmlUCSIsLatin1Supplement(code);
37684 desret_int(ret_val);
37685 call_tests++;
37686 des_int(n_code, code, 0);
37687 xmlResetLastError();
37688 if (mem_base != xmlMemBlocks()) {
37689 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
37690 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037691 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037692 printf(" %d", n_code);
37693 printf("\n");
37694 }
37695 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037696 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037697#endif
37698
Daniel Veillard42595322004-11-08 10:52:06 +000037699 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037700}
37701
37702
37703static int
37704test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037705 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037706
37707#ifdef LIBXML_UNICODE_ENABLED
37708 int mem_base;
37709 int ret_val;
37710 int code; /* UCS code point */
37711 int n_code;
37712
37713 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37714 mem_base = xmlMemBlocks();
37715 code = gen_int(n_code, 0);
37716
37717 ret_val = xmlUCSIsLatinExtendedA(code);
37718 desret_int(ret_val);
37719 call_tests++;
37720 des_int(n_code, code, 0);
37721 xmlResetLastError();
37722 if (mem_base != xmlMemBlocks()) {
37723 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
37724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037725 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037726 printf(" %d", n_code);
37727 printf("\n");
37728 }
37729 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037730 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037731#endif
37732
Daniel Veillard42595322004-11-08 10:52:06 +000037733 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037734}
37735
37736
37737static int
37738test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037739 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037740
37741#ifdef LIBXML_UNICODE_ENABLED
37742 int mem_base;
37743 int ret_val;
37744 int code; /* UCS code point */
37745 int n_code;
37746
37747 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37748 mem_base = xmlMemBlocks();
37749 code = gen_int(n_code, 0);
37750
37751 ret_val = xmlUCSIsLatinExtendedAdditional(code);
37752 desret_int(ret_val);
37753 call_tests++;
37754 des_int(n_code, code, 0);
37755 xmlResetLastError();
37756 if (mem_base != xmlMemBlocks()) {
37757 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
37758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037759 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037760 printf(" %d", n_code);
37761 printf("\n");
37762 }
37763 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037764 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037765#endif
37766
Daniel Veillard42595322004-11-08 10:52:06 +000037767 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037768}
37769
37770
37771static int
37772test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037773 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037774
37775#ifdef LIBXML_UNICODE_ENABLED
37776 int mem_base;
37777 int ret_val;
37778 int code; /* UCS code point */
37779 int n_code;
37780
37781 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37782 mem_base = xmlMemBlocks();
37783 code = gen_int(n_code, 0);
37784
37785 ret_val = xmlUCSIsLatinExtendedB(code);
37786 desret_int(ret_val);
37787 call_tests++;
37788 des_int(n_code, code, 0);
37789 xmlResetLastError();
37790 if (mem_base != xmlMemBlocks()) {
37791 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
37792 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037793 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037794 printf(" %d", n_code);
37795 printf("\n");
37796 }
37797 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037798 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037799#endif
37800
Daniel Veillard42595322004-11-08 10:52:06 +000037801 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037802}
37803
37804
37805static int
37806test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037807 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037808
37809#ifdef LIBXML_UNICODE_ENABLED
37810 int mem_base;
37811 int ret_val;
37812 int code; /* UCS code point */
37813 int n_code;
37814
37815 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37816 mem_base = xmlMemBlocks();
37817 code = gen_int(n_code, 0);
37818
37819 ret_val = xmlUCSIsLetterlikeSymbols(code);
37820 desret_int(ret_val);
37821 call_tests++;
37822 des_int(n_code, code, 0);
37823 xmlResetLastError();
37824 if (mem_base != xmlMemBlocks()) {
37825 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
37826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037827 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037828 printf(" %d", n_code);
37829 printf("\n");
37830 }
37831 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037832 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037833#endif
37834
Daniel Veillard42595322004-11-08 10:52:06 +000037835 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037836}
37837
37838
37839static int
37840test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037841 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037842
37843#ifdef LIBXML_UNICODE_ENABLED
37844 int mem_base;
37845 int ret_val;
37846 int code; /* UCS code point */
37847 int n_code;
37848
37849 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37850 mem_base = xmlMemBlocks();
37851 code = gen_int(n_code, 0);
37852
37853 ret_val = xmlUCSIsLimbu(code);
37854 desret_int(ret_val);
37855 call_tests++;
37856 des_int(n_code, code, 0);
37857 xmlResetLastError();
37858 if (mem_base != xmlMemBlocks()) {
37859 printf("Leak of %d blocks found in xmlUCSIsLimbu",
37860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037861 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037862 printf(" %d", n_code);
37863 printf("\n");
37864 }
37865 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037866 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037867#endif
37868
Daniel Veillard42595322004-11-08 10:52:06 +000037869 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037870}
37871
37872
37873static int
37874test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037875 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037876
37877#ifdef LIBXML_UNICODE_ENABLED
37878 int mem_base;
37879 int ret_val;
37880 int code; /* UCS code point */
37881 int n_code;
37882
37883 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37884 mem_base = xmlMemBlocks();
37885 code = gen_int(n_code, 0);
37886
37887 ret_val = xmlUCSIsLinearBIdeograms(code);
37888 desret_int(ret_val);
37889 call_tests++;
37890 des_int(n_code, code, 0);
37891 xmlResetLastError();
37892 if (mem_base != xmlMemBlocks()) {
37893 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
37894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037895 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037896 printf(" %d", n_code);
37897 printf("\n");
37898 }
37899 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037900 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037901#endif
37902
Daniel Veillard42595322004-11-08 10:52:06 +000037903 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037904}
37905
37906
37907static int
37908test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037909 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037910
37911#ifdef LIBXML_UNICODE_ENABLED
37912 int mem_base;
37913 int ret_val;
37914 int code; /* UCS code point */
37915 int n_code;
37916
37917 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37918 mem_base = xmlMemBlocks();
37919 code = gen_int(n_code, 0);
37920
37921 ret_val = xmlUCSIsLinearBSyllabary(code);
37922 desret_int(ret_val);
37923 call_tests++;
37924 des_int(n_code, code, 0);
37925 xmlResetLastError();
37926 if (mem_base != xmlMemBlocks()) {
37927 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
37928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037929 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037930 printf(" %d", n_code);
37931 printf("\n");
37932 }
37933 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037934 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037935#endif
37936
Daniel Veillard42595322004-11-08 10:52:06 +000037937 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037938}
37939
37940
37941static int
37942test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037943 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037944
37945#ifdef LIBXML_UNICODE_ENABLED
37946 int mem_base;
37947 int ret_val;
37948 int code; /* UCS code point */
37949 int n_code;
37950
37951 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37952 mem_base = xmlMemBlocks();
37953 code = gen_int(n_code, 0);
37954
37955 ret_val = xmlUCSIsLowSurrogates(code);
37956 desret_int(ret_val);
37957 call_tests++;
37958 des_int(n_code, code, 0);
37959 xmlResetLastError();
37960 if (mem_base != xmlMemBlocks()) {
37961 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
37962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037963 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037964 printf(" %d", n_code);
37965 printf("\n");
37966 }
37967 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037968 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037969#endif
37970
Daniel Veillard42595322004-11-08 10:52:06 +000037971 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037972}
37973
37974
37975static int
37976test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037977 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037978
37979#ifdef LIBXML_UNICODE_ENABLED
37980 int mem_base;
37981 int ret_val;
37982 int code; /* UCS code point */
37983 int n_code;
37984
37985 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37986 mem_base = xmlMemBlocks();
37987 code = gen_int(n_code, 0);
37988
37989 ret_val = xmlUCSIsMalayalam(code);
37990 desret_int(ret_val);
37991 call_tests++;
37992 des_int(n_code, code, 0);
37993 xmlResetLastError();
37994 if (mem_base != xmlMemBlocks()) {
37995 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
37996 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037997 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037998 printf(" %d", n_code);
37999 printf("\n");
38000 }
38001 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038002 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038003#endif
38004
Daniel Veillard42595322004-11-08 10:52:06 +000038005 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038006}
38007
38008
38009static int
38010test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038011 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038012
38013#ifdef LIBXML_UNICODE_ENABLED
38014 int mem_base;
38015 int ret_val;
38016 int code; /* UCS code point */
38017 int n_code;
38018
38019 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38020 mem_base = xmlMemBlocks();
38021 code = gen_int(n_code, 0);
38022
38023 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
38024 desret_int(ret_val);
38025 call_tests++;
38026 des_int(n_code, code, 0);
38027 xmlResetLastError();
38028 if (mem_base != xmlMemBlocks()) {
38029 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
38030 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038031 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038032 printf(" %d", n_code);
38033 printf("\n");
38034 }
38035 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038036 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038037#endif
38038
Daniel Veillard42595322004-11-08 10:52:06 +000038039 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038040}
38041
38042
38043static int
38044test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038045 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038046
38047#ifdef LIBXML_UNICODE_ENABLED
38048 int mem_base;
38049 int ret_val;
38050 int code; /* UCS code point */
38051 int n_code;
38052
38053 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38054 mem_base = xmlMemBlocks();
38055 code = gen_int(n_code, 0);
38056
38057 ret_val = xmlUCSIsMathematicalOperators(code);
38058 desret_int(ret_val);
38059 call_tests++;
38060 des_int(n_code, code, 0);
38061 xmlResetLastError();
38062 if (mem_base != xmlMemBlocks()) {
38063 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
38064 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038065 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038066 printf(" %d", n_code);
38067 printf("\n");
38068 }
38069 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038070 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038071#endif
38072
Daniel Veillard42595322004-11-08 10:52:06 +000038073 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038074}
38075
38076
38077static int
38078test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038079 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038080
38081#ifdef LIBXML_UNICODE_ENABLED
38082 int mem_base;
38083 int ret_val;
38084 int code; /* UCS code point */
38085 int n_code;
38086
38087 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38088 mem_base = xmlMemBlocks();
38089 code = gen_int(n_code, 0);
38090
38091 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
38092 desret_int(ret_val);
38093 call_tests++;
38094 des_int(n_code, code, 0);
38095 xmlResetLastError();
38096 if (mem_base != xmlMemBlocks()) {
38097 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
38098 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038099 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038100 printf(" %d", n_code);
38101 printf("\n");
38102 }
38103 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038104 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038105#endif
38106
Daniel Veillard42595322004-11-08 10:52:06 +000038107 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038108}
38109
38110
38111static int
38112test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038113 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038114
38115#ifdef LIBXML_UNICODE_ENABLED
38116 int mem_base;
38117 int ret_val;
38118 int code; /* UCS code point */
38119 int n_code;
38120
38121 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38122 mem_base = xmlMemBlocks();
38123 code = gen_int(n_code, 0);
38124
38125 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
38126 desret_int(ret_val);
38127 call_tests++;
38128 des_int(n_code, code, 0);
38129 xmlResetLastError();
38130 if (mem_base != xmlMemBlocks()) {
38131 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
38132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038133 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038134 printf(" %d", n_code);
38135 printf("\n");
38136 }
38137 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038138 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038139#endif
38140
Daniel Veillard42595322004-11-08 10:52:06 +000038141 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038142}
38143
38144
38145static int
38146test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038147 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038148
38149#ifdef LIBXML_UNICODE_ENABLED
38150 int mem_base;
38151 int ret_val;
38152 int code; /* UCS code point */
38153 int n_code;
38154
38155 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38156 mem_base = xmlMemBlocks();
38157 code = gen_int(n_code, 0);
38158
38159 ret_val = xmlUCSIsMiscellaneousSymbols(code);
38160 desret_int(ret_val);
38161 call_tests++;
38162 des_int(n_code, code, 0);
38163 xmlResetLastError();
38164 if (mem_base != xmlMemBlocks()) {
38165 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
38166 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038167 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038168 printf(" %d", n_code);
38169 printf("\n");
38170 }
38171 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038172 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038173#endif
38174
Daniel Veillard42595322004-11-08 10:52:06 +000038175 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038176}
38177
38178
38179static int
38180test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038181 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038182
38183#ifdef LIBXML_UNICODE_ENABLED
38184 int mem_base;
38185 int ret_val;
38186 int code; /* UCS code point */
38187 int n_code;
38188
38189 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38190 mem_base = xmlMemBlocks();
38191 code = gen_int(n_code, 0);
38192
38193 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
38194 desret_int(ret_val);
38195 call_tests++;
38196 des_int(n_code, code, 0);
38197 xmlResetLastError();
38198 if (mem_base != xmlMemBlocks()) {
38199 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
38200 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038201 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038202 printf(" %d", n_code);
38203 printf("\n");
38204 }
38205 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038206 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038207#endif
38208
Daniel Veillard42595322004-11-08 10:52:06 +000038209 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038210}
38211
38212
38213static int
38214test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038215 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038216
38217#ifdef LIBXML_UNICODE_ENABLED
38218 int mem_base;
38219 int ret_val;
38220 int code; /* UCS code point */
38221 int n_code;
38222
38223 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38224 mem_base = xmlMemBlocks();
38225 code = gen_int(n_code, 0);
38226
38227 ret_val = xmlUCSIsMiscellaneousTechnical(code);
38228 desret_int(ret_val);
38229 call_tests++;
38230 des_int(n_code, code, 0);
38231 xmlResetLastError();
38232 if (mem_base != xmlMemBlocks()) {
38233 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
38234 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038235 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038236 printf(" %d", n_code);
38237 printf("\n");
38238 }
38239 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038240 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038241#endif
38242
Daniel Veillard42595322004-11-08 10:52:06 +000038243 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038244}
38245
38246
38247static int
38248test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038249 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038250
38251#ifdef LIBXML_UNICODE_ENABLED
38252 int mem_base;
38253 int ret_val;
38254 int code; /* UCS code point */
38255 int n_code;
38256
38257 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38258 mem_base = xmlMemBlocks();
38259 code = gen_int(n_code, 0);
38260
38261 ret_val = xmlUCSIsMongolian(code);
38262 desret_int(ret_val);
38263 call_tests++;
38264 des_int(n_code, code, 0);
38265 xmlResetLastError();
38266 if (mem_base != xmlMemBlocks()) {
38267 printf("Leak of %d blocks found in xmlUCSIsMongolian",
38268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038269 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038270 printf(" %d", n_code);
38271 printf("\n");
38272 }
38273 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038274 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038275#endif
38276
Daniel Veillard42595322004-11-08 10:52:06 +000038277 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038278}
38279
38280
38281static int
38282test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038283 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038284
38285#ifdef LIBXML_UNICODE_ENABLED
38286 int mem_base;
38287 int ret_val;
38288 int code; /* UCS code point */
38289 int n_code;
38290
38291 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38292 mem_base = xmlMemBlocks();
38293 code = gen_int(n_code, 0);
38294
38295 ret_val = xmlUCSIsMusicalSymbols(code);
38296 desret_int(ret_val);
38297 call_tests++;
38298 des_int(n_code, code, 0);
38299 xmlResetLastError();
38300 if (mem_base != xmlMemBlocks()) {
38301 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
38302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038303 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038304 printf(" %d", n_code);
38305 printf("\n");
38306 }
38307 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038308 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038309#endif
38310
Daniel Veillard42595322004-11-08 10:52:06 +000038311 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038312}
38313
38314
38315static int
38316test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038317 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038318
38319#ifdef LIBXML_UNICODE_ENABLED
38320 int mem_base;
38321 int ret_val;
38322 int code; /* UCS code point */
38323 int n_code;
38324
38325 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38326 mem_base = xmlMemBlocks();
38327 code = gen_int(n_code, 0);
38328
38329 ret_val = xmlUCSIsMyanmar(code);
38330 desret_int(ret_val);
38331 call_tests++;
38332 des_int(n_code, code, 0);
38333 xmlResetLastError();
38334 if (mem_base != xmlMemBlocks()) {
38335 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
38336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038337 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038338 printf(" %d", n_code);
38339 printf("\n");
38340 }
38341 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038342 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038343#endif
38344
Daniel Veillard42595322004-11-08 10:52:06 +000038345 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038346}
38347
38348
38349static int
38350test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038351 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038352
38353#ifdef LIBXML_UNICODE_ENABLED
38354 int mem_base;
38355 int ret_val;
38356 int code; /* UCS code point */
38357 int n_code;
38358
38359 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38360 mem_base = xmlMemBlocks();
38361 code = gen_int(n_code, 0);
38362
38363 ret_val = xmlUCSIsNumberForms(code);
38364 desret_int(ret_val);
38365 call_tests++;
38366 des_int(n_code, code, 0);
38367 xmlResetLastError();
38368 if (mem_base != xmlMemBlocks()) {
38369 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
38370 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038371 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038372 printf(" %d", n_code);
38373 printf("\n");
38374 }
38375 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038376 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038377#endif
38378
Daniel Veillard42595322004-11-08 10:52:06 +000038379 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038380}
38381
38382
38383static int
38384test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038385 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038386
38387#ifdef LIBXML_UNICODE_ENABLED
38388 int mem_base;
38389 int ret_val;
38390 int code; /* UCS code point */
38391 int n_code;
38392
38393 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38394 mem_base = xmlMemBlocks();
38395 code = gen_int(n_code, 0);
38396
38397 ret_val = xmlUCSIsOgham(code);
38398 desret_int(ret_val);
38399 call_tests++;
38400 des_int(n_code, code, 0);
38401 xmlResetLastError();
38402 if (mem_base != xmlMemBlocks()) {
38403 printf("Leak of %d blocks found in xmlUCSIsOgham",
38404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038405 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038406 printf(" %d", n_code);
38407 printf("\n");
38408 }
38409 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038410 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038411#endif
38412
Daniel Veillard42595322004-11-08 10:52:06 +000038413 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038414}
38415
38416
38417static int
38418test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038419 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038420
38421#ifdef LIBXML_UNICODE_ENABLED
38422 int mem_base;
38423 int ret_val;
38424 int code; /* UCS code point */
38425 int n_code;
38426
38427 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38428 mem_base = xmlMemBlocks();
38429 code = gen_int(n_code, 0);
38430
38431 ret_val = xmlUCSIsOldItalic(code);
38432 desret_int(ret_val);
38433 call_tests++;
38434 des_int(n_code, code, 0);
38435 xmlResetLastError();
38436 if (mem_base != xmlMemBlocks()) {
38437 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
38438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038439 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038440 printf(" %d", n_code);
38441 printf("\n");
38442 }
38443 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038444 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038445#endif
38446
Daniel Veillard42595322004-11-08 10:52:06 +000038447 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038448}
38449
38450
38451static int
38452test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038453 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038454
38455#ifdef LIBXML_UNICODE_ENABLED
38456 int mem_base;
38457 int ret_val;
38458 int code; /* UCS code point */
38459 int n_code;
38460
38461 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38462 mem_base = xmlMemBlocks();
38463 code = gen_int(n_code, 0);
38464
38465 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
38466 desret_int(ret_val);
38467 call_tests++;
38468 des_int(n_code, code, 0);
38469 xmlResetLastError();
38470 if (mem_base != xmlMemBlocks()) {
38471 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
38472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038473 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038474 printf(" %d", n_code);
38475 printf("\n");
38476 }
38477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038478 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038479#endif
38480
Daniel Veillard42595322004-11-08 10:52:06 +000038481 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038482}
38483
38484
38485static int
38486test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038487 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038488
38489#ifdef LIBXML_UNICODE_ENABLED
38490 int mem_base;
38491 int ret_val;
38492 int code; /* UCS code point */
38493 int n_code;
38494
38495 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38496 mem_base = xmlMemBlocks();
38497 code = gen_int(n_code, 0);
38498
38499 ret_val = xmlUCSIsOriya(code);
38500 desret_int(ret_val);
38501 call_tests++;
38502 des_int(n_code, code, 0);
38503 xmlResetLastError();
38504 if (mem_base != xmlMemBlocks()) {
38505 printf("Leak of %d blocks found in xmlUCSIsOriya",
38506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038507 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038508 printf(" %d", n_code);
38509 printf("\n");
38510 }
38511 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038512 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038513#endif
38514
Daniel Veillard42595322004-11-08 10:52:06 +000038515 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038516}
38517
38518
38519static int
38520test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038521 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038522
38523#ifdef LIBXML_UNICODE_ENABLED
38524 int mem_base;
38525 int ret_val;
38526 int code; /* UCS code point */
38527 int n_code;
38528
38529 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38530 mem_base = xmlMemBlocks();
38531 code = gen_int(n_code, 0);
38532
38533 ret_val = xmlUCSIsOsmanya(code);
38534 desret_int(ret_val);
38535 call_tests++;
38536 des_int(n_code, code, 0);
38537 xmlResetLastError();
38538 if (mem_base != xmlMemBlocks()) {
38539 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
38540 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038541 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038542 printf(" %d", n_code);
38543 printf("\n");
38544 }
38545 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038546 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038547#endif
38548
Daniel Veillard42595322004-11-08 10:52:06 +000038549 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038550}
38551
38552
38553static int
38554test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038555 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038556
38557#ifdef LIBXML_UNICODE_ENABLED
38558 int mem_base;
38559 int ret_val;
38560 int code; /* UCS code point */
38561 int n_code;
38562
38563 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38564 mem_base = xmlMemBlocks();
38565 code = gen_int(n_code, 0);
38566
38567 ret_val = xmlUCSIsPhoneticExtensions(code);
38568 desret_int(ret_val);
38569 call_tests++;
38570 des_int(n_code, code, 0);
38571 xmlResetLastError();
38572 if (mem_base != xmlMemBlocks()) {
38573 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
38574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038575 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038576 printf(" %d", n_code);
38577 printf("\n");
38578 }
38579 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038580 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038581#endif
38582
Daniel Veillard42595322004-11-08 10:52:06 +000038583 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038584}
38585
38586
38587static int
38588test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038589 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038590
38591#ifdef LIBXML_UNICODE_ENABLED
38592 int mem_base;
38593 int ret_val;
38594 int code; /* UCS code point */
38595 int n_code;
38596
38597 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38598 mem_base = xmlMemBlocks();
38599 code = gen_int(n_code, 0);
38600
38601 ret_val = xmlUCSIsPrivateUse(code);
38602 desret_int(ret_val);
38603 call_tests++;
38604 des_int(n_code, code, 0);
38605 xmlResetLastError();
38606 if (mem_base != xmlMemBlocks()) {
38607 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
38608 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038609 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038610 printf(" %d", n_code);
38611 printf("\n");
38612 }
38613 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038614 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038615#endif
38616
Daniel Veillard42595322004-11-08 10:52:06 +000038617 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038618}
38619
38620
38621static int
38622test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038623 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038624
38625#ifdef LIBXML_UNICODE_ENABLED
38626 int mem_base;
38627 int ret_val;
38628 int code; /* UCS code point */
38629 int n_code;
38630
38631 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38632 mem_base = xmlMemBlocks();
38633 code = gen_int(n_code, 0);
38634
38635 ret_val = xmlUCSIsPrivateUseArea(code);
38636 desret_int(ret_val);
38637 call_tests++;
38638 des_int(n_code, code, 0);
38639 xmlResetLastError();
38640 if (mem_base != xmlMemBlocks()) {
38641 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
38642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038643 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038644 printf(" %d", n_code);
38645 printf("\n");
38646 }
38647 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038648 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038649#endif
38650
Daniel Veillard42595322004-11-08 10:52:06 +000038651 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038652}
38653
38654
38655static int
38656test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038657 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038658
38659#ifdef LIBXML_UNICODE_ENABLED
38660 int mem_base;
38661 int ret_val;
38662 int code; /* UCS code point */
38663 int n_code;
38664
38665 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38666 mem_base = xmlMemBlocks();
38667 code = gen_int(n_code, 0);
38668
38669 ret_val = xmlUCSIsRunic(code);
38670 desret_int(ret_val);
38671 call_tests++;
38672 des_int(n_code, code, 0);
38673 xmlResetLastError();
38674 if (mem_base != xmlMemBlocks()) {
38675 printf("Leak of %d blocks found in xmlUCSIsRunic",
38676 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038677 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038678 printf(" %d", n_code);
38679 printf("\n");
38680 }
38681 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038682 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038683#endif
38684
Daniel Veillard42595322004-11-08 10:52:06 +000038685 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038686}
38687
38688
38689static int
38690test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038691 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038692
38693#ifdef LIBXML_UNICODE_ENABLED
38694 int mem_base;
38695 int ret_val;
38696 int code; /* UCS code point */
38697 int n_code;
38698
38699 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38700 mem_base = xmlMemBlocks();
38701 code = gen_int(n_code, 0);
38702
38703 ret_val = xmlUCSIsShavian(code);
38704 desret_int(ret_val);
38705 call_tests++;
38706 des_int(n_code, code, 0);
38707 xmlResetLastError();
38708 if (mem_base != xmlMemBlocks()) {
38709 printf("Leak of %d blocks found in xmlUCSIsShavian",
38710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038711 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038712 printf(" %d", n_code);
38713 printf("\n");
38714 }
38715 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038716 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038717#endif
38718
Daniel Veillard42595322004-11-08 10:52:06 +000038719 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038720}
38721
38722
38723static int
38724test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038725 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038726
38727#ifdef LIBXML_UNICODE_ENABLED
38728 int mem_base;
38729 int ret_val;
38730 int code; /* UCS code point */
38731 int n_code;
38732
38733 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38734 mem_base = xmlMemBlocks();
38735 code = gen_int(n_code, 0);
38736
38737 ret_val = xmlUCSIsSinhala(code);
38738 desret_int(ret_val);
38739 call_tests++;
38740 des_int(n_code, code, 0);
38741 xmlResetLastError();
38742 if (mem_base != xmlMemBlocks()) {
38743 printf("Leak of %d blocks found in xmlUCSIsSinhala",
38744 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038745 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038746 printf(" %d", n_code);
38747 printf("\n");
38748 }
38749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038750 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038751#endif
38752
Daniel Veillard42595322004-11-08 10:52:06 +000038753 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038754}
38755
38756
38757static int
38758test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038759 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038760
38761#ifdef LIBXML_UNICODE_ENABLED
38762 int mem_base;
38763 int ret_val;
38764 int code; /* UCS code point */
38765 int n_code;
38766
38767 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38768 mem_base = xmlMemBlocks();
38769 code = gen_int(n_code, 0);
38770
38771 ret_val = xmlUCSIsSmallFormVariants(code);
38772 desret_int(ret_val);
38773 call_tests++;
38774 des_int(n_code, code, 0);
38775 xmlResetLastError();
38776 if (mem_base != xmlMemBlocks()) {
38777 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
38778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038779 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038780 printf(" %d", n_code);
38781 printf("\n");
38782 }
38783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038784 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038785#endif
38786
Daniel Veillard42595322004-11-08 10:52:06 +000038787 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038788}
38789
38790
38791static int
38792test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038793 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038794
38795#ifdef LIBXML_UNICODE_ENABLED
38796 int mem_base;
38797 int ret_val;
38798 int code; /* UCS code point */
38799 int n_code;
38800
38801 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38802 mem_base = xmlMemBlocks();
38803 code = gen_int(n_code, 0);
38804
38805 ret_val = xmlUCSIsSpacingModifierLetters(code);
38806 desret_int(ret_val);
38807 call_tests++;
38808 des_int(n_code, code, 0);
38809 xmlResetLastError();
38810 if (mem_base != xmlMemBlocks()) {
38811 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
38812 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038813 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038814 printf(" %d", n_code);
38815 printf("\n");
38816 }
38817 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038818 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038819#endif
38820
Daniel Veillard42595322004-11-08 10:52:06 +000038821 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038822}
38823
38824
38825static int
38826test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038827 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038828
38829#ifdef LIBXML_UNICODE_ENABLED
38830 int mem_base;
38831 int ret_val;
38832 int code; /* UCS code point */
38833 int n_code;
38834
38835 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38836 mem_base = xmlMemBlocks();
38837 code = gen_int(n_code, 0);
38838
38839 ret_val = xmlUCSIsSpecials(code);
38840 desret_int(ret_val);
38841 call_tests++;
38842 des_int(n_code, code, 0);
38843 xmlResetLastError();
38844 if (mem_base != xmlMemBlocks()) {
38845 printf("Leak of %d blocks found in xmlUCSIsSpecials",
38846 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038847 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038848 printf(" %d", n_code);
38849 printf("\n");
38850 }
38851 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038852 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038853#endif
38854
Daniel Veillard42595322004-11-08 10:52:06 +000038855 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038856}
38857
38858
38859static int
38860test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038861 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038862
38863#ifdef LIBXML_UNICODE_ENABLED
38864 int mem_base;
38865 int ret_val;
38866 int code; /* UCS code point */
38867 int n_code;
38868
38869 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38870 mem_base = xmlMemBlocks();
38871 code = gen_int(n_code, 0);
38872
38873 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
38874 desret_int(ret_val);
38875 call_tests++;
38876 des_int(n_code, code, 0);
38877 xmlResetLastError();
38878 if (mem_base != xmlMemBlocks()) {
38879 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
38880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038881 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038882 printf(" %d", n_code);
38883 printf("\n");
38884 }
38885 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038886 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038887#endif
38888
Daniel Veillard42595322004-11-08 10:52:06 +000038889 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038890}
38891
38892
38893static int
38894test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038895 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038896
38897#ifdef LIBXML_UNICODE_ENABLED
38898 int mem_base;
38899 int ret_val;
38900 int code; /* UCS code point */
38901 int n_code;
38902
38903 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38904 mem_base = xmlMemBlocks();
38905 code = gen_int(n_code, 0);
38906
38907 ret_val = xmlUCSIsSupplementalArrowsA(code);
38908 desret_int(ret_val);
38909 call_tests++;
38910 des_int(n_code, code, 0);
38911 xmlResetLastError();
38912 if (mem_base != xmlMemBlocks()) {
38913 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
38914 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038915 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038916 printf(" %d", n_code);
38917 printf("\n");
38918 }
38919 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038920 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038921#endif
38922
Daniel Veillard42595322004-11-08 10:52:06 +000038923 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038924}
38925
38926
38927static int
38928test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038929 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038930
38931#ifdef LIBXML_UNICODE_ENABLED
38932 int mem_base;
38933 int ret_val;
38934 int code; /* UCS code point */
38935 int n_code;
38936
38937 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38938 mem_base = xmlMemBlocks();
38939 code = gen_int(n_code, 0);
38940
38941 ret_val = xmlUCSIsSupplementalArrowsB(code);
38942 desret_int(ret_val);
38943 call_tests++;
38944 des_int(n_code, code, 0);
38945 xmlResetLastError();
38946 if (mem_base != xmlMemBlocks()) {
38947 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
38948 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038949 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038950 printf(" %d", n_code);
38951 printf("\n");
38952 }
38953 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038954 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038955#endif
38956
Daniel Veillard42595322004-11-08 10:52:06 +000038957 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038958}
38959
38960
38961static int
38962test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038963 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038964
38965#ifdef LIBXML_UNICODE_ENABLED
38966 int mem_base;
38967 int ret_val;
38968 int code; /* UCS code point */
38969 int n_code;
38970
38971 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38972 mem_base = xmlMemBlocks();
38973 code = gen_int(n_code, 0);
38974
38975 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
38976 desret_int(ret_val);
38977 call_tests++;
38978 des_int(n_code, code, 0);
38979 xmlResetLastError();
38980 if (mem_base != xmlMemBlocks()) {
38981 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
38982 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038983 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038984 printf(" %d", n_code);
38985 printf("\n");
38986 }
38987 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038988 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038989#endif
38990
Daniel Veillard42595322004-11-08 10:52:06 +000038991 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038992}
38993
38994
38995static int
38996test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038997 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038998
38999#ifdef LIBXML_UNICODE_ENABLED
39000 int mem_base;
39001 int ret_val;
39002 int code; /* UCS code point */
39003 int n_code;
39004
39005 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39006 mem_base = xmlMemBlocks();
39007 code = gen_int(n_code, 0);
39008
39009 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
39010 desret_int(ret_val);
39011 call_tests++;
39012 des_int(n_code, code, 0);
39013 xmlResetLastError();
39014 if (mem_base != xmlMemBlocks()) {
39015 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
39016 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039017 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039018 printf(" %d", n_code);
39019 printf("\n");
39020 }
39021 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039022 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039023#endif
39024
Daniel Veillard42595322004-11-08 10:52:06 +000039025 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039026}
39027
39028
39029static int
39030test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039031 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039032
39033#ifdef LIBXML_UNICODE_ENABLED
39034 int mem_base;
39035 int ret_val;
39036 int code; /* UCS code point */
39037 int n_code;
39038
39039 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39040 mem_base = xmlMemBlocks();
39041 code = gen_int(n_code, 0);
39042
39043 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
39044 desret_int(ret_val);
39045 call_tests++;
39046 des_int(n_code, code, 0);
39047 xmlResetLastError();
39048 if (mem_base != xmlMemBlocks()) {
39049 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
39050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039051 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039052 printf(" %d", n_code);
39053 printf("\n");
39054 }
39055 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039056 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039057#endif
39058
Daniel Veillard42595322004-11-08 10:52:06 +000039059 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039060}
39061
39062
39063static int
39064test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039065 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039066
39067#ifdef LIBXML_UNICODE_ENABLED
39068 int mem_base;
39069 int ret_val;
39070 int code; /* UCS code point */
39071 int n_code;
39072
39073 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39074 mem_base = xmlMemBlocks();
39075 code = gen_int(n_code, 0);
39076
39077 ret_val = xmlUCSIsSyriac(code);
39078 desret_int(ret_val);
39079 call_tests++;
39080 des_int(n_code, code, 0);
39081 xmlResetLastError();
39082 if (mem_base != xmlMemBlocks()) {
39083 printf("Leak of %d blocks found in xmlUCSIsSyriac",
39084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039085 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039086 printf(" %d", n_code);
39087 printf("\n");
39088 }
39089 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039090 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039091#endif
39092
Daniel Veillard42595322004-11-08 10:52:06 +000039093 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039094}
39095
39096
39097static int
39098test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039099 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039100
39101#ifdef LIBXML_UNICODE_ENABLED
39102 int mem_base;
39103 int ret_val;
39104 int code; /* UCS code point */
39105 int n_code;
39106
39107 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39108 mem_base = xmlMemBlocks();
39109 code = gen_int(n_code, 0);
39110
39111 ret_val = xmlUCSIsTagalog(code);
39112 desret_int(ret_val);
39113 call_tests++;
39114 des_int(n_code, code, 0);
39115 xmlResetLastError();
39116 if (mem_base != xmlMemBlocks()) {
39117 printf("Leak of %d blocks found in xmlUCSIsTagalog",
39118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039119 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039120 printf(" %d", n_code);
39121 printf("\n");
39122 }
39123 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039124 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039125#endif
39126
Daniel Veillard42595322004-11-08 10:52:06 +000039127 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039128}
39129
39130
39131static int
39132test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039133 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039134
39135#ifdef LIBXML_UNICODE_ENABLED
39136 int mem_base;
39137 int ret_val;
39138 int code; /* UCS code point */
39139 int n_code;
39140
39141 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39142 mem_base = xmlMemBlocks();
39143 code = gen_int(n_code, 0);
39144
39145 ret_val = xmlUCSIsTagbanwa(code);
39146 desret_int(ret_val);
39147 call_tests++;
39148 des_int(n_code, code, 0);
39149 xmlResetLastError();
39150 if (mem_base != xmlMemBlocks()) {
39151 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
39152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039153 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039154 printf(" %d", n_code);
39155 printf("\n");
39156 }
39157 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039158 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039159#endif
39160
Daniel Veillard42595322004-11-08 10:52:06 +000039161 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039162}
39163
39164
39165static int
39166test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039167 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039168
39169#ifdef LIBXML_UNICODE_ENABLED
39170 int mem_base;
39171 int ret_val;
39172 int code; /* UCS code point */
39173 int n_code;
39174
39175 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39176 mem_base = xmlMemBlocks();
39177 code = gen_int(n_code, 0);
39178
39179 ret_val = xmlUCSIsTags(code);
39180 desret_int(ret_val);
39181 call_tests++;
39182 des_int(n_code, code, 0);
39183 xmlResetLastError();
39184 if (mem_base != xmlMemBlocks()) {
39185 printf("Leak of %d blocks found in xmlUCSIsTags",
39186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039187 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039188 printf(" %d", n_code);
39189 printf("\n");
39190 }
39191 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039192 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039193#endif
39194
Daniel Veillard42595322004-11-08 10:52:06 +000039195 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039196}
39197
39198
39199static int
39200test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039201 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039202
39203#ifdef LIBXML_UNICODE_ENABLED
39204 int mem_base;
39205 int ret_val;
39206 int code; /* UCS code point */
39207 int n_code;
39208
39209 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39210 mem_base = xmlMemBlocks();
39211 code = gen_int(n_code, 0);
39212
39213 ret_val = xmlUCSIsTaiLe(code);
39214 desret_int(ret_val);
39215 call_tests++;
39216 des_int(n_code, code, 0);
39217 xmlResetLastError();
39218 if (mem_base != xmlMemBlocks()) {
39219 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
39220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039221 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039222 printf(" %d", n_code);
39223 printf("\n");
39224 }
39225 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039226 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039227#endif
39228
Daniel Veillard42595322004-11-08 10:52:06 +000039229 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039230}
39231
39232
39233static int
39234test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039235 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039236
39237#ifdef LIBXML_UNICODE_ENABLED
39238 int mem_base;
39239 int ret_val;
39240 int code; /* UCS code point */
39241 int n_code;
39242
39243 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39244 mem_base = xmlMemBlocks();
39245 code = gen_int(n_code, 0);
39246
39247 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
39248 desret_int(ret_val);
39249 call_tests++;
39250 des_int(n_code, code, 0);
39251 xmlResetLastError();
39252 if (mem_base != xmlMemBlocks()) {
39253 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
39254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039255 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039256 printf(" %d", n_code);
39257 printf("\n");
39258 }
39259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039260 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039261#endif
39262
Daniel Veillard42595322004-11-08 10:52:06 +000039263 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039264}
39265
39266
39267static int
39268test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039269 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039270
39271#ifdef LIBXML_UNICODE_ENABLED
39272 int mem_base;
39273 int ret_val;
39274 int code; /* UCS code point */
39275 int n_code;
39276
39277 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39278 mem_base = xmlMemBlocks();
39279 code = gen_int(n_code, 0);
39280
39281 ret_val = xmlUCSIsTamil(code);
39282 desret_int(ret_val);
39283 call_tests++;
39284 des_int(n_code, code, 0);
39285 xmlResetLastError();
39286 if (mem_base != xmlMemBlocks()) {
39287 printf("Leak of %d blocks found in xmlUCSIsTamil",
39288 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039289 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039290 printf(" %d", n_code);
39291 printf("\n");
39292 }
39293 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039294 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039295#endif
39296
Daniel Veillard42595322004-11-08 10:52:06 +000039297 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039298}
39299
39300
39301static int
39302test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039303 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039304
39305#ifdef LIBXML_UNICODE_ENABLED
39306 int mem_base;
39307 int ret_val;
39308 int code; /* UCS code point */
39309 int n_code;
39310
39311 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39312 mem_base = xmlMemBlocks();
39313 code = gen_int(n_code, 0);
39314
39315 ret_val = xmlUCSIsTelugu(code);
39316 desret_int(ret_val);
39317 call_tests++;
39318 des_int(n_code, code, 0);
39319 xmlResetLastError();
39320 if (mem_base != xmlMemBlocks()) {
39321 printf("Leak of %d blocks found in xmlUCSIsTelugu",
39322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039323 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039324 printf(" %d", n_code);
39325 printf("\n");
39326 }
39327 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039328 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039329#endif
39330
Daniel Veillard42595322004-11-08 10:52:06 +000039331 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039332}
39333
39334
39335static int
39336test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039337 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039338
39339#ifdef LIBXML_UNICODE_ENABLED
39340 int mem_base;
39341 int ret_val;
39342 int code; /* UCS code point */
39343 int n_code;
39344
39345 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39346 mem_base = xmlMemBlocks();
39347 code = gen_int(n_code, 0);
39348
39349 ret_val = xmlUCSIsThaana(code);
39350 desret_int(ret_val);
39351 call_tests++;
39352 des_int(n_code, code, 0);
39353 xmlResetLastError();
39354 if (mem_base != xmlMemBlocks()) {
39355 printf("Leak of %d blocks found in xmlUCSIsThaana",
39356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039357 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039358 printf(" %d", n_code);
39359 printf("\n");
39360 }
39361 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039362 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039363#endif
39364
Daniel Veillard42595322004-11-08 10:52:06 +000039365 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039366}
39367
39368
39369static int
39370test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039371 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039372
39373#ifdef LIBXML_UNICODE_ENABLED
39374 int mem_base;
39375 int ret_val;
39376 int code; /* UCS code point */
39377 int n_code;
39378
39379 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39380 mem_base = xmlMemBlocks();
39381 code = gen_int(n_code, 0);
39382
39383 ret_val = xmlUCSIsThai(code);
39384 desret_int(ret_val);
39385 call_tests++;
39386 des_int(n_code, code, 0);
39387 xmlResetLastError();
39388 if (mem_base != xmlMemBlocks()) {
39389 printf("Leak of %d blocks found in xmlUCSIsThai",
39390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039391 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039392 printf(" %d", n_code);
39393 printf("\n");
39394 }
39395 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039396 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039397#endif
39398
Daniel Veillard42595322004-11-08 10:52:06 +000039399 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039400}
39401
39402
39403static int
39404test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039405 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039406
39407#ifdef LIBXML_UNICODE_ENABLED
39408 int mem_base;
39409 int ret_val;
39410 int code; /* UCS code point */
39411 int n_code;
39412
39413 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39414 mem_base = xmlMemBlocks();
39415 code = gen_int(n_code, 0);
39416
39417 ret_val = xmlUCSIsTibetan(code);
39418 desret_int(ret_val);
39419 call_tests++;
39420 des_int(n_code, code, 0);
39421 xmlResetLastError();
39422 if (mem_base != xmlMemBlocks()) {
39423 printf("Leak of %d blocks found in xmlUCSIsTibetan",
39424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039425 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039426 printf(" %d", n_code);
39427 printf("\n");
39428 }
39429 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039430 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039431#endif
39432
Daniel Veillard42595322004-11-08 10:52:06 +000039433 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039434}
39435
39436
39437static int
39438test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039439 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039440
39441#ifdef LIBXML_UNICODE_ENABLED
39442 int mem_base;
39443 int ret_val;
39444 int code; /* UCS code point */
39445 int n_code;
39446
39447 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39448 mem_base = xmlMemBlocks();
39449 code = gen_int(n_code, 0);
39450
39451 ret_val = xmlUCSIsUgaritic(code);
39452 desret_int(ret_val);
39453 call_tests++;
39454 des_int(n_code, code, 0);
39455 xmlResetLastError();
39456 if (mem_base != xmlMemBlocks()) {
39457 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
39458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039459 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039460 printf(" %d", n_code);
39461 printf("\n");
39462 }
39463 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039464 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039465#endif
39466
Daniel Veillard42595322004-11-08 10:52:06 +000039467 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039468}
39469
39470
39471static int
39472test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039473 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039474
39475#ifdef LIBXML_UNICODE_ENABLED
39476 int mem_base;
39477 int ret_val;
39478 int code; /* UCS code point */
39479 int n_code;
39480
39481 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39482 mem_base = xmlMemBlocks();
39483 code = gen_int(n_code, 0);
39484
39485 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
39486 desret_int(ret_val);
39487 call_tests++;
39488 des_int(n_code, code, 0);
39489 xmlResetLastError();
39490 if (mem_base != xmlMemBlocks()) {
39491 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
39492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039493 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039494 printf(" %d", n_code);
39495 printf("\n");
39496 }
39497 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039498 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039499#endif
39500
Daniel Veillard42595322004-11-08 10:52:06 +000039501 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039502}
39503
39504
39505static int
39506test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039507 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039508
39509#ifdef LIBXML_UNICODE_ENABLED
39510 int mem_base;
39511 int ret_val;
39512 int code; /* UCS code point */
39513 int n_code;
39514
39515 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39516 mem_base = xmlMemBlocks();
39517 code = gen_int(n_code, 0);
39518
39519 ret_val = xmlUCSIsVariationSelectors(code);
39520 desret_int(ret_val);
39521 call_tests++;
39522 des_int(n_code, code, 0);
39523 xmlResetLastError();
39524 if (mem_base != xmlMemBlocks()) {
39525 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
39526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039527 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039528 printf(" %d", n_code);
39529 printf("\n");
39530 }
39531 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039532 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039533#endif
39534
Daniel Veillard42595322004-11-08 10:52:06 +000039535 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039536}
39537
39538
39539static int
39540test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039541 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039542
39543#ifdef LIBXML_UNICODE_ENABLED
39544 int mem_base;
39545 int ret_val;
39546 int code; /* UCS code point */
39547 int n_code;
39548
39549 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39550 mem_base = xmlMemBlocks();
39551 code = gen_int(n_code, 0);
39552
39553 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
39554 desret_int(ret_val);
39555 call_tests++;
39556 des_int(n_code, code, 0);
39557 xmlResetLastError();
39558 if (mem_base != xmlMemBlocks()) {
39559 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
39560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039561 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039562 printf(" %d", n_code);
39563 printf("\n");
39564 }
39565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039566 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039567#endif
39568
Daniel Veillard42595322004-11-08 10:52:06 +000039569 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039570}
39571
39572
39573static int
39574test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039575 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039576
39577#ifdef LIBXML_UNICODE_ENABLED
39578 int mem_base;
39579 int ret_val;
39580 int code; /* UCS code point */
39581 int n_code;
39582
39583 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39584 mem_base = xmlMemBlocks();
39585 code = gen_int(n_code, 0);
39586
39587 ret_val = xmlUCSIsYiRadicals(code);
39588 desret_int(ret_val);
39589 call_tests++;
39590 des_int(n_code, code, 0);
39591 xmlResetLastError();
39592 if (mem_base != xmlMemBlocks()) {
39593 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
39594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039595 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039596 printf(" %d", n_code);
39597 printf("\n");
39598 }
39599 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039600 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039601#endif
39602
Daniel Veillard42595322004-11-08 10:52:06 +000039603 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039604}
39605
39606
39607static int
39608test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039609 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039610
39611#ifdef LIBXML_UNICODE_ENABLED
39612 int mem_base;
39613 int ret_val;
39614 int code; /* UCS code point */
39615 int n_code;
39616
39617 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39618 mem_base = xmlMemBlocks();
39619 code = gen_int(n_code, 0);
39620
39621 ret_val = xmlUCSIsYiSyllables(code);
39622 desret_int(ret_val);
39623 call_tests++;
39624 des_int(n_code, code, 0);
39625 xmlResetLastError();
39626 if (mem_base != xmlMemBlocks()) {
39627 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
39628 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039629 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039630 printf(" %d", n_code);
39631 printf("\n");
39632 }
39633 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039634 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039635#endif
39636
Daniel Veillard42595322004-11-08 10:52:06 +000039637 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039638}
39639
39640
39641static int
39642test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039643 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039644
39645#ifdef LIBXML_UNICODE_ENABLED
39646 int mem_base;
39647 int ret_val;
39648 int code; /* UCS code point */
39649 int n_code;
39650
39651 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39652 mem_base = xmlMemBlocks();
39653 code = gen_int(n_code, 0);
39654
39655 ret_val = xmlUCSIsYijingHexagramSymbols(code);
39656 desret_int(ret_val);
39657 call_tests++;
39658 des_int(n_code, code, 0);
39659 xmlResetLastError();
39660 if (mem_base != xmlMemBlocks()) {
39661 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
39662 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039663 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039664 printf(" %d", n_code);
39665 printf("\n");
39666 }
39667 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039668 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039669#endif
39670
Daniel Veillard42595322004-11-08 10:52:06 +000039671 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039672}
39673
39674static int
39675test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039676 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039677
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039678 if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000039679 test_ret += test_xmlUCSIsAegeanNumbers();
39680 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
39681 test_ret += test_xmlUCSIsArabic();
39682 test_ret += test_xmlUCSIsArabicPresentationFormsA();
39683 test_ret += test_xmlUCSIsArabicPresentationFormsB();
39684 test_ret += test_xmlUCSIsArmenian();
39685 test_ret += test_xmlUCSIsArrows();
39686 test_ret += test_xmlUCSIsBasicLatin();
39687 test_ret += test_xmlUCSIsBengali();
39688 test_ret += test_xmlUCSIsBlock();
39689 test_ret += test_xmlUCSIsBlockElements();
39690 test_ret += test_xmlUCSIsBopomofo();
39691 test_ret += test_xmlUCSIsBopomofoExtended();
39692 test_ret += test_xmlUCSIsBoxDrawing();
39693 test_ret += test_xmlUCSIsBraillePatterns();
39694 test_ret += test_xmlUCSIsBuhid();
39695 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
39696 test_ret += test_xmlUCSIsCJKCompatibility();
39697 test_ret += test_xmlUCSIsCJKCompatibilityForms();
39698 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
39699 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
39700 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
39701 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
39702 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
39703 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
39704 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
39705 test_ret += test_xmlUCSIsCat();
39706 test_ret += test_xmlUCSIsCatC();
39707 test_ret += test_xmlUCSIsCatCc();
39708 test_ret += test_xmlUCSIsCatCf();
39709 test_ret += test_xmlUCSIsCatCo();
39710 test_ret += test_xmlUCSIsCatCs();
39711 test_ret += test_xmlUCSIsCatL();
39712 test_ret += test_xmlUCSIsCatLl();
39713 test_ret += test_xmlUCSIsCatLm();
39714 test_ret += test_xmlUCSIsCatLo();
39715 test_ret += test_xmlUCSIsCatLt();
39716 test_ret += test_xmlUCSIsCatLu();
39717 test_ret += test_xmlUCSIsCatM();
39718 test_ret += test_xmlUCSIsCatMc();
39719 test_ret += test_xmlUCSIsCatMe();
39720 test_ret += test_xmlUCSIsCatMn();
39721 test_ret += test_xmlUCSIsCatN();
39722 test_ret += test_xmlUCSIsCatNd();
39723 test_ret += test_xmlUCSIsCatNl();
39724 test_ret += test_xmlUCSIsCatNo();
39725 test_ret += test_xmlUCSIsCatP();
39726 test_ret += test_xmlUCSIsCatPc();
39727 test_ret += test_xmlUCSIsCatPd();
39728 test_ret += test_xmlUCSIsCatPe();
39729 test_ret += test_xmlUCSIsCatPf();
39730 test_ret += test_xmlUCSIsCatPi();
39731 test_ret += test_xmlUCSIsCatPo();
39732 test_ret += test_xmlUCSIsCatPs();
39733 test_ret += test_xmlUCSIsCatS();
39734 test_ret += test_xmlUCSIsCatSc();
39735 test_ret += test_xmlUCSIsCatSk();
39736 test_ret += test_xmlUCSIsCatSm();
39737 test_ret += test_xmlUCSIsCatSo();
39738 test_ret += test_xmlUCSIsCatZ();
39739 test_ret += test_xmlUCSIsCatZl();
39740 test_ret += test_xmlUCSIsCatZp();
39741 test_ret += test_xmlUCSIsCatZs();
39742 test_ret += test_xmlUCSIsCherokee();
39743 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
39744 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
39745 test_ret += test_xmlUCSIsCombiningHalfMarks();
39746 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
39747 test_ret += test_xmlUCSIsControlPictures();
39748 test_ret += test_xmlUCSIsCurrencySymbols();
39749 test_ret += test_xmlUCSIsCypriotSyllabary();
39750 test_ret += test_xmlUCSIsCyrillic();
39751 test_ret += test_xmlUCSIsCyrillicSupplement();
39752 test_ret += test_xmlUCSIsDeseret();
39753 test_ret += test_xmlUCSIsDevanagari();
39754 test_ret += test_xmlUCSIsDingbats();
39755 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
39756 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
39757 test_ret += test_xmlUCSIsEthiopic();
39758 test_ret += test_xmlUCSIsGeneralPunctuation();
39759 test_ret += test_xmlUCSIsGeometricShapes();
39760 test_ret += test_xmlUCSIsGeorgian();
39761 test_ret += test_xmlUCSIsGothic();
39762 test_ret += test_xmlUCSIsGreek();
39763 test_ret += test_xmlUCSIsGreekExtended();
39764 test_ret += test_xmlUCSIsGreekandCoptic();
39765 test_ret += test_xmlUCSIsGujarati();
39766 test_ret += test_xmlUCSIsGurmukhi();
39767 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
39768 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
39769 test_ret += test_xmlUCSIsHangulJamo();
39770 test_ret += test_xmlUCSIsHangulSyllables();
39771 test_ret += test_xmlUCSIsHanunoo();
39772 test_ret += test_xmlUCSIsHebrew();
39773 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
39774 test_ret += test_xmlUCSIsHighSurrogates();
39775 test_ret += test_xmlUCSIsHiragana();
39776 test_ret += test_xmlUCSIsIPAExtensions();
39777 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
39778 test_ret += test_xmlUCSIsKanbun();
39779 test_ret += test_xmlUCSIsKangxiRadicals();
39780 test_ret += test_xmlUCSIsKannada();
39781 test_ret += test_xmlUCSIsKatakana();
39782 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
39783 test_ret += test_xmlUCSIsKhmer();
39784 test_ret += test_xmlUCSIsKhmerSymbols();
39785 test_ret += test_xmlUCSIsLao();
39786 test_ret += test_xmlUCSIsLatin1Supplement();
39787 test_ret += test_xmlUCSIsLatinExtendedA();
39788 test_ret += test_xmlUCSIsLatinExtendedAdditional();
39789 test_ret += test_xmlUCSIsLatinExtendedB();
39790 test_ret += test_xmlUCSIsLetterlikeSymbols();
39791 test_ret += test_xmlUCSIsLimbu();
39792 test_ret += test_xmlUCSIsLinearBIdeograms();
39793 test_ret += test_xmlUCSIsLinearBSyllabary();
39794 test_ret += test_xmlUCSIsLowSurrogates();
39795 test_ret += test_xmlUCSIsMalayalam();
39796 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
39797 test_ret += test_xmlUCSIsMathematicalOperators();
39798 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
39799 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
39800 test_ret += test_xmlUCSIsMiscellaneousSymbols();
39801 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
39802 test_ret += test_xmlUCSIsMiscellaneousTechnical();
39803 test_ret += test_xmlUCSIsMongolian();
39804 test_ret += test_xmlUCSIsMusicalSymbols();
39805 test_ret += test_xmlUCSIsMyanmar();
39806 test_ret += test_xmlUCSIsNumberForms();
39807 test_ret += test_xmlUCSIsOgham();
39808 test_ret += test_xmlUCSIsOldItalic();
39809 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
39810 test_ret += test_xmlUCSIsOriya();
39811 test_ret += test_xmlUCSIsOsmanya();
39812 test_ret += test_xmlUCSIsPhoneticExtensions();
39813 test_ret += test_xmlUCSIsPrivateUse();
39814 test_ret += test_xmlUCSIsPrivateUseArea();
39815 test_ret += test_xmlUCSIsRunic();
39816 test_ret += test_xmlUCSIsShavian();
39817 test_ret += test_xmlUCSIsSinhala();
39818 test_ret += test_xmlUCSIsSmallFormVariants();
39819 test_ret += test_xmlUCSIsSpacingModifierLetters();
39820 test_ret += test_xmlUCSIsSpecials();
39821 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
39822 test_ret += test_xmlUCSIsSupplementalArrowsA();
39823 test_ret += test_xmlUCSIsSupplementalArrowsB();
39824 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
39825 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
39826 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
39827 test_ret += test_xmlUCSIsSyriac();
39828 test_ret += test_xmlUCSIsTagalog();
39829 test_ret += test_xmlUCSIsTagbanwa();
39830 test_ret += test_xmlUCSIsTags();
39831 test_ret += test_xmlUCSIsTaiLe();
39832 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
39833 test_ret += test_xmlUCSIsTamil();
39834 test_ret += test_xmlUCSIsTelugu();
39835 test_ret += test_xmlUCSIsThaana();
39836 test_ret += test_xmlUCSIsThai();
39837 test_ret += test_xmlUCSIsTibetan();
39838 test_ret += test_xmlUCSIsUgaritic();
39839 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
39840 test_ret += test_xmlUCSIsVariationSelectors();
39841 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
39842 test_ret += test_xmlUCSIsYiRadicals();
39843 test_ret += test_xmlUCSIsYiSyllables();
39844 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039845
Daniel Veillard42595322004-11-08 10:52:06 +000039846 if (test_ret != 0)
39847 printf("Module xmlunicode: %d errors\n", test_ret);
39848 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039849}
39850
39851static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000039852test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039853 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039854
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039855#ifdef LIBXML_WRITER_ENABLED
39856 int mem_base;
39857 xmlTextWriterPtr ret_val;
39858 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
39859 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039860
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039861 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
39862 mem_base = xmlMemBlocks();
39863 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039864
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039865 ret_val = xmlNewTextWriter(out);
39866 if (ret_val != NULL) out = NULL;
39867 desret_xmlTextWriterPtr(ret_val);
39868 call_tests++;
39869 des_xmlOutputBufferPtr(n_out, out, 0);
39870 xmlResetLastError();
39871 if (mem_base != xmlMemBlocks()) {
39872 printf("Leak of %d blocks found in xmlNewTextWriter",
39873 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039874 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039875 printf(" %d", n_out);
39876 printf("\n");
39877 }
39878 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039879 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039880#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000039881
Daniel Veillard42595322004-11-08 10:52:06 +000039882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039883}
39884
39885
39886static int
39887test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039889
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039890#ifdef LIBXML_WRITER_ENABLED
39891 int mem_base;
39892 xmlTextWriterPtr ret_val;
39893 const char * uri; /* the URI of the resource for the output */
39894 int n_uri;
39895 int compression; /* compress the output? */
39896 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039897
Daniel Veillard42595322004-11-08 10:52:06 +000039898 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039899 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39900 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000039901 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039902 compression = gen_int(n_compression, 1);
39903
39904 ret_val = xmlNewTextWriterFilename(uri, compression);
39905 desret_xmlTextWriterPtr(ret_val);
39906 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039907 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039908 des_int(n_compression, compression, 1);
39909 xmlResetLastError();
39910 if (mem_base != xmlMemBlocks()) {
39911 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
39912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039913 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039914 printf(" %d", n_uri);
39915 printf(" %d", n_compression);
39916 printf("\n");
39917 }
39918 }
39919 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039920 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039921#endif
39922
Daniel Veillard42595322004-11-08 10:52:06 +000039923 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039924}
39925
39926
39927static int
39928test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039929 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039930
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039931#ifdef LIBXML_WRITER_ENABLED
39932 int mem_base;
39933 xmlTextWriterPtr ret_val;
39934 xmlBufferPtr buf; /* xmlBufferPtr */
39935 int n_buf;
39936 int compression; /* compress the output? */
39937 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039938
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039939 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
39940 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39941 mem_base = xmlMemBlocks();
39942 buf = gen_xmlBufferPtr(n_buf, 0);
39943 compression = gen_int(n_compression, 1);
39944
39945 ret_val = xmlNewTextWriterMemory(buf, compression);
39946 desret_xmlTextWriterPtr(ret_val);
39947 call_tests++;
39948 des_xmlBufferPtr(n_buf, buf, 0);
39949 des_int(n_compression, compression, 1);
39950 xmlResetLastError();
39951 if (mem_base != xmlMemBlocks()) {
39952 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
39953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039954 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039955 printf(" %d", n_buf);
39956 printf(" %d", n_compression);
39957 printf("\n");
39958 }
39959 }
39960 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039961 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039962#endif
39963
Daniel Veillard42595322004-11-08 10:52:06 +000039964 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039965}
39966
39967
39968static int
39969test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039970 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039971
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039972#ifdef LIBXML_WRITER_ENABLED
39973 int mem_base;
39974 xmlTextWriterPtr ret_val;
39975 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
39976 int n_ctxt;
39977 int compression; /* compress the output? */
39978 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039979
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039980 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
39981 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39982 mem_base = xmlMemBlocks();
39983 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
39984 compression = gen_int(n_compression, 1);
39985
39986 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000039987 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039988 desret_xmlTextWriterPtr(ret_val);
39989 call_tests++;
39990 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
39991 des_int(n_compression, compression, 1);
39992 xmlResetLastError();
39993 if (mem_base != xmlMemBlocks()) {
39994 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
39995 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039996 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039997 printf(" %d", n_ctxt);
39998 printf(" %d", n_compression);
39999 printf("\n");
40000 }
40001 }
40002 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040003 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040004#endif
40005
Daniel Veillard42595322004-11-08 10:52:06 +000040006 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040007}
40008
40009
40010static int
40011test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040012 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040013
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040014#ifdef LIBXML_WRITER_ENABLED
40015 int mem_base;
40016 xmlTextWriterPtr ret_val;
40017 xmlDocPtr doc; /* xmlDocPtr */
40018 int n_doc;
40019 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
40020 int n_node;
40021 int compression; /* compress the output? */
40022 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040023
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040024 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
40025 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
40026 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40027 mem_base = xmlMemBlocks();
40028 doc = gen_xmlDocPtr(n_doc, 0);
40029 node = gen_xmlNodePtr(n_node, 1);
40030 compression = gen_int(n_compression, 2);
40031
40032 ret_val = xmlNewTextWriterTree(doc, node, compression);
40033 desret_xmlTextWriterPtr(ret_val);
40034 call_tests++;
40035 des_xmlDocPtr(n_doc, doc, 0);
40036 des_xmlNodePtr(n_node, node, 1);
40037 des_int(n_compression, compression, 2);
40038 xmlResetLastError();
40039 if (mem_base != xmlMemBlocks()) {
40040 printf("Leak of %d blocks found in xmlNewTextWriterTree",
40041 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040042 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040043 printf(" %d", n_doc);
40044 printf(" %d", n_node);
40045 printf(" %d", n_compression);
40046 printf("\n");
40047 }
40048 }
40049 }
40050 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040051 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040052#endif
40053
Daniel Veillard42595322004-11-08 10:52:06 +000040054 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040055}
40056
40057
40058static int
40059test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040060 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040061
Daniel Veillarde43cc572004-11-03 11:50:29 +000040062#ifdef LIBXML_WRITER_ENABLED
40063 int mem_base;
40064 int ret_val;
40065 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40066 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040067
Daniel Veillarde43cc572004-11-03 11:50:29 +000040068 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40069 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040070 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040071
40072 ret_val = xmlTextWriterEndAttribute(writer);
40073 desret_int(ret_val);
40074 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040075 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040076 xmlResetLastError();
40077 if (mem_base != xmlMemBlocks()) {
40078 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
40079 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040080 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040081 printf(" %d", n_writer);
40082 printf("\n");
40083 }
40084 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040085 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040086#endif
40087
Daniel Veillard42595322004-11-08 10:52:06 +000040088 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040089}
40090
40091
40092static int
40093test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040094 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040095
Daniel Veillarde43cc572004-11-03 11:50:29 +000040096#ifdef LIBXML_WRITER_ENABLED
40097 int mem_base;
40098 int ret_val;
40099 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40100 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040101
Daniel Veillarde43cc572004-11-03 11:50:29 +000040102 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40103 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040104 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040105
40106 ret_val = xmlTextWriterEndCDATA(writer);
40107 desret_int(ret_val);
40108 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040109 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040110 xmlResetLastError();
40111 if (mem_base != xmlMemBlocks()) {
40112 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
40113 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040114 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040115 printf(" %d", n_writer);
40116 printf("\n");
40117 }
40118 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040119 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040120#endif
40121
Daniel Veillard42595322004-11-08 10:52:06 +000040122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040123}
40124
40125
40126static int
40127test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040129
Daniel Veillarde43cc572004-11-03 11:50:29 +000040130#ifdef LIBXML_WRITER_ENABLED
40131 int mem_base;
40132 int ret_val;
40133 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40134 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040135
Daniel Veillarde43cc572004-11-03 11:50:29 +000040136 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40137 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040138 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040139
40140 ret_val = xmlTextWriterEndComment(writer);
40141 desret_int(ret_val);
40142 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040143 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040144 xmlResetLastError();
40145 if (mem_base != xmlMemBlocks()) {
40146 printf("Leak of %d blocks found in xmlTextWriterEndComment",
40147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040148 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040149 printf(" %d", n_writer);
40150 printf("\n");
40151 }
40152 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040153 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040154#endif
40155
Daniel Veillard42595322004-11-08 10:52:06 +000040156 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040157}
40158
40159
40160static int
40161test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040162 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040163
Daniel Veillarde43cc572004-11-03 11:50:29 +000040164#ifdef LIBXML_WRITER_ENABLED
40165 int mem_base;
40166 int ret_val;
40167 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40168 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040169
Daniel Veillarde43cc572004-11-03 11:50:29 +000040170 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40171 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040172 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040173
40174 ret_val = xmlTextWriterEndDTD(writer);
40175 desret_int(ret_val);
40176 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040177 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040178 xmlResetLastError();
40179 if (mem_base != xmlMemBlocks()) {
40180 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
40181 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040182 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040183 printf(" %d", n_writer);
40184 printf("\n");
40185 }
40186 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040187 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040188#endif
40189
Daniel Veillard42595322004-11-08 10:52:06 +000040190 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040191}
40192
40193
40194static int
40195test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040197
Daniel Veillarde43cc572004-11-03 11:50:29 +000040198#ifdef LIBXML_WRITER_ENABLED
40199 int mem_base;
40200 int ret_val;
40201 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40202 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040203
Daniel Veillarde43cc572004-11-03 11:50:29 +000040204 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40205 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040206 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040207
40208 ret_val = xmlTextWriterEndDTDAttlist(writer);
40209 desret_int(ret_val);
40210 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040211 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040212 xmlResetLastError();
40213 if (mem_base != xmlMemBlocks()) {
40214 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
40215 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040216 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040217 printf(" %d", n_writer);
40218 printf("\n");
40219 }
40220 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040221 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040222#endif
40223
Daniel Veillard42595322004-11-08 10:52:06 +000040224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040225}
40226
40227
40228static int
40229test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040231
Daniel Veillarde43cc572004-11-03 11:50:29 +000040232#ifdef LIBXML_WRITER_ENABLED
40233 int mem_base;
40234 int ret_val;
40235 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40236 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040237
Daniel Veillarde43cc572004-11-03 11:50:29 +000040238 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40239 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040240 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040241
40242 ret_val = xmlTextWriterEndDTDElement(writer);
40243 desret_int(ret_val);
40244 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040245 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040246 xmlResetLastError();
40247 if (mem_base != xmlMemBlocks()) {
40248 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
40249 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040250 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040251 printf(" %d", n_writer);
40252 printf("\n");
40253 }
40254 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040255 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040256#endif
40257
Daniel Veillard42595322004-11-08 10:52:06 +000040258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040259}
40260
40261
40262static int
40263test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040264 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040265
Daniel Veillarde43cc572004-11-03 11:50:29 +000040266#ifdef LIBXML_WRITER_ENABLED
40267 int mem_base;
40268 int ret_val;
40269 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40270 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040271
Daniel Veillarde43cc572004-11-03 11:50:29 +000040272 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40273 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040274 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040275
40276 ret_val = xmlTextWriterEndDTDEntity(writer);
40277 desret_int(ret_val);
40278 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040279 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040280 xmlResetLastError();
40281 if (mem_base != xmlMemBlocks()) {
40282 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
40283 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040284 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040285 printf(" %d", n_writer);
40286 printf("\n");
40287 }
40288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040289 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040290#endif
40291
Daniel Veillard42595322004-11-08 10:52:06 +000040292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040293}
40294
40295
40296static int
40297test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040299
Daniel Veillarde43cc572004-11-03 11:50:29 +000040300#ifdef LIBXML_WRITER_ENABLED
40301 int mem_base;
40302 int ret_val;
40303 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40304 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040305
Daniel Veillarde43cc572004-11-03 11:50:29 +000040306 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40307 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040308 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040309
40310 ret_val = xmlTextWriterEndDocument(writer);
40311 desret_int(ret_val);
40312 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040313 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040314 xmlResetLastError();
40315 if (mem_base != xmlMemBlocks()) {
40316 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
40317 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040318 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040319 printf(" %d", n_writer);
40320 printf("\n");
40321 }
40322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040323 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040324#endif
40325
Daniel Veillard42595322004-11-08 10:52:06 +000040326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040327}
40328
40329
40330static int
40331test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040333
Daniel Veillarde43cc572004-11-03 11:50:29 +000040334#ifdef LIBXML_WRITER_ENABLED
40335 int mem_base;
40336 int ret_val;
40337 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40338 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040339
Daniel Veillarde43cc572004-11-03 11:50:29 +000040340 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40341 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040342 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040343
40344 ret_val = xmlTextWriterEndElement(writer);
40345 desret_int(ret_val);
40346 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040347 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040348 xmlResetLastError();
40349 if (mem_base != xmlMemBlocks()) {
40350 printf("Leak of %d blocks found in xmlTextWriterEndElement",
40351 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040352 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040353 printf(" %d", n_writer);
40354 printf("\n");
40355 }
40356 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040357 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040358#endif
40359
Daniel Veillard42595322004-11-08 10:52:06 +000040360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040361}
40362
40363
40364static int
40365test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040367
Daniel Veillarde43cc572004-11-03 11:50:29 +000040368#ifdef LIBXML_WRITER_ENABLED
40369 int mem_base;
40370 int ret_val;
40371 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40372 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040373
Daniel Veillarde43cc572004-11-03 11:50:29 +000040374 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40375 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040376 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040377
40378 ret_val = xmlTextWriterEndPI(writer);
40379 desret_int(ret_val);
40380 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040381 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040382 xmlResetLastError();
40383 if (mem_base != xmlMemBlocks()) {
40384 printf("Leak of %d blocks found in xmlTextWriterEndPI",
40385 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040386 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040387 printf(" %d", n_writer);
40388 printf("\n");
40389 }
40390 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040391 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040392#endif
40393
Daniel Veillard42595322004-11-08 10:52:06 +000040394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040395}
40396
40397
40398static int
40399test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040401
Daniel Veillarde43cc572004-11-03 11:50:29 +000040402#ifdef LIBXML_WRITER_ENABLED
40403 int mem_base;
40404 int ret_val;
40405 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40406 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040407
Daniel Veillarde43cc572004-11-03 11:50:29 +000040408 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40409 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040410 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040411
40412 ret_val = xmlTextWriterFlush(writer);
40413 desret_int(ret_val);
40414 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040415 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040416 xmlResetLastError();
40417 if (mem_base != xmlMemBlocks()) {
40418 printf("Leak of %d blocks found in xmlTextWriterFlush",
40419 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040420 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040421 printf(" %d", n_writer);
40422 printf("\n");
40423 }
40424 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040425 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040426#endif
40427
Daniel Veillard42595322004-11-08 10:52:06 +000040428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040429}
40430
40431
40432static int
40433test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040435
Daniel Veillarde43cc572004-11-03 11:50:29 +000040436#ifdef LIBXML_WRITER_ENABLED
40437 int mem_base;
40438 int ret_val;
40439 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40440 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040441
Daniel Veillarde43cc572004-11-03 11:50:29 +000040442 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40443 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040444 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040445
40446 ret_val = xmlTextWriterFullEndElement(writer);
40447 desret_int(ret_val);
40448 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040449 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040450 xmlResetLastError();
40451 if (mem_base != xmlMemBlocks()) {
40452 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
40453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040454 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040455 printf(" %d", n_writer);
40456 printf("\n");
40457 }
40458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040459 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040460#endif
40461
Daniel Veillard42595322004-11-08 10:52:06 +000040462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040463}
40464
40465
40466static int
40467test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040469
Daniel Veillarde43cc572004-11-03 11:50:29 +000040470#ifdef LIBXML_WRITER_ENABLED
40471 int mem_base;
40472 int ret_val;
40473 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40474 int n_writer;
40475 int indent; /* do indentation? */
40476 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040477
Daniel Veillarde43cc572004-11-03 11:50:29 +000040478 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40479 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
40480 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040481 writer = gen_xmlTextWriterPtr(n_writer, 0);
40482 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040483
40484 ret_val = xmlTextWriterSetIndent(writer, indent);
40485 desret_int(ret_val);
40486 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040487 des_xmlTextWriterPtr(n_writer, writer, 0);
40488 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040489 xmlResetLastError();
40490 if (mem_base != xmlMemBlocks()) {
40491 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
40492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040493 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040494 printf(" %d", n_writer);
40495 printf(" %d", n_indent);
40496 printf("\n");
40497 }
40498 }
40499 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040500 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040501#endif
40502
Daniel Veillard42595322004-11-08 10:52:06 +000040503 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040504}
40505
40506
40507static int
40508test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040509 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040510
Daniel Veillarde43cc572004-11-03 11:50:29 +000040511#ifdef LIBXML_WRITER_ENABLED
40512 int mem_base;
40513 int ret_val;
40514 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40515 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040516 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040517 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040518
Daniel Veillarde43cc572004-11-03 11:50:29 +000040519 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40520 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
40521 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040522 writer = gen_xmlTextWriterPtr(n_writer, 0);
40523 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040524
40525 ret_val = xmlTextWriterSetIndentString(writer, str);
40526 desret_int(ret_val);
40527 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040528 des_xmlTextWriterPtr(n_writer, writer, 0);
40529 des_const_xmlChar_ptr(n_str, str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040530 xmlResetLastError();
40531 if (mem_base != xmlMemBlocks()) {
40532 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
40533 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040534 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040535 printf(" %d", n_writer);
40536 printf(" %d", n_str);
40537 printf("\n");
40538 }
40539 }
40540 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040541 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040542#endif
40543
Daniel Veillard42595322004-11-08 10:52:06 +000040544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040545}
40546
40547
40548static int
40549test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040551
Daniel Veillarde43cc572004-11-03 11:50:29 +000040552#ifdef LIBXML_WRITER_ENABLED
40553 int mem_base;
40554 int ret_val;
40555 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40556 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040557 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040558 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040559
Daniel Veillarde43cc572004-11-03 11:50:29 +000040560 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40561 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40562 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040563 writer = gen_xmlTextWriterPtr(n_writer, 0);
40564 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040565
40566 ret_val = xmlTextWriterStartAttribute(writer, name);
40567 desret_int(ret_val);
40568 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040569 des_xmlTextWriterPtr(n_writer, writer, 0);
40570 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040571 xmlResetLastError();
40572 if (mem_base != xmlMemBlocks()) {
40573 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
40574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040575 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040576 printf(" %d", n_writer);
40577 printf(" %d", n_name);
40578 printf("\n");
40579 }
40580 }
40581 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040582 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040583#endif
40584
Daniel Veillard42595322004-11-08 10:52:06 +000040585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040586}
40587
40588
40589static int
40590test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040592
Daniel Veillarde43cc572004-11-03 11:50:29 +000040593#ifdef LIBXML_WRITER_ENABLED
40594 int mem_base;
40595 int ret_val;
40596 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40597 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040598 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040599 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040600 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040601 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040602 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040603 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040604
Daniel Veillarde43cc572004-11-03 11:50:29 +000040605 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40606 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40607 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40608 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40609 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040610 writer = gen_xmlTextWriterPtr(n_writer, 0);
40611 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40612 name = gen_const_xmlChar_ptr(n_name, 2);
40613 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040614
40615 ret_val = xmlTextWriterStartAttributeNS(writer, prefix, name, namespaceURI);
40616 desret_int(ret_val);
40617 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040618 des_xmlTextWriterPtr(n_writer, writer, 0);
40619 des_const_xmlChar_ptr(n_prefix, prefix, 1);
40620 des_const_xmlChar_ptr(n_name, name, 2);
40621 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040622 xmlResetLastError();
40623 if (mem_base != xmlMemBlocks()) {
40624 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
40625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040626 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040627 printf(" %d", n_writer);
40628 printf(" %d", n_prefix);
40629 printf(" %d", n_name);
40630 printf(" %d", n_namespaceURI);
40631 printf("\n");
40632 }
40633 }
40634 }
40635 }
40636 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040637 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040638#endif
40639
Daniel Veillard42595322004-11-08 10:52:06 +000040640 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040641}
40642
40643
40644static int
40645test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040647
Daniel Veillarde43cc572004-11-03 11:50:29 +000040648#ifdef LIBXML_WRITER_ENABLED
40649 int mem_base;
40650 int ret_val;
40651 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40652 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040653
Daniel Veillarde43cc572004-11-03 11:50:29 +000040654 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40655 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040656 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040657
40658 ret_val = xmlTextWriterStartCDATA(writer);
40659 desret_int(ret_val);
40660 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040661 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040662 xmlResetLastError();
40663 if (mem_base != xmlMemBlocks()) {
40664 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
40665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040666 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040667 printf(" %d", n_writer);
40668 printf("\n");
40669 }
40670 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040671 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040672#endif
40673
Daniel Veillard42595322004-11-08 10:52:06 +000040674 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040675}
40676
40677
40678static int
40679test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040680 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040681
Daniel Veillarde43cc572004-11-03 11:50:29 +000040682#ifdef LIBXML_WRITER_ENABLED
40683 int mem_base;
40684 int ret_val;
40685 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40686 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040687
Daniel Veillarde43cc572004-11-03 11:50:29 +000040688 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40689 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040690 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040691
40692 ret_val = xmlTextWriterStartComment(writer);
40693 desret_int(ret_val);
40694 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040695 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040696 xmlResetLastError();
40697 if (mem_base != xmlMemBlocks()) {
40698 printf("Leak of %d blocks found in xmlTextWriterStartComment",
40699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040700 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040701 printf(" %d", n_writer);
40702 printf("\n");
40703 }
40704 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040705 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040706#endif
40707
Daniel Veillard42595322004-11-08 10:52:06 +000040708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040709}
40710
40711
40712static int
40713test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040715
Daniel Veillarde43cc572004-11-03 11:50:29 +000040716#ifdef LIBXML_WRITER_ENABLED
40717 int mem_base;
40718 int ret_val;
40719 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40720 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040721 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040722 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040723 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040724 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040725 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040726 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040727
Daniel Veillarde43cc572004-11-03 11:50:29 +000040728 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40729 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40730 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
40731 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
40732 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040733 writer = gen_xmlTextWriterPtr(n_writer, 0);
40734 name = gen_const_xmlChar_ptr(n_name, 1);
40735 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
40736 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040737
40738 ret_val = xmlTextWriterStartDTD(writer, name, pubid, sysid);
40739 desret_int(ret_val);
40740 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040741 des_xmlTextWriterPtr(n_writer, writer, 0);
40742 des_const_xmlChar_ptr(n_name, name, 1);
40743 des_const_xmlChar_ptr(n_pubid, pubid, 2);
40744 des_const_xmlChar_ptr(n_sysid, sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040745 xmlResetLastError();
40746 if (mem_base != xmlMemBlocks()) {
40747 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
40748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040749 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040750 printf(" %d", n_writer);
40751 printf(" %d", n_name);
40752 printf(" %d", n_pubid);
40753 printf(" %d", n_sysid);
40754 printf("\n");
40755 }
40756 }
40757 }
40758 }
40759 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040760 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040761#endif
40762
Daniel Veillard42595322004-11-08 10:52:06 +000040763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040764}
40765
40766
40767static int
40768test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040769 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040770
Daniel Veillarde43cc572004-11-03 11:50:29 +000040771#ifdef LIBXML_WRITER_ENABLED
40772 int mem_base;
40773 int ret_val;
40774 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40775 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040776 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040777 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040778
Daniel Veillarde43cc572004-11-03 11:50:29 +000040779 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40780 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40781 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040782 writer = gen_xmlTextWriterPtr(n_writer, 0);
40783 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040784
40785 ret_val = xmlTextWriterStartDTDAttlist(writer, name);
40786 desret_int(ret_val);
40787 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040788 des_xmlTextWriterPtr(n_writer, writer, 0);
40789 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040790 xmlResetLastError();
40791 if (mem_base != xmlMemBlocks()) {
40792 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
40793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040794 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040795 printf(" %d", n_writer);
40796 printf(" %d", n_name);
40797 printf("\n");
40798 }
40799 }
40800 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040801 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040802#endif
40803
Daniel Veillard42595322004-11-08 10:52:06 +000040804 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040805}
40806
40807
40808static int
40809test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040810 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040811
Daniel Veillarde43cc572004-11-03 11:50:29 +000040812#ifdef LIBXML_WRITER_ENABLED
40813 int mem_base;
40814 int ret_val;
40815 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40816 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040817 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040818 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040819
Daniel Veillarde43cc572004-11-03 11:50:29 +000040820 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40821 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40822 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040823 writer = gen_xmlTextWriterPtr(n_writer, 0);
40824 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040825
40826 ret_val = xmlTextWriterStartDTDElement(writer, name);
40827 desret_int(ret_val);
40828 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040829 des_xmlTextWriterPtr(n_writer, writer, 0);
40830 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040831 xmlResetLastError();
40832 if (mem_base != xmlMemBlocks()) {
40833 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
40834 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040835 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040836 printf(" %d", n_writer);
40837 printf(" %d", n_name);
40838 printf("\n");
40839 }
40840 }
40841 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040842 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040843#endif
40844
Daniel Veillard42595322004-11-08 10:52:06 +000040845 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040846}
40847
40848
40849static int
40850test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040851 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040852
Daniel Veillarde43cc572004-11-03 11:50:29 +000040853#ifdef LIBXML_WRITER_ENABLED
40854 int mem_base;
40855 int ret_val;
40856 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40857 int n_writer;
40858 int pe; /* TRUE if this is a parameter entity, FALSE if not */
40859 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040860 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040861 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040862
Daniel Veillarde43cc572004-11-03 11:50:29 +000040863 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40864 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
40865 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40866 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040867 writer = gen_xmlTextWriterPtr(n_writer, 0);
40868 pe = gen_int(n_pe, 1);
40869 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040870
40871 ret_val = xmlTextWriterStartDTDEntity(writer, pe, name);
40872 desret_int(ret_val);
40873 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040874 des_xmlTextWriterPtr(n_writer, writer, 0);
40875 des_int(n_pe, pe, 1);
40876 des_const_xmlChar_ptr(n_name, name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040877 xmlResetLastError();
40878 if (mem_base != xmlMemBlocks()) {
40879 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
40880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040881 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040882 printf(" %d", n_writer);
40883 printf(" %d", n_pe);
40884 printf(" %d", n_name);
40885 printf("\n");
40886 }
40887 }
40888 }
40889 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040890 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040891#endif
40892
Daniel Veillard42595322004-11-08 10:52:06 +000040893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040894}
40895
40896
40897static int
40898test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040900
Daniel Veillarde43cc572004-11-03 11:50:29 +000040901#ifdef LIBXML_WRITER_ENABLED
40902 int mem_base;
40903 int ret_val;
40904 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40905 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040906 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040907 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040908 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040909 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040910 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040911 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040912
Daniel Veillarde43cc572004-11-03 11:50:29 +000040913 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40914 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
40915 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
40916 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
40917 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040918 writer = gen_xmlTextWriterPtr(n_writer, 0);
40919 version = gen_const_char_ptr(n_version, 1);
40920 encoding = gen_const_char_ptr(n_encoding, 2);
40921 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040922
40923 ret_val = xmlTextWriterStartDocument(writer, version, encoding, standalone);
40924 desret_int(ret_val);
40925 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040926 des_xmlTextWriterPtr(n_writer, writer, 0);
40927 des_const_char_ptr(n_version, version, 1);
40928 des_const_char_ptr(n_encoding, encoding, 2);
40929 des_const_char_ptr(n_standalone, standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040930 xmlResetLastError();
40931 if (mem_base != xmlMemBlocks()) {
40932 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
40933 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040934 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040935 printf(" %d", n_writer);
40936 printf(" %d", n_version);
40937 printf(" %d", n_encoding);
40938 printf(" %d", n_standalone);
40939 printf("\n");
40940 }
40941 }
40942 }
40943 }
40944 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040945 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040946#endif
40947
Daniel Veillard42595322004-11-08 10:52:06 +000040948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040949}
40950
40951
40952static int
40953test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040954 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040955
Daniel Veillarde43cc572004-11-03 11:50:29 +000040956#ifdef LIBXML_WRITER_ENABLED
40957 int mem_base;
40958 int ret_val;
40959 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40960 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040961 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040962 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040963
Daniel Veillarde43cc572004-11-03 11:50:29 +000040964 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40965 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40966 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040967 writer = gen_xmlTextWriterPtr(n_writer, 0);
40968 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040969
40970 ret_val = xmlTextWriterStartElement(writer, name);
40971 desret_int(ret_val);
40972 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040973 des_xmlTextWriterPtr(n_writer, writer, 0);
40974 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040975 xmlResetLastError();
40976 if (mem_base != xmlMemBlocks()) {
40977 printf("Leak of %d blocks found in xmlTextWriterStartElement",
40978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040979 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040980 printf(" %d", n_writer);
40981 printf(" %d", n_name);
40982 printf("\n");
40983 }
40984 }
40985 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040986 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040987#endif
40988
Daniel Veillard42595322004-11-08 10:52:06 +000040989 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040990}
40991
40992
40993static int
40994test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040995 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040996
Daniel Veillarde43cc572004-11-03 11:50:29 +000040997#ifdef LIBXML_WRITER_ENABLED
40998 int mem_base;
40999 int ret_val;
41000 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41001 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041002 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041003 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041004 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041005 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041006 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041007 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041008
Daniel Veillarde43cc572004-11-03 11:50:29 +000041009 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41010 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41011 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41012 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41013 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041014 writer = gen_xmlTextWriterPtr(n_writer, 0);
41015 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41016 name = gen_const_xmlChar_ptr(n_name, 2);
41017 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041018
41019 ret_val = xmlTextWriterStartElementNS(writer, prefix, name, namespaceURI);
41020 desret_int(ret_val);
41021 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041022 des_xmlTextWriterPtr(n_writer, writer, 0);
41023 des_const_xmlChar_ptr(n_prefix, prefix, 1);
41024 des_const_xmlChar_ptr(n_name, name, 2);
41025 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041026 xmlResetLastError();
41027 if (mem_base != xmlMemBlocks()) {
41028 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
41029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041030 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041031 printf(" %d", n_writer);
41032 printf(" %d", n_prefix);
41033 printf(" %d", n_name);
41034 printf(" %d", n_namespaceURI);
41035 printf("\n");
41036 }
41037 }
41038 }
41039 }
41040 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041041 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041042#endif
41043
Daniel Veillard42595322004-11-08 10:52:06 +000041044 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041045}
41046
41047
41048static int
41049test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041050 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041051
Daniel Veillarde43cc572004-11-03 11:50:29 +000041052#ifdef LIBXML_WRITER_ENABLED
41053 int mem_base;
41054 int ret_val;
41055 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41056 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041057 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041058 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041059
Daniel Veillarde43cc572004-11-03 11:50:29 +000041060 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41061 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41062 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041063 writer = gen_xmlTextWriterPtr(n_writer, 0);
41064 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041065
41066 ret_val = xmlTextWriterStartPI(writer, target);
41067 desret_int(ret_val);
41068 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041069 des_xmlTextWriterPtr(n_writer, writer, 0);
41070 des_const_xmlChar_ptr(n_target, target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041071 xmlResetLastError();
41072 if (mem_base != xmlMemBlocks()) {
41073 printf("Leak of %d blocks found in xmlTextWriterStartPI",
41074 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041075 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041076 printf(" %d", n_writer);
41077 printf(" %d", n_target);
41078 printf("\n");
41079 }
41080 }
41081 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041082 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041083#endif
41084
Daniel Veillard42595322004-11-08 10:52:06 +000041085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041086}
41087
41088
41089static int
41090test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041092
Daniel Veillarde43cc572004-11-03 11:50:29 +000041093#ifdef LIBXML_WRITER_ENABLED
41094 int mem_base;
41095 int ret_val;
41096 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41097 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041098 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041099 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041100 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041101 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041102
Daniel Veillarde43cc572004-11-03 11:50:29 +000041103 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41104 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41105 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41106 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041107 writer = gen_xmlTextWriterPtr(n_writer, 0);
41108 name = gen_const_xmlChar_ptr(n_name, 1);
41109 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041110
41111 ret_val = xmlTextWriterWriteAttribute(writer, name, content);
41112 desret_int(ret_val);
41113 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041114 des_xmlTextWriterPtr(n_writer, writer, 0);
41115 des_const_xmlChar_ptr(n_name, name, 1);
41116 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041117 xmlResetLastError();
41118 if (mem_base != xmlMemBlocks()) {
41119 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
41120 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041121 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041122 printf(" %d", n_writer);
41123 printf(" %d", n_name);
41124 printf(" %d", n_content);
41125 printf("\n");
41126 }
41127 }
41128 }
41129 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041130 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041131#endif
41132
Daniel Veillard42595322004-11-08 10:52:06 +000041133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041134}
41135
41136
41137static int
41138test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041140
Daniel Veillarde43cc572004-11-03 11:50:29 +000041141#ifdef LIBXML_WRITER_ENABLED
41142 int mem_base;
41143 int ret_val;
41144 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41145 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041146 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041147 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041148 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041149 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041150 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041151 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041152 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041153 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041154
Daniel Veillarde43cc572004-11-03 11:50:29 +000041155 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41156 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41157 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41158 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41159 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41160 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041161 writer = gen_xmlTextWriterPtr(n_writer, 0);
41162 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41163 name = gen_const_xmlChar_ptr(n_name, 2);
41164 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41165 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041166
41167 ret_val = xmlTextWriterWriteAttributeNS(writer, prefix, name, namespaceURI, content);
41168 desret_int(ret_val);
41169 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041170 des_xmlTextWriterPtr(n_writer, writer, 0);
41171 des_const_xmlChar_ptr(n_prefix, prefix, 1);
41172 des_const_xmlChar_ptr(n_name, name, 2);
41173 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
41174 des_const_xmlChar_ptr(n_content, content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041175 xmlResetLastError();
41176 if (mem_base != xmlMemBlocks()) {
41177 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
41178 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041179 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041180 printf(" %d", n_writer);
41181 printf(" %d", n_prefix);
41182 printf(" %d", n_name);
41183 printf(" %d", n_namespaceURI);
41184 printf(" %d", n_content);
41185 printf("\n");
41186 }
41187 }
41188 }
41189 }
41190 }
41191 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041192 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041193#endif
41194
Daniel Veillard42595322004-11-08 10:52:06 +000041195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041196}
41197
41198
41199static int
41200test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041202
Daniel Veillarde43cc572004-11-03 11:50:29 +000041203#ifdef LIBXML_WRITER_ENABLED
41204 int mem_base;
41205 int ret_val;
41206 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41207 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041208 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041209 int n_data;
41210 int start; /* the position within the data of the first byte to encode */
41211 int n_start;
41212 int len; /* the number of bytes to encode */
41213 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041214
Daniel Veillarde43cc572004-11-03 11:50:29 +000041215 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41216 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41217 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41218 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41219 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041220 writer = gen_xmlTextWriterPtr(n_writer, 0);
41221 data = gen_const_char_ptr(n_data, 1);
41222 start = gen_int(n_start, 2);
41223 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041224
41225 ret_val = xmlTextWriterWriteBase64(writer, data, start, len);
41226 desret_int(ret_val);
41227 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041228 des_xmlTextWriterPtr(n_writer, writer, 0);
41229 des_const_char_ptr(n_data, data, 1);
41230 des_int(n_start, start, 2);
41231 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041232 xmlResetLastError();
41233 if (mem_base != xmlMemBlocks()) {
41234 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
41235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041236 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041237 printf(" %d", n_writer);
41238 printf(" %d", n_data);
41239 printf(" %d", n_start);
41240 printf(" %d", n_len);
41241 printf("\n");
41242 }
41243 }
41244 }
41245 }
41246 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041247 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041248#endif
41249
Daniel Veillard42595322004-11-08 10:52:06 +000041250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041251}
41252
41253
41254static int
41255test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041257
Daniel Veillarde43cc572004-11-03 11:50:29 +000041258#ifdef LIBXML_WRITER_ENABLED
41259 int mem_base;
41260 int ret_val;
41261 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41262 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041263 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041264 int n_data;
41265 int start; /* the position within the data of the first byte to encode */
41266 int n_start;
41267 int len; /* the number of bytes to encode */
41268 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041269
Daniel Veillarde43cc572004-11-03 11:50:29 +000041270 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41271 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41272 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41273 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41274 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041275 writer = gen_xmlTextWriterPtr(n_writer, 0);
41276 data = gen_const_char_ptr(n_data, 1);
41277 start = gen_int(n_start, 2);
41278 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041279
41280 ret_val = xmlTextWriterWriteBinHex(writer, data, start, len);
41281 desret_int(ret_val);
41282 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041283 des_xmlTextWriterPtr(n_writer, writer, 0);
41284 des_const_char_ptr(n_data, data, 1);
41285 des_int(n_start, start, 2);
41286 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041287 xmlResetLastError();
41288 if (mem_base != xmlMemBlocks()) {
41289 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
41290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041291 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041292 printf(" %d", n_writer);
41293 printf(" %d", n_data);
41294 printf(" %d", n_start);
41295 printf(" %d", n_len);
41296 printf("\n");
41297 }
41298 }
41299 }
41300 }
41301 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041302 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041303#endif
41304
Daniel Veillard42595322004-11-08 10:52:06 +000041305 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041306}
41307
41308
41309static int
41310test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041311 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041312
Daniel Veillarde43cc572004-11-03 11:50:29 +000041313#ifdef LIBXML_WRITER_ENABLED
41314 int mem_base;
41315 int ret_val;
41316 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41317 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041318 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041319 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041320
Daniel Veillarde43cc572004-11-03 11:50:29 +000041321 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41322 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41323 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041324 writer = gen_xmlTextWriterPtr(n_writer, 0);
41325 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041326
41327 ret_val = xmlTextWriterWriteCDATA(writer, content);
41328 desret_int(ret_val);
41329 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041330 des_xmlTextWriterPtr(n_writer, writer, 0);
41331 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041332 xmlResetLastError();
41333 if (mem_base != xmlMemBlocks()) {
41334 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
41335 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041336 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041337 printf(" %d", n_writer);
41338 printf(" %d", n_content);
41339 printf("\n");
41340 }
41341 }
41342 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041343 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041344#endif
41345
Daniel Veillard42595322004-11-08 10:52:06 +000041346 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041347}
41348
41349
41350static int
41351test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041352 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041353
Daniel Veillarde43cc572004-11-03 11:50:29 +000041354#ifdef LIBXML_WRITER_ENABLED
41355 int mem_base;
41356 int ret_val;
41357 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41358 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041359 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041360 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041361
Daniel Veillarde43cc572004-11-03 11:50:29 +000041362 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41363 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41364 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041365 writer = gen_xmlTextWriterPtr(n_writer, 0);
41366 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041367
41368 ret_val = xmlTextWriterWriteComment(writer, content);
41369 desret_int(ret_val);
41370 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041371 des_xmlTextWriterPtr(n_writer, writer, 0);
41372 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041373 xmlResetLastError();
41374 if (mem_base != xmlMemBlocks()) {
41375 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
41376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041377 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041378 printf(" %d", n_writer);
41379 printf(" %d", n_content);
41380 printf("\n");
41381 }
41382 }
41383 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041384 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041385#endif
41386
Daniel Veillard42595322004-11-08 10:52:06 +000041387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041388}
41389
41390
41391static int
41392test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041394
Daniel Veillarde43cc572004-11-03 11:50:29 +000041395#ifdef LIBXML_WRITER_ENABLED
41396 int mem_base;
41397 int ret_val;
41398 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41399 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041400 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041401 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041402 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041403 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041404 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041405 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041406 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041407 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041408
Daniel Veillarde43cc572004-11-03 11:50:29 +000041409 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41410 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41411 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41412 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41413 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
41414 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041415 writer = gen_xmlTextWriterPtr(n_writer, 0);
41416 name = gen_const_xmlChar_ptr(n_name, 1);
41417 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41418 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
41419 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041420
41421 ret_val = xmlTextWriterWriteDTD(writer, name, pubid, sysid, subset);
41422 desret_int(ret_val);
41423 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041424 des_xmlTextWriterPtr(n_writer, writer, 0);
41425 des_const_xmlChar_ptr(n_name, name, 1);
41426 des_const_xmlChar_ptr(n_pubid, pubid, 2);
41427 des_const_xmlChar_ptr(n_sysid, sysid, 3);
41428 des_const_xmlChar_ptr(n_subset, subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041429 xmlResetLastError();
41430 if (mem_base != xmlMemBlocks()) {
41431 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
41432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041433 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041434 printf(" %d", n_writer);
41435 printf(" %d", n_name);
41436 printf(" %d", n_pubid);
41437 printf(" %d", n_sysid);
41438 printf(" %d", n_subset);
41439 printf("\n");
41440 }
41441 }
41442 }
41443 }
41444 }
41445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041446 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041447#endif
41448
Daniel Veillard42595322004-11-08 10:52:06 +000041449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041450}
41451
41452
41453static int
41454test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041456
Daniel Veillarde43cc572004-11-03 11:50:29 +000041457#ifdef LIBXML_WRITER_ENABLED
41458 int mem_base;
41459 int ret_val;
41460 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41461 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041462 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041463 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041464 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041465 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041466
Daniel Veillarde43cc572004-11-03 11:50:29 +000041467 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41468 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41469 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41470 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041471 writer = gen_xmlTextWriterPtr(n_writer, 0);
41472 name = gen_const_xmlChar_ptr(n_name, 1);
41473 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041474
41475 ret_val = xmlTextWriterWriteDTDAttlist(writer, name, content);
41476 desret_int(ret_val);
41477 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041478 des_xmlTextWriterPtr(n_writer, writer, 0);
41479 des_const_xmlChar_ptr(n_name, name, 1);
41480 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041481 xmlResetLastError();
41482 if (mem_base != xmlMemBlocks()) {
41483 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
41484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041485 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041486 printf(" %d", n_writer);
41487 printf(" %d", n_name);
41488 printf(" %d", n_content);
41489 printf("\n");
41490 }
41491 }
41492 }
41493 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041494 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041495#endif
41496
Daniel Veillard42595322004-11-08 10:52:06 +000041497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041498}
41499
41500
41501static int
41502test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041504
Daniel Veillarde43cc572004-11-03 11:50:29 +000041505#ifdef LIBXML_WRITER_ENABLED
41506 int mem_base;
41507 int ret_val;
41508 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41509 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041510 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041511 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041512 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041513 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041514
Daniel Veillarde43cc572004-11-03 11:50:29 +000041515 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41516 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41517 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41518 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041519 writer = gen_xmlTextWriterPtr(n_writer, 0);
41520 name = gen_const_xmlChar_ptr(n_name, 1);
41521 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041522
41523 ret_val = xmlTextWriterWriteDTDElement(writer, name, content);
41524 desret_int(ret_val);
41525 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041526 des_xmlTextWriterPtr(n_writer, writer, 0);
41527 des_const_xmlChar_ptr(n_name, name, 1);
41528 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041529 xmlResetLastError();
41530 if (mem_base != xmlMemBlocks()) {
41531 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
41532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041533 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041534 printf(" %d", n_writer);
41535 printf(" %d", n_name);
41536 printf(" %d", n_content);
41537 printf("\n");
41538 }
41539 }
41540 }
41541 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041542 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041543#endif
41544
Daniel Veillard42595322004-11-08 10:52:06 +000041545 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041546}
41547
41548
41549static int
41550test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041551 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041552
Daniel Veillarde43cc572004-11-03 11:50:29 +000041553#ifdef LIBXML_WRITER_ENABLED
41554 int mem_base;
41555 int ret_val;
41556 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41557 int n_writer;
41558 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41559 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041560 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041561 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041562 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041563 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041564 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041565 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041566 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041567 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041568 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041569 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041570
Daniel Veillarde43cc572004-11-03 11:50:29 +000041571 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41572 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41573 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41574 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41575 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41576 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41577 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41578 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041579 writer = gen_xmlTextWriterPtr(n_writer, 0);
41580 pe = gen_int(n_pe, 1);
41581 name = gen_const_xmlChar_ptr(n_name, 2);
41582 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41583 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41584 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
41585 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041586
41587 ret_val = xmlTextWriterWriteDTDEntity(writer, pe, name, pubid, sysid, ndataid, content);
41588 desret_int(ret_val);
41589 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041590 des_xmlTextWriterPtr(n_writer, writer, 0);
41591 des_int(n_pe, pe, 1);
41592 des_const_xmlChar_ptr(n_name, name, 2);
41593 des_const_xmlChar_ptr(n_pubid, pubid, 3);
41594 des_const_xmlChar_ptr(n_sysid, sysid, 4);
41595 des_const_xmlChar_ptr(n_ndataid, ndataid, 5);
41596 des_const_xmlChar_ptr(n_content, content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041597 xmlResetLastError();
41598 if (mem_base != xmlMemBlocks()) {
41599 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
41600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041601 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041602 printf(" %d", n_writer);
41603 printf(" %d", n_pe);
41604 printf(" %d", n_name);
41605 printf(" %d", n_pubid);
41606 printf(" %d", n_sysid);
41607 printf(" %d", n_ndataid);
41608 printf(" %d", n_content);
41609 printf("\n");
41610 }
41611 }
41612 }
41613 }
41614 }
41615 }
41616 }
41617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041618 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041619#endif
41620
Daniel Veillard42595322004-11-08 10:52:06 +000041621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041622}
41623
41624
41625static int
41626test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041628
Daniel Veillarde43cc572004-11-03 11:50:29 +000041629#ifdef LIBXML_WRITER_ENABLED
41630 int mem_base;
41631 int ret_val;
41632 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41633 int n_writer;
41634 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41635 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041636 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041637 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041638 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041639 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041640 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041641 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041642 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041643 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041644
Daniel Veillarde43cc572004-11-03 11:50:29 +000041645 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41646 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41647 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41648 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41649 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41650 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41651 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041652 writer = gen_xmlTextWriterPtr(n_writer, 0);
41653 pe = gen_int(n_pe, 1);
41654 name = gen_const_xmlChar_ptr(n_name, 2);
41655 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41656 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41657 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041658
41659 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, name, pubid, sysid, ndataid);
41660 desret_int(ret_val);
41661 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041662 des_xmlTextWriterPtr(n_writer, writer, 0);
41663 des_int(n_pe, pe, 1);
41664 des_const_xmlChar_ptr(n_name, name, 2);
41665 des_const_xmlChar_ptr(n_pubid, pubid, 3);
41666 des_const_xmlChar_ptr(n_sysid, sysid, 4);
41667 des_const_xmlChar_ptr(n_ndataid, ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041668 xmlResetLastError();
41669 if (mem_base != xmlMemBlocks()) {
41670 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
41671 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041672 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041673 printf(" %d", n_writer);
41674 printf(" %d", n_pe);
41675 printf(" %d", n_name);
41676 printf(" %d", n_pubid);
41677 printf(" %d", n_sysid);
41678 printf(" %d", n_ndataid);
41679 printf("\n");
41680 }
41681 }
41682 }
41683 }
41684 }
41685 }
41686 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041687 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041688#endif
41689
Daniel Veillard42595322004-11-08 10:52:06 +000041690 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041691}
41692
41693
41694static int
41695test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041696 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041697
Daniel Veillarde43cc572004-11-03 11:50:29 +000041698#ifdef LIBXML_WRITER_ENABLED
41699 int mem_base;
41700 int ret_val;
41701 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41702 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041703 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041704 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041705 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041706 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041707 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041708 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041709
Daniel Veillarde43cc572004-11-03 11:50:29 +000041710 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41711 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41712 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41713 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41714 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041715 writer = gen_xmlTextWriterPtr(n_writer, 0);
41716 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
41717 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
41718 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041719
41720 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, pubid, sysid, ndataid);
41721 desret_int(ret_val);
41722 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041723 des_xmlTextWriterPtr(n_writer, writer, 0);
41724 des_const_xmlChar_ptr(n_pubid, pubid, 1);
41725 des_const_xmlChar_ptr(n_sysid, sysid, 2);
41726 des_const_xmlChar_ptr(n_ndataid, ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041727 xmlResetLastError();
41728 if (mem_base != xmlMemBlocks()) {
41729 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
41730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041731 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041732 printf(" %d", n_writer);
41733 printf(" %d", n_pubid);
41734 printf(" %d", n_sysid);
41735 printf(" %d", n_ndataid);
41736 printf("\n");
41737 }
41738 }
41739 }
41740 }
41741 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041742 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041743#endif
41744
Daniel Veillard42595322004-11-08 10:52:06 +000041745 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041746}
41747
41748
41749static int
41750test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041751 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041752
Daniel Veillarde43cc572004-11-03 11:50:29 +000041753#ifdef LIBXML_WRITER_ENABLED
41754 int mem_base;
41755 int ret_val;
41756 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41757 int n_writer;
41758 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41759 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041760 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041761 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041762 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041763 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041764
Daniel Veillarde43cc572004-11-03 11:50:29 +000041765 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41766 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41767 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41768 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41769 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041770 writer = gen_xmlTextWriterPtr(n_writer, 0);
41771 pe = gen_int(n_pe, 1);
41772 name = gen_const_xmlChar_ptr(n_name, 2);
41773 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041774
41775 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, name, content);
41776 desret_int(ret_val);
41777 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041778 des_xmlTextWriterPtr(n_writer, writer, 0);
41779 des_int(n_pe, pe, 1);
41780 des_const_xmlChar_ptr(n_name, name, 2);
41781 des_const_xmlChar_ptr(n_content, content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041782 xmlResetLastError();
41783 if (mem_base != xmlMemBlocks()) {
41784 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
41785 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041786 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041787 printf(" %d", n_writer);
41788 printf(" %d", n_pe);
41789 printf(" %d", n_name);
41790 printf(" %d", n_content);
41791 printf("\n");
41792 }
41793 }
41794 }
41795 }
41796 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041797 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041798#endif
41799
Daniel Veillard42595322004-11-08 10:52:06 +000041800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041801}
41802
41803
41804static int
41805test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041807
Daniel Veillarde43cc572004-11-03 11:50:29 +000041808#ifdef LIBXML_WRITER_ENABLED
41809 int mem_base;
41810 int ret_val;
41811 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41812 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041813 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041814 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041815 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041816 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041817 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041818 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041819
Daniel Veillarde43cc572004-11-03 11:50:29 +000041820 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41821 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41822 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41823 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41824 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041825 writer = gen_xmlTextWriterPtr(n_writer, 0);
41826 name = gen_const_xmlChar_ptr(n_name, 1);
41827 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41828 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041829
41830 ret_val = xmlTextWriterWriteDTDNotation(writer, name, pubid, sysid);
41831 desret_int(ret_val);
41832 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041833 des_xmlTextWriterPtr(n_writer, writer, 0);
41834 des_const_xmlChar_ptr(n_name, name, 1);
41835 des_const_xmlChar_ptr(n_pubid, pubid, 2);
41836 des_const_xmlChar_ptr(n_sysid, sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041837 xmlResetLastError();
41838 if (mem_base != xmlMemBlocks()) {
41839 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
41840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041841 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041842 printf(" %d", n_writer);
41843 printf(" %d", n_name);
41844 printf(" %d", n_pubid);
41845 printf(" %d", n_sysid);
41846 printf("\n");
41847 }
41848 }
41849 }
41850 }
41851 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041852 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041853#endif
41854
Daniel Veillard42595322004-11-08 10:52:06 +000041855 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041856}
41857
41858
41859static int
41860test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041861 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041862
Daniel Veillarde43cc572004-11-03 11:50:29 +000041863#ifdef LIBXML_WRITER_ENABLED
41864 int mem_base;
41865 int ret_val;
41866 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41867 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041868 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041869 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041870 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041871 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041872
Daniel Veillarde43cc572004-11-03 11:50:29 +000041873 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41874 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41875 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41876 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041877 writer = gen_xmlTextWriterPtr(n_writer, 0);
41878 name = gen_const_xmlChar_ptr(n_name, 1);
41879 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041880
41881 ret_val = xmlTextWriterWriteElement(writer, name, content);
41882 desret_int(ret_val);
41883 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041884 des_xmlTextWriterPtr(n_writer, writer, 0);
41885 des_const_xmlChar_ptr(n_name, name, 1);
41886 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041887 xmlResetLastError();
41888 if (mem_base != xmlMemBlocks()) {
41889 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
41890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041891 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041892 printf(" %d", n_writer);
41893 printf(" %d", n_name);
41894 printf(" %d", n_content);
41895 printf("\n");
41896 }
41897 }
41898 }
41899 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041900 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041901#endif
41902
Daniel Veillard42595322004-11-08 10:52:06 +000041903 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041904}
41905
41906
41907static int
41908test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041909 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041910
Daniel Veillarde43cc572004-11-03 11:50:29 +000041911#ifdef LIBXML_WRITER_ENABLED
41912 int mem_base;
41913 int ret_val;
41914 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41915 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041916 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041917 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041918 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041919 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041920 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041921 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041922 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041923 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041924
Daniel Veillarde43cc572004-11-03 11:50:29 +000041925 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41926 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41927 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41928 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41929 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41930 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041931 writer = gen_xmlTextWriterPtr(n_writer, 0);
41932 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41933 name = gen_const_xmlChar_ptr(n_name, 2);
41934 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41935 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041936
41937 ret_val = xmlTextWriterWriteElementNS(writer, prefix, name, namespaceURI, content);
41938 desret_int(ret_val);
41939 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041940 des_xmlTextWriterPtr(n_writer, writer, 0);
41941 des_const_xmlChar_ptr(n_prefix, prefix, 1);
41942 des_const_xmlChar_ptr(n_name, name, 2);
41943 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
41944 des_const_xmlChar_ptr(n_content, content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041945 xmlResetLastError();
41946 if (mem_base != xmlMemBlocks()) {
41947 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
41948 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041949 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041950 printf(" %d", n_writer);
41951 printf(" %d", n_prefix);
41952 printf(" %d", n_name);
41953 printf(" %d", n_namespaceURI);
41954 printf(" %d", n_content);
41955 printf("\n");
41956 }
41957 }
41958 }
41959 }
41960 }
41961 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041962 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041963#endif
41964
Daniel Veillard42595322004-11-08 10:52:06 +000041965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041966}
41967
41968
41969static int
41970test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041972
41973
41974 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041976}
41977
41978
41979static int
41980test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041982
41983
41984 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041985 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041986}
41987
41988
41989static int
41990test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041991 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041992
41993
41994 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041996}
41997
41998
41999static int
42000test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042002
42003
42004 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042005 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042006}
42007
42008
42009static int
42010test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042011 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042012
42013
42014 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042015 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042016}
42017
42018
42019static int
42020test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042021 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042022
42023
42024 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042025 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042026}
42027
42028
42029static int
42030test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042031 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042032
42033
42034 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042036}
42037
42038
42039static int
42040test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042042
42043
42044 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042046}
42047
42048
42049static int
42050test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042052
42053
42054 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042056}
42057
42058
42059static int
42060test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042062
42063
42064 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042065 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042066}
42067
42068
42069static int
42070test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042072
42073
42074 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042075 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042076}
42077
42078
42079static int
42080test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042081 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042082
42083
42084 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042086}
42087
42088
42089static int
42090test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042092
42093
42094 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042096}
42097
42098
42099static int
42100test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042102
Daniel Veillarde43cc572004-11-03 11:50:29 +000042103#ifdef LIBXML_WRITER_ENABLED
42104 int mem_base;
42105 int ret_val;
42106 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42107 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042108 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042109 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042110 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042111 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042112
Daniel Veillarde43cc572004-11-03 11:50:29 +000042113 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42114 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
42115 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42116 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042117 writer = gen_xmlTextWriterPtr(n_writer, 0);
42118 target = gen_const_xmlChar_ptr(n_target, 1);
42119 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042120
42121 ret_val = xmlTextWriterWritePI(writer, target, content);
42122 desret_int(ret_val);
42123 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042124 des_xmlTextWriterPtr(n_writer, writer, 0);
42125 des_const_xmlChar_ptr(n_target, target, 1);
42126 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042127 xmlResetLastError();
42128 if (mem_base != xmlMemBlocks()) {
42129 printf("Leak of %d blocks found in xmlTextWriterWritePI",
42130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042131 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042132 printf(" %d", n_writer);
42133 printf(" %d", n_target);
42134 printf(" %d", n_content);
42135 printf("\n");
42136 }
42137 }
42138 }
42139 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042140 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042141#endif
42142
Daniel Veillard42595322004-11-08 10:52:06 +000042143 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042144}
42145
42146
42147static int
42148test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042149 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042150
Daniel Veillarde43cc572004-11-03 11:50:29 +000042151#ifdef LIBXML_WRITER_ENABLED
42152 int mem_base;
42153 int ret_val;
42154 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42155 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042156 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042157 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042158
Daniel Veillarde43cc572004-11-03 11:50:29 +000042159 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42160 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42161 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042162 writer = gen_xmlTextWriterPtr(n_writer, 0);
42163 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042164
42165 ret_val = xmlTextWriterWriteRaw(writer, content);
42166 desret_int(ret_val);
42167 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042168 des_xmlTextWriterPtr(n_writer, writer, 0);
42169 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042170 xmlResetLastError();
42171 if (mem_base != xmlMemBlocks()) {
42172 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
42173 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042174 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042175 printf(" %d", n_writer);
42176 printf(" %d", n_content);
42177 printf("\n");
42178 }
42179 }
42180 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042181 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042182#endif
42183
Daniel Veillard42595322004-11-08 10:52:06 +000042184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042185}
42186
42187
42188static int
42189test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042191
Daniel Veillarde43cc572004-11-03 11:50:29 +000042192#ifdef LIBXML_WRITER_ENABLED
42193 int mem_base;
42194 int ret_val;
42195 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42196 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042197 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042198 int n_content;
42199 int len; /* length of the text string */
42200 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042201
Daniel Veillarde43cc572004-11-03 11:50:29 +000042202 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42203 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42204 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42205 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042206 writer = gen_xmlTextWriterPtr(n_writer, 0);
42207 content = gen_const_xmlChar_ptr(n_content, 1);
42208 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042209
42210 ret_val = xmlTextWriterWriteRawLen(writer, content, len);
42211 desret_int(ret_val);
42212 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042213 des_xmlTextWriterPtr(n_writer, writer, 0);
42214 des_const_xmlChar_ptr(n_content, content, 1);
42215 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042216 xmlResetLastError();
42217 if (mem_base != xmlMemBlocks()) {
42218 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
42219 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042220 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042221 printf(" %d", n_writer);
42222 printf(" %d", n_content);
42223 printf(" %d", n_len);
42224 printf("\n");
42225 }
42226 }
42227 }
42228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042229 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042230#endif
42231
Daniel Veillard42595322004-11-08 10:52:06 +000042232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042233}
42234
42235
42236static int
42237test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042239
Daniel Veillarde43cc572004-11-03 11:50:29 +000042240#ifdef LIBXML_WRITER_ENABLED
42241 int mem_base;
42242 int ret_val;
42243 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42244 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042245 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042246 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042247
Daniel Veillarde43cc572004-11-03 11:50:29 +000042248 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42249 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42250 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042251 writer = gen_xmlTextWriterPtr(n_writer, 0);
42252 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042253
42254 ret_val = xmlTextWriterWriteString(writer, content);
42255 desret_int(ret_val);
42256 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042257 des_xmlTextWriterPtr(n_writer, writer, 0);
42258 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042259 xmlResetLastError();
42260 if (mem_base != xmlMemBlocks()) {
42261 printf("Leak of %d blocks found in xmlTextWriterWriteString",
42262 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042263 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042264 printf(" %d", n_writer);
42265 printf(" %d", n_content);
42266 printf("\n");
42267 }
42268 }
42269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042270 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042271#endif
42272
Daniel Veillard42595322004-11-08 10:52:06 +000042273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042274}
42275
42276
42277static int
42278test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042280
42281
42282 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042283 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042284}
42285
42286
42287static int
42288test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042289 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042290
42291
42292 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042293 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042294}
42295
42296
42297static int
42298test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042300
42301
42302 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042303 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042304}
42305
42306
42307static int
42308test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042309 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042310
42311
42312 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042314}
42315
42316
42317static int
42318test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042320
42321
42322 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042324}
42325
42326
42327static int
42328test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042330
42331
42332 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042334}
42335
42336
42337static int
42338test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042340
42341
42342 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042344}
42345
42346
42347static int
42348test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042350
42351
42352 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042354}
42355
42356
42357static int
42358test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042360
42361
42362 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042364}
42365
42366
42367static int
42368test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042370
42371
42372 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042374}
42375
42376
42377static int
42378test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042380
42381
42382 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042384}
42385
42386
42387static int
42388test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042390
42391
42392 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042394}
42395
42396
42397static int
42398test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042399 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042400
42401
42402 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042403 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042404}
42405
42406static int
42407test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042408 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042409
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042410 if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000042411 test_ret += test_xmlNewTextWriter();
42412 test_ret += test_xmlNewTextWriterFilename();
42413 test_ret += test_xmlNewTextWriterMemory();
42414 test_ret += test_xmlNewTextWriterPushParser();
42415 test_ret += test_xmlNewTextWriterTree();
42416 test_ret += test_xmlTextWriterEndAttribute();
42417 test_ret += test_xmlTextWriterEndCDATA();
42418 test_ret += test_xmlTextWriterEndComment();
42419 test_ret += test_xmlTextWriterEndDTD();
42420 test_ret += test_xmlTextWriterEndDTDAttlist();
42421 test_ret += test_xmlTextWriterEndDTDElement();
42422 test_ret += test_xmlTextWriterEndDTDEntity();
42423 test_ret += test_xmlTextWriterEndDocument();
42424 test_ret += test_xmlTextWriterEndElement();
42425 test_ret += test_xmlTextWriterEndPI();
42426 test_ret += test_xmlTextWriterFlush();
42427 test_ret += test_xmlTextWriterFullEndElement();
42428 test_ret += test_xmlTextWriterSetIndent();
42429 test_ret += test_xmlTextWriterSetIndentString();
42430 test_ret += test_xmlTextWriterStartAttribute();
42431 test_ret += test_xmlTextWriterStartAttributeNS();
42432 test_ret += test_xmlTextWriterStartCDATA();
42433 test_ret += test_xmlTextWriterStartComment();
42434 test_ret += test_xmlTextWriterStartDTD();
42435 test_ret += test_xmlTextWriterStartDTDAttlist();
42436 test_ret += test_xmlTextWriterStartDTDElement();
42437 test_ret += test_xmlTextWriterStartDTDEntity();
42438 test_ret += test_xmlTextWriterStartDocument();
42439 test_ret += test_xmlTextWriterStartElement();
42440 test_ret += test_xmlTextWriterStartElementNS();
42441 test_ret += test_xmlTextWriterStartPI();
42442 test_ret += test_xmlTextWriterWriteAttribute();
42443 test_ret += test_xmlTextWriterWriteAttributeNS();
42444 test_ret += test_xmlTextWriterWriteBase64();
42445 test_ret += test_xmlTextWriterWriteBinHex();
42446 test_ret += test_xmlTextWriterWriteCDATA();
42447 test_ret += test_xmlTextWriterWriteComment();
42448 test_ret += test_xmlTextWriterWriteDTD();
42449 test_ret += test_xmlTextWriterWriteDTDAttlist();
42450 test_ret += test_xmlTextWriterWriteDTDElement();
42451 test_ret += test_xmlTextWriterWriteDTDEntity();
42452 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
42453 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
42454 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
42455 test_ret += test_xmlTextWriterWriteDTDNotation();
42456 test_ret += test_xmlTextWriterWriteElement();
42457 test_ret += test_xmlTextWriterWriteElementNS();
42458 test_ret += test_xmlTextWriterWriteFormatAttribute();
42459 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
42460 test_ret += test_xmlTextWriterWriteFormatCDATA();
42461 test_ret += test_xmlTextWriterWriteFormatComment();
42462 test_ret += test_xmlTextWriterWriteFormatDTD();
42463 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
42464 test_ret += test_xmlTextWriterWriteFormatDTDElement();
42465 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
42466 test_ret += test_xmlTextWriterWriteFormatElement();
42467 test_ret += test_xmlTextWriterWriteFormatElementNS();
42468 test_ret += test_xmlTextWriterWriteFormatPI();
42469 test_ret += test_xmlTextWriterWriteFormatRaw();
42470 test_ret += test_xmlTextWriterWriteFormatString();
42471 test_ret += test_xmlTextWriterWritePI();
42472 test_ret += test_xmlTextWriterWriteRaw();
42473 test_ret += test_xmlTextWriterWriteRawLen();
42474 test_ret += test_xmlTextWriterWriteString();
42475 test_ret += test_xmlTextWriterWriteVFormatAttribute();
42476 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
42477 test_ret += test_xmlTextWriterWriteVFormatCDATA();
42478 test_ret += test_xmlTextWriterWriteVFormatComment();
42479 test_ret += test_xmlTextWriterWriteVFormatDTD();
42480 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
42481 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
42482 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
42483 test_ret += test_xmlTextWriterWriteVFormatElement();
42484 test_ret += test_xmlTextWriterWriteVFormatElementNS();
42485 test_ret += test_xmlTextWriterWriteVFormatPI();
42486 test_ret += test_xmlTextWriterWriteVFormatRaw();
42487 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000042488
Daniel Veillard42595322004-11-08 10:52:06 +000042489 if (test_ret != 0)
42490 printf("Module xmlwriter: %d errors\n", test_ret);
42491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042492}
42493
42494static int
42495test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042497
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042498#ifdef LIBXML_XPATH_ENABLED
42499 int mem_base;
42500 double ret_val;
42501 int val; /* a boolean */
42502 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042503
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042504 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42505 mem_base = xmlMemBlocks();
42506 val = gen_int(n_val, 0);
42507
42508 ret_val = xmlXPathCastBooleanToNumber(val);
42509 desret_double(ret_val);
42510 call_tests++;
42511 des_int(n_val, val, 0);
42512 xmlResetLastError();
42513 if (mem_base != xmlMemBlocks()) {
42514 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
42515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042516 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042517 printf(" %d", n_val);
42518 printf("\n");
42519 }
42520 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042521 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042522#endif
42523
Daniel Veillard42595322004-11-08 10:52:06 +000042524 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042525}
42526
42527
42528static int
42529test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042530 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042531
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042532#ifdef LIBXML_XPATH_ENABLED
42533 int mem_base;
42534 xmlChar * ret_val;
42535 int val; /* a boolean */
42536 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042537
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042538 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42539 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042540 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042541
42542 ret_val = xmlXPathCastBooleanToString(val);
42543 desret_xmlChar_ptr(ret_val);
42544 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042545 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042546 xmlResetLastError();
42547 if (mem_base != xmlMemBlocks()) {
42548 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
42549 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042550 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042551 printf(" %d", n_val);
42552 printf("\n");
42553 }
42554 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042555 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042556#endif
42557
Daniel Veillard42595322004-11-08 10:52:06 +000042558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042559}
42560
42561
42562static int
42563test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042565
Daniel Veillardce682bc2004-11-05 17:22:25 +000042566#ifdef LIBXML_XPATH_ENABLED
42567 int mem_base;
42568 int ret_val;
42569 xmlNodeSetPtr ns; /* a node-set */
42570 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042571
Daniel Veillardce682bc2004-11-05 17:22:25 +000042572 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42573 mem_base = xmlMemBlocks();
42574 ns = gen_xmlNodeSetPtr(n_ns, 0);
42575
42576 ret_val = xmlXPathCastNodeSetToBoolean(ns);
42577 desret_int(ret_val);
42578 call_tests++;
42579 des_xmlNodeSetPtr(n_ns, ns, 0);
42580 xmlResetLastError();
42581 if (mem_base != xmlMemBlocks()) {
42582 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
42583 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042584 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042585 printf(" %d", n_ns);
42586 printf("\n");
42587 }
42588 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042589 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042590#endif
42591
Daniel Veillard42595322004-11-08 10:52:06 +000042592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042593}
42594
42595
42596static int
42597test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042598 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042599
Daniel Veillardce682bc2004-11-05 17:22:25 +000042600#ifdef LIBXML_XPATH_ENABLED
42601 int mem_base;
42602 double ret_val;
42603 xmlNodeSetPtr ns; /* a node-set */
42604 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042605
Daniel Veillardce682bc2004-11-05 17:22:25 +000042606 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42607 mem_base = xmlMemBlocks();
42608 ns = gen_xmlNodeSetPtr(n_ns, 0);
42609
42610 ret_val = xmlXPathCastNodeSetToNumber(ns);
42611 desret_double(ret_val);
42612 call_tests++;
42613 des_xmlNodeSetPtr(n_ns, ns, 0);
42614 xmlResetLastError();
42615 if (mem_base != xmlMemBlocks()) {
42616 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
42617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042618 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042619 printf(" %d", n_ns);
42620 printf("\n");
42621 }
42622 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042623 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042624#endif
42625
Daniel Veillard42595322004-11-08 10:52:06 +000042626 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042627}
42628
42629
42630static int
42631test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042632 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042633
Daniel Veillardce682bc2004-11-05 17:22:25 +000042634#ifdef LIBXML_XPATH_ENABLED
42635 int mem_base;
42636 xmlChar * ret_val;
42637 xmlNodeSetPtr ns; /* a node-set */
42638 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042639
Daniel Veillardce682bc2004-11-05 17:22:25 +000042640 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42641 mem_base = xmlMemBlocks();
42642 ns = gen_xmlNodeSetPtr(n_ns, 0);
42643
42644 ret_val = xmlXPathCastNodeSetToString(ns);
42645 desret_xmlChar_ptr(ret_val);
42646 call_tests++;
42647 des_xmlNodeSetPtr(n_ns, ns, 0);
42648 xmlResetLastError();
42649 if (mem_base != xmlMemBlocks()) {
42650 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
42651 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042652 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042653 printf(" %d", n_ns);
42654 printf("\n");
42655 }
42656 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042657 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042658#endif
42659
Daniel Veillard42595322004-11-08 10:52:06 +000042660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042661}
42662
42663
42664static int
42665test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042667
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042668#ifdef LIBXML_XPATH_ENABLED
42669 int mem_base;
42670 double ret_val;
42671 xmlNodePtr node; /* a node */
42672 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042673
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042674 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42675 mem_base = xmlMemBlocks();
42676 node = gen_xmlNodePtr(n_node, 0);
42677
42678 ret_val = xmlXPathCastNodeToNumber(node);
42679 desret_double(ret_val);
42680 call_tests++;
42681 des_xmlNodePtr(n_node, node, 0);
42682 xmlResetLastError();
42683 if (mem_base != xmlMemBlocks()) {
42684 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
42685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042686 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042687 printf(" %d", n_node);
42688 printf("\n");
42689 }
42690 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042691 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042692#endif
42693
Daniel Veillard42595322004-11-08 10:52:06 +000042694 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042695}
42696
42697
42698static int
42699test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042700 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042701
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042702#ifdef LIBXML_XPATH_ENABLED
42703 int mem_base;
42704 xmlChar * ret_val;
42705 xmlNodePtr node; /* a node */
42706 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042707
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042708 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42709 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042710 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042711
42712 ret_val = xmlXPathCastNodeToString(node);
42713 desret_xmlChar_ptr(ret_val);
42714 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042715 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042716 xmlResetLastError();
42717 if (mem_base != xmlMemBlocks()) {
42718 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
42719 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042720 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042721 printf(" %d", n_node);
42722 printf("\n");
42723 }
42724 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042725 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042726#endif
42727
Daniel Veillard42595322004-11-08 10:52:06 +000042728 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042729}
42730
42731
42732static int
42733test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042735
Daniel Veillard3d95c732004-11-06 22:25:14 +000042736#ifdef LIBXML_XPATH_ENABLED
42737 int mem_base;
42738 int ret_val;
42739 double val; /* a number */
42740 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042741
Daniel Veillard3d95c732004-11-06 22:25:14 +000042742 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42743 mem_base = xmlMemBlocks();
42744 val = gen_double(n_val, 0);
42745
42746 ret_val = xmlXPathCastNumberToBoolean(val);
42747 desret_int(ret_val);
42748 call_tests++;
42749 des_double(n_val, val, 0);
42750 xmlResetLastError();
42751 if (mem_base != xmlMemBlocks()) {
42752 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
42753 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042754 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042755 printf(" %d", n_val);
42756 printf("\n");
42757 }
42758 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042759 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042760#endif
42761
Daniel Veillard42595322004-11-08 10:52:06 +000042762 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042763}
42764
42765
42766static int
42767test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042769
Daniel Veillard3d95c732004-11-06 22:25:14 +000042770#ifdef LIBXML_XPATH_ENABLED
42771 int mem_base;
42772 xmlChar * ret_val;
42773 double val; /* a number */
42774 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042775
Daniel Veillard3d95c732004-11-06 22:25:14 +000042776 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42777 mem_base = xmlMemBlocks();
42778 val = gen_double(n_val, 0);
42779
42780 ret_val = xmlXPathCastNumberToString(val);
42781 desret_xmlChar_ptr(ret_val);
42782 call_tests++;
42783 des_double(n_val, val, 0);
42784 xmlResetLastError();
42785 if (mem_base != xmlMemBlocks()) {
42786 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
42787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042788 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042789 printf(" %d", n_val);
42790 printf("\n");
42791 }
42792 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042793 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042794#endif
42795
Daniel Veillard42595322004-11-08 10:52:06 +000042796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042797}
42798
42799
42800static int
42801test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042803
42804#ifdef LIBXML_XPATH_ENABLED
42805 int mem_base;
42806 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042807 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000042808 int n_val;
42809
42810 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42811 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042812 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042813
42814 ret_val = xmlXPathCastStringToBoolean(val);
42815 desret_int(ret_val);
42816 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042817 des_const_xmlChar_ptr(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042818 xmlResetLastError();
42819 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042820 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042821 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042822 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042823 printf(" %d", n_val);
42824 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042825 }
42826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042827 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042828#endif
42829
Daniel Veillard42595322004-11-08 10:52:06 +000042830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042831}
42832
42833
42834static int
42835test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042837
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042838#ifdef LIBXML_XPATH_ENABLED
42839 int mem_base;
42840 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042841 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042842 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042843
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042844 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42845 mem_base = xmlMemBlocks();
42846 val = gen_const_xmlChar_ptr(n_val, 0);
42847
42848 ret_val = xmlXPathCastStringToNumber(val);
42849 desret_double(ret_val);
42850 call_tests++;
42851 des_const_xmlChar_ptr(n_val, val, 0);
42852 xmlResetLastError();
42853 if (mem_base != xmlMemBlocks()) {
42854 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
42855 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042856 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042857 printf(" %d", n_val);
42858 printf("\n");
42859 }
42860 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042861 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042862#endif
42863
Daniel Veillard42595322004-11-08 10:52:06 +000042864 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042865}
42866
42867
42868static int
42869test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042870 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042871
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042872#ifdef LIBXML_XPATH_ENABLED
42873 int mem_base;
42874 int ret_val;
42875 xmlXPathObjectPtr val; /* an XPath object */
42876 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042877
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042878 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42879 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042880 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042881
42882 ret_val = xmlXPathCastToBoolean(val);
42883 desret_int(ret_val);
42884 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042885 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042886 xmlResetLastError();
42887 if (mem_base != xmlMemBlocks()) {
42888 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
42889 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042890 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042891 printf(" %d", n_val);
42892 printf("\n");
42893 }
42894 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042895 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042896#endif
42897
Daniel Veillard42595322004-11-08 10:52:06 +000042898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042899}
42900
42901
42902static int
42903test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042905
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042906#ifdef LIBXML_XPATH_ENABLED
42907 int mem_base;
42908 double ret_val;
42909 xmlXPathObjectPtr val; /* an XPath object */
42910 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042911
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042912 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42913 mem_base = xmlMemBlocks();
42914 val = gen_xmlXPathObjectPtr(n_val, 0);
42915
42916 ret_val = xmlXPathCastToNumber(val);
42917 desret_double(ret_val);
42918 call_tests++;
42919 des_xmlXPathObjectPtr(n_val, val, 0);
42920 xmlResetLastError();
42921 if (mem_base != xmlMemBlocks()) {
42922 printf("Leak of %d blocks found in xmlXPathCastToNumber",
42923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042924 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042925 printf(" %d", n_val);
42926 printf("\n");
42927 }
42928 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042929 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042930#endif
42931
Daniel Veillard42595322004-11-08 10:52:06 +000042932 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042933}
42934
42935
42936static int
42937test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042938 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042939
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042940#ifdef LIBXML_XPATH_ENABLED
42941 int mem_base;
42942 xmlChar * ret_val;
42943 xmlXPathObjectPtr val; /* an XPath object */
42944 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042945
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042946 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42947 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042948 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042949
42950 ret_val = xmlXPathCastToString(val);
42951 desret_xmlChar_ptr(ret_val);
42952 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042953 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042954 xmlResetLastError();
42955 if (mem_base != xmlMemBlocks()) {
42956 printf("Leak of %d blocks found in xmlXPathCastToString",
42957 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042958 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042959 printf(" %d", n_val);
42960 printf("\n");
42961 }
42962 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042963 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042964#endif
42965
Daniel Veillard42595322004-11-08 10:52:06 +000042966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042967}
42968
42969
42970static int
42971test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042973
42974#ifdef LIBXML_XPATH_ENABLED
42975 int mem_base;
42976 int ret_val;
42977 xmlNodePtr node1; /* the first node */
42978 int n_node1;
42979 xmlNodePtr node2; /* the second node */
42980 int n_node2;
42981
42982 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
42983 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
42984 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042985 node1 = gen_xmlNodePtr(n_node1, 0);
42986 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042987
42988 ret_val = xmlXPathCmpNodes(node1, node2);
42989 desret_int(ret_val);
42990 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042991 des_xmlNodePtr(n_node1, node1, 0);
42992 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042993 xmlResetLastError();
42994 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042995 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042996 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042997 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042998 printf(" %d", n_node1);
42999 printf(" %d", n_node2);
43000 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043001 }
43002 }
43003 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043004 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043005#endif
43006
Daniel Veillard42595322004-11-08 10:52:06 +000043007 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043008}
43009
43010
43011static int
43012test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043013 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043014
43015
43016 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043017 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043018}
43019
Daniel Veillarda521d282004-11-09 14:59:59 +000043020#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043021
Daniel Veillardce682bc2004-11-05 17:22:25 +000043022#define gen_nb_xmlXPathCompExprPtr 1
43023static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43024 return(NULL);
43025}
43026static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43027}
Daniel Veillarda521d282004-11-09 14:59:59 +000043028#endif
43029
43030#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000043031
43032#define gen_nb_xmlXPathContextPtr 1
43033static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43034 return(NULL);
43035}
43036static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43037}
Daniel Veillarda521d282004-11-09 14:59:59 +000043038#endif
43039
Daniel Veillardce682bc2004-11-05 17:22:25 +000043040
Daniel Veillardd93f6252004-11-02 15:53:51 +000043041static int
43042test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043043 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043044
Daniel Veillardce682bc2004-11-05 17:22:25 +000043045#ifdef LIBXML_XPATH_ENABLED
43046 int mem_base;
43047 xmlXPathObjectPtr ret_val;
43048 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
43049 int n_comp;
43050 xmlXPathContextPtr ctx; /* the XPath context */
43051 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043052
Daniel Veillardce682bc2004-11-05 17:22:25 +000043053 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43054 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43055 mem_base = xmlMemBlocks();
43056 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
43057 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43058
43059 ret_val = xmlXPathCompiledEval(comp, ctx);
43060 desret_xmlXPathObjectPtr(ret_val);
43061 call_tests++;
43062 des_xmlXPathCompExprPtr(n_comp, comp, 0);
43063 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43064 xmlResetLastError();
43065 if (mem_base != xmlMemBlocks()) {
43066 printf("Leak of %d blocks found in xmlXPathCompiledEval",
43067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043068 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043069 printf(" %d", n_comp);
43070 printf(" %d", n_ctx);
43071 printf("\n");
43072 }
43073 }
43074 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043075 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043076#endif
43077
Daniel Veillard42595322004-11-08 10:52:06 +000043078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043079}
43080
43081
43082static int
43083test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043085
Daniel Veillard3d97e662004-11-04 10:49:00 +000043086#ifdef LIBXML_XPATH_ENABLED
43087 int mem_base;
43088 xmlXPathObjectPtr ret_val;
43089 xmlXPathObjectPtr val; /* an XPath object */
43090 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043091
Daniel Veillard3d97e662004-11-04 10:49:00 +000043092 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43093 mem_base = xmlMemBlocks();
43094 val = gen_xmlXPathObjectPtr(n_val, 0);
43095
43096 ret_val = xmlXPathConvertBoolean(val);
43097 val = NULL;
43098 desret_xmlXPathObjectPtr(ret_val);
43099 call_tests++;
43100 des_xmlXPathObjectPtr(n_val, val, 0);
43101 xmlResetLastError();
43102 if (mem_base != xmlMemBlocks()) {
43103 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
43104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043105 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043106 printf(" %d", n_val);
43107 printf("\n");
43108 }
43109 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043110 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043111#endif
43112
Daniel Veillard42595322004-11-08 10:52:06 +000043113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043114}
43115
43116
43117static int
43118test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043120
Daniel Veillard3d97e662004-11-04 10:49:00 +000043121#ifdef LIBXML_XPATH_ENABLED
43122 int mem_base;
43123 xmlXPathObjectPtr ret_val;
43124 xmlXPathObjectPtr val; /* an XPath object */
43125 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043126
Daniel Veillard3d97e662004-11-04 10:49:00 +000043127 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43128 mem_base = xmlMemBlocks();
43129 val = gen_xmlXPathObjectPtr(n_val, 0);
43130
43131 ret_val = xmlXPathConvertNumber(val);
43132 val = NULL;
43133 desret_xmlXPathObjectPtr(ret_val);
43134 call_tests++;
43135 des_xmlXPathObjectPtr(n_val, val, 0);
43136 xmlResetLastError();
43137 if (mem_base != xmlMemBlocks()) {
43138 printf("Leak of %d blocks found in xmlXPathConvertNumber",
43139 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043140 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043141 printf(" %d", n_val);
43142 printf("\n");
43143 }
43144 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043145 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043146#endif
43147
Daniel Veillard42595322004-11-08 10:52:06 +000043148 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043149}
43150
43151
43152static int
43153test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043155
Daniel Veillard3d97e662004-11-04 10:49:00 +000043156#ifdef LIBXML_XPATH_ENABLED
43157 int mem_base;
43158 xmlXPathObjectPtr ret_val;
43159 xmlXPathObjectPtr val; /* an XPath object */
43160 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043161
Daniel Veillard3d97e662004-11-04 10:49:00 +000043162 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43163 mem_base = xmlMemBlocks();
43164 val = gen_xmlXPathObjectPtr(n_val, 0);
43165
43166 ret_val = xmlXPathConvertString(val);
43167 val = NULL;
43168 desret_xmlXPathObjectPtr(ret_val);
43169 call_tests++;
43170 des_xmlXPathObjectPtr(n_val, val, 0);
43171 xmlResetLastError();
43172 if (mem_base != xmlMemBlocks()) {
43173 printf("Leak of %d blocks found in xmlXPathConvertString",
43174 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043175 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043176 printf(" %d", n_val);
43177 printf("\n");
43178 }
43179 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043180 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043181#endif
43182
Daniel Veillard42595322004-11-08 10:52:06 +000043183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043184}
43185
43186
43187static int
43188test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043190
43191
43192 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043194}
43195
43196
43197static int
43198test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043200
Daniel Veillardce682bc2004-11-05 17:22:25 +000043201#ifdef LIBXML_XPATH_ENABLED
43202 int mem_base;
43203 xmlXPathObjectPtr ret_val;
43204 xmlChar * str; /* the XPath expression */
43205 int n_str;
43206 xmlXPathContextPtr ctx; /* the XPath context */
43207 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043208
Daniel Veillardce682bc2004-11-05 17:22:25 +000043209 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43210 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43211 mem_base = xmlMemBlocks();
43212 str = gen_const_xmlChar_ptr(n_str, 0);
43213 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43214
43215 ret_val = xmlXPathEval(str, ctx);
43216 desret_xmlXPathObjectPtr(ret_val);
43217 call_tests++;
43218 des_const_xmlChar_ptr(n_str, str, 0);
43219 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43220 xmlResetLastError();
43221 if (mem_base != xmlMemBlocks()) {
43222 printf("Leak of %d blocks found in xmlXPathEval",
43223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043224 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043225 printf(" %d", n_str);
43226 printf(" %d", n_ctx);
43227 printf("\n");
43228 }
43229 }
43230 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043231 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043232#endif
43233
Daniel Veillard42595322004-11-08 10:52:06 +000043234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043235}
43236
43237
43238static int
43239test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043240 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043241
Daniel Veillardce682bc2004-11-05 17:22:25 +000043242#ifdef LIBXML_XPATH_ENABLED
43243 int mem_base;
43244 xmlXPathObjectPtr ret_val;
43245 xmlChar * str; /* the XPath expression */
43246 int n_str;
43247 xmlXPathContextPtr ctxt; /* the XPath context */
43248 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043249
Daniel Veillardce682bc2004-11-05 17:22:25 +000043250 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43251 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43252 mem_base = xmlMemBlocks();
43253 str = gen_const_xmlChar_ptr(n_str, 0);
43254 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
43255
43256 ret_val = xmlXPathEvalExpression(str, ctxt);
43257 desret_xmlXPathObjectPtr(ret_val);
43258 call_tests++;
43259 des_const_xmlChar_ptr(n_str, str, 0);
43260 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
43261 xmlResetLastError();
43262 if (mem_base != xmlMemBlocks()) {
43263 printf("Leak of %d blocks found in xmlXPathEvalExpression",
43264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043265 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043266 printf(" %d", n_str);
43267 printf(" %d", n_ctxt);
43268 printf("\n");
43269 }
43270 }
43271 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043272 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043273#endif
43274
Daniel Veillard42595322004-11-08 10:52:06 +000043275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043276}
43277
43278
43279static int
43280test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043282
Daniel Veillardce682bc2004-11-05 17:22:25 +000043283#ifdef LIBXML_XPATH_ENABLED
43284 int mem_base;
43285 int ret_val;
43286 xmlXPathContextPtr ctxt; /* the XPath context */
43287 int n_ctxt;
43288 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43289 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043290
Daniel Veillardce682bc2004-11-05 17:22:25 +000043291 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43292 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43293 mem_base = xmlMemBlocks();
43294 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
43295 res = gen_xmlXPathObjectPtr(n_res, 1);
43296
43297 ret_val = xmlXPathEvalPredicate(ctxt, res);
43298 desret_int(ret_val);
43299 call_tests++;
43300 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
43301 des_xmlXPathObjectPtr(n_res, res, 1);
43302 xmlResetLastError();
43303 if (mem_base != xmlMemBlocks()) {
43304 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
43305 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043306 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043307 printf(" %d", n_ctxt);
43308 printf(" %d", n_res);
43309 printf("\n");
43310 }
43311 }
43312 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043313 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043314#endif
43315
Daniel Veillard42595322004-11-08 10:52:06 +000043316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043317}
43318
43319
43320static int
43321test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043323
43324#ifdef LIBXML_XPATH_ENABLED
43325 int mem_base;
43326
43327 mem_base = xmlMemBlocks();
43328
43329 xmlXPathInit();
43330 call_tests++;
43331 xmlResetLastError();
43332 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043333 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043335 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043336 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043337 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043338 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043339#endif
43340
Daniel Veillard42595322004-11-08 10:52:06 +000043341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043342}
43343
43344
43345static int
43346test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043348
Daniel Veillard3d95c732004-11-06 22:25:14 +000043349#ifdef LIBXML_XPATH_ENABLED
43350 int mem_base;
43351 int ret_val;
43352 double val; /* a double value */
43353 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043354
Daniel Veillard3d95c732004-11-06 22:25:14 +000043355 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43356 mem_base = xmlMemBlocks();
43357 val = gen_double(n_val, 0);
43358
43359 ret_val = xmlXPathIsInf(val);
43360 desret_int(ret_val);
43361 call_tests++;
43362 des_double(n_val, val, 0);
43363 xmlResetLastError();
43364 if (mem_base != xmlMemBlocks()) {
43365 printf("Leak of %d blocks found in xmlXPathIsInf",
43366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043367 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043368 printf(" %d", n_val);
43369 printf("\n");
43370 }
43371 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043372 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043373#endif
43374
Daniel Veillard42595322004-11-08 10:52:06 +000043375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043376}
43377
43378
43379static int
43380test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043382
Daniel Veillard3d95c732004-11-06 22:25:14 +000043383#ifdef LIBXML_XPATH_ENABLED
43384 int mem_base;
43385 int ret_val;
43386 double val; /* a double value */
43387 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043388
Daniel Veillard3d95c732004-11-06 22:25:14 +000043389 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43390 mem_base = xmlMemBlocks();
43391 val = gen_double(n_val, 0);
43392
43393 ret_val = xmlXPathIsNaN(val);
43394 desret_int(ret_val);
43395 call_tests++;
43396 des_double(n_val, val, 0);
43397 xmlResetLastError();
43398 if (mem_base != xmlMemBlocks()) {
43399 printf("Leak of %d blocks found in xmlXPathIsNaN",
43400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043401 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043402 printf(" %d", n_val);
43403 printf("\n");
43404 }
43405 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043406 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043407#endif
43408
Daniel Veillard42595322004-11-08 10:52:06 +000043409 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043410}
43411
43412
43413static int
43414test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043415 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043416
43417
43418 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043420}
43421
43422
43423static int
43424test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043426
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043427#ifdef LIBXML_XPATH_ENABLED
43428 int mem_base;
43429 xmlNodeSetPtr ret_val;
43430 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
43431 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043432
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043433 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43434 mem_base = xmlMemBlocks();
43435 val = gen_xmlNodePtr(n_val, 0);
43436
43437 ret_val = xmlXPathNodeSetCreate(val);
43438 desret_xmlNodeSetPtr(ret_val);
43439 call_tests++;
43440 des_xmlNodePtr(n_val, val, 0);
43441 xmlResetLastError();
43442 if (mem_base != xmlMemBlocks()) {
43443 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
43444 xmlMemBlocks() - mem_base);
43445 test_ret++;
43446 printf(" %d", n_val);
43447 printf("\n");
43448 }
43449 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043450 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043451#endif
43452
Daniel Veillard42595322004-11-08 10:52:06 +000043453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043454}
43455
43456
43457static int
43458test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043460
Daniel Veillard3d97e662004-11-04 10:49:00 +000043461#ifdef LIBXML_XPATH_ENABLED
43462 int mem_base;
43463 xmlXPathObjectPtr ret_val;
43464 xmlXPathObjectPtr val; /* the original object */
43465 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043466
Daniel Veillard3d97e662004-11-04 10:49:00 +000043467 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43468 mem_base = xmlMemBlocks();
43469 val = gen_xmlXPathObjectPtr(n_val, 0);
43470
43471 ret_val = xmlXPathObjectCopy(val);
43472 desret_xmlXPathObjectPtr(ret_val);
43473 call_tests++;
43474 des_xmlXPathObjectPtr(n_val, val, 0);
43475 xmlResetLastError();
43476 if (mem_base != xmlMemBlocks()) {
43477 printf("Leak of %d blocks found in xmlXPathObjectCopy",
43478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043479 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043480 printf(" %d", n_val);
43481 printf("\n");
43482 }
43483 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043484 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043485#endif
43486
Daniel Veillard42595322004-11-08 10:52:06 +000043487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043488}
43489
43490
43491static int
43492test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043494
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043495#ifdef LIBXML_XPATH_ENABLED
43496 int mem_base;
43497 long ret_val;
43498 xmlDocPtr doc; /* an input document */
43499 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043500
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043501 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
43502 mem_base = xmlMemBlocks();
43503 doc = gen_xmlDocPtr(n_doc, 0);
43504
43505 ret_val = xmlXPathOrderDocElems(doc);
43506 desret_long(ret_val);
43507 call_tests++;
43508 des_xmlDocPtr(n_doc, doc, 0);
43509 xmlResetLastError();
43510 if (mem_base != xmlMemBlocks()) {
43511 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
43512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043513 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043514 printf(" %d", n_doc);
43515 printf("\n");
43516 }
43517 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043518 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043519#endif
43520
Daniel Veillard42595322004-11-08 10:52:06 +000043521 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043522}
43523
43524static int
43525test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043526 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043527
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043528 if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043529 test_ret += test_xmlXPathCastBooleanToNumber();
43530 test_ret += test_xmlXPathCastBooleanToString();
43531 test_ret += test_xmlXPathCastNodeSetToBoolean();
43532 test_ret += test_xmlXPathCastNodeSetToNumber();
43533 test_ret += test_xmlXPathCastNodeSetToString();
43534 test_ret += test_xmlXPathCastNodeToNumber();
43535 test_ret += test_xmlXPathCastNodeToString();
43536 test_ret += test_xmlXPathCastNumberToBoolean();
43537 test_ret += test_xmlXPathCastNumberToString();
43538 test_ret += test_xmlXPathCastStringToBoolean();
43539 test_ret += test_xmlXPathCastStringToNumber();
43540 test_ret += test_xmlXPathCastToBoolean();
43541 test_ret += test_xmlXPathCastToNumber();
43542 test_ret += test_xmlXPathCastToString();
43543 test_ret += test_xmlXPathCmpNodes();
43544 test_ret += test_xmlXPathCompile();
43545 test_ret += test_xmlXPathCompiledEval();
43546 test_ret += test_xmlXPathConvertBoolean();
43547 test_ret += test_xmlXPathConvertNumber();
43548 test_ret += test_xmlXPathConvertString();
43549 test_ret += test_xmlXPathCtxtCompile();
43550 test_ret += test_xmlXPathEval();
43551 test_ret += test_xmlXPathEvalExpression();
43552 test_ret += test_xmlXPathEvalPredicate();
43553 test_ret += test_xmlXPathInit();
43554 test_ret += test_xmlXPathIsInf();
43555 test_ret += test_xmlXPathIsNaN();
43556 test_ret += test_xmlXPathNewContext();
43557 test_ret += test_xmlXPathNodeSetCreate();
43558 test_ret += test_xmlXPathObjectCopy();
43559 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043560
Daniel Veillard42595322004-11-08 10:52:06 +000043561 if (test_ret != 0)
43562 printf("Module xpath: %d errors\n", test_ret);
43563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043564}
Daniel Veillarda521d282004-11-09 14:59:59 +000043565#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043566
Daniel Veillarda82b1822004-11-08 16:24:57 +000043567#define gen_nb_xmlXPathParserContextPtr 1
43568static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43569 return(NULL);
43570}
43571static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43572}
Daniel Veillarda521d282004-11-09 14:59:59 +000043573#endif
43574
Daniel Veillarda82b1822004-11-08 16:24:57 +000043575
43576static int
43577test_valuePop(void) {
43578 int test_ret = 0;
43579
43580#ifdef LIBXML_XPATH_ENABLED
43581 int mem_base;
43582 xmlXPathObjectPtr ret_val;
43583 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43584 int n_ctxt;
43585
43586 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43587 mem_base = xmlMemBlocks();
43588 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43589
43590 ret_val = valuePop(ctxt);
43591 desret_xmlXPathObjectPtr(ret_val);
43592 call_tests++;
43593 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43594 xmlResetLastError();
43595 if (mem_base != xmlMemBlocks()) {
43596 printf("Leak of %d blocks found in valuePop",
43597 xmlMemBlocks() - mem_base);
43598 test_ret++;
43599 printf(" %d", n_ctxt);
43600 printf("\n");
43601 }
43602 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043603 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043604#endif
43605
Daniel Veillarda82b1822004-11-08 16:24:57 +000043606 return(test_ret);
43607}
43608
43609
43610static int
43611test_valuePush(void) {
43612 int test_ret = 0;
43613
43614#ifdef LIBXML_XPATH_ENABLED
43615 int mem_base;
43616 int ret_val;
43617 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43618 int n_ctxt;
43619 xmlXPathObjectPtr value; /* the XPath object */
43620 int n_value;
43621
43622 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43623 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
43624 mem_base = xmlMemBlocks();
43625 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43626 value = gen_xmlXPathObjectPtr(n_value, 1);
43627
43628 ret_val = valuePush(ctxt, value);
43629 desret_int(ret_val);
43630 call_tests++;
43631 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43632 des_xmlXPathObjectPtr(n_value, value, 1);
43633 xmlResetLastError();
43634 if (mem_base != xmlMemBlocks()) {
43635 printf("Leak of %d blocks found in valuePush",
43636 xmlMemBlocks() - mem_base);
43637 test_ret++;
43638 printf(" %d", n_ctxt);
43639 printf(" %d", n_value);
43640 printf("\n");
43641 }
43642 }
43643 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043644 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043645#endif
43646
Daniel Veillarda82b1822004-11-08 16:24:57 +000043647 return(test_ret);
43648}
43649
43650
43651static int
43652test_xmlXPathAddValues(void) {
43653 int test_ret = 0;
43654
43655#ifdef LIBXML_XPATH_ENABLED
43656 int mem_base;
43657 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43658 int n_ctxt;
43659
43660 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43661 mem_base = xmlMemBlocks();
43662 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43663
43664 xmlXPathAddValues(ctxt);
43665 call_tests++;
43666 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43667 xmlResetLastError();
43668 if (mem_base != xmlMemBlocks()) {
43669 printf("Leak of %d blocks found in xmlXPathAddValues",
43670 xmlMemBlocks() - mem_base);
43671 test_ret++;
43672 printf(" %d", n_ctxt);
43673 printf("\n");
43674 }
43675 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043676 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043677#endif
43678
Daniel Veillarda82b1822004-11-08 16:24:57 +000043679 return(test_ret);
43680}
43681
43682
43683static int
43684test_xmlXPathBooleanFunction(void) {
43685 int test_ret = 0;
43686
43687#ifdef LIBXML_XPATH_ENABLED
43688 int mem_base;
43689 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43690 int n_ctxt;
43691 int nargs; /* the number of arguments */
43692 int n_nargs;
43693
43694 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43695 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43696 mem_base = xmlMemBlocks();
43697 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43698 nargs = gen_int(n_nargs, 1);
43699
43700 xmlXPathBooleanFunction(ctxt, nargs);
43701 call_tests++;
43702 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43703 des_int(n_nargs, nargs, 1);
43704 xmlResetLastError();
43705 if (mem_base != xmlMemBlocks()) {
43706 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
43707 xmlMemBlocks() - mem_base);
43708 test_ret++;
43709 printf(" %d", n_ctxt);
43710 printf(" %d", n_nargs);
43711 printf("\n");
43712 }
43713 }
43714 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043715 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043716#endif
43717
Daniel Veillarda82b1822004-11-08 16:24:57 +000043718 return(test_ret);
43719}
43720
43721
43722static int
43723test_xmlXPathCeilingFunction(void) {
43724 int test_ret = 0;
43725
43726#ifdef LIBXML_XPATH_ENABLED
43727 int mem_base;
43728 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43729 int n_ctxt;
43730 int nargs; /* the number of arguments */
43731 int n_nargs;
43732
43733 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43734 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43735 mem_base = xmlMemBlocks();
43736 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43737 nargs = gen_int(n_nargs, 1);
43738
43739 xmlXPathCeilingFunction(ctxt, nargs);
43740 call_tests++;
43741 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43742 des_int(n_nargs, nargs, 1);
43743 xmlResetLastError();
43744 if (mem_base != xmlMemBlocks()) {
43745 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
43746 xmlMemBlocks() - mem_base);
43747 test_ret++;
43748 printf(" %d", n_ctxt);
43749 printf(" %d", n_nargs);
43750 printf("\n");
43751 }
43752 }
43753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043754 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043755#endif
43756
Daniel Veillarda82b1822004-11-08 16:24:57 +000043757 return(test_ret);
43758}
43759
43760
43761static int
43762test_xmlXPathCompareValues(void) {
43763 int test_ret = 0;
43764
43765#ifdef LIBXML_XPATH_ENABLED
43766 int mem_base;
43767 int ret_val;
43768 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43769 int n_ctxt;
43770 int inf; /* less than (1) or greater than (0) */
43771 int n_inf;
43772 int strict; /* is the comparison strict */
43773 int n_strict;
43774
43775 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43776 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
43777 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
43778 mem_base = xmlMemBlocks();
43779 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43780 inf = gen_int(n_inf, 1);
43781 strict = gen_int(n_strict, 2);
43782
43783 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
43784 desret_int(ret_val);
43785 call_tests++;
43786 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43787 des_int(n_inf, inf, 1);
43788 des_int(n_strict, strict, 2);
43789 xmlResetLastError();
43790 if (mem_base != xmlMemBlocks()) {
43791 printf("Leak of %d blocks found in xmlXPathCompareValues",
43792 xmlMemBlocks() - mem_base);
43793 test_ret++;
43794 printf(" %d", n_ctxt);
43795 printf(" %d", n_inf);
43796 printf(" %d", n_strict);
43797 printf("\n");
43798 }
43799 }
43800 }
43801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043802 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043803#endif
43804
Daniel Veillarda82b1822004-11-08 16:24:57 +000043805 return(test_ret);
43806}
43807
43808
43809static int
43810test_xmlXPathConcatFunction(void) {
43811 int test_ret = 0;
43812
43813#ifdef LIBXML_XPATH_ENABLED
43814 int mem_base;
43815 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43816 int n_ctxt;
43817 int nargs; /* the number of arguments */
43818 int n_nargs;
43819
43820 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43821 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43822 mem_base = xmlMemBlocks();
43823 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43824 nargs = gen_int(n_nargs, 1);
43825
43826 xmlXPathConcatFunction(ctxt, nargs);
43827 call_tests++;
43828 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43829 des_int(n_nargs, nargs, 1);
43830 xmlResetLastError();
43831 if (mem_base != xmlMemBlocks()) {
43832 printf("Leak of %d blocks found in xmlXPathConcatFunction",
43833 xmlMemBlocks() - mem_base);
43834 test_ret++;
43835 printf(" %d", n_ctxt);
43836 printf(" %d", n_nargs);
43837 printf("\n");
43838 }
43839 }
43840 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043841 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043842#endif
43843
Daniel Veillarda82b1822004-11-08 16:24:57 +000043844 return(test_ret);
43845}
43846
43847
43848static int
43849test_xmlXPathContainsFunction(void) {
43850 int test_ret = 0;
43851
43852#ifdef LIBXML_XPATH_ENABLED
43853 int mem_base;
43854 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43855 int n_ctxt;
43856 int nargs; /* the number of arguments */
43857 int n_nargs;
43858
43859 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43860 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43861 mem_base = xmlMemBlocks();
43862 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43863 nargs = gen_int(n_nargs, 1);
43864
43865 xmlXPathContainsFunction(ctxt, nargs);
43866 call_tests++;
43867 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43868 des_int(n_nargs, nargs, 1);
43869 xmlResetLastError();
43870 if (mem_base != xmlMemBlocks()) {
43871 printf("Leak of %d blocks found in xmlXPathContainsFunction",
43872 xmlMemBlocks() - mem_base);
43873 test_ret++;
43874 printf(" %d", n_ctxt);
43875 printf(" %d", n_nargs);
43876 printf("\n");
43877 }
43878 }
43879 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043880 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043881#endif
43882
Daniel Veillarda82b1822004-11-08 16:24:57 +000043883 return(test_ret);
43884}
43885
43886
43887static int
43888test_xmlXPathCountFunction(void) {
43889 int test_ret = 0;
43890
43891#ifdef LIBXML_XPATH_ENABLED
43892 int mem_base;
43893 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43894 int n_ctxt;
43895 int nargs; /* the number of arguments */
43896 int n_nargs;
43897
43898 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43899 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43900 mem_base = xmlMemBlocks();
43901 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43902 nargs = gen_int(n_nargs, 1);
43903
43904 xmlXPathCountFunction(ctxt, nargs);
43905 call_tests++;
43906 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43907 des_int(n_nargs, nargs, 1);
43908 xmlResetLastError();
43909 if (mem_base != xmlMemBlocks()) {
43910 printf("Leak of %d blocks found in xmlXPathCountFunction",
43911 xmlMemBlocks() - mem_base);
43912 test_ret++;
43913 printf(" %d", n_ctxt);
43914 printf(" %d", n_nargs);
43915 printf("\n");
43916 }
43917 }
43918 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043919 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043920#endif
43921
Daniel Veillarda82b1822004-11-08 16:24:57 +000043922 return(test_ret);
43923}
43924
43925
43926static int
43927test_xmlXPathDebugDumpCompExpr(void) {
43928 int test_ret = 0;
43929
43930#ifdef LIBXML_XPATH_ENABLED
43931#ifdef LIBXML_DEBUG_ENABLED
43932 int mem_base;
43933 FILE * output; /* the FILE * for the output */
43934 int n_output;
43935 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
43936 int n_comp;
43937 int depth; /* the indentation level. */
43938 int n_depth;
43939
43940 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43941 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43942 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43943 mem_base = xmlMemBlocks();
43944 output = gen_FILE_ptr(n_output, 0);
43945 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
43946 depth = gen_int(n_depth, 2);
43947
43948 xmlXPathDebugDumpCompExpr(output, comp, depth);
43949 call_tests++;
43950 des_FILE_ptr(n_output, output, 0);
43951 des_xmlXPathCompExprPtr(n_comp, comp, 1);
43952 des_int(n_depth, depth, 2);
43953 xmlResetLastError();
43954 if (mem_base != xmlMemBlocks()) {
43955 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
43956 xmlMemBlocks() - mem_base);
43957 test_ret++;
43958 printf(" %d", n_output);
43959 printf(" %d", n_comp);
43960 printf(" %d", n_depth);
43961 printf("\n");
43962 }
43963 }
43964 }
43965 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043966 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043967#endif
43968#endif
43969
Daniel Veillarda82b1822004-11-08 16:24:57 +000043970 return(test_ret);
43971}
43972
43973
43974static int
43975test_xmlXPathDebugDumpObject(void) {
43976 int test_ret = 0;
43977
43978#ifdef LIBXML_XPATH_ENABLED
43979#ifdef LIBXML_DEBUG_ENABLED
43980 int mem_base;
43981 FILE * output; /* the FILE * to dump the output */
43982 int n_output;
43983 xmlXPathObjectPtr cur; /* the object to inspect */
43984 int n_cur;
43985 int depth; /* indentation level */
43986 int n_depth;
43987
43988 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43989 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
43990 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43991 mem_base = xmlMemBlocks();
43992 output = gen_FILE_ptr(n_output, 0);
43993 cur = gen_xmlXPathObjectPtr(n_cur, 1);
43994 depth = gen_int(n_depth, 2);
43995
43996 xmlXPathDebugDumpObject(output, cur, depth);
43997 call_tests++;
43998 des_FILE_ptr(n_output, output, 0);
43999 des_xmlXPathObjectPtr(n_cur, cur, 1);
44000 des_int(n_depth, depth, 2);
44001 xmlResetLastError();
44002 if (mem_base != xmlMemBlocks()) {
44003 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
44004 xmlMemBlocks() - mem_base);
44005 test_ret++;
44006 printf(" %d", n_output);
44007 printf(" %d", n_cur);
44008 printf(" %d", n_depth);
44009 printf("\n");
44010 }
44011 }
44012 }
44013 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044014 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044015#endif
44016#endif
44017
Daniel Veillarda82b1822004-11-08 16:24:57 +000044018 return(test_ret);
44019}
44020
44021
44022static int
44023test_xmlXPathDifference(void) {
44024 int test_ret = 0;
44025
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044026#ifdef LIBXML_XPATH_ENABLED
44027 int mem_base;
44028 xmlNodeSetPtr ret_val;
44029 xmlNodeSetPtr nodes1; /* a node-set */
44030 int n_nodes1;
44031 xmlNodeSetPtr nodes2; /* a node-set */
44032 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044033
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044034 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44035 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44036 mem_base = xmlMemBlocks();
44037 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44038 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44039
44040 ret_val = xmlXPathDifference(nodes1, nodes2);
44041 desret_xmlNodeSetPtr(ret_val);
44042 call_tests++;
44043 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44044 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44045 xmlResetLastError();
44046 if (mem_base != xmlMemBlocks()) {
44047 printf("Leak of %d blocks found in xmlXPathDifference",
44048 xmlMemBlocks() - mem_base);
44049 test_ret++;
44050 printf(" %d", n_nodes1);
44051 printf(" %d", n_nodes2);
44052 printf("\n");
44053 }
44054 }
44055 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044056 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044057#endif
44058
Daniel Veillarda82b1822004-11-08 16:24:57 +000044059 return(test_ret);
44060}
44061
44062
44063static int
44064test_xmlXPathDistinct(void) {
44065 int test_ret = 0;
44066
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044067#ifdef LIBXML_XPATH_ENABLED
44068 int mem_base;
44069 xmlNodeSetPtr ret_val;
44070 xmlNodeSetPtr nodes; /* a node-set */
44071 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044072
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044073 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44074 mem_base = xmlMemBlocks();
44075 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44076
44077 ret_val = xmlXPathDistinct(nodes);
44078 desret_xmlNodeSetPtr(ret_val);
44079 call_tests++;
44080 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44081 xmlResetLastError();
44082 if (mem_base != xmlMemBlocks()) {
44083 printf("Leak of %d blocks found in xmlXPathDistinct",
44084 xmlMemBlocks() - mem_base);
44085 test_ret++;
44086 printf(" %d", n_nodes);
44087 printf("\n");
44088 }
44089 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044090 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044091#endif
44092
Daniel Veillarda82b1822004-11-08 16:24:57 +000044093 return(test_ret);
44094}
44095
44096
44097static int
44098test_xmlXPathDistinctSorted(void) {
44099 int test_ret = 0;
44100
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044101#ifdef LIBXML_XPATH_ENABLED
44102 int mem_base;
44103 xmlNodeSetPtr ret_val;
44104 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
44105 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044106
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044107 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44108 mem_base = xmlMemBlocks();
44109 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44110
44111 ret_val = xmlXPathDistinctSorted(nodes);
44112 desret_xmlNodeSetPtr(ret_val);
44113 call_tests++;
44114 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44115 xmlResetLastError();
44116 if (mem_base != xmlMemBlocks()) {
44117 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
44118 xmlMemBlocks() - mem_base);
44119 test_ret++;
44120 printf(" %d", n_nodes);
44121 printf("\n");
44122 }
44123 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044124 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044125#endif
44126
Daniel Veillarda82b1822004-11-08 16:24:57 +000044127 return(test_ret);
44128}
44129
44130
44131static int
44132test_xmlXPathDivValues(void) {
44133 int test_ret = 0;
44134
44135#ifdef LIBXML_XPATH_ENABLED
44136 int mem_base;
44137 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44138 int n_ctxt;
44139
44140 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44141 mem_base = xmlMemBlocks();
44142 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44143
44144 xmlXPathDivValues(ctxt);
44145 call_tests++;
44146 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44147 xmlResetLastError();
44148 if (mem_base != xmlMemBlocks()) {
44149 printf("Leak of %d blocks found in xmlXPathDivValues",
44150 xmlMemBlocks() - mem_base);
44151 test_ret++;
44152 printf(" %d", n_ctxt);
44153 printf("\n");
44154 }
44155 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044156 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044157#endif
44158
Daniel Veillarda82b1822004-11-08 16:24:57 +000044159 return(test_ret);
44160}
44161
44162
44163static int
44164test_xmlXPathEqualValues(void) {
44165 int test_ret = 0;
44166
44167#ifdef LIBXML_XPATH_ENABLED
44168 int mem_base;
44169 int ret_val;
44170 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44171 int n_ctxt;
44172
44173 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44174 mem_base = xmlMemBlocks();
44175 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44176
44177 ret_val = xmlXPathEqualValues(ctxt);
44178 desret_int(ret_val);
44179 call_tests++;
44180 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44181 xmlResetLastError();
44182 if (mem_base != xmlMemBlocks()) {
44183 printf("Leak of %d blocks found in xmlXPathEqualValues",
44184 xmlMemBlocks() - mem_base);
44185 test_ret++;
44186 printf(" %d", n_ctxt);
44187 printf("\n");
44188 }
44189 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044190 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044191#endif
44192
Daniel Veillarda82b1822004-11-08 16:24:57 +000044193 return(test_ret);
44194}
44195
44196
44197static int
44198test_xmlXPathErr(void) {
44199 int test_ret = 0;
44200
44201#ifdef LIBXML_XPATH_ENABLED
44202 int mem_base;
44203 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
44204 int n_ctxt;
44205 int error; /* the error code */
44206 int n_error;
44207
44208 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44209 for (n_error = 0;n_error < gen_nb_int;n_error++) {
44210 mem_base = xmlMemBlocks();
44211 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44212 error = gen_int(n_error, 1);
44213
44214 xmlXPathErr(ctxt, error);
44215 call_tests++;
44216 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44217 des_int(n_error, error, 1);
44218 xmlResetLastError();
44219 if (mem_base != xmlMemBlocks()) {
44220 printf("Leak of %d blocks found in xmlXPathErr",
44221 xmlMemBlocks() - mem_base);
44222 test_ret++;
44223 printf(" %d", n_ctxt);
44224 printf(" %d", n_error);
44225 printf("\n");
44226 }
44227 }
44228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044229 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044230#endif
44231
Daniel Veillarda82b1822004-11-08 16:24:57 +000044232 return(test_ret);
44233}
44234
44235
44236static int
44237test_xmlXPathEvalExpr(void) {
44238 int test_ret = 0;
44239
44240#ifdef LIBXML_XPATH_ENABLED
44241 int mem_base;
44242 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44243 int n_ctxt;
44244
44245 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44246 mem_base = xmlMemBlocks();
44247 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44248
44249 xmlXPathEvalExpr(ctxt);
44250 call_tests++;
44251 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44252 xmlResetLastError();
44253 if (mem_base != xmlMemBlocks()) {
44254 printf("Leak of %d blocks found in xmlXPathEvalExpr",
44255 xmlMemBlocks() - mem_base);
44256 test_ret++;
44257 printf(" %d", n_ctxt);
44258 printf("\n");
44259 }
44260 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044261 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044262#endif
44263
Daniel Veillarda82b1822004-11-08 16:24:57 +000044264 return(test_ret);
44265}
44266
44267
44268static int
44269test_xmlXPathEvaluatePredicateResult(void) {
44270 int test_ret = 0;
44271
44272#ifdef LIBXML_XPATH_ENABLED
44273 int mem_base;
44274 int ret_val;
44275 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44276 int n_ctxt;
44277 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44278 int n_res;
44279
44280 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44281 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44282 mem_base = xmlMemBlocks();
44283 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44284 res = gen_xmlXPathObjectPtr(n_res, 1);
44285
44286 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
44287 desret_int(ret_val);
44288 call_tests++;
44289 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44290 des_xmlXPathObjectPtr(n_res, res, 1);
44291 xmlResetLastError();
44292 if (mem_base != xmlMemBlocks()) {
44293 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
44294 xmlMemBlocks() - mem_base);
44295 test_ret++;
44296 printf(" %d", n_ctxt);
44297 printf(" %d", n_res);
44298 printf("\n");
44299 }
44300 }
44301 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044302 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044303#endif
44304
Daniel Veillarda82b1822004-11-08 16:24:57 +000044305 return(test_ret);
44306}
44307
44308
44309static int
44310test_xmlXPathFalseFunction(void) {
44311 int test_ret = 0;
44312
44313#ifdef LIBXML_XPATH_ENABLED
44314 int mem_base;
44315 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44316 int n_ctxt;
44317 int nargs; /* the number of arguments */
44318 int n_nargs;
44319
44320 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44321 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44322 mem_base = xmlMemBlocks();
44323 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44324 nargs = gen_int(n_nargs, 1);
44325
44326 xmlXPathFalseFunction(ctxt, nargs);
44327 call_tests++;
44328 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44329 des_int(n_nargs, nargs, 1);
44330 xmlResetLastError();
44331 if (mem_base != xmlMemBlocks()) {
44332 printf("Leak of %d blocks found in xmlXPathFalseFunction",
44333 xmlMemBlocks() - mem_base);
44334 test_ret++;
44335 printf(" %d", n_ctxt);
44336 printf(" %d", n_nargs);
44337 printf("\n");
44338 }
44339 }
44340 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044341 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044342#endif
44343
Daniel Veillarda82b1822004-11-08 16:24:57 +000044344 return(test_ret);
44345}
44346
44347
44348static int
44349test_xmlXPathFloorFunction(void) {
44350 int test_ret = 0;
44351
44352#ifdef LIBXML_XPATH_ENABLED
44353 int mem_base;
44354 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44355 int n_ctxt;
44356 int nargs; /* the number of arguments */
44357 int n_nargs;
44358
44359 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44360 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44361 mem_base = xmlMemBlocks();
44362 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44363 nargs = gen_int(n_nargs, 1);
44364
44365 xmlXPathFloorFunction(ctxt, nargs);
44366 call_tests++;
44367 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44368 des_int(n_nargs, nargs, 1);
44369 xmlResetLastError();
44370 if (mem_base != xmlMemBlocks()) {
44371 printf("Leak of %d blocks found in xmlXPathFloorFunction",
44372 xmlMemBlocks() - mem_base);
44373 test_ret++;
44374 printf(" %d", n_ctxt);
44375 printf(" %d", n_nargs);
44376 printf("\n");
44377 }
44378 }
44379 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044380 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044381#endif
44382
Daniel Veillarda82b1822004-11-08 16:24:57 +000044383 return(test_ret);
44384}
44385
44386
44387static int
44388test_xmlXPathFunctionLookup(void) {
44389 int test_ret = 0;
44390
44391
44392 /* missing type support */
44393 return(test_ret);
44394}
44395
44396
44397static int
44398test_xmlXPathFunctionLookupNS(void) {
44399 int test_ret = 0;
44400
44401
44402 /* missing type support */
44403 return(test_ret);
44404}
44405
44406
44407static int
44408test_xmlXPathHasSameNodes(void) {
44409 int test_ret = 0;
44410
44411#ifdef LIBXML_XPATH_ENABLED
44412 int mem_base;
44413 int ret_val;
44414 xmlNodeSetPtr nodes1; /* a node-set */
44415 int n_nodes1;
44416 xmlNodeSetPtr nodes2; /* a node-set */
44417 int n_nodes2;
44418
44419 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44420 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44421 mem_base = xmlMemBlocks();
44422 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44423 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44424
44425 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
44426 desret_int(ret_val);
44427 call_tests++;
44428 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44429 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44430 xmlResetLastError();
44431 if (mem_base != xmlMemBlocks()) {
44432 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
44433 xmlMemBlocks() - mem_base);
44434 test_ret++;
44435 printf(" %d", n_nodes1);
44436 printf(" %d", n_nodes2);
44437 printf("\n");
44438 }
44439 }
44440 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044441 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044442#endif
44443
Daniel Veillarda82b1822004-11-08 16:24:57 +000044444 return(test_ret);
44445}
44446
44447
44448static int
44449test_xmlXPathIdFunction(void) {
44450 int test_ret = 0;
44451
44452#ifdef LIBXML_XPATH_ENABLED
44453 int mem_base;
44454 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44455 int n_ctxt;
44456 int nargs; /* the number of arguments */
44457 int n_nargs;
44458
44459 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44460 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44461 mem_base = xmlMemBlocks();
44462 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44463 nargs = gen_int(n_nargs, 1);
44464
44465 xmlXPathIdFunction(ctxt, nargs);
44466 call_tests++;
44467 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44468 des_int(n_nargs, nargs, 1);
44469 xmlResetLastError();
44470 if (mem_base != xmlMemBlocks()) {
44471 printf("Leak of %d blocks found in xmlXPathIdFunction",
44472 xmlMemBlocks() - mem_base);
44473 test_ret++;
44474 printf(" %d", n_ctxt);
44475 printf(" %d", n_nargs);
44476 printf("\n");
44477 }
44478 }
44479 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044480 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044481#endif
44482
Daniel Veillarda82b1822004-11-08 16:24:57 +000044483 return(test_ret);
44484}
44485
44486
44487static int
44488test_xmlXPathIntersection(void) {
44489 int test_ret = 0;
44490
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044491#ifdef LIBXML_XPATH_ENABLED
44492 int mem_base;
44493 xmlNodeSetPtr ret_val;
44494 xmlNodeSetPtr nodes1; /* a node-set */
44495 int n_nodes1;
44496 xmlNodeSetPtr nodes2; /* a node-set */
44497 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044498
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044499 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44500 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44501 mem_base = xmlMemBlocks();
44502 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44503 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44504
44505 ret_val = xmlXPathIntersection(nodes1, nodes2);
44506 desret_xmlNodeSetPtr(ret_val);
44507 call_tests++;
44508 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44509 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44510 xmlResetLastError();
44511 if (mem_base != xmlMemBlocks()) {
44512 printf("Leak of %d blocks found in xmlXPathIntersection",
44513 xmlMemBlocks() - mem_base);
44514 test_ret++;
44515 printf(" %d", n_nodes1);
44516 printf(" %d", n_nodes2);
44517 printf("\n");
44518 }
44519 }
44520 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044521 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044522#endif
44523
Daniel Veillarda82b1822004-11-08 16:24:57 +000044524 return(test_ret);
44525}
44526
44527
44528static int
44529test_xmlXPathIsNodeType(void) {
44530 int test_ret = 0;
44531
44532#ifdef LIBXML_XPATH_ENABLED
44533 int mem_base;
44534 int ret_val;
44535 xmlChar * name; /* a name string */
44536 int n_name;
44537
44538 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
44539 mem_base = xmlMemBlocks();
44540 name = gen_const_xmlChar_ptr(n_name, 0);
44541
44542 ret_val = xmlXPathIsNodeType(name);
44543 desret_int(ret_val);
44544 call_tests++;
44545 des_const_xmlChar_ptr(n_name, name, 0);
44546 xmlResetLastError();
44547 if (mem_base != xmlMemBlocks()) {
44548 printf("Leak of %d blocks found in xmlXPathIsNodeType",
44549 xmlMemBlocks() - mem_base);
44550 test_ret++;
44551 printf(" %d", n_name);
44552 printf("\n");
44553 }
44554 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044555 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044556#endif
44557
Daniel Veillarda82b1822004-11-08 16:24:57 +000044558 return(test_ret);
44559}
44560
44561
44562static int
44563test_xmlXPathLangFunction(void) {
44564 int test_ret = 0;
44565
44566#ifdef LIBXML_XPATH_ENABLED
44567 int mem_base;
44568 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44569 int n_ctxt;
44570 int nargs; /* the number of arguments */
44571 int n_nargs;
44572
44573 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44574 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44575 mem_base = xmlMemBlocks();
44576 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44577 nargs = gen_int(n_nargs, 1);
44578
44579 xmlXPathLangFunction(ctxt, nargs);
44580 call_tests++;
44581 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44582 des_int(n_nargs, nargs, 1);
44583 xmlResetLastError();
44584 if (mem_base != xmlMemBlocks()) {
44585 printf("Leak of %d blocks found in xmlXPathLangFunction",
44586 xmlMemBlocks() - mem_base);
44587 test_ret++;
44588 printf(" %d", n_ctxt);
44589 printf(" %d", n_nargs);
44590 printf("\n");
44591 }
44592 }
44593 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044594 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044595#endif
44596
Daniel Veillarda82b1822004-11-08 16:24:57 +000044597 return(test_ret);
44598}
44599
44600
44601static int
44602test_xmlXPathLastFunction(void) {
44603 int test_ret = 0;
44604
44605#ifdef LIBXML_XPATH_ENABLED
44606 int mem_base;
44607 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44608 int n_ctxt;
44609 int nargs; /* the number of arguments */
44610 int n_nargs;
44611
44612 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44613 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44614 mem_base = xmlMemBlocks();
44615 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44616 nargs = gen_int(n_nargs, 1);
44617
44618 xmlXPathLastFunction(ctxt, nargs);
44619 call_tests++;
44620 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44621 des_int(n_nargs, nargs, 1);
44622 xmlResetLastError();
44623 if (mem_base != xmlMemBlocks()) {
44624 printf("Leak of %d blocks found in xmlXPathLastFunction",
44625 xmlMemBlocks() - mem_base);
44626 test_ret++;
44627 printf(" %d", n_ctxt);
44628 printf(" %d", n_nargs);
44629 printf("\n");
44630 }
44631 }
44632 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044633 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044634#endif
44635
Daniel Veillarda82b1822004-11-08 16:24:57 +000044636 return(test_ret);
44637}
44638
44639
44640static int
44641test_xmlXPathLeading(void) {
44642 int test_ret = 0;
44643
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044644#ifdef LIBXML_XPATH_ENABLED
44645 int mem_base;
44646 xmlNodeSetPtr ret_val;
44647 xmlNodeSetPtr nodes1; /* a node-set */
44648 int n_nodes1;
44649 xmlNodeSetPtr nodes2; /* a node-set */
44650 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044651
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044652 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44653 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44654 mem_base = xmlMemBlocks();
44655 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44656 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44657
44658 ret_val = xmlXPathLeading(nodes1, nodes2);
44659 desret_xmlNodeSetPtr(ret_val);
44660 call_tests++;
44661 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44662 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44663 xmlResetLastError();
44664 if (mem_base != xmlMemBlocks()) {
44665 printf("Leak of %d blocks found in xmlXPathLeading",
44666 xmlMemBlocks() - mem_base);
44667 test_ret++;
44668 printf(" %d", n_nodes1);
44669 printf(" %d", n_nodes2);
44670 printf("\n");
44671 }
44672 }
44673 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044674 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044675#endif
44676
Daniel Veillarda82b1822004-11-08 16:24:57 +000044677 return(test_ret);
44678}
44679
44680
44681static int
44682test_xmlXPathLeadingSorted(void) {
44683 int test_ret = 0;
44684
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044685#ifdef LIBXML_XPATH_ENABLED
44686 int mem_base;
44687 xmlNodeSetPtr ret_val;
44688 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
44689 int n_nodes1;
44690 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
44691 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044692
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044693 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44694 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44695 mem_base = xmlMemBlocks();
44696 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44697 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44698
44699 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
44700 desret_xmlNodeSetPtr(ret_val);
44701 call_tests++;
44702 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44703 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44704 xmlResetLastError();
44705 if (mem_base != xmlMemBlocks()) {
44706 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
44707 xmlMemBlocks() - mem_base);
44708 test_ret++;
44709 printf(" %d", n_nodes1);
44710 printf(" %d", n_nodes2);
44711 printf("\n");
44712 }
44713 }
44714 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044715 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044716#endif
44717
Daniel Veillarda82b1822004-11-08 16:24:57 +000044718 return(test_ret);
44719}
44720
44721
44722static int
44723test_xmlXPathLocalNameFunction(void) {
44724 int test_ret = 0;
44725
44726#ifdef LIBXML_XPATH_ENABLED
44727 int mem_base;
44728 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44729 int n_ctxt;
44730 int nargs; /* the number of arguments */
44731 int n_nargs;
44732
44733 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44734 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44735 mem_base = xmlMemBlocks();
44736 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44737 nargs = gen_int(n_nargs, 1);
44738
44739 xmlXPathLocalNameFunction(ctxt, nargs);
44740 call_tests++;
44741 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44742 des_int(n_nargs, nargs, 1);
44743 xmlResetLastError();
44744 if (mem_base != xmlMemBlocks()) {
44745 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
44746 xmlMemBlocks() - mem_base);
44747 test_ret++;
44748 printf(" %d", n_ctxt);
44749 printf(" %d", n_nargs);
44750 printf("\n");
44751 }
44752 }
44753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044754 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044755#endif
44756
Daniel Veillarda82b1822004-11-08 16:24:57 +000044757 return(test_ret);
44758}
44759
44760
44761static int
44762test_xmlXPathModValues(void) {
44763 int test_ret = 0;
44764
44765#ifdef LIBXML_XPATH_ENABLED
44766 int mem_base;
44767 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44768 int n_ctxt;
44769
44770 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44771 mem_base = xmlMemBlocks();
44772 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44773
44774 xmlXPathModValues(ctxt);
44775 call_tests++;
44776 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44777 xmlResetLastError();
44778 if (mem_base != xmlMemBlocks()) {
44779 printf("Leak of %d blocks found in xmlXPathModValues",
44780 xmlMemBlocks() - mem_base);
44781 test_ret++;
44782 printf(" %d", n_ctxt);
44783 printf("\n");
44784 }
44785 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044786 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044787#endif
44788
Daniel Veillarda82b1822004-11-08 16:24:57 +000044789 return(test_ret);
44790}
44791
44792
44793static int
44794test_xmlXPathMultValues(void) {
44795 int test_ret = 0;
44796
44797#ifdef LIBXML_XPATH_ENABLED
44798 int mem_base;
44799 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44800 int n_ctxt;
44801
44802 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44803 mem_base = xmlMemBlocks();
44804 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44805
44806 xmlXPathMultValues(ctxt);
44807 call_tests++;
44808 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44809 xmlResetLastError();
44810 if (mem_base != xmlMemBlocks()) {
44811 printf("Leak of %d blocks found in xmlXPathMultValues",
44812 xmlMemBlocks() - mem_base);
44813 test_ret++;
44814 printf(" %d", n_ctxt);
44815 printf("\n");
44816 }
44817 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044818 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044819#endif
44820
Daniel Veillarda82b1822004-11-08 16:24:57 +000044821 return(test_ret);
44822}
44823
44824
44825static int
44826test_xmlXPathNamespaceURIFunction(void) {
44827 int test_ret = 0;
44828
44829#ifdef LIBXML_XPATH_ENABLED
44830 int mem_base;
44831 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44832 int n_ctxt;
44833 int nargs; /* the number of arguments */
44834 int n_nargs;
44835
44836 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44837 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44838 mem_base = xmlMemBlocks();
44839 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44840 nargs = gen_int(n_nargs, 1);
44841
44842 xmlXPathNamespaceURIFunction(ctxt, nargs);
44843 call_tests++;
44844 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44845 des_int(n_nargs, nargs, 1);
44846 xmlResetLastError();
44847 if (mem_base != xmlMemBlocks()) {
44848 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
44849 xmlMemBlocks() - mem_base);
44850 test_ret++;
44851 printf(" %d", n_ctxt);
44852 printf(" %d", n_nargs);
44853 printf("\n");
44854 }
44855 }
44856 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044857 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044858#endif
44859
Daniel Veillarda82b1822004-11-08 16:24:57 +000044860 return(test_ret);
44861}
44862
44863
44864static int
44865test_xmlXPathNewBoolean(void) {
44866 int test_ret = 0;
44867
44868#ifdef LIBXML_XPATH_ENABLED
44869 int mem_base;
44870 xmlXPathObjectPtr ret_val;
44871 int val; /* the boolean value */
44872 int n_val;
44873
44874 for (n_val = 0;n_val < gen_nb_int;n_val++) {
44875 mem_base = xmlMemBlocks();
44876 val = gen_int(n_val, 0);
44877
44878 ret_val = xmlXPathNewBoolean(val);
44879 desret_xmlXPathObjectPtr(ret_val);
44880 call_tests++;
44881 des_int(n_val, val, 0);
44882 xmlResetLastError();
44883 if (mem_base != xmlMemBlocks()) {
44884 printf("Leak of %d blocks found in xmlXPathNewBoolean",
44885 xmlMemBlocks() - mem_base);
44886 test_ret++;
44887 printf(" %d", n_val);
44888 printf("\n");
44889 }
44890 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044891 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044892#endif
44893
Daniel Veillarda82b1822004-11-08 16:24:57 +000044894 return(test_ret);
44895}
44896
44897
44898static int
44899test_xmlXPathNewCString(void) {
44900 int test_ret = 0;
44901
44902#ifdef LIBXML_XPATH_ENABLED
44903 int mem_base;
44904 xmlXPathObjectPtr ret_val;
44905 char * val; /* the char * value */
44906 int n_val;
44907
44908 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
44909 mem_base = xmlMemBlocks();
44910 val = gen_const_char_ptr(n_val, 0);
44911
44912 ret_val = xmlXPathNewCString(val);
44913 desret_xmlXPathObjectPtr(ret_val);
44914 call_tests++;
44915 des_const_char_ptr(n_val, val, 0);
44916 xmlResetLastError();
44917 if (mem_base != xmlMemBlocks()) {
44918 printf("Leak of %d blocks found in xmlXPathNewCString",
44919 xmlMemBlocks() - mem_base);
44920 test_ret++;
44921 printf(" %d", n_val);
44922 printf("\n");
44923 }
44924 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044925 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044926#endif
44927
Daniel Veillarda82b1822004-11-08 16:24:57 +000044928 return(test_ret);
44929}
44930
44931
44932static int
44933test_xmlXPathNewFloat(void) {
44934 int test_ret = 0;
44935
44936#ifdef LIBXML_XPATH_ENABLED
44937 int mem_base;
44938 xmlXPathObjectPtr ret_val;
44939 double val; /* the double value */
44940 int n_val;
44941
44942 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44943 mem_base = xmlMemBlocks();
44944 val = gen_double(n_val, 0);
44945
44946 ret_val = xmlXPathNewFloat(val);
44947 desret_xmlXPathObjectPtr(ret_val);
44948 call_tests++;
44949 des_double(n_val, val, 0);
44950 xmlResetLastError();
44951 if (mem_base != xmlMemBlocks()) {
44952 printf("Leak of %d blocks found in xmlXPathNewFloat",
44953 xmlMemBlocks() - mem_base);
44954 test_ret++;
44955 printf(" %d", n_val);
44956 printf("\n");
44957 }
44958 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044959 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044960#endif
44961
Daniel Veillarda82b1822004-11-08 16:24:57 +000044962 return(test_ret);
44963}
44964
44965
44966static int
44967test_xmlXPathNewNodeSet(void) {
44968 int test_ret = 0;
44969
44970#ifdef LIBXML_XPATH_ENABLED
44971 int mem_base;
44972 xmlXPathObjectPtr ret_val;
44973 xmlNodePtr val; /* the NodePtr value */
44974 int n_val;
44975
44976 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
44977 mem_base = xmlMemBlocks();
44978 val = gen_xmlNodePtr(n_val, 0);
44979
44980 ret_val = xmlXPathNewNodeSet(val);
44981 desret_xmlXPathObjectPtr(ret_val);
44982 call_tests++;
44983 des_xmlNodePtr(n_val, val, 0);
44984 xmlResetLastError();
44985 if (mem_base != xmlMemBlocks()) {
44986 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
44987 xmlMemBlocks() - mem_base);
44988 test_ret++;
44989 printf(" %d", n_val);
44990 printf("\n");
44991 }
44992 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044993 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044994#endif
44995
Daniel Veillarda82b1822004-11-08 16:24:57 +000044996 return(test_ret);
44997}
44998
44999
45000static int
45001test_xmlXPathNewNodeSetList(void) {
45002 int test_ret = 0;
45003
45004#ifdef LIBXML_XPATH_ENABLED
45005 int mem_base;
45006 xmlXPathObjectPtr ret_val;
45007 xmlNodeSetPtr val; /* an existing NodeSet */
45008 int n_val;
45009
45010 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
45011 mem_base = xmlMemBlocks();
45012 val = gen_xmlNodeSetPtr(n_val, 0);
45013
45014 ret_val = xmlXPathNewNodeSetList(val);
45015 desret_xmlXPathObjectPtr(ret_val);
45016 call_tests++;
45017 des_xmlNodeSetPtr(n_val, val, 0);
45018 xmlResetLastError();
45019 if (mem_base != xmlMemBlocks()) {
45020 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
45021 xmlMemBlocks() - mem_base);
45022 test_ret++;
45023 printf(" %d", n_val);
45024 printf("\n");
45025 }
45026 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045027 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045028#endif
45029
Daniel Veillarda82b1822004-11-08 16:24:57 +000045030 return(test_ret);
45031}
45032
45033
45034static int
45035test_xmlXPathNewParserContext(void) {
45036 int test_ret = 0;
45037
45038
45039 /* missing type support */
45040 return(test_ret);
45041}
45042
45043
45044static int
45045test_xmlXPathNewString(void) {
45046 int test_ret = 0;
45047
45048#ifdef LIBXML_XPATH_ENABLED
45049 int mem_base;
45050 xmlXPathObjectPtr ret_val;
45051 xmlChar * val; /* the xmlChar * value */
45052 int n_val;
45053
45054 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
45055 mem_base = xmlMemBlocks();
45056 val = gen_const_xmlChar_ptr(n_val, 0);
45057
45058 ret_val = xmlXPathNewString(val);
45059 desret_xmlXPathObjectPtr(ret_val);
45060 call_tests++;
45061 des_const_xmlChar_ptr(n_val, val, 0);
45062 xmlResetLastError();
45063 if (mem_base != xmlMemBlocks()) {
45064 printf("Leak of %d blocks found in xmlXPathNewString",
45065 xmlMemBlocks() - mem_base);
45066 test_ret++;
45067 printf(" %d", n_val);
45068 printf("\n");
45069 }
45070 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045071 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045072#endif
45073
Daniel Veillarda82b1822004-11-08 16:24:57 +000045074 return(test_ret);
45075}
45076
45077
45078static int
45079test_xmlXPathNextAncestor(void) {
45080 int test_ret = 0;
45081
45082#ifdef LIBXML_XPATH_ENABLED
45083 int mem_base;
45084 xmlNodePtr ret_val;
45085 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45086 int n_ctxt;
45087 xmlNodePtr cur; /* the current node in the traversal */
45088 int n_cur;
45089
45090 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45091 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45092 mem_base = xmlMemBlocks();
45093 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45094 cur = gen_xmlNodePtr(n_cur, 1);
45095
45096 ret_val = xmlXPathNextAncestor(ctxt, cur);
45097 desret_xmlNodePtr(ret_val);
45098 call_tests++;
45099 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45100 des_xmlNodePtr(n_cur, cur, 1);
45101 xmlResetLastError();
45102 if (mem_base != xmlMemBlocks()) {
45103 printf("Leak of %d blocks found in xmlXPathNextAncestor",
45104 xmlMemBlocks() - mem_base);
45105 test_ret++;
45106 printf(" %d", n_ctxt);
45107 printf(" %d", n_cur);
45108 printf("\n");
45109 }
45110 }
45111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045112 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045113#endif
45114
Daniel Veillarda82b1822004-11-08 16:24:57 +000045115 return(test_ret);
45116}
45117
45118
45119static int
45120test_xmlXPathNextAncestorOrSelf(void) {
45121 int test_ret = 0;
45122
45123#ifdef LIBXML_XPATH_ENABLED
45124 int mem_base;
45125 xmlNodePtr ret_val;
45126 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45127 int n_ctxt;
45128 xmlNodePtr cur; /* the current node in the traversal */
45129 int n_cur;
45130
45131 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45132 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45133 mem_base = xmlMemBlocks();
45134 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45135 cur = gen_xmlNodePtr(n_cur, 1);
45136
45137 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
45138 desret_xmlNodePtr(ret_val);
45139 call_tests++;
45140 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45141 des_xmlNodePtr(n_cur, cur, 1);
45142 xmlResetLastError();
45143 if (mem_base != xmlMemBlocks()) {
45144 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
45145 xmlMemBlocks() - mem_base);
45146 test_ret++;
45147 printf(" %d", n_ctxt);
45148 printf(" %d", n_cur);
45149 printf("\n");
45150 }
45151 }
45152 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045153 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045154#endif
45155
Daniel Veillarda82b1822004-11-08 16:24:57 +000045156 return(test_ret);
45157}
45158
45159
45160static int
45161test_xmlXPathNextAttribute(void) {
45162 int test_ret = 0;
45163
45164#ifdef LIBXML_XPATH_ENABLED
45165 int mem_base;
45166 xmlNodePtr ret_val;
45167 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45168 int n_ctxt;
45169 xmlNodePtr cur; /* the current attribute in the traversal */
45170 int n_cur;
45171
45172 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45173 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45174 mem_base = xmlMemBlocks();
45175 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45176 cur = gen_xmlNodePtr(n_cur, 1);
45177
45178 ret_val = xmlXPathNextAttribute(ctxt, cur);
45179 desret_xmlNodePtr(ret_val);
45180 call_tests++;
45181 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45182 des_xmlNodePtr(n_cur, cur, 1);
45183 xmlResetLastError();
45184 if (mem_base != xmlMemBlocks()) {
45185 printf("Leak of %d blocks found in xmlXPathNextAttribute",
45186 xmlMemBlocks() - mem_base);
45187 test_ret++;
45188 printf(" %d", n_ctxt);
45189 printf(" %d", n_cur);
45190 printf("\n");
45191 }
45192 }
45193 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045194 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045195#endif
45196
Daniel Veillarda82b1822004-11-08 16:24:57 +000045197 return(test_ret);
45198}
45199
45200
45201static int
45202test_xmlXPathNextChild(void) {
45203 int test_ret = 0;
45204
45205#ifdef LIBXML_XPATH_ENABLED
45206 int mem_base;
45207 xmlNodePtr ret_val;
45208 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45209 int n_ctxt;
45210 xmlNodePtr cur; /* the current node in the traversal */
45211 int n_cur;
45212
45213 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45214 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45215 mem_base = xmlMemBlocks();
45216 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45217 cur = gen_xmlNodePtr(n_cur, 1);
45218
45219 ret_val = xmlXPathNextChild(ctxt, cur);
45220 desret_xmlNodePtr(ret_val);
45221 call_tests++;
45222 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45223 des_xmlNodePtr(n_cur, cur, 1);
45224 xmlResetLastError();
45225 if (mem_base != xmlMemBlocks()) {
45226 printf("Leak of %d blocks found in xmlXPathNextChild",
45227 xmlMemBlocks() - mem_base);
45228 test_ret++;
45229 printf(" %d", n_ctxt);
45230 printf(" %d", n_cur);
45231 printf("\n");
45232 }
45233 }
45234 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045235 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045236#endif
45237
Daniel Veillarda82b1822004-11-08 16:24:57 +000045238 return(test_ret);
45239}
45240
45241
45242static int
45243test_xmlXPathNextDescendant(void) {
45244 int test_ret = 0;
45245
45246#ifdef LIBXML_XPATH_ENABLED
45247 int mem_base;
45248 xmlNodePtr ret_val;
45249 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45250 int n_ctxt;
45251 xmlNodePtr cur; /* the current node in the traversal */
45252 int n_cur;
45253
45254 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45255 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45256 mem_base = xmlMemBlocks();
45257 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45258 cur = gen_xmlNodePtr(n_cur, 1);
45259
45260 ret_val = xmlXPathNextDescendant(ctxt, cur);
45261 desret_xmlNodePtr(ret_val);
45262 call_tests++;
45263 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45264 des_xmlNodePtr(n_cur, cur, 1);
45265 xmlResetLastError();
45266 if (mem_base != xmlMemBlocks()) {
45267 printf("Leak of %d blocks found in xmlXPathNextDescendant",
45268 xmlMemBlocks() - mem_base);
45269 test_ret++;
45270 printf(" %d", n_ctxt);
45271 printf(" %d", n_cur);
45272 printf("\n");
45273 }
45274 }
45275 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045276 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045277#endif
45278
Daniel Veillarda82b1822004-11-08 16:24:57 +000045279 return(test_ret);
45280}
45281
45282
45283static int
45284test_xmlXPathNextDescendantOrSelf(void) {
45285 int test_ret = 0;
45286
45287#ifdef LIBXML_XPATH_ENABLED
45288 int mem_base;
45289 xmlNodePtr ret_val;
45290 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45291 int n_ctxt;
45292 xmlNodePtr cur; /* the current node in the traversal */
45293 int n_cur;
45294
45295 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45296 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45297 mem_base = xmlMemBlocks();
45298 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45299 cur = gen_xmlNodePtr(n_cur, 1);
45300
45301 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
45302 desret_xmlNodePtr(ret_val);
45303 call_tests++;
45304 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45305 des_xmlNodePtr(n_cur, cur, 1);
45306 xmlResetLastError();
45307 if (mem_base != xmlMemBlocks()) {
45308 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
45309 xmlMemBlocks() - mem_base);
45310 test_ret++;
45311 printf(" %d", n_ctxt);
45312 printf(" %d", n_cur);
45313 printf("\n");
45314 }
45315 }
45316 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045317 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045318#endif
45319
Daniel Veillarda82b1822004-11-08 16:24:57 +000045320 return(test_ret);
45321}
45322
45323
45324static int
45325test_xmlXPathNextFollowing(void) {
45326 int test_ret = 0;
45327
45328#ifdef LIBXML_XPATH_ENABLED
45329 int mem_base;
45330 xmlNodePtr ret_val;
45331 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45332 int n_ctxt;
45333 xmlNodePtr cur; /* the current node in the traversal */
45334 int n_cur;
45335
45336 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45337 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45338 mem_base = xmlMemBlocks();
45339 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45340 cur = gen_xmlNodePtr(n_cur, 1);
45341
45342 ret_val = xmlXPathNextFollowing(ctxt, cur);
45343 desret_xmlNodePtr(ret_val);
45344 call_tests++;
45345 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45346 des_xmlNodePtr(n_cur, cur, 1);
45347 xmlResetLastError();
45348 if (mem_base != xmlMemBlocks()) {
45349 printf("Leak of %d blocks found in xmlXPathNextFollowing",
45350 xmlMemBlocks() - mem_base);
45351 test_ret++;
45352 printf(" %d", n_ctxt);
45353 printf(" %d", n_cur);
45354 printf("\n");
45355 }
45356 }
45357 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045358 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045359#endif
45360
Daniel Veillarda82b1822004-11-08 16:24:57 +000045361 return(test_ret);
45362}
45363
45364
45365static int
45366test_xmlXPathNextFollowingSibling(void) {
45367 int test_ret = 0;
45368
45369#ifdef LIBXML_XPATH_ENABLED
45370 int mem_base;
45371 xmlNodePtr ret_val;
45372 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45373 int n_ctxt;
45374 xmlNodePtr cur; /* the current node in the traversal */
45375 int n_cur;
45376
45377 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45378 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45379 mem_base = xmlMemBlocks();
45380 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45381 cur = gen_xmlNodePtr(n_cur, 1);
45382
45383 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
45384 desret_xmlNodePtr(ret_val);
45385 call_tests++;
45386 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45387 des_xmlNodePtr(n_cur, cur, 1);
45388 xmlResetLastError();
45389 if (mem_base != xmlMemBlocks()) {
45390 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
45391 xmlMemBlocks() - mem_base);
45392 test_ret++;
45393 printf(" %d", n_ctxt);
45394 printf(" %d", n_cur);
45395 printf("\n");
45396 }
45397 }
45398 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045399 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045400#endif
45401
Daniel Veillarda82b1822004-11-08 16:24:57 +000045402 return(test_ret);
45403}
45404
45405
45406static int
45407test_xmlXPathNextNamespace(void) {
45408 int test_ret = 0;
45409
45410#ifdef LIBXML_XPATH_ENABLED
45411 int mem_base;
45412 xmlNodePtr ret_val;
45413 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45414 int n_ctxt;
45415 xmlNodePtr cur; /* the current attribute in the traversal */
45416 int n_cur;
45417
45418 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45419 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45420 mem_base = xmlMemBlocks();
45421 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45422 cur = gen_xmlNodePtr(n_cur, 1);
45423
45424 ret_val = xmlXPathNextNamespace(ctxt, cur);
45425 desret_xmlNodePtr(ret_val);
45426 call_tests++;
45427 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45428 des_xmlNodePtr(n_cur, cur, 1);
45429 xmlResetLastError();
45430 if (mem_base != xmlMemBlocks()) {
45431 printf("Leak of %d blocks found in xmlXPathNextNamespace",
45432 xmlMemBlocks() - mem_base);
45433 test_ret++;
45434 printf(" %d", n_ctxt);
45435 printf(" %d", n_cur);
45436 printf("\n");
45437 }
45438 }
45439 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045440 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045441#endif
45442
Daniel Veillarda82b1822004-11-08 16:24:57 +000045443 return(test_ret);
45444}
45445
45446
45447static int
45448test_xmlXPathNextParent(void) {
45449 int test_ret = 0;
45450
45451#ifdef LIBXML_XPATH_ENABLED
45452 int mem_base;
45453 xmlNodePtr ret_val;
45454 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45455 int n_ctxt;
45456 xmlNodePtr cur; /* the current node in the traversal */
45457 int n_cur;
45458
45459 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45460 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45461 mem_base = xmlMemBlocks();
45462 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45463 cur = gen_xmlNodePtr(n_cur, 1);
45464
45465 ret_val = xmlXPathNextParent(ctxt, cur);
45466 desret_xmlNodePtr(ret_val);
45467 call_tests++;
45468 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45469 des_xmlNodePtr(n_cur, cur, 1);
45470 xmlResetLastError();
45471 if (mem_base != xmlMemBlocks()) {
45472 printf("Leak of %d blocks found in xmlXPathNextParent",
45473 xmlMemBlocks() - mem_base);
45474 test_ret++;
45475 printf(" %d", n_ctxt);
45476 printf(" %d", n_cur);
45477 printf("\n");
45478 }
45479 }
45480 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045481 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045482#endif
45483
Daniel Veillarda82b1822004-11-08 16:24:57 +000045484 return(test_ret);
45485}
45486
45487
45488static int
45489test_xmlXPathNextPreceding(void) {
45490 int test_ret = 0;
45491
45492#ifdef LIBXML_XPATH_ENABLED
45493 int mem_base;
45494 xmlNodePtr ret_val;
45495 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45496 int n_ctxt;
45497 xmlNodePtr cur; /* the current node in the traversal */
45498 int n_cur;
45499
45500 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45501 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45502 mem_base = xmlMemBlocks();
45503 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45504 cur = gen_xmlNodePtr(n_cur, 1);
45505
45506 ret_val = xmlXPathNextPreceding(ctxt, cur);
45507 desret_xmlNodePtr(ret_val);
45508 call_tests++;
45509 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45510 des_xmlNodePtr(n_cur, cur, 1);
45511 xmlResetLastError();
45512 if (mem_base != xmlMemBlocks()) {
45513 printf("Leak of %d blocks found in xmlXPathNextPreceding",
45514 xmlMemBlocks() - mem_base);
45515 test_ret++;
45516 printf(" %d", n_ctxt);
45517 printf(" %d", n_cur);
45518 printf("\n");
45519 }
45520 }
45521 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045522 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045523#endif
45524
Daniel Veillarda82b1822004-11-08 16:24:57 +000045525 return(test_ret);
45526}
45527
45528
45529static int
45530test_xmlXPathNextPrecedingSibling(void) {
45531 int test_ret = 0;
45532
45533#ifdef LIBXML_XPATH_ENABLED
45534 int mem_base;
45535 xmlNodePtr ret_val;
45536 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45537 int n_ctxt;
45538 xmlNodePtr cur; /* the current node in the traversal */
45539 int n_cur;
45540
45541 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45542 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45543 mem_base = xmlMemBlocks();
45544 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45545 cur = gen_xmlNodePtr(n_cur, 1);
45546
45547 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
45548 desret_xmlNodePtr(ret_val);
45549 call_tests++;
45550 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45551 des_xmlNodePtr(n_cur, cur, 1);
45552 xmlResetLastError();
45553 if (mem_base != xmlMemBlocks()) {
45554 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
45555 xmlMemBlocks() - mem_base);
45556 test_ret++;
45557 printf(" %d", n_ctxt);
45558 printf(" %d", n_cur);
45559 printf("\n");
45560 }
45561 }
45562 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045563 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045564#endif
45565
Daniel Veillarda82b1822004-11-08 16:24:57 +000045566 return(test_ret);
45567}
45568
45569
45570static int
45571test_xmlXPathNextSelf(void) {
45572 int test_ret = 0;
45573
45574#ifdef LIBXML_XPATH_ENABLED
45575 int mem_base;
45576 xmlNodePtr ret_val;
45577 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45578 int n_ctxt;
45579 xmlNodePtr cur; /* the current node in the traversal */
45580 int n_cur;
45581
45582 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45583 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45584 mem_base = xmlMemBlocks();
45585 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45586 cur = gen_xmlNodePtr(n_cur, 1);
45587
45588 ret_val = xmlXPathNextSelf(ctxt, cur);
45589 desret_xmlNodePtr(ret_val);
45590 call_tests++;
45591 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45592 des_xmlNodePtr(n_cur, cur, 1);
45593 xmlResetLastError();
45594 if (mem_base != xmlMemBlocks()) {
45595 printf("Leak of %d blocks found in xmlXPathNextSelf",
45596 xmlMemBlocks() - mem_base);
45597 test_ret++;
45598 printf(" %d", n_ctxt);
45599 printf(" %d", n_cur);
45600 printf("\n");
45601 }
45602 }
45603 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045604 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045605#endif
45606
Daniel Veillarda82b1822004-11-08 16:24:57 +000045607 return(test_ret);
45608}
45609
45610
45611static int
45612test_xmlXPathNodeLeading(void) {
45613 int test_ret = 0;
45614
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045615#ifdef LIBXML_XPATH_ENABLED
45616 int mem_base;
45617 xmlNodeSetPtr ret_val;
45618 xmlNodeSetPtr nodes; /* a node-set */
45619 int n_nodes;
45620 xmlNodePtr node; /* a node */
45621 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045622
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045623 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45624 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45625 mem_base = xmlMemBlocks();
45626 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45627 node = gen_xmlNodePtr(n_node, 1);
45628
45629 ret_val = xmlXPathNodeLeading(nodes, node);
45630 desret_xmlNodeSetPtr(ret_val);
45631 call_tests++;
45632 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45633 des_xmlNodePtr(n_node, node, 1);
45634 xmlResetLastError();
45635 if (mem_base != xmlMemBlocks()) {
45636 printf("Leak of %d blocks found in xmlXPathNodeLeading",
45637 xmlMemBlocks() - mem_base);
45638 test_ret++;
45639 printf(" %d", n_nodes);
45640 printf(" %d", n_node);
45641 printf("\n");
45642 }
45643 }
45644 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045645 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045646#endif
45647
Daniel Veillarda82b1822004-11-08 16:24:57 +000045648 return(test_ret);
45649}
45650
45651
45652static int
45653test_xmlXPathNodeLeadingSorted(void) {
45654 int test_ret = 0;
45655
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045656#ifdef LIBXML_XPATH_ENABLED
45657 int mem_base;
45658 xmlNodeSetPtr ret_val;
45659 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45660 int n_nodes;
45661 xmlNodePtr node; /* a node */
45662 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045663
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045664 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45665 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45666 mem_base = xmlMemBlocks();
45667 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45668 node = gen_xmlNodePtr(n_node, 1);
45669
45670 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
45671 desret_xmlNodeSetPtr(ret_val);
45672 call_tests++;
45673 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45674 des_xmlNodePtr(n_node, node, 1);
45675 xmlResetLastError();
45676 if (mem_base != xmlMemBlocks()) {
45677 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
45678 xmlMemBlocks() - mem_base);
45679 test_ret++;
45680 printf(" %d", n_nodes);
45681 printf(" %d", n_node);
45682 printf("\n");
45683 }
45684 }
45685 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045686 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045687#endif
45688
Daniel Veillarda82b1822004-11-08 16:24:57 +000045689 return(test_ret);
45690}
45691
45692
45693static int
45694test_xmlXPathNodeSetAdd(void) {
45695 int test_ret = 0;
45696
45697#ifdef LIBXML_XPATH_ENABLED
45698 int mem_base;
45699 xmlNodeSetPtr cur; /* the initial node set */
45700 int n_cur;
45701 xmlNodePtr val; /* a new xmlNodePtr */
45702 int n_val;
45703
45704 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45705 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45706 mem_base = xmlMemBlocks();
45707 cur = gen_xmlNodeSetPtr(n_cur, 0);
45708 val = gen_xmlNodePtr(n_val, 1);
45709
45710 xmlXPathNodeSetAdd(cur, val);
45711 call_tests++;
45712 des_xmlNodeSetPtr(n_cur, cur, 0);
45713 des_xmlNodePtr(n_val, val, 1);
45714 xmlResetLastError();
45715 if (mem_base != xmlMemBlocks()) {
45716 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
45717 xmlMemBlocks() - mem_base);
45718 test_ret++;
45719 printf(" %d", n_cur);
45720 printf(" %d", n_val);
45721 printf("\n");
45722 }
45723 }
45724 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045725 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045726#endif
45727
Daniel Veillarda82b1822004-11-08 16:24:57 +000045728 return(test_ret);
45729}
45730
45731
45732static int
45733test_xmlXPathNodeSetAddNs(void) {
45734 int test_ret = 0;
45735
45736#ifdef LIBXML_XPATH_ENABLED
45737 int mem_base;
45738 xmlNodeSetPtr cur; /* the initial node set */
45739 int n_cur;
45740 xmlNodePtr node; /* the hosting node */
45741 int n_node;
45742 xmlNsPtr ns; /* a the namespace node */
45743 int n_ns;
45744
45745 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45746 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45747 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
45748 mem_base = xmlMemBlocks();
45749 cur = gen_xmlNodeSetPtr(n_cur, 0);
45750 node = gen_xmlNodePtr(n_node, 1);
45751 ns = gen_xmlNsPtr(n_ns, 2);
45752
45753 xmlXPathNodeSetAddNs(cur, node, ns);
45754 call_tests++;
45755 des_xmlNodeSetPtr(n_cur, cur, 0);
45756 des_xmlNodePtr(n_node, node, 1);
45757 des_xmlNsPtr(n_ns, ns, 2);
45758 xmlResetLastError();
45759 if (mem_base != xmlMemBlocks()) {
45760 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
45761 xmlMemBlocks() - mem_base);
45762 test_ret++;
45763 printf(" %d", n_cur);
45764 printf(" %d", n_node);
45765 printf(" %d", n_ns);
45766 printf("\n");
45767 }
45768 }
45769 }
45770 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045771 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045772#endif
45773
Daniel Veillarda82b1822004-11-08 16:24:57 +000045774 return(test_ret);
45775}
45776
45777
45778static int
45779test_xmlXPathNodeSetAddUnique(void) {
45780 int test_ret = 0;
45781
45782#ifdef LIBXML_XPATH_ENABLED
45783 int mem_base;
45784 xmlNodeSetPtr cur; /* the initial node set */
45785 int n_cur;
45786 xmlNodePtr val; /* a new xmlNodePtr */
45787 int n_val;
45788
45789 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45790 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45791 mem_base = xmlMemBlocks();
45792 cur = gen_xmlNodeSetPtr(n_cur, 0);
45793 val = gen_xmlNodePtr(n_val, 1);
45794
45795 xmlXPathNodeSetAddUnique(cur, val);
45796 call_tests++;
45797 des_xmlNodeSetPtr(n_cur, cur, 0);
45798 des_xmlNodePtr(n_val, val, 1);
45799 xmlResetLastError();
45800 if (mem_base != xmlMemBlocks()) {
45801 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
45802 xmlMemBlocks() - mem_base);
45803 test_ret++;
45804 printf(" %d", n_cur);
45805 printf(" %d", n_val);
45806 printf("\n");
45807 }
45808 }
45809 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045810 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045811#endif
45812
Daniel Veillarda82b1822004-11-08 16:24:57 +000045813 return(test_ret);
45814}
45815
45816
45817static int
45818test_xmlXPathNodeSetContains(void) {
45819 int test_ret = 0;
45820
45821#ifdef LIBXML_XPATH_ENABLED
45822 int mem_base;
45823 int ret_val;
45824 xmlNodeSetPtr cur; /* the node-set */
45825 int n_cur;
45826 xmlNodePtr val; /* the node */
45827 int n_val;
45828
45829 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45830 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45831 mem_base = xmlMemBlocks();
45832 cur = gen_xmlNodeSetPtr(n_cur, 0);
45833 val = gen_xmlNodePtr(n_val, 1);
45834
45835 ret_val = xmlXPathNodeSetContains(cur, val);
45836 desret_int(ret_val);
45837 call_tests++;
45838 des_xmlNodeSetPtr(n_cur, cur, 0);
45839 des_xmlNodePtr(n_val, val, 1);
45840 xmlResetLastError();
45841 if (mem_base != xmlMemBlocks()) {
45842 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
45843 xmlMemBlocks() - mem_base);
45844 test_ret++;
45845 printf(" %d", n_cur);
45846 printf(" %d", n_val);
45847 printf("\n");
45848 }
45849 }
45850 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045851 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045852#endif
45853
Daniel Veillarda82b1822004-11-08 16:24:57 +000045854 return(test_ret);
45855}
45856
45857
45858static int
45859test_xmlXPathNodeSetDel(void) {
45860 int test_ret = 0;
45861
45862#ifdef LIBXML_XPATH_ENABLED
45863 int mem_base;
45864 xmlNodeSetPtr cur; /* the initial node set */
45865 int n_cur;
45866 xmlNodePtr val; /* an xmlNodePtr */
45867 int n_val;
45868
45869 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45870 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45871 mem_base = xmlMemBlocks();
45872 cur = gen_xmlNodeSetPtr(n_cur, 0);
45873 val = gen_xmlNodePtr(n_val, 1);
45874
45875 xmlXPathNodeSetDel(cur, val);
45876 call_tests++;
45877 des_xmlNodeSetPtr(n_cur, cur, 0);
45878 des_xmlNodePtr(n_val, val, 1);
45879 xmlResetLastError();
45880 if (mem_base != xmlMemBlocks()) {
45881 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
45882 xmlMemBlocks() - mem_base);
45883 test_ret++;
45884 printf(" %d", n_cur);
45885 printf(" %d", n_val);
45886 printf("\n");
45887 }
45888 }
45889 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045890 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045891#endif
45892
Daniel Veillarda82b1822004-11-08 16:24:57 +000045893 return(test_ret);
45894}
45895
45896
45897static int
45898test_xmlXPathNodeSetMerge(void) {
45899 int test_ret = 0;
45900
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045901#ifdef LIBXML_XPATH_ENABLED
45902 int mem_base;
45903 xmlNodeSetPtr ret_val;
45904 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
45905 int n_val1;
45906 xmlNodeSetPtr val2; /* the second NodeSet */
45907 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045908
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045909 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
45910 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
45911 mem_base = xmlMemBlocks();
45912 val1 = gen_xmlNodeSetPtr(n_val1, 0);
45913 val2 = gen_xmlNodeSetPtr(n_val2, 1);
45914
45915 ret_val = xmlXPathNodeSetMerge(val1, val2);
45916 desret_xmlNodeSetPtr(ret_val);
45917 call_tests++;
45918 des_xmlNodeSetPtr(n_val1, val1, 0);
45919 des_xmlNodeSetPtr(n_val2, val2, 1);
45920 xmlResetLastError();
45921 if (mem_base != xmlMemBlocks()) {
45922 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
45923 xmlMemBlocks() - mem_base);
45924 test_ret++;
45925 printf(" %d", n_val1);
45926 printf(" %d", n_val2);
45927 printf("\n");
45928 }
45929 }
45930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045931 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045932#endif
45933
Daniel Veillarda82b1822004-11-08 16:24:57 +000045934 return(test_ret);
45935}
45936
45937
45938static int
45939test_xmlXPathNodeSetRemove(void) {
45940 int test_ret = 0;
45941
45942#ifdef LIBXML_XPATH_ENABLED
45943 int mem_base;
45944 xmlNodeSetPtr cur; /* the initial node set */
45945 int n_cur;
45946 int val; /* the index to remove */
45947 int n_val;
45948
45949 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45950 for (n_val = 0;n_val < gen_nb_int;n_val++) {
45951 mem_base = xmlMemBlocks();
45952 cur = gen_xmlNodeSetPtr(n_cur, 0);
45953 val = gen_int(n_val, 1);
45954
45955 xmlXPathNodeSetRemove(cur, val);
45956 call_tests++;
45957 des_xmlNodeSetPtr(n_cur, cur, 0);
45958 des_int(n_val, val, 1);
45959 xmlResetLastError();
45960 if (mem_base != xmlMemBlocks()) {
45961 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
45962 xmlMemBlocks() - mem_base);
45963 test_ret++;
45964 printf(" %d", n_cur);
45965 printf(" %d", n_val);
45966 printf("\n");
45967 }
45968 }
45969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045970 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045971#endif
45972
Daniel Veillarda82b1822004-11-08 16:24:57 +000045973 return(test_ret);
45974}
45975
45976
45977static int
45978test_xmlXPathNodeSetSort(void) {
45979 int test_ret = 0;
45980
45981#ifdef LIBXML_XPATH_ENABLED
45982 int mem_base;
45983 xmlNodeSetPtr set; /* the node set */
45984 int n_set;
45985
45986 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
45987 mem_base = xmlMemBlocks();
45988 set = gen_xmlNodeSetPtr(n_set, 0);
45989
45990 xmlXPathNodeSetSort(set);
45991 call_tests++;
45992 des_xmlNodeSetPtr(n_set, set, 0);
45993 xmlResetLastError();
45994 if (mem_base != xmlMemBlocks()) {
45995 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
45996 xmlMemBlocks() - mem_base);
45997 test_ret++;
45998 printf(" %d", n_set);
45999 printf("\n");
46000 }
46001 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046002 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046003#endif
46004
Daniel Veillarda82b1822004-11-08 16:24:57 +000046005 return(test_ret);
46006}
46007
46008
46009static int
46010test_xmlXPathNodeTrailing(void) {
46011 int test_ret = 0;
46012
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046013#ifdef LIBXML_XPATH_ENABLED
46014 int mem_base;
46015 xmlNodeSetPtr ret_val;
46016 xmlNodeSetPtr nodes; /* a node-set */
46017 int n_nodes;
46018 xmlNodePtr node; /* a node */
46019 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046020
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046021 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46022 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46023 mem_base = xmlMemBlocks();
46024 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46025 node = gen_xmlNodePtr(n_node, 1);
46026
46027 ret_val = xmlXPathNodeTrailing(nodes, node);
46028 desret_xmlNodeSetPtr(ret_val);
46029 call_tests++;
46030 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46031 des_xmlNodePtr(n_node, node, 1);
46032 xmlResetLastError();
46033 if (mem_base != xmlMemBlocks()) {
46034 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
46035 xmlMemBlocks() - mem_base);
46036 test_ret++;
46037 printf(" %d", n_nodes);
46038 printf(" %d", n_node);
46039 printf("\n");
46040 }
46041 }
46042 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046043 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046044#endif
46045
Daniel Veillarda82b1822004-11-08 16:24:57 +000046046 return(test_ret);
46047}
46048
46049
46050static int
46051test_xmlXPathNodeTrailingSorted(void) {
46052 int test_ret = 0;
46053
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046054#ifdef LIBXML_XPATH_ENABLED
46055 int mem_base;
46056 xmlNodeSetPtr ret_val;
46057 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46058 int n_nodes;
46059 xmlNodePtr node; /* a node */
46060 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046061
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046062 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46063 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46064 mem_base = xmlMemBlocks();
46065 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46066 node = gen_xmlNodePtr(n_node, 1);
46067
46068 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
46069 desret_xmlNodeSetPtr(ret_val);
46070 call_tests++;
46071 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46072 des_xmlNodePtr(n_node, node, 1);
46073 xmlResetLastError();
46074 if (mem_base != xmlMemBlocks()) {
46075 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
46076 xmlMemBlocks() - mem_base);
46077 test_ret++;
46078 printf(" %d", n_nodes);
46079 printf(" %d", n_node);
46080 printf("\n");
46081 }
46082 }
46083 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046084 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046085#endif
46086
Daniel Veillarda82b1822004-11-08 16:24:57 +000046087 return(test_ret);
46088}
46089
46090
46091static int
46092test_xmlXPathNormalizeFunction(void) {
46093 int test_ret = 0;
46094
46095#ifdef LIBXML_XPATH_ENABLED
46096 int mem_base;
46097 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46098 int n_ctxt;
46099 int nargs; /* the number of arguments */
46100 int n_nargs;
46101
46102 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46103 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46104 mem_base = xmlMemBlocks();
46105 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46106 nargs = gen_int(n_nargs, 1);
46107
46108 xmlXPathNormalizeFunction(ctxt, nargs);
46109 call_tests++;
46110 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46111 des_int(n_nargs, nargs, 1);
46112 xmlResetLastError();
46113 if (mem_base != xmlMemBlocks()) {
46114 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
46115 xmlMemBlocks() - mem_base);
46116 test_ret++;
46117 printf(" %d", n_ctxt);
46118 printf(" %d", n_nargs);
46119 printf("\n");
46120 }
46121 }
46122 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046123 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046124#endif
46125
Daniel Veillarda82b1822004-11-08 16:24:57 +000046126 return(test_ret);
46127}
46128
46129
46130static int
46131test_xmlXPathNotEqualValues(void) {
46132 int test_ret = 0;
46133
46134#ifdef LIBXML_XPATH_ENABLED
46135 int mem_base;
46136 int ret_val;
46137 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46138 int n_ctxt;
46139
46140 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46141 mem_base = xmlMemBlocks();
46142 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46143
46144 ret_val = xmlXPathNotEqualValues(ctxt);
46145 desret_int(ret_val);
46146 call_tests++;
46147 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46148 xmlResetLastError();
46149 if (mem_base != xmlMemBlocks()) {
46150 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
46151 xmlMemBlocks() - mem_base);
46152 test_ret++;
46153 printf(" %d", n_ctxt);
46154 printf("\n");
46155 }
46156 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046157 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046158#endif
46159
Daniel Veillarda82b1822004-11-08 16:24:57 +000046160 return(test_ret);
46161}
46162
46163
46164static int
46165test_xmlXPathNotFunction(void) {
46166 int test_ret = 0;
46167
46168#ifdef LIBXML_XPATH_ENABLED
46169 int mem_base;
46170 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46171 int n_ctxt;
46172 int nargs; /* the number of arguments */
46173 int n_nargs;
46174
46175 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46176 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46177 mem_base = xmlMemBlocks();
46178 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46179 nargs = gen_int(n_nargs, 1);
46180
46181 xmlXPathNotFunction(ctxt, nargs);
46182 call_tests++;
46183 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46184 des_int(n_nargs, nargs, 1);
46185 xmlResetLastError();
46186 if (mem_base != xmlMemBlocks()) {
46187 printf("Leak of %d blocks found in xmlXPathNotFunction",
46188 xmlMemBlocks() - mem_base);
46189 test_ret++;
46190 printf(" %d", n_ctxt);
46191 printf(" %d", n_nargs);
46192 printf("\n");
46193 }
46194 }
46195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046196 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046197#endif
46198
Daniel Veillarda82b1822004-11-08 16:24:57 +000046199 return(test_ret);
46200}
46201
46202
46203static int
46204test_xmlXPathNsLookup(void) {
46205 int test_ret = 0;
46206
46207#ifdef LIBXML_XPATH_ENABLED
46208 int mem_base;
46209 const xmlChar * ret_val;
46210 xmlXPathContextPtr ctxt; /* the XPath context */
46211 int n_ctxt;
46212 xmlChar * prefix; /* the namespace prefix value */
46213 int n_prefix;
46214
46215 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46216 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46217 mem_base = xmlMemBlocks();
46218 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46219 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46220
46221 ret_val = xmlXPathNsLookup(ctxt, prefix);
46222 desret_const_xmlChar_ptr(ret_val);
46223 call_tests++;
46224 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46225 des_const_xmlChar_ptr(n_prefix, prefix, 1);
46226 xmlResetLastError();
46227 if (mem_base != xmlMemBlocks()) {
46228 printf("Leak of %d blocks found in xmlXPathNsLookup",
46229 xmlMemBlocks() - mem_base);
46230 test_ret++;
46231 printf(" %d", n_ctxt);
46232 printf(" %d", n_prefix);
46233 printf("\n");
46234 }
46235 }
46236 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046237 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046238#endif
46239
Daniel Veillarda82b1822004-11-08 16:24:57 +000046240 return(test_ret);
46241}
46242
46243
46244static int
46245test_xmlXPathNumberFunction(void) {
46246 int test_ret = 0;
46247
46248#ifdef LIBXML_XPATH_ENABLED
46249 int mem_base;
46250 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46251 int n_ctxt;
46252 int nargs; /* the number of arguments */
46253 int n_nargs;
46254
46255 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46256 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46257 mem_base = xmlMemBlocks();
46258 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46259 nargs = gen_int(n_nargs, 1);
46260
46261 xmlXPathNumberFunction(ctxt, nargs);
46262 call_tests++;
46263 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46264 des_int(n_nargs, nargs, 1);
46265 xmlResetLastError();
46266 if (mem_base != xmlMemBlocks()) {
46267 printf("Leak of %d blocks found in xmlXPathNumberFunction",
46268 xmlMemBlocks() - mem_base);
46269 test_ret++;
46270 printf(" %d", n_ctxt);
46271 printf(" %d", n_nargs);
46272 printf("\n");
46273 }
46274 }
46275 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046276 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046277#endif
46278
Daniel Veillarda82b1822004-11-08 16:24:57 +000046279 return(test_ret);
46280}
46281
46282
46283static int
46284test_xmlXPathParseNCName(void) {
46285 int test_ret = 0;
46286
46287#ifdef LIBXML_XPATH_ENABLED
46288 int mem_base;
46289 xmlChar * ret_val;
46290 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46291 int n_ctxt;
46292
46293 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46294 mem_base = xmlMemBlocks();
46295 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46296
46297 ret_val = xmlXPathParseNCName(ctxt);
46298 desret_xmlChar_ptr(ret_val);
46299 call_tests++;
46300 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46301 xmlResetLastError();
46302 if (mem_base != xmlMemBlocks()) {
46303 printf("Leak of %d blocks found in xmlXPathParseNCName",
46304 xmlMemBlocks() - mem_base);
46305 test_ret++;
46306 printf(" %d", n_ctxt);
46307 printf("\n");
46308 }
46309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046310 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046311#endif
46312
Daniel Veillarda82b1822004-11-08 16:24:57 +000046313 return(test_ret);
46314}
46315
46316
46317static int
46318test_xmlXPathParseName(void) {
46319 int test_ret = 0;
46320
46321#ifdef LIBXML_XPATH_ENABLED
46322 int mem_base;
46323 xmlChar * ret_val;
46324 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46325 int n_ctxt;
46326
46327 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46328 mem_base = xmlMemBlocks();
46329 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46330
46331 ret_val = xmlXPathParseName(ctxt);
46332 desret_xmlChar_ptr(ret_val);
46333 call_tests++;
46334 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46335 xmlResetLastError();
46336 if (mem_base != xmlMemBlocks()) {
46337 printf("Leak of %d blocks found in xmlXPathParseName",
46338 xmlMemBlocks() - mem_base);
46339 test_ret++;
46340 printf(" %d", n_ctxt);
46341 printf("\n");
46342 }
46343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046344 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046345#endif
46346
Daniel Veillarda82b1822004-11-08 16:24:57 +000046347 return(test_ret);
46348}
46349
46350
46351static int
46352test_xmlXPathPopBoolean(void) {
46353 int test_ret = 0;
46354
46355#ifdef LIBXML_XPATH_ENABLED
46356 int mem_base;
46357 int ret_val;
46358 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46359 int n_ctxt;
46360
46361 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46362 mem_base = xmlMemBlocks();
46363 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46364
46365 ret_val = xmlXPathPopBoolean(ctxt);
46366 desret_int(ret_val);
46367 call_tests++;
46368 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46369 xmlResetLastError();
46370 if (mem_base != xmlMemBlocks()) {
46371 printf("Leak of %d blocks found in xmlXPathPopBoolean",
46372 xmlMemBlocks() - mem_base);
46373 test_ret++;
46374 printf(" %d", n_ctxt);
46375 printf("\n");
46376 }
46377 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046378 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046379#endif
46380
Daniel Veillarda82b1822004-11-08 16:24:57 +000046381 return(test_ret);
46382}
46383
46384
46385static int
46386test_xmlXPathPopExternal(void) {
46387 int test_ret = 0;
46388
46389#ifdef LIBXML_XPATH_ENABLED
46390 int mem_base;
46391 void * ret_val;
46392 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46393 int n_ctxt;
46394
46395 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46396 mem_base = xmlMemBlocks();
46397 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46398
46399 ret_val = xmlXPathPopExternal(ctxt);
46400 desret_void_ptr(ret_val);
46401 call_tests++;
46402 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46403 xmlResetLastError();
46404 if (mem_base != xmlMemBlocks()) {
46405 printf("Leak of %d blocks found in xmlXPathPopExternal",
46406 xmlMemBlocks() - mem_base);
46407 test_ret++;
46408 printf(" %d", n_ctxt);
46409 printf("\n");
46410 }
46411 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046412 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046413#endif
46414
Daniel Veillarda82b1822004-11-08 16:24:57 +000046415 return(test_ret);
46416}
46417
46418
46419static int
46420test_xmlXPathPopNodeSet(void) {
46421 int test_ret = 0;
46422
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046423#ifdef LIBXML_XPATH_ENABLED
46424 int mem_base;
46425 xmlNodeSetPtr ret_val;
46426 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46427 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046428
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046429 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46430 mem_base = xmlMemBlocks();
46431 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46432
46433 ret_val = xmlXPathPopNodeSet(ctxt);
46434 desret_xmlNodeSetPtr(ret_val);
46435 call_tests++;
46436 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46437 xmlResetLastError();
46438 if (mem_base != xmlMemBlocks()) {
46439 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
46440 xmlMemBlocks() - mem_base);
46441 test_ret++;
46442 printf(" %d", n_ctxt);
46443 printf("\n");
46444 }
46445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046446 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046447#endif
46448
Daniel Veillarda82b1822004-11-08 16:24:57 +000046449 return(test_ret);
46450}
46451
46452
46453static int
46454test_xmlXPathPopNumber(void) {
46455 int test_ret = 0;
46456
46457#ifdef LIBXML_XPATH_ENABLED
46458 int mem_base;
46459 double ret_val;
46460 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46461 int n_ctxt;
46462
46463 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46464 mem_base = xmlMemBlocks();
46465 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46466
46467 ret_val = xmlXPathPopNumber(ctxt);
46468 desret_double(ret_val);
46469 call_tests++;
46470 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46471 xmlResetLastError();
46472 if (mem_base != xmlMemBlocks()) {
46473 printf("Leak of %d blocks found in xmlXPathPopNumber",
46474 xmlMemBlocks() - mem_base);
46475 test_ret++;
46476 printf(" %d", n_ctxt);
46477 printf("\n");
46478 }
46479 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046480 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046481#endif
46482
Daniel Veillarda82b1822004-11-08 16:24:57 +000046483 return(test_ret);
46484}
46485
46486
46487static int
46488test_xmlXPathPopString(void) {
46489 int test_ret = 0;
46490
46491#ifdef LIBXML_XPATH_ENABLED
46492 int mem_base;
46493 xmlChar * ret_val;
46494 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46495 int n_ctxt;
46496
46497 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46498 mem_base = xmlMemBlocks();
46499 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46500
46501 ret_val = xmlXPathPopString(ctxt);
46502 desret_xmlChar_ptr(ret_val);
46503 call_tests++;
46504 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46505 xmlResetLastError();
46506 if (mem_base != xmlMemBlocks()) {
46507 printf("Leak of %d blocks found in xmlXPathPopString",
46508 xmlMemBlocks() - mem_base);
46509 test_ret++;
46510 printf(" %d", n_ctxt);
46511 printf("\n");
46512 }
46513 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046514 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046515#endif
46516
Daniel Veillarda82b1822004-11-08 16:24:57 +000046517 return(test_ret);
46518}
46519
46520
46521static int
46522test_xmlXPathPositionFunction(void) {
46523 int test_ret = 0;
46524
46525#ifdef LIBXML_XPATH_ENABLED
46526 int mem_base;
46527 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46528 int n_ctxt;
46529 int nargs; /* the number of arguments */
46530 int n_nargs;
46531
46532 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46533 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46534 mem_base = xmlMemBlocks();
46535 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46536 nargs = gen_int(n_nargs, 1);
46537
46538 xmlXPathPositionFunction(ctxt, nargs);
46539 call_tests++;
46540 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46541 des_int(n_nargs, nargs, 1);
46542 xmlResetLastError();
46543 if (mem_base != xmlMemBlocks()) {
46544 printf("Leak of %d blocks found in xmlXPathPositionFunction",
46545 xmlMemBlocks() - mem_base);
46546 test_ret++;
46547 printf(" %d", n_ctxt);
46548 printf(" %d", n_nargs);
46549 printf("\n");
46550 }
46551 }
46552 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046553 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046554#endif
46555
Daniel Veillarda82b1822004-11-08 16:24:57 +000046556 return(test_ret);
46557}
46558
46559
46560static int
46561test_xmlXPathRegisterAllFunctions(void) {
46562 int test_ret = 0;
46563
46564#ifdef LIBXML_XPATH_ENABLED
46565 int mem_base;
46566 xmlXPathContextPtr ctxt; /* the XPath context */
46567 int n_ctxt;
46568
46569 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46570 mem_base = xmlMemBlocks();
46571 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46572
46573 xmlXPathRegisterAllFunctions(ctxt);
46574 call_tests++;
46575 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46576 xmlResetLastError();
46577 if (mem_base != xmlMemBlocks()) {
46578 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
46579 xmlMemBlocks() - mem_base);
46580 test_ret++;
46581 printf(" %d", n_ctxt);
46582 printf("\n");
46583 }
46584 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046585 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046586#endif
46587
Daniel Veillarda82b1822004-11-08 16:24:57 +000046588 return(test_ret);
46589}
46590
46591
46592static int
46593test_xmlXPathRegisterFunc(void) {
46594 int test_ret = 0;
46595
46596
46597 /* missing type support */
46598 return(test_ret);
46599}
46600
46601
46602static int
46603test_xmlXPathRegisterFuncLookup(void) {
46604 int test_ret = 0;
46605
46606
46607 /* missing type support */
46608 return(test_ret);
46609}
46610
46611
46612static int
46613test_xmlXPathRegisterFuncNS(void) {
46614 int test_ret = 0;
46615
46616
46617 /* missing type support */
46618 return(test_ret);
46619}
46620
46621
46622static int
46623test_xmlXPathRegisterNs(void) {
46624 int test_ret = 0;
46625
46626#ifdef LIBXML_XPATH_ENABLED
46627 int mem_base;
46628 int ret_val;
46629 xmlXPathContextPtr ctxt; /* the XPath context */
46630 int n_ctxt;
46631 xmlChar * prefix; /* the namespace prefix */
46632 int n_prefix;
46633 xmlChar * ns_uri; /* the namespace name */
46634 int n_ns_uri;
46635
46636 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46637 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46638 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46639 mem_base = xmlMemBlocks();
46640 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46641 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46642 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46643
46644 ret_val = xmlXPathRegisterNs(ctxt, prefix, ns_uri);
46645 desret_int(ret_val);
46646 call_tests++;
46647 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46648 des_const_xmlChar_ptr(n_prefix, prefix, 1);
46649 des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2);
46650 xmlResetLastError();
46651 if (mem_base != xmlMemBlocks()) {
46652 printf("Leak of %d blocks found in xmlXPathRegisterNs",
46653 xmlMemBlocks() - mem_base);
46654 test_ret++;
46655 printf(" %d", n_ctxt);
46656 printf(" %d", n_prefix);
46657 printf(" %d", n_ns_uri);
46658 printf("\n");
46659 }
46660 }
46661 }
46662 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046663 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046664#endif
46665
Daniel Veillarda82b1822004-11-08 16:24:57 +000046666 return(test_ret);
46667}
46668
46669
46670static int
46671test_xmlXPathRegisterVariable(void) {
46672 int test_ret = 0;
46673
46674#ifdef LIBXML_XPATH_ENABLED
46675 int mem_base;
46676 int ret_val;
46677 xmlXPathContextPtr ctxt; /* the XPath context */
46678 int n_ctxt;
46679 xmlChar * name; /* the variable name */
46680 int n_name;
46681 xmlXPathObjectPtr value; /* the variable value or NULL */
46682 int n_value;
46683
46684 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46685 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46686 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46687 mem_base = xmlMemBlocks();
46688 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46689 name = gen_const_xmlChar_ptr(n_name, 1);
46690 value = gen_xmlXPathObjectPtr(n_value, 2);
46691
46692 ret_val = xmlXPathRegisterVariable(ctxt, name, value);
46693 desret_int(ret_val);
46694 call_tests++;
46695 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46696 des_const_xmlChar_ptr(n_name, name, 1);
46697 des_xmlXPathObjectPtr(n_value, value, 2);
46698 xmlResetLastError();
46699 if (mem_base != xmlMemBlocks()) {
46700 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
46701 xmlMemBlocks() - mem_base);
46702 test_ret++;
46703 printf(" %d", n_ctxt);
46704 printf(" %d", n_name);
46705 printf(" %d", n_value);
46706 printf("\n");
46707 }
46708 }
46709 }
46710 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046711 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046712#endif
46713
Daniel Veillarda82b1822004-11-08 16:24:57 +000046714 return(test_ret);
46715}
46716
46717
46718static int
46719test_xmlXPathRegisterVariableLookup(void) {
46720 int test_ret = 0;
46721
46722
46723 /* missing type support */
46724 return(test_ret);
46725}
46726
46727
46728static int
46729test_xmlXPathRegisterVariableNS(void) {
46730 int test_ret = 0;
46731
46732#ifdef LIBXML_XPATH_ENABLED
46733 int mem_base;
46734 int ret_val;
46735 xmlXPathContextPtr ctxt; /* the XPath context */
46736 int n_ctxt;
46737 xmlChar * name; /* the variable name */
46738 int n_name;
46739 xmlChar * ns_uri; /* the variable namespace URI */
46740 int n_ns_uri;
46741 xmlXPathObjectPtr value; /* the variable value or NULL */
46742 int n_value;
46743
46744 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46745 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46746 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46747 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46748 mem_base = xmlMemBlocks();
46749 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46750 name = gen_const_xmlChar_ptr(n_name, 1);
46751 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46752 value = gen_xmlXPathObjectPtr(n_value, 3);
46753
46754 ret_val = xmlXPathRegisterVariableNS(ctxt, name, ns_uri, value);
46755 desret_int(ret_val);
46756 call_tests++;
46757 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46758 des_const_xmlChar_ptr(n_name, name, 1);
46759 des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2);
46760 des_xmlXPathObjectPtr(n_value, value, 3);
46761 xmlResetLastError();
46762 if (mem_base != xmlMemBlocks()) {
46763 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
46764 xmlMemBlocks() - mem_base);
46765 test_ret++;
46766 printf(" %d", n_ctxt);
46767 printf(" %d", n_name);
46768 printf(" %d", n_ns_uri);
46769 printf(" %d", n_value);
46770 printf("\n");
46771 }
46772 }
46773 }
46774 }
46775 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046776 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046777#endif
46778
Daniel Veillarda82b1822004-11-08 16:24:57 +000046779 return(test_ret);
46780}
46781
46782
46783static int
46784test_xmlXPathRegisteredFuncsCleanup(void) {
46785 int test_ret = 0;
46786
46787#ifdef LIBXML_XPATH_ENABLED
46788 int mem_base;
46789 xmlXPathContextPtr ctxt; /* the XPath context */
46790 int n_ctxt;
46791
46792 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46793 mem_base = xmlMemBlocks();
46794 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46795
46796 xmlXPathRegisteredFuncsCleanup(ctxt);
46797 call_tests++;
46798 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46799 xmlResetLastError();
46800 if (mem_base != xmlMemBlocks()) {
46801 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
46802 xmlMemBlocks() - mem_base);
46803 test_ret++;
46804 printf(" %d", n_ctxt);
46805 printf("\n");
46806 }
46807 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046808 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046809#endif
46810
Daniel Veillarda82b1822004-11-08 16:24:57 +000046811 return(test_ret);
46812}
46813
46814
46815static int
46816test_xmlXPathRegisteredNsCleanup(void) {
46817 int test_ret = 0;
46818
46819#ifdef LIBXML_XPATH_ENABLED
46820 int mem_base;
46821 xmlXPathContextPtr ctxt; /* the XPath context */
46822 int n_ctxt;
46823
46824 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46825 mem_base = xmlMemBlocks();
46826 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46827
46828 xmlXPathRegisteredNsCleanup(ctxt);
46829 call_tests++;
46830 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46831 xmlResetLastError();
46832 if (mem_base != xmlMemBlocks()) {
46833 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
46834 xmlMemBlocks() - mem_base);
46835 test_ret++;
46836 printf(" %d", n_ctxt);
46837 printf("\n");
46838 }
46839 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046840 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046841#endif
46842
Daniel Veillarda82b1822004-11-08 16:24:57 +000046843 return(test_ret);
46844}
46845
46846
46847static int
46848test_xmlXPathRegisteredVariablesCleanup(void) {
46849 int test_ret = 0;
46850
46851#ifdef LIBXML_XPATH_ENABLED
46852 int mem_base;
46853 xmlXPathContextPtr ctxt; /* the XPath context */
46854 int n_ctxt;
46855
46856 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46857 mem_base = xmlMemBlocks();
46858 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46859
46860 xmlXPathRegisteredVariablesCleanup(ctxt);
46861 call_tests++;
46862 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46863 xmlResetLastError();
46864 if (mem_base != xmlMemBlocks()) {
46865 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
46866 xmlMemBlocks() - mem_base);
46867 test_ret++;
46868 printf(" %d", n_ctxt);
46869 printf("\n");
46870 }
46871 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046872 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046873#endif
46874
Daniel Veillarda82b1822004-11-08 16:24:57 +000046875 return(test_ret);
46876}
46877
46878
46879static int
46880test_xmlXPathRoot(void) {
46881 int test_ret = 0;
46882
46883#ifdef LIBXML_XPATH_ENABLED
46884 int mem_base;
46885 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46886 int n_ctxt;
46887
46888 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46889 mem_base = xmlMemBlocks();
46890 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46891
46892 xmlXPathRoot(ctxt);
46893 call_tests++;
46894 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46895 xmlResetLastError();
46896 if (mem_base != xmlMemBlocks()) {
46897 printf("Leak of %d blocks found in xmlXPathRoot",
46898 xmlMemBlocks() - mem_base);
46899 test_ret++;
46900 printf(" %d", n_ctxt);
46901 printf("\n");
46902 }
46903 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046904 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046905#endif
46906
Daniel Veillarda82b1822004-11-08 16:24:57 +000046907 return(test_ret);
46908}
46909
46910
46911static int
46912test_xmlXPathRoundFunction(void) {
46913 int test_ret = 0;
46914
46915#ifdef LIBXML_XPATH_ENABLED
46916 int mem_base;
46917 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46918 int n_ctxt;
46919 int nargs; /* the number of arguments */
46920 int n_nargs;
46921
46922 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46923 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46924 mem_base = xmlMemBlocks();
46925 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46926 nargs = gen_int(n_nargs, 1);
46927
46928 xmlXPathRoundFunction(ctxt, nargs);
46929 call_tests++;
46930 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46931 des_int(n_nargs, nargs, 1);
46932 xmlResetLastError();
46933 if (mem_base != xmlMemBlocks()) {
46934 printf("Leak of %d blocks found in xmlXPathRoundFunction",
46935 xmlMemBlocks() - mem_base);
46936 test_ret++;
46937 printf(" %d", n_ctxt);
46938 printf(" %d", n_nargs);
46939 printf("\n");
46940 }
46941 }
46942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046943 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046944#endif
46945
Daniel Veillarda82b1822004-11-08 16:24:57 +000046946 return(test_ret);
46947}
46948
46949
46950static int
46951test_xmlXPathStartsWithFunction(void) {
46952 int test_ret = 0;
46953
46954#ifdef LIBXML_XPATH_ENABLED
46955 int mem_base;
46956 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46957 int n_ctxt;
46958 int nargs; /* the number of arguments */
46959 int n_nargs;
46960
46961 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46962 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46963 mem_base = xmlMemBlocks();
46964 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46965 nargs = gen_int(n_nargs, 1);
46966
46967 xmlXPathStartsWithFunction(ctxt, nargs);
46968 call_tests++;
46969 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46970 des_int(n_nargs, nargs, 1);
46971 xmlResetLastError();
46972 if (mem_base != xmlMemBlocks()) {
46973 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
46974 xmlMemBlocks() - mem_base);
46975 test_ret++;
46976 printf(" %d", n_ctxt);
46977 printf(" %d", n_nargs);
46978 printf("\n");
46979 }
46980 }
46981 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046982 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046983#endif
46984
Daniel Veillarda82b1822004-11-08 16:24:57 +000046985 return(test_ret);
46986}
46987
46988
46989static int
46990test_xmlXPathStringEvalNumber(void) {
46991 int test_ret = 0;
46992
46993#ifdef LIBXML_XPATH_ENABLED
46994 int mem_base;
46995 double ret_val;
46996 xmlChar * str; /* A string to scan */
46997 int n_str;
46998
46999 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47000 mem_base = xmlMemBlocks();
47001 str = gen_const_xmlChar_ptr(n_str, 0);
47002
47003 ret_val = xmlXPathStringEvalNumber(str);
47004 desret_double(ret_val);
47005 call_tests++;
47006 des_const_xmlChar_ptr(n_str, str, 0);
47007 xmlResetLastError();
47008 if (mem_base != xmlMemBlocks()) {
47009 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
47010 xmlMemBlocks() - mem_base);
47011 test_ret++;
47012 printf(" %d", n_str);
47013 printf("\n");
47014 }
47015 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047016 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047017#endif
47018
Daniel Veillarda82b1822004-11-08 16:24:57 +000047019 return(test_ret);
47020}
47021
47022
47023static int
47024test_xmlXPathStringFunction(void) {
47025 int test_ret = 0;
47026
47027#ifdef LIBXML_XPATH_ENABLED
47028 int mem_base;
47029 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47030 int n_ctxt;
47031 int nargs; /* the number of arguments */
47032 int n_nargs;
47033
47034 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47035 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47036 mem_base = xmlMemBlocks();
47037 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47038 nargs = gen_int(n_nargs, 1);
47039
47040 xmlXPathStringFunction(ctxt, nargs);
47041 call_tests++;
47042 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47043 des_int(n_nargs, nargs, 1);
47044 xmlResetLastError();
47045 if (mem_base != xmlMemBlocks()) {
47046 printf("Leak of %d blocks found in xmlXPathStringFunction",
47047 xmlMemBlocks() - mem_base);
47048 test_ret++;
47049 printf(" %d", n_ctxt);
47050 printf(" %d", n_nargs);
47051 printf("\n");
47052 }
47053 }
47054 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047055 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047056#endif
47057
Daniel Veillarda82b1822004-11-08 16:24:57 +000047058 return(test_ret);
47059}
47060
47061
47062static int
47063test_xmlXPathStringLengthFunction(void) {
47064 int test_ret = 0;
47065
47066#ifdef LIBXML_XPATH_ENABLED
47067 int mem_base;
47068 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47069 int n_ctxt;
47070 int nargs; /* the number of arguments */
47071 int n_nargs;
47072
47073 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47074 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47075 mem_base = xmlMemBlocks();
47076 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47077 nargs = gen_int(n_nargs, 1);
47078
47079 xmlXPathStringLengthFunction(ctxt, nargs);
47080 call_tests++;
47081 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47082 des_int(n_nargs, nargs, 1);
47083 xmlResetLastError();
47084 if (mem_base != xmlMemBlocks()) {
47085 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
47086 xmlMemBlocks() - mem_base);
47087 test_ret++;
47088 printf(" %d", n_ctxt);
47089 printf(" %d", n_nargs);
47090 printf("\n");
47091 }
47092 }
47093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047094 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047095#endif
47096
Daniel Veillarda82b1822004-11-08 16:24:57 +000047097 return(test_ret);
47098}
47099
47100
47101static int
47102test_xmlXPathSubValues(void) {
47103 int test_ret = 0;
47104
47105#ifdef LIBXML_XPATH_ENABLED
47106 int mem_base;
47107 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47108 int n_ctxt;
47109
47110 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47111 mem_base = xmlMemBlocks();
47112 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47113
47114 xmlXPathSubValues(ctxt);
47115 call_tests++;
47116 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47117 xmlResetLastError();
47118 if (mem_base != xmlMemBlocks()) {
47119 printf("Leak of %d blocks found in xmlXPathSubValues",
47120 xmlMemBlocks() - mem_base);
47121 test_ret++;
47122 printf(" %d", n_ctxt);
47123 printf("\n");
47124 }
47125 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047126 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047127#endif
47128
Daniel Veillarda82b1822004-11-08 16:24:57 +000047129 return(test_ret);
47130}
47131
47132
47133static int
47134test_xmlXPathSubstringAfterFunction(void) {
47135 int test_ret = 0;
47136
47137#ifdef LIBXML_XPATH_ENABLED
47138 int mem_base;
47139 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47140 int n_ctxt;
47141 int nargs; /* the number of arguments */
47142 int n_nargs;
47143
47144 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47145 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47146 mem_base = xmlMemBlocks();
47147 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47148 nargs = gen_int(n_nargs, 1);
47149
47150 xmlXPathSubstringAfterFunction(ctxt, nargs);
47151 call_tests++;
47152 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47153 des_int(n_nargs, nargs, 1);
47154 xmlResetLastError();
47155 if (mem_base != xmlMemBlocks()) {
47156 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
47157 xmlMemBlocks() - mem_base);
47158 test_ret++;
47159 printf(" %d", n_ctxt);
47160 printf(" %d", n_nargs);
47161 printf("\n");
47162 }
47163 }
47164 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047165 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047166#endif
47167
Daniel Veillarda82b1822004-11-08 16:24:57 +000047168 return(test_ret);
47169}
47170
47171
47172static int
47173test_xmlXPathSubstringBeforeFunction(void) {
47174 int test_ret = 0;
47175
47176#ifdef LIBXML_XPATH_ENABLED
47177 int mem_base;
47178 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47179 int n_ctxt;
47180 int nargs; /* the number of arguments */
47181 int n_nargs;
47182
47183 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47184 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47185 mem_base = xmlMemBlocks();
47186 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47187 nargs = gen_int(n_nargs, 1);
47188
47189 xmlXPathSubstringBeforeFunction(ctxt, nargs);
47190 call_tests++;
47191 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47192 des_int(n_nargs, nargs, 1);
47193 xmlResetLastError();
47194 if (mem_base != xmlMemBlocks()) {
47195 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
47196 xmlMemBlocks() - mem_base);
47197 test_ret++;
47198 printf(" %d", n_ctxt);
47199 printf(" %d", n_nargs);
47200 printf("\n");
47201 }
47202 }
47203 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047204 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047205#endif
47206
Daniel Veillarda82b1822004-11-08 16:24:57 +000047207 return(test_ret);
47208}
47209
47210
47211static int
47212test_xmlXPathSubstringFunction(void) {
47213 int test_ret = 0;
47214
47215#ifdef LIBXML_XPATH_ENABLED
47216 int mem_base;
47217 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47218 int n_ctxt;
47219 int nargs; /* the number of arguments */
47220 int n_nargs;
47221
47222 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47223 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47224 mem_base = xmlMemBlocks();
47225 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47226 nargs = gen_int(n_nargs, 1);
47227
47228 xmlXPathSubstringFunction(ctxt, nargs);
47229 call_tests++;
47230 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47231 des_int(n_nargs, nargs, 1);
47232 xmlResetLastError();
47233 if (mem_base != xmlMemBlocks()) {
47234 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
47235 xmlMemBlocks() - mem_base);
47236 test_ret++;
47237 printf(" %d", n_ctxt);
47238 printf(" %d", n_nargs);
47239 printf("\n");
47240 }
47241 }
47242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047243 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047244#endif
47245
Daniel Veillarda82b1822004-11-08 16:24:57 +000047246 return(test_ret);
47247}
47248
47249
47250static int
47251test_xmlXPathSumFunction(void) {
47252 int test_ret = 0;
47253
47254#ifdef LIBXML_XPATH_ENABLED
47255 int mem_base;
47256 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47257 int n_ctxt;
47258 int nargs; /* the number of arguments */
47259 int n_nargs;
47260
47261 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47262 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47263 mem_base = xmlMemBlocks();
47264 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47265 nargs = gen_int(n_nargs, 1);
47266
47267 xmlXPathSumFunction(ctxt, nargs);
47268 call_tests++;
47269 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47270 des_int(n_nargs, nargs, 1);
47271 xmlResetLastError();
47272 if (mem_base != xmlMemBlocks()) {
47273 printf("Leak of %d blocks found in xmlXPathSumFunction",
47274 xmlMemBlocks() - mem_base);
47275 test_ret++;
47276 printf(" %d", n_ctxt);
47277 printf(" %d", n_nargs);
47278 printf("\n");
47279 }
47280 }
47281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047282 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047283#endif
47284
Daniel Veillarda82b1822004-11-08 16:24:57 +000047285 return(test_ret);
47286}
47287
47288
47289static int
47290test_xmlXPathTrailing(void) {
47291 int test_ret = 0;
47292
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047293#ifdef LIBXML_XPATH_ENABLED
47294 int mem_base;
47295 xmlNodeSetPtr ret_val;
47296 xmlNodeSetPtr nodes1; /* a node-set */
47297 int n_nodes1;
47298 xmlNodeSetPtr nodes2; /* a node-set */
47299 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047300
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047301 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47302 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47303 mem_base = xmlMemBlocks();
47304 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47305 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47306
47307 ret_val = xmlXPathTrailing(nodes1, nodes2);
47308 desret_xmlNodeSetPtr(ret_val);
47309 call_tests++;
47310 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47311 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47312 xmlResetLastError();
47313 if (mem_base != xmlMemBlocks()) {
47314 printf("Leak of %d blocks found in xmlXPathTrailing",
47315 xmlMemBlocks() - mem_base);
47316 test_ret++;
47317 printf(" %d", n_nodes1);
47318 printf(" %d", n_nodes2);
47319 printf("\n");
47320 }
47321 }
47322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047323 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047324#endif
47325
Daniel Veillarda82b1822004-11-08 16:24:57 +000047326 return(test_ret);
47327}
47328
47329
47330static int
47331test_xmlXPathTrailingSorted(void) {
47332 int test_ret = 0;
47333
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047334#ifdef LIBXML_XPATH_ENABLED
47335 int mem_base;
47336 xmlNodeSetPtr ret_val;
47337 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
47338 int n_nodes1;
47339 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
47340 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047341
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047342 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47343 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47344 mem_base = xmlMemBlocks();
47345 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47346 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47347
47348 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
47349 desret_xmlNodeSetPtr(ret_val);
47350 call_tests++;
47351 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47352 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47353 xmlResetLastError();
47354 if (mem_base != xmlMemBlocks()) {
47355 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
47356 xmlMemBlocks() - mem_base);
47357 test_ret++;
47358 printf(" %d", n_nodes1);
47359 printf(" %d", n_nodes2);
47360 printf("\n");
47361 }
47362 }
47363 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047364 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047365#endif
47366
Daniel Veillarda82b1822004-11-08 16:24:57 +000047367 return(test_ret);
47368}
47369
47370
47371static int
47372test_xmlXPathTranslateFunction(void) {
47373 int test_ret = 0;
47374
47375#ifdef LIBXML_XPATH_ENABLED
47376 int mem_base;
47377 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47378 int n_ctxt;
47379 int nargs; /* the number of arguments */
47380 int n_nargs;
47381
47382 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47383 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47384 mem_base = xmlMemBlocks();
47385 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47386 nargs = gen_int(n_nargs, 1);
47387
47388 xmlXPathTranslateFunction(ctxt, nargs);
47389 call_tests++;
47390 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47391 des_int(n_nargs, nargs, 1);
47392 xmlResetLastError();
47393 if (mem_base != xmlMemBlocks()) {
47394 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
47395 xmlMemBlocks() - mem_base);
47396 test_ret++;
47397 printf(" %d", n_ctxt);
47398 printf(" %d", n_nargs);
47399 printf("\n");
47400 }
47401 }
47402 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047403 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047404#endif
47405
Daniel Veillarda82b1822004-11-08 16:24:57 +000047406 return(test_ret);
47407}
47408
47409
47410static int
47411test_xmlXPathTrueFunction(void) {
47412 int test_ret = 0;
47413
47414#ifdef LIBXML_XPATH_ENABLED
47415 int mem_base;
47416 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47417 int n_ctxt;
47418 int nargs; /* the number of arguments */
47419 int n_nargs;
47420
47421 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47422 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47423 mem_base = xmlMemBlocks();
47424 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47425 nargs = gen_int(n_nargs, 1);
47426
47427 xmlXPathTrueFunction(ctxt, nargs);
47428 call_tests++;
47429 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47430 des_int(n_nargs, nargs, 1);
47431 xmlResetLastError();
47432 if (mem_base != xmlMemBlocks()) {
47433 printf("Leak of %d blocks found in xmlXPathTrueFunction",
47434 xmlMemBlocks() - mem_base);
47435 test_ret++;
47436 printf(" %d", n_ctxt);
47437 printf(" %d", n_nargs);
47438 printf("\n");
47439 }
47440 }
47441 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047442 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047443#endif
47444
Daniel Veillarda82b1822004-11-08 16:24:57 +000047445 return(test_ret);
47446}
47447
47448
47449static int
47450test_xmlXPathValueFlipSign(void) {
47451 int test_ret = 0;
47452
47453#ifdef LIBXML_XPATH_ENABLED
47454 int mem_base;
47455 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47456 int n_ctxt;
47457
47458 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47459 mem_base = xmlMemBlocks();
47460 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47461
47462 xmlXPathValueFlipSign(ctxt);
47463 call_tests++;
47464 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47465 xmlResetLastError();
47466 if (mem_base != xmlMemBlocks()) {
47467 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
47468 xmlMemBlocks() - mem_base);
47469 test_ret++;
47470 printf(" %d", n_ctxt);
47471 printf("\n");
47472 }
47473 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047474 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047475#endif
47476
Daniel Veillarda82b1822004-11-08 16:24:57 +000047477 return(test_ret);
47478}
47479
47480
47481static int
47482test_xmlXPathVariableLookup(void) {
47483 int test_ret = 0;
47484
47485#ifdef LIBXML_XPATH_ENABLED
47486 int mem_base;
47487 xmlXPathObjectPtr ret_val;
47488 xmlXPathContextPtr ctxt; /* the XPath context */
47489 int n_ctxt;
47490 xmlChar * name; /* the variable name */
47491 int n_name;
47492
47493 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47494 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47495 mem_base = xmlMemBlocks();
47496 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47497 name = gen_const_xmlChar_ptr(n_name, 1);
47498
47499 ret_val = xmlXPathVariableLookup(ctxt, name);
47500 desret_xmlXPathObjectPtr(ret_val);
47501 call_tests++;
47502 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47503 des_const_xmlChar_ptr(n_name, name, 1);
47504 xmlResetLastError();
47505 if (mem_base != xmlMemBlocks()) {
47506 printf("Leak of %d blocks found in xmlXPathVariableLookup",
47507 xmlMemBlocks() - mem_base);
47508 test_ret++;
47509 printf(" %d", n_ctxt);
47510 printf(" %d", n_name);
47511 printf("\n");
47512 }
47513 }
47514 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047515 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047516#endif
47517
Daniel Veillarda82b1822004-11-08 16:24:57 +000047518 return(test_ret);
47519}
47520
47521
47522static int
47523test_xmlXPathVariableLookupNS(void) {
47524 int test_ret = 0;
47525
47526#ifdef LIBXML_XPATH_ENABLED
47527 int mem_base;
47528 xmlXPathObjectPtr ret_val;
47529 xmlXPathContextPtr ctxt; /* the XPath context */
47530 int n_ctxt;
47531 xmlChar * name; /* the variable name */
47532 int n_name;
47533 xmlChar * ns_uri; /* the variable namespace URI */
47534 int n_ns_uri;
47535
47536 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47537 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47538 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47539 mem_base = xmlMemBlocks();
47540 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47541 name = gen_const_xmlChar_ptr(n_name, 1);
47542 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47543
47544 ret_val = xmlXPathVariableLookupNS(ctxt, name, ns_uri);
47545 desret_xmlXPathObjectPtr(ret_val);
47546 call_tests++;
47547 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47548 des_const_xmlChar_ptr(n_name, name, 1);
47549 des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2);
47550 xmlResetLastError();
47551 if (mem_base != xmlMemBlocks()) {
47552 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
47553 xmlMemBlocks() - mem_base);
47554 test_ret++;
47555 printf(" %d", n_ctxt);
47556 printf(" %d", n_name);
47557 printf(" %d", n_ns_uri);
47558 printf("\n");
47559 }
47560 }
47561 }
47562 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047563 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047564#endif
47565
Daniel Veillarda82b1822004-11-08 16:24:57 +000047566 return(test_ret);
47567}
47568
47569
47570static int
47571test_xmlXPathWrapCString(void) {
47572 int test_ret = 0;
47573
47574#ifdef LIBXML_XPATH_ENABLED
47575 int mem_base;
47576 xmlXPathObjectPtr ret_val;
47577 char * val; /* the char * value */
47578 int n_val;
47579
47580 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
47581 mem_base = xmlMemBlocks();
47582 val = gen_char_ptr(n_val, 0);
47583
47584 ret_val = xmlXPathWrapCString(val);
47585 desret_xmlXPathObjectPtr(ret_val);
47586 call_tests++;
47587 des_char_ptr(n_val, val, 0);
47588 xmlResetLastError();
47589 if (mem_base != xmlMemBlocks()) {
47590 printf("Leak of %d blocks found in xmlXPathWrapCString",
47591 xmlMemBlocks() - mem_base);
47592 test_ret++;
47593 printf(" %d", n_val);
47594 printf("\n");
47595 }
47596 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047597 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047598#endif
47599
Daniel Veillarda82b1822004-11-08 16:24:57 +000047600 return(test_ret);
47601}
47602
47603
47604static int
47605test_xmlXPathWrapExternal(void) {
47606 int test_ret = 0;
47607
47608#ifdef LIBXML_XPATH_ENABLED
47609 int mem_base;
47610 xmlXPathObjectPtr ret_val;
47611 void * val; /* the user data */
47612 int n_val;
47613
47614 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
47615 mem_base = xmlMemBlocks();
47616 val = gen_void_ptr(n_val, 0);
47617
47618 ret_val = xmlXPathWrapExternal(val);
47619 desret_xmlXPathObjectPtr(ret_val);
47620 call_tests++;
47621 des_void_ptr(n_val, val, 0);
47622 xmlResetLastError();
47623 if (mem_base != xmlMemBlocks()) {
47624 printf("Leak of %d blocks found in xmlXPathWrapExternal",
47625 xmlMemBlocks() - mem_base);
47626 test_ret++;
47627 printf(" %d", n_val);
47628 printf("\n");
47629 }
47630 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047631 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047632#endif
47633
Daniel Veillarda82b1822004-11-08 16:24:57 +000047634 return(test_ret);
47635}
47636
47637
47638static int
47639test_xmlXPathWrapNodeSet(void) {
47640 int test_ret = 0;
47641
47642#ifdef LIBXML_XPATH_ENABLED
47643 int mem_base;
47644 xmlXPathObjectPtr ret_val;
47645 xmlNodeSetPtr val; /* the NodePtr value */
47646 int n_val;
47647
47648 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
47649 mem_base = xmlMemBlocks();
47650 val = gen_xmlNodeSetPtr(n_val, 0);
47651
47652 ret_val = xmlXPathWrapNodeSet(val);
47653 desret_xmlXPathObjectPtr(ret_val);
47654 call_tests++;
47655 des_xmlNodeSetPtr(n_val, val, 0);
47656 xmlResetLastError();
47657 if (mem_base != xmlMemBlocks()) {
47658 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
47659 xmlMemBlocks() - mem_base);
47660 test_ret++;
47661 printf(" %d", n_val);
47662 printf("\n");
47663 }
47664 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047665 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047666#endif
47667
Daniel Veillarda82b1822004-11-08 16:24:57 +000047668 return(test_ret);
47669}
47670
47671
47672static int
47673test_xmlXPatherror(void) {
47674 int test_ret = 0;
47675
47676#ifdef LIBXML_XPATH_ENABLED
47677 int mem_base;
47678 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47679 int n_ctxt;
47680 const char * file; /* the file name */
47681 int n_file;
47682 int line; /* the line number */
47683 int n_line;
47684 int no; /* the error number */
47685 int n_no;
47686
47687 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47688 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
47689 for (n_line = 0;n_line < gen_nb_int;n_line++) {
47690 for (n_no = 0;n_no < gen_nb_int;n_no++) {
47691 mem_base = xmlMemBlocks();
47692 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47693 file = gen_filepath(n_file, 1);
47694 line = gen_int(n_line, 2);
47695 no = gen_int(n_no, 3);
47696
47697 xmlXPatherror(ctxt, file, line, no);
47698 call_tests++;
47699 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47700 des_filepath(n_file, file, 1);
47701 des_int(n_line, line, 2);
47702 des_int(n_no, no, 3);
47703 xmlResetLastError();
47704 if (mem_base != xmlMemBlocks()) {
47705 printf("Leak of %d blocks found in xmlXPatherror",
47706 xmlMemBlocks() - mem_base);
47707 test_ret++;
47708 printf(" %d", n_ctxt);
47709 printf(" %d", n_file);
47710 printf(" %d", n_line);
47711 printf(" %d", n_no);
47712 printf("\n");
47713 }
47714 }
47715 }
47716 }
47717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047718 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047719#endif
47720
Daniel Veillarda82b1822004-11-08 16:24:57 +000047721 return(test_ret);
47722}
47723
47724static int
47725test_xpathInternals(void) {
47726 int test_ret = 0;
47727
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047728 if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000047729 test_ret += test_valuePop();
47730 test_ret += test_valuePush();
47731 test_ret += test_xmlXPathAddValues();
47732 test_ret += test_xmlXPathBooleanFunction();
47733 test_ret += test_xmlXPathCeilingFunction();
47734 test_ret += test_xmlXPathCompareValues();
47735 test_ret += test_xmlXPathConcatFunction();
47736 test_ret += test_xmlXPathContainsFunction();
47737 test_ret += test_xmlXPathCountFunction();
47738 test_ret += test_xmlXPathDebugDumpCompExpr();
47739 test_ret += test_xmlXPathDebugDumpObject();
47740 test_ret += test_xmlXPathDifference();
47741 test_ret += test_xmlXPathDistinct();
47742 test_ret += test_xmlXPathDistinctSorted();
47743 test_ret += test_xmlXPathDivValues();
47744 test_ret += test_xmlXPathEqualValues();
47745 test_ret += test_xmlXPathErr();
47746 test_ret += test_xmlXPathEvalExpr();
47747 test_ret += test_xmlXPathEvaluatePredicateResult();
47748 test_ret += test_xmlXPathFalseFunction();
47749 test_ret += test_xmlXPathFloorFunction();
47750 test_ret += test_xmlXPathFunctionLookup();
47751 test_ret += test_xmlXPathFunctionLookupNS();
47752 test_ret += test_xmlXPathHasSameNodes();
47753 test_ret += test_xmlXPathIdFunction();
47754 test_ret += test_xmlXPathIntersection();
47755 test_ret += test_xmlXPathIsNodeType();
47756 test_ret += test_xmlXPathLangFunction();
47757 test_ret += test_xmlXPathLastFunction();
47758 test_ret += test_xmlXPathLeading();
47759 test_ret += test_xmlXPathLeadingSorted();
47760 test_ret += test_xmlXPathLocalNameFunction();
47761 test_ret += test_xmlXPathModValues();
47762 test_ret += test_xmlXPathMultValues();
47763 test_ret += test_xmlXPathNamespaceURIFunction();
47764 test_ret += test_xmlXPathNewBoolean();
47765 test_ret += test_xmlXPathNewCString();
47766 test_ret += test_xmlXPathNewFloat();
47767 test_ret += test_xmlXPathNewNodeSet();
47768 test_ret += test_xmlXPathNewNodeSetList();
47769 test_ret += test_xmlXPathNewParserContext();
47770 test_ret += test_xmlXPathNewString();
47771 test_ret += test_xmlXPathNextAncestor();
47772 test_ret += test_xmlXPathNextAncestorOrSelf();
47773 test_ret += test_xmlXPathNextAttribute();
47774 test_ret += test_xmlXPathNextChild();
47775 test_ret += test_xmlXPathNextDescendant();
47776 test_ret += test_xmlXPathNextDescendantOrSelf();
47777 test_ret += test_xmlXPathNextFollowing();
47778 test_ret += test_xmlXPathNextFollowingSibling();
47779 test_ret += test_xmlXPathNextNamespace();
47780 test_ret += test_xmlXPathNextParent();
47781 test_ret += test_xmlXPathNextPreceding();
47782 test_ret += test_xmlXPathNextPrecedingSibling();
47783 test_ret += test_xmlXPathNextSelf();
47784 test_ret += test_xmlXPathNodeLeading();
47785 test_ret += test_xmlXPathNodeLeadingSorted();
47786 test_ret += test_xmlXPathNodeSetAdd();
47787 test_ret += test_xmlXPathNodeSetAddNs();
47788 test_ret += test_xmlXPathNodeSetAddUnique();
47789 test_ret += test_xmlXPathNodeSetContains();
47790 test_ret += test_xmlXPathNodeSetDel();
47791 test_ret += test_xmlXPathNodeSetMerge();
47792 test_ret += test_xmlXPathNodeSetRemove();
47793 test_ret += test_xmlXPathNodeSetSort();
47794 test_ret += test_xmlXPathNodeTrailing();
47795 test_ret += test_xmlXPathNodeTrailingSorted();
47796 test_ret += test_xmlXPathNormalizeFunction();
47797 test_ret += test_xmlXPathNotEqualValues();
47798 test_ret += test_xmlXPathNotFunction();
47799 test_ret += test_xmlXPathNsLookup();
47800 test_ret += test_xmlXPathNumberFunction();
47801 test_ret += test_xmlXPathParseNCName();
47802 test_ret += test_xmlXPathParseName();
47803 test_ret += test_xmlXPathPopBoolean();
47804 test_ret += test_xmlXPathPopExternal();
47805 test_ret += test_xmlXPathPopNodeSet();
47806 test_ret += test_xmlXPathPopNumber();
47807 test_ret += test_xmlXPathPopString();
47808 test_ret += test_xmlXPathPositionFunction();
47809 test_ret += test_xmlXPathRegisterAllFunctions();
47810 test_ret += test_xmlXPathRegisterFunc();
47811 test_ret += test_xmlXPathRegisterFuncLookup();
47812 test_ret += test_xmlXPathRegisterFuncNS();
47813 test_ret += test_xmlXPathRegisterNs();
47814 test_ret += test_xmlXPathRegisterVariable();
47815 test_ret += test_xmlXPathRegisterVariableLookup();
47816 test_ret += test_xmlXPathRegisterVariableNS();
47817 test_ret += test_xmlXPathRegisteredFuncsCleanup();
47818 test_ret += test_xmlXPathRegisteredNsCleanup();
47819 test_ret += test_xmlXPathRegisteredVariablesCleanup();
47820 test_ret += test_xmlXPathRoot();
47821 test_ret += test_xmlXPathRoundFunction();
47822 test_ret += test_xmlXPathStartsWithFunction();
47823 test_ret += test_xmlXPathStringEvalNumber();
47824 test_ret += test_xmlXPathStringFunction();
47825 test_ret += test_xmlXPathStringLengthFunction();
47826 test_ret += test_xmlXPathSubValues();
47827 test_ret += test_xmlXPathSubstringAfterFunction();
47828 test_ret += test_xmlXPathSubstringBeforeFunction();
47829 test_ret += test_xmlXPathSubstringFunction();
47830 test_ret += test_xmlXPathSumFunction();
47831 test_ret += test_xmlXPathTrailing();
47832 test_ret += test_xmlXPathTrailingSorted();
47833 test_ret += test_xmlXPathTranslateFunction();
47834 test_ret += test_xmlXPathTrueFunction();
47835 test_ret += test_xmlXPathValueFlipSign();
47836 test_ret += test_xmlXPathVariableLookup();
47837 test_ret += test_xmlXPathVariableLookupNS();
47838 test_ret += test_xmlXPathWrapCString();
47839 test_ret += test_xmlXPathWrapExternal();
47840 test_ret += test_xmlXPathWrapNodeSet();
47841 test_ret += test_xmlXPatherror();
47842
47843 if (test_ret != 0)
47844 printf("Module xpathInternals: %d errors\n", test_ret);
47845 return(test_ret);
47846}
47847
Daniel Veillardd93f6252004-11-02 15:53:51 +000047848static int
47849test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047851
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047852#ifdef LIBXML_XPTR_ENABLED
47853 int mem_base;
47854 xmlNodePtr ret_val;
47855 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
47856 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047857
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047858 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
47859 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000047860 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047861
47862 ret_val = xmlXPtrBuildNodeList(obj);
47863 desret_xmlNodePtr(ret_val);
47864 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047865 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047866 xmlResetLastError();
47867 if (mem_base != xmlMemBlocks()) {
47868 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
47869 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047870 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047871 printf(" %d", n_obj);
47872 printf("\n");
47873 }
47874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047875 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047876#endif
47877
Daniel Veillard42595322004-11-08 10:52:06 +000047878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047879}
47880
47881
47882static int
47883test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047885
Daniel Veillardce682bc2004-11-05 17:22:25 +000047886#ifdef LIBXML_XPTR_ENABLED
47887 int mem_base;
47888 xmlXPathObjectPtr ret_val;
47889 xmlChar * str; /* the XPointer expression */
47890 int n_str;
47891 xmlXPathContextPtr ctx; /* the XPointer context */
47892 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047893
Daniel Veillardce682bc2004-11-05 17:22:25 +000047894 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47895 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
47896 mem_base = xmlMemBlocks();
47897 str = gen_const_xmlChar_ptr(n_str, 0);
47898 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
47899
47900 ret_val = xmlXPtrEval(str, ctx);
47901 desret_xmlXPathObjectPtr(ret_val);
47902 call_tests++;
47903 des_const_xmlChar_ptr(n_str, str, 0);
47904 des_xmlXPathContextPtr(n_ctx, ctx, 1);
47905 xmlResetLastError();
47906 if (mem_base != xmlMemBlocks()) {
47907 printf("Leak of %d blocks found in xmlXPtrEval",
47908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047909 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047910 printf(" %d", n_str);
47911 printf(" %d", n_ctx);
47912 printf("\n");
47913 }
47914 }
47915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047916 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047917#endif
47918
Daniel Veillard42595322004-11-08 10:52:06 +000047919 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047920}
47921
47922
47923static int
47924test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047925 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047926
Daniel Veillardce682bc2004-11-05 17:22:25 +000047927#ifdef LIBXML_XPTR_ENABLED
47928 int mem_base;
47929 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
47930 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047931
Daniel Veillardce682bc2004-11-05 17:22:25 +000047932 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47933 mem_base = xmlMemBlocks();
47934 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47935
47936 xmlXPtrEvalRangePredicate(ctxt);
47937 call_tests++;
47938 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47939 xmlResetLastError();
47940 if (mem_base != xmlMemBlocks()) {
47941 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
47942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047943 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047944 printf(" %d", n_ctxt);
47945 printf("\n");
47946 }
47947 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047948 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047949#endif
47950
Daniel Veillard42595322004-11-08 10:52:06 +000047951 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047952}
47953
Daniel Veillarda521d282004-11-09 14:59:59 +000047954#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000047955
Daniel Veillardce682bc2004-11-05 17:22:25 +000047956#define gen_nb_xmlLocationSetPtr 1
47957static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
47958 return(NULL);
47959}
47960static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
47961}
Daniel Veillarda521d282004-11-09 14:59:59 +000047962#endif
47963
Daniel Veillardce682bc2004-11-05 17:22:25 +000047964
Daniel Veillardd93f6252004-11-02 15:53:51 +000047965static int
47966test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047967 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047968
Daniel Veillardce682bc2004-11-05 17:22:25 +000047969#ifdef LIBXML_XPTR_ENABLED
47970 int mem_base;
47971 xmlLocationSetPtr cur; /* the initial range set */
47972 int n_cur;
47973 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
47974 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047975
Daniel Veillardce682bc2004-11-05 17:22:25 +000047976 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47977 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
47978 mem_base = xmlMemBlocks();
47979 cur = gen_xmlLocationSetPtr(n_cur, 0);
47980 val = gen_xmlXPathObjectPtr(n_val, 1);
47981
47982 xmlXPtrLocationSetAdd(cur, val);
47983 call_tests++;
47984 des_xmlLocationSetPtr(n_cur, cur, 0);
47985 des_xmlXPathObjectPtr(n_val, val, 1);
47986 xmlResetLastError();
47987 if (mem_base != xmlMemBlocks()) {
47988 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
47989 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047990 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047991 printf(" %d", n_cur);
47992 printf(" %d", n_val);
47993 printf("\n");
47994 }
47995 }
47996 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047997 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047998#endif
47999
Daniel Veillard42595322004-11-08 10:52:06 +000048000 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048001}
48002
48003
48004static int
48005test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048006 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048007
48008
48009 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048011}
48012
48013
48014static int
48015test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048016 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048017
Daniel Veillardce682bc2004-11-05 17:22:25 +000048018#ifdef LIBXML_XPTR_ENABLED
48019 int mem_base;
48020 xmlLocationSetPtr cur; /* the initial range set */
48021 int n_cur;
48022 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
48023 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048024
Daniel Veillardce682bc2004-11-05 17:22:25 +000048025 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48026 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48027 mem_base = xmlMemBlocks();
48028 cur = gen_xmlLocationSetPtr(n_cur, 0);
48029 val = gen_xmlXPathObjectPtr(n_val, 1);
48030
48031 xmlXPtrLocationSetDel(cur, val);
48032 call_tests++;
48033 des_xmlLocationSetPtr(n_cur, cur, 0);
48034 des_xmlXPathObjectPtr(n_val, val, 1);
48035 xmlResetLastError();
48036 if (mem_base != xmlMemBlocks()) {
48037 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
48038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048039 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048040 printf(" %d", n_cur);
48041 printf(" %d", n_val);
48042 printf("\n");
48043 }
48044 }
48045 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048046 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048047#endif
48048
Daniel Veillard42595322004-11-08 10:52:06 +000048049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048050}
48051
48052
48053static int
48054test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048056
48057
48058 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048059 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048060}
48061
48062
48063static int
48064test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048065 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048066
Daniel Veillardce682bc2004-11-05 17:22:25 +000048067#ifdef LIBXML_XPTR_ENABLED
48068 int mem_base;
48069 xmlLocationSetPtr cur; /* the initial range set */
48070 int n_cur;
48071 int val; /* the index to remove */
48072 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048073
Daniel Veillardce682bc2004-11-05 17:22:25 +000048074 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48075 for (n_val = 0;n_val < gen_nb_int;n_val++) {
48076 mem_base = xmlMemBlocks();
48077 cur = gen_xmlLocationSetPtr(n_cur, 0);
48078 val = gen_int(n_val, 1);
48079
48080 xmlXPtrLocationSetRemove(cur, val);
48081 call_tests++;
48082 des_xmlLocationSetPtr(n_cur, cur, 0);
48083 des_int(n_val, val, 1);
48084 xmlResetLastError();
48085 if (mem_base != xmlMemBlocks()) {
48086 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
48087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048088 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048089 printf(" %d", n_cur);
48090 printf(" %d", n_val);
48091 printf("\n");
48092 }
48093 }
48094 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048095 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048096#endif
48097
Daniel Veillard42595322004-11-08 10:52:06 +000048098 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048099}
48100
48101
48102static int
48103test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048105
Daniel Veillard3d97e662004-11-04 10:49:00 +000048106#ifdef LIBXML_XPTR_ENABLED
48107 int mem_base;
48108 xmlXPathObjectPtr ret_val;
48109 xmlNodePtr start; /* the starting and ending node */
48110 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048111
Daniel Veillard3d97e662004-11-04 10:49:00 +000048112 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48113 mem_base = xmlMemBlocks();
48114 start = gen_xmlNodePtr(n_start, 0);
48115
48116 ret_val = xmlXPtrNewCollapsedRange(start);
48117 desret_xmlXPathObjectPtr(ret_val);
48118 call_tests++;
48119 des_xmlNodePtr(n_start, start, 0);
48120 xmlResetLastError();
48121 if (mem_base != xmlMemBlocks()) {
48122 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
48123 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048124 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048125 printf(" %d", n_start);
48126 printf("\n");
48127 }
48128 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048129 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048130#endif
48131
Daniel Veillard42595322004-11-08 10:52:06 +000048132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048133}
48134
48135
48136static int
48137test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048139
48140
48141 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048143}
48144
48145
48146static int
48147test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048149
Daniel Veillardce682bc2004-11-05 17:22:25 +000048150#ifdef LIBXML_XPTR_ENABLED
48151 int mem_base;
48152 xmlXPathObjectPtr ret_val;
48153 xmlNodeSetPtr set; /* a node set */
48154 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048155
Daniel Veillardce682bc2004-11-05 17:22:25 +000048156 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
48157 mem_base = xmlMemBlocks();
48158 set = gen_xmlNodeSetPtr(n_set, 0);
48159
48160 ret_val = xmlXPtrNewLocationSetNodeSet(set);
48161 desret_xmlXPathObjectPtr(ret_val);
48162 call_tests++;
48163 des_xmlNodeSetPtr(n_set, set, 0);
48164 xmlResetLastError();
48165 if (mem_base != xmlMemBlocks()) {
48166 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
48167 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048168 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048169 printf(" %d", n_set);
48170 printf("\n");
48171 }
48172 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048173 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048174#endif
48175
Daniel Veillard42595322004-11-08 10:52:06 +000048176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048177}
48178
48179
48180static int
48181test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048182 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048183
Daniel Veillard3d97e662004-11-04 10:49:00 +000048184#ifdef LIBXML_XPTR_ENABLED
48185 int mem_base;
48186 xmlXPathObjectPtr ret_val;
48187 xmlNodePtr start; /* the start NodePtr value */
48188 int n_start;
48189 xmlNodePtr end; /* the end NodePtr value or NULL */
48190 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048191
Daniel Veillard3d97e662004-11-04 10:49:00 +000048192 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48193 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48194 mem_base = xmlMemBlocks();
48195 start = gen_xmlNodePtr(n_start, 0);
48196 end = gen_xmlNodePtr(n_end, 1);
48197
48198 ret_val = xmlXPtrNewLocationSetNodes(start, end);
48199 desret_xmlXPathObjectPtr(ret_val);
48200 call_tests++;
48201 des_xmlNodePtr(n_start, start, 0);
48202 des_xmlNodePtr(n_end, end, 1);
48203 xmlResetLastError();
48204 if (mem_base != xmlMemBlocks()) {
48205 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
48206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048207 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048208 printf(" %d", n_start);
48209 printf(" %d", n_end);
48210 printf("\n");
48211 }
48212 }
48213 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048214 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048215#endif
48216
Daniel Veillard42595322004-11-08 10:52:06 +000048217 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048218}
48219
48220
48221static int
48222test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048223 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048224
Daniel Veillard3d97e662004-11-04 10:49:00 +000048225#ifdef LIBXML_XPTR_ENABLED
48226 int mem_base;
48227 xmlXPathObjectPtr ret_val;
48228 xmlNodePtr start; /* the starting node */
48229 int n_start;
48230 int startindex; /* the start index */
48231 int n_startindex;
48232 xmlNodePtr end; /* the ending point */
48233 int n_end;
48234 int endindex; /* the ending index */
48235 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048236
Daniel Veillard3d97e662004-11-04 10:49:00 +000048237 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48238 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
48239 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48240 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
48241 mem_base = xmlMemBlocks();
48242 start = gen_xmlNodePtr(n_start, 0);
48243 startindex = gen_int(n_startindex, 1);
48244 end = gen_xmlNodePtr(n_end, 2);
48245 endindex = gen_int(n_endindex, 3);
48246
48247 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
48248 desret_xmlXPathObjectPtr(ret_val);
48249 call_tests++;
48250 des_xmlNodePtr(n_start, start, 0);
48251 des_int(n_startindex, startindex, 1);
48252 des_xmlNodePtr(n_end, end, 2);
48253 des_int(n_endindex, endindex, 3);
48254 xmlResetLastError();
48255 if (mem_base != xmlMemBlocks()) {
48256 printf("Leak of %d blocks found in xmlXPtrNewRange",
48257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048258 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048259 printf(" %d", n_start);
48260 printf(" %d", n_startindex);
48261 printf(" %d", n_end);
48262 printf(" %d", n_endindex);
48263 printf("\n");
48264 }
48265 }
48266 }
48267 }
48268 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048269 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048270#endif
48271
Daniel Veillard42595322004-11-08 10:52:06 +000048272 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048273}
48274
48275
48276static int
48277test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048278 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048279
Daniel Veillard3d97e662004-11-04 10:49:00 +000048280#ifdef LIBXML_XPTR_ENABLED
48281 int mem_base;
48282 xmlXPathObjectPtr ret_val;
48283 xmlNodePtr start; /* the starting node */
48284 int n_start;
48285 xmlXPathObjectPtr end; /* the ending object */
48286 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048287
Daniel Veillard3d97e662004-11-04 10:49:00 +000048288 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48289 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48290 mem_base = xmlMemBlocks();
48291 start = gen_xmlNodePtr(n_start, 0);
48292 end = gen_xmlXPathObjectPtr(n_end, 1);
48293
48294 ret_val = xmlXPtrNewRangeNodeObject(start, end);
48295 desret_xmlXPathObjectPtr(ret_val);
48296 call_tests++;
48297 des_xmlNodePtr(n_start, start, 0);
48298 des_xmlXPathObjectPtr(n_end, end, 1);
48299 xmlResetLastError();
48300 if (mem_base != xmlMemBlocks()) {
48301 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
48302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048303 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048304 printf(" %d", n_start);
48305 printf(" %d", n_end);
48306 printf("\n");
48307 }
48308 }
48309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048310 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048311#endif
48312
Daniel Veillard42595322004-11-08 10:52:06 +000048313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048314}
48315
48316
48317static int
48318test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048320
Daniel Veillard3d97e662004-11-04 10:49:00 +000048321#ifdef LIBXML_XPTR_ENABLED
48322 int mem_base;
48323 xmlXPathObjectPtr ret_val;
48324 xmlNodePtr start; /* the starting node */
48325 int n_start;
48326 xmlXPathObjectPtr end; /* the ending point */
48327 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048328
Daniel Veillard3d97e662004-11-04 10:49:00 +000048329 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48330 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48331 mem_base = xmlMemBlocks();
48332 start = gen_xmlNodePtr(n_start, 0);
48333 end = gen_xmlXPathObjectPtr(n_end, 1);
48334
48335 ret_val = xmlXPtrNewRangeNodePoint(start, end);
48336 desret_xmlXPathObjectPtr(ret_val);
48337 call_tests++;
48338 des_xmlNodePtr(n_start, start, 0);
48339 des_xmlXPathObjectPtr(n_end, end, 1);
48340 xmlResetLastError();
48341 if (mem_base != xmlMemBlocks()) {
48342 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
48343 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048344 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048345 printf(" %d", n_start);
48346 printf(" %d", n_end);
48347 printf("\n");
48348 }
48349 }
48350 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048351 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048352#endif
48353
Daniel Veillard42595322004-11-08 10:52:06 +000048354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048355}
48356
48357
48358static int
48359test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048361
Daniel Veillard3d97e662004-11-04 10:49:00 +000048362#ifdef LIBXML_XPTR_ENABLED
48363 int mem_base;
48364 xmlXPathObjectPtr ret_val;
48365 xmlNodePtr start; /* the starting node */
48366 int n_start;
48367 xmlNodePtr end; /* the ending node */
48368 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048369
Daniel Veillard3d97e662004-11-04 10:49:00 +000048370 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48371 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48372 mem_base = xmlMemBlocks();
48373 start = gen_xmlNodePtr(n_start, 0);
48374 end = gen_xmlNodePtr(n_end, 1);
48375
48376 ret_val = xmlXPtrNewRangeNodes(start, end);
48377 desret_xmlXPathObjectPtr(ret_val);
48378 call_tests++;
48379 des_xmlNodePtr(n_start, start, 0);
48380 des_xmlNodePtr(n_end, end, 1);
48381 xmlResetLastError();
48382 if (mem_base != xmlMemBlocks()) {
48383 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
48384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048385 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048386 printf(" %d", n_start);
48387 printf(" %d", n_end);
48388 printf("\n");
48389 }
48390 }
48391 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048392 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048393#endif
48394
Daniel Veillard42595322004-11-08 10:52:06 +000048395 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048396}
48397
48398
48399static int
48400test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048401 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048402
Daniel Veillard3d97e662004-11-04 10:49:00 +000048403#ifdef LIBXML_XPTR_ENABLED
48404 int mem_base;
48405 xmlXPathObjectPtr ret_val;
48406 xmlXPathObjectPtr start; /* the starting point */
48407 int n_start;
48408 xmlNodePtr end; /* the ending node */
48409 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048410
Daniel Veillard3d97e662004-11-04 10:49:00 +000048411 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48412 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48413 mem_base = xmlMemBlocks();
48414 start = gen_xmlXPathObjectPtr(n_start, 0);
48415 end = gen_xmlNodePtr(n_end, 1);
48416
48417 ret_val = xmlXPtrNewRangePointNode(start, end);
48418 desret_xmlXPathObjectPtr(ret_val);
48419 call_tests++;
48420 des_xmlXPathObjectPtr(n_start, start, 0);
48421 des_xmlNodePtr(n_end, end, 1);
48422 xmlResetLastError();
48423 if (mem_base != xmlMemBlocks()) {
48424 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
48425 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048426 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048427 printf(" %d", n_start);
48428 printf(" %d", n_end);
48429 printf("\n");
48430 }
48431 }
48432 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048433 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048434#endif
48435
Daniel Veillard42595322004-11-08 10:52:06 +000048436 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048437}
48438
48439
48440static int
48441test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048442 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048443
Daniel Veillard3d97e662004-11-04 10:49:00 +000048444#ifdef LIBXML_XPTR_ENABLED
48445 int mem_base;
48446 xmlXPathObjectPtr ret_val;
48447 xmlXPathObjectPtr start; /* the starting point */
48448 int n_start;
48449 xmlXPathObjectPtr end; /* the ending point */
48450 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048451
Daniel Veillard3d97e662004-11-04 10:49:00 +000048452 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48453 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48454 mem_base = xmlMemBlocks();
48455 start = gen_xmlXPathObjectPtr(n_start, 0);
48456 end = gen_xmlXPathObjectPtr(n_end, 1);
48457
48458 ret_val = xmlXPtrNewRangePoints(start, end);
48459 desret_xmlXPathObjectPtr(ret_val);
48460 call_tests++;
48461 des_xmlXPathObjectPtr(n_start, start, 0);
48462 des_xmlXPathObjectPtr(n_end, end, 1);
48463 xmlResetLastError();
48464 if (mem_base != xmlMemBlocks()) {
48465 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
48466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048467 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048468 printf(" %d", n_start);
48469 printf(" %d", n_end);
48470 printf("\n");
48471 }
48472 }
48473 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048474 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048475#endif
48476
Daniel Veillard42595322004-11-08 10:52:06 +000048477 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048478}
48479
48480
48481static int
48482test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048483 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048484
Daniel Veillardce682bc2004-11-05 17:22:25 +000048485#ifdef LIBXML_XPTR_ENABLED
48486 int mem_base;
48487 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48488 int n_ctxt;
48489 int nargs; /* the number of args */
48490 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048491
Daniel Veillardce682bc2004-11-05 17:22:25 +000048492 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48493 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48494 mem_base = xmlMemBlocks();
48495 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48496 nargs = gen_int(n_nargs, 1);
48497
48498 xmlXPtrRangeToFunction(ctxt, nargs);
48499 call_tests++;
48500 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48501 des_int(n_nargs, nargs, 1);
48502 xmlResetLastError();
48503 if (mem_base != xmlMemBlocks()) {
48504 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
48505 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048506 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048507 printf(" %d", n_ctxt);
48508 printf(" %d", n_nargs);
48509 printf("\n");
48510 }
48511 }
48512 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048513 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048514#endif
48515
Daniel Veillard42595322004-11-08 10:52:06 +000048516 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048517}
48518
48519
48520static int
48521test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048522 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048523
Daniel Veillardce682bc2004-11-05 17:22:25 +000048524#ifdef LIBXML_XPTR_ENABLED
48525 int mem_base;
48526 xmlXPathObjectPtr ret_val;
48527 xmlLocationSetPtr val; /* the LocationSet value */
48528 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048529
Daniel Veillardce682bc2004-11-05 17:22:25 +000048530 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
48531 mem_base = xmlMemBlocks();
48532 val = gen_xmlLocationSetPtr(n_val, 0);
48533
48534 ret_val = xmlXPtrWrapLocationSet(val);
48535 desret_xmlXPathObjectPtr(ret_val);
48536 call_tests++;
48537 des_xmlLocationSetPtr(n_val, val, 0);
48538 xmlResetLastError();
48539 if (mem_base != xmlMemBlocks()) {
48540 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
48541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048542 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048543 printf(" %d", n_val);
48544 printf("\n");
48545 }
48546 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048547 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048548#endif
48549
Daniel Veillard42595322004-11-08 10:52:06 +000048550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048551}
48552
48553static int
48554test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048555 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048556
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048557 if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000048558 test_ret += test_xmlXPtrBuildNodeList();
48559 test_ret += test_xmlXPtrEval();
48560 test_ret += test_xmlXPtrEvalRangePredicate();
48561 test_ret += test_xmlXPtrLocationSetAdd();
48562 test_ret += test_xmlXPtrLocationSetCreate();
48563 test_ret += test_xmlXPtrLocationSetDel();
48564 test_ret += test_xmlXPtrLocationSetMerge();
48565 test_ret += test_xmlXPtrLocationSetRemove();
48566 test_ret += test_xmlXPtrNewCollapsedRange();
48567 test_ret += test_xmlXPtrNewContext();
48568 test_ret += test_xmlXPtrNewLocationSetNodeSet();
48569 test_ret += test_xmlXPtrNewLocationSetNodes();
48570 test_ret += test_xmlXPtrNewRange();
48571 test_ret += test_xmlXPtrNewRangeNodeObject();
48572 test_ret += test_xmlXPtrNewRangeNodePoint();
48573 test_ret += test_xmlXPtrNewRangeNodes();
48574 test_ret += test_xmlXPtrNewRangePointNode();
48575 test_ret += test_xmlXPtrNewRangePoints();
48576 test_ret += test_xmlXPtrRangeToFunction();
48577 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000048578
Daniel Veillard42595322004-11-08 10:52:06 +000048579 if (test_ret != 0)
48580 printf("Module xpointer: %d errors\n", test_ret);
48581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048582}
Daniel Veillardce244ad2004-11-05 10:03:46 +000048583static int
48584test_module(const char *module) {
48585 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
48586 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048587 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048588 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048589 if (!strcmp(module, "catalog")) return(test_catalog());
48590 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048591 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048592 if (!strcmp(module, "dict")) return(test_dict());
48593 if (!strcmp(module, "encoding")) return(test_encoding());
48594 if (!strcmp(module, "entities")) return(test_entities());
48595 if (!strcmp(module, "hash")) return(test_hash());
48596 if (!strcmp(module, "list")) return(test_list());
48597 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
48598 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
48599 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048600 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048601 if (!strcmp(module, "pattern")) return(test_pattern());
48602 if (!strcmp(module, "relaxng")) return(test_relaxng());
48603 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
48604 if (!strcmp(module, "tree")) return(test_tree());
48605 if (!strcmp(module, "uri")) return(test_uri());
48606 if (!strcmp(module, "valid")) return(test_valid());
48607 if (!strcmp(module, "xinclude")) return(test_xinclude());
48608 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048609 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048610 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
48611 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048612 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048613 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
48614 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
48615 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
48616 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000048617 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048618 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
48619 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048620 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048621 if (!strcmp(module, "xpointer")) return(test_xpointer());
48622 return(0);
48623}