blob: ea7b40c41529d119d922f187578dd8fd566a32bc [file] [log] [blame]
Daniel Veillardd93f6252004-11-02 15:53:51 +00001/*
2 * testapi.c: libxml2 API tester program.
3 *
4 * Automatically generated by gentest.py from libxml2-api.xml
5 *
6 * See Copyright for the status of this software.
7 *
8 * daniel@veillard.com
9 */
10
11#include <stdio.h>
Daniel Veillardce244ad2004-11-05 10:03:46 +000012#include <string.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000013#include <libxml/xmlerror.h>
Daniel Veillard3d97e662004-11-04 10:49:00 +000014#include <libxml/relaxng.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000015
16static int testlibxml2(void);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017static int test_module(const char *module);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018
19static int generic_errors = 0;
20static int call_tests = 0;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021static int function_tests = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022
Daniel Veillard5ea30d72004-11-08 11:54:28 +000023static xmlChar chartab[1024];
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000024static int inttab[1024];
25static unsigned long longtab[1024];
Daniel Veillardce244ad2004-11-05 10:03:46 +000026
27static xmlDocPtr api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000028static xmlDtdPtr api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000029static xmlNodePtr api_root = NULL;
30static xmlAttrPtr api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000031static xmlNsPtr api_ns = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032
Daniel Veillardd93f6252004-11-02 15:53:51 +000033static void
34structured_errors(void *userData ATTRIBUTE_UNUSED,
35 xmlErrorPtr error ATTRIBUTE_UNUSED) {
36 generic_errors++;
37}
38
Daniel Veillardce244ad2004-11-05 10:03:46 +000039static void
40free_api_doc(void) {
41 xmlFreeDoc(api_doc);
42 api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000043 api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000044 api_root = NULL;
45 api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000046 api_ns = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000047}
48
49static xmlDocPtr
50get_api_doc(void) {
51 if (api_doc == NULL) {
Daniel Veillard27f20102004-11-05 11:50:11 +000052 api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0);
Daniel Veillardce244ad2004-11-05 10:03:46 +000053 api_root = NULL;
54 api_attr = NULL;
55 }
56 return(api_doc);
57}
58
Daniel Veillard27f20102004-11-05 11:50:11 +000059static xmlDtdPtr
60get_api_dtd(void) {
61 if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) {
62 get_api_doc();
63 if ((api_doc != NULL) && (api_doc->children != NULL) &&
64 (api_doc->children->type == XML_DTD_NODE))
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000065 api_dtd = (xmlDtdPtr) api_doc->children;
Daniel Veillard27f20102004-11-05 11:50:11 +000066 }
67 return(api_dtd);
68}
69
Daniel Veillardce244ad2004-11-05 10:03:46 +000070static xmlNodePtr
71get_api_root(void) {
72 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
73 get_api_doc();
74 if ((api_doc != NULL) && (api_doc->children != NULL) &&
Daniel Veillard27f20102004-11-05 11:50:11 +000075 (api_doc->children->next != NULL) &&
76 (api_doc->children->next->type == XML_ELEMENT_NODE))
77 api_root = api_doc->children->next;
Daniel Veillardce244ad2004-11-05 10:03:46 +000078 }
79 return(api_root);
80}
81
Daniel Veillard27f20102004-11-05 11:50:11 +000082static xmlNsPtr
83get_api_ns(void) {
84 get_api_root();
85 if (api_root != NULL)
86 api_ns = api_root->nsDef;
87 return(api_ns);
88}
89
Daniel Veillardce244ad2004-11-05 10:03:46 +000090static xmlAttrPtr
91get_api_attr(void) {
Daniel Veillardc8311492004-11-08 16:51:13 +000092#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000093 static int nr = 0;
94 xmlChar name[20];
Daniel Veillardc8311492004-11-08 16:51:13 +000095#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000096
97 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
98 get_api_root();
99 }
100 if (api_root == NULL)
101 return(NULL);
102 if (api_root->properties != NULL) {
103 api_attr = api_root->properties;
104 return(api_root->properties);
105 }
Daniel Veillardc8311492004-11-08 16:51:13 +0000106 api_attr = NULL;
107#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +0000108 snprintf((char *) name, 20, "foo%d", nr++);
109 api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar");
Daniel Veillardc8311492004-11-08 16:51:13 +0000110#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +0000111 return(api_attr);
112}
113
114int main(int argc, char **argv) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000115 int ret;
116 int blocks, mem;
117
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000118 memset(chartab, 0, sizeof(chartab));
Daniel Veillardc8311492004-11-08 16:51:13 +0000119 strncpy((char *) chartab, " chartab\n", 20);
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000120 memset(inttab, 0, sizeof(inttab));
121 memset(longtab, 0, sizeof(longtab));
122
Daniel Veillarda03e3652004-11-02 18:45:30 +0000123 xmlInitParser();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000124#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000125 xmlRelaxNGInitTypes();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000126#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +0000127
Daniel Veillardd93f6252004-11-02 15:53:51 +0000128 LIBXML_TEST_VERSION
129
130 xmlSetStructuredErrorFunc(NULL, structured_errors);
131
Daniel Veillardce244ad2004-11-05 10:03:46 +0000132 if (argc == 2)
133 ret = test_module(argv[1]);
134 else
135 ret = testlibxml2();
Daniel Veillardd93f6252004-11-02 15:53:51 +0000136
137 xmlCleanupParser();
138 blocks = xmlMemBlocks();
139 mem = xmlMemUsed();
140 if ((blocks != 0) || (mem != 0)) {
141 printf("testapi leaked %d bytes in %d blocks\n", mem, blocks);
142 }
143 xmlMemoryDump();
144
145 return (ret != 0);
146}
147
148#include <libxml/HTMLparser.h>
149#include <libxml/HTMLtree.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000150#include <libxml/catalog.h>
151#include <libxml/chvalid.h>
152#include <libxml/dict.h>
153#include <libxml/encoding.h>
154#include <libxml/entities.h>
155#include <libxml/hash.h>
156#include <libxml/list.h>
157#include <libxml/nanoftp.h>
158#include <libxml/nanohttp.h>
159#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +0000160#include <libxml/parserInternals.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000161#include <libxml/pattern.h>
162#include <libxml/relaxng.h>
163#include <libxml/schemasInternals.h>
164#include <libxml/tree.h>
165#include <libxml/uri.h>
166#include <libxml/valid.h>
167#include <libxml/xinclude.h>
168#include <libxml/xmlIO.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000169#include <libxml/xmlerror.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000170#include <libxml/xmlreader.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000171#include <libxml/xmlsave.h>
172#include <libxml/xmlschemas.h>
173#include <libxml/xmlschemastypes.h>
174#include <libxml/xmlstring.h>
175#include <libxml/xmlwriter.h>
176#include <libxml/xpath.h>
177#include <libxml/xpointer.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000178
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000179#define gen_nb_void_ptr 2
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000180
Daniel Veillard3d97e662004-11-04 10:49:00 +0000181static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000182 return(NULL);
183}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000184static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000185}
186
Daniel Veillardce244ad2004-11-05 10:03:46 +0000187#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000188#define gen_nb_const_void_ptr 2
189
190static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) {
191 if (no == 0) return((const void *) "immutable string");
192 return(NULL);
193}
194static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
195}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000196#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000197
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000198#define gen_nb_userdata 3
199
Daniel Veillard3d97e662004-11-04 10:49:00 +0000200static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000201 if (no == 0) return((void *) &call_tests);
202 if (no == 1) return((void *) -1);
203 return(NULL);
204}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000205static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000206}
207
208
Daniel Veillardd93f6252004-11-02 15:53:51 +0000209#define gen_nb_int 4
210
Daniel Veillard3d97e662004-11-04 10:49:00 +0000211static int gen_int(int no, int nr ATTRIBUTE_UNUSED) {
212 if (no == 0) return(0);
213 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000214 if (no == 2) return(-1);
215 if (no == 3) return(122);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000216 return(-1);
217}
218
219static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
220}
221
Daniel Veillard6128c012004-11-08 17:16:15 +0000222#define gen_nb_parseroptions 5
223
224static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) {
225 if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER);
226 if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA);
227 if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN);
228 if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT);
229 return(XML_PARSE_SAX1);
230}
231
232static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
233}
234
Daniel Veillardce244ad2004-11-05 10:03:46 +0000235#if 0
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000236#define gen_nb_long 5
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000237
238static long gen_long(int no, int nr ATTRIBUTE_UNUSED) {
239 if (no == 0) return(0);
240 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000241 if (no == 2) return(-1);
242 if (no == 3) return(122);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000243 return(-1);
244}
245
246static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
247}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000248#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000249
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000250#define gen_nb_xmlChar 4
251
252static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) {
253 if (no == 0) return('a');
254 if (no == 1) return(' ');
255 if (no == 2) return('ø');
256 return(0);
257}
258
259static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
260}
261
Daniel Veillard3d97e662004-11-04 10:49:00 +0000262#define gen_nb_unsigned_int 3
263
264static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000265 if (no == 0) return(0);
266 if (no == 1) return(1);
267 if (no == 2) return(122);
268 return(-1);
269}
270
Daniel Veillard3d97e662004-11-04 10:49:00 +0000271static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000272}
273
Daniel Veillard3d95c732004-11-06 22:25:14 +0000274#define gen_nb_unsigned_long 4
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000275
276static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
277 if (no == 0) return(0);
278 if (no == 1) return(1);
279 if (no == 2) return(122);
280 return(-1);
281}
282
283static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
284}
285
Daniel Veillard3d95c732004-11-06 22:25:14 +0000286#define gen_nb_double 4
287
288static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
289 if (no == 0) return(0);
290 if (no == 1) return(-1.1);
Daniel Veillardc8311492004-11-08 16:51:13 +0000291#if defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +0000292 if (no == 2) return(xmlXPathNAN);
Daniel Veillardc8311492004-11-08 16:51:13 +0000293#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000294 return(-1);
295}
296
297static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
298}
299
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000300#define gen_nb_unsigned_long_ptr 2
301
302static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
303 if (no == 0) return(&longtab[nr]);
304 return(NULL);
305}
306
307static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
308}
309
310#define gen_nb_int_ptr 2
311
312static int *gen_int_ptr(int no, int nr) {
313 if (no == 0) return(&inttab[nr]);
314 return(NULL);
315}
316
317static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
318}
319
Daniel Veillardd93f6252004-11-02 15:53:51 +0000320#define gen_nb_const_char_ptr 4
321
Daniel Veillardce682bc2004-11-05 17:22:25 +0000322static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) {
323 if (no == 0) return((char *) "foo");
324 if (no == 1) return((char *) "<foo/>");
325 if (no == 2) return((char *) "test/ent2");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000326 return(NULL);
327}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000328static 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 +0000329}
330
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000331#define gen_nb_xmlChar_ptr 2
332
Daniel Veillard3d97e662004-11-04 10:49:00 +0000333static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000334 if (no == 0) return(&chartab[0]);
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000335 return(NULL);
336}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000337static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000338}
339
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000340#define gen_nb_FILE_ptr 2
341
342static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) {
343 if (no == 0) return(fopen("test.out", "a+"));
344 return(NULL);
345}
346static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
347 if (val != NULL) fclose(val);
348}
349
Daniel Veillarda82b1822004-11-08 16:24:57 +0000350#define gen_nb_debug_FILE_ptr 2
351static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
352 return(fopen("test.out", "a+"));
353}
354static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
355 if (val != NULL) fclose(val);
356}
357
Daniel Veillardd93f6252004-11-02 15:53:51 +0000358#define gen_nb_const_xmlChar_ptr 5
359
Daniel Veillardce682bc2004-11-05 17:22:25 +0000360static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
361 if (no == 0) return((xmlChar *) "foo");
362 if (no == 1) return((xmlChar *) "<foo/>");
363 if (no == 2) return((xmlChar *) "nøne");
364 if (no == 3) return((xmlChar *) " 2ab ");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000365 return(NULL);
366}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000367static 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 +0000368}
369
370#define gen_nb_filepath 8
371
Daniel Veillard3d97e662004-11-04 10:49:00 +0000372static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000373 if (no == 0) return("missing.xml");
374 if (no == 1) return("<foo/>");
375 if (no == 2) return("test/ent2");
376 if (no == 3) return("test/valid/REC-xml-19980210.xml");
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000377 if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000378 if (no == 5) return("http://missing.example.org/");
379 if (no == 6) return("http://missing. example.org/");
380 return(NULL);
381}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000382static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000383}
384
Daniel Veillard27f20102004-11-05 11:50:11 +0000385#define gen_nb_eaten_name 2
386
387static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000388 if (no == 0) return(xmlStrdup(BAD_CAST "eaten"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000389 return(NULL);
390}
391static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
392}
393
Daniel Veillardd93f6252004-11-02 15:53:51 +0000394#define gen_nb_fileoutput 6
395
Daniel Veillard3d97e662004-11-04 10:49:00 +0000396static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000397 if (no == 0) return("/missing.xml");
398 if (no == 1) return("<foo/>");
399 if (no == 2) return("ftp://missing.example.org/foo");
400 if (no == 3) return("http://missing.example.org/");
401 if (no == 4) return("http://missing. example.org/");
402 return(NULL);
403}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000404static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000405}
406
407#define gen_nb_xmlParserCtxtPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000408static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000409 if (no == 0) return(xmlNewParserCtxt());
410 return(NULL);
411}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000412static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000413 if (val != NULL)
414 xmlFreeParserCtxt(val);
415}
416
Daniel Veillard34099b42004-11-04 17:34:35 +0000417#define gen_nb_xmlSAXHandlerPtr 2
418static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
419 if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
420 return(NULL);
421}
422static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
423}
424
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000425#define gen_nb_xmlValidCtxtPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000426static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000427 if (no == 0) return(xmlNewValidCtxt());
428 return(NULL);
429}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000430static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000431 if (val != NULL)
432 xmlFreeValidCtxt(val);
433}
434
Daniel Veillard34099b42004-11-04 17:34:35 +0000435#define gen_nb_xmlParserInputBufferPtr 8
436
437static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
438 if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE));
439 if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE));
440 if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE));
441 if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE));
442 if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE));
443 if (no == 5) return(xmlParserInputBufferCreateFilename("http://missing.example.org/", XML_CHAR_ENCODING_NONE));
444 if (no == 6) return(xmlParserInputBufferCreateFilename("http://missing. example.org/", XML_CHAR_ENCODING_NONE));
445 return(NULL);
446}
447static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
448 xmlFreeParserInputBuffer(val);
449}
450
Daniel Veillardd93f6252004-11-02 15:53:51 +0000451#define gen_nb_xmlDocPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000452static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000453 if (no == 0) return(xmlNewDoc(BAD_CAST "1.0"));
454 if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0));
455 return(NULL);
456}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000457static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000458 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
Daniel Veillardd93f6252004-11-02 15:53:51 +0000459 xmlFreeDoc(val);
460}
461
Daniel Veillardce244ad2004-11-05 10:03:46 +0000462#define gen_nb_xmlAttrPtr 2
463static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) {
464 if (no == 0) return(get_api_attr());
465 return(NULL);
466}
467static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
468 if (no == 0) free_api_doc();
469}
470
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000471#define gen_nb_xmlDictPtr 2
472static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) {
473 if (no == 0) return(xmlDictCreate());
474 return(NULL);
475}
476static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) {
477 if (val != NULL)
478 xmlDictFree(val);
479}
480
Daniel Veillardce244ad2004-11-05 10:03:46 +0000481#define gen_nb_xmlNodePtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000482static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000483 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
Daniel Veillardce244ad2004-11-05 10:03:46 +0000484 if (no == 1) return(get_api_root());
Daniel Veillardd93f6252004-11-02 15:53:51 +0000485 return(NULL);
Daniel Veillardce244ad2004-11-05 10:03:46 +0000486/* if (no == 2) return((xmlNodePtr) get_api_doc()); */
Daniel Veillardd93f6252004-11-02 15:53:51 +0000487}
Daniel Veillard27f20102004-11-05 11:50:11 +0000488static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000489 if (no == 1) free_api_doc();
490 else if (val != NULL) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000491 xmlUnlinkNode(val);
492 xmlFreeNode(val);
493 }
494}
495
Daniel Veillard27f20102004-11-05 11:50:11 +0000496#define gen_nb_xmlDtdPtr 3
497static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000498 if (no == 0)
499 return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000500 if (no == 1) return(get_api_dtd());
501 return(NULL);
502}
503static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) {
504 if (no == 1) free_api_doc();
505 else if (val != NULL) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000506 xmlUnlinkNode((xmlNodePtr) val);
507 xmlFreeNode((xmlNodePtr) val);
Daniel Veillard27f20102004-11-05 11:50:11 +0000508 }
509}
510
511#define gen_nb_xmlNsPtr 2
512static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) {
513 if (no == 0) return(get_api_ns());
514 return(NULL);
515}
516static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
517 if (no == 0) free_api_doc();
518}
519
Daniel Veillardd93f6252004-11-02 15:53:51 +0000520#define gen_nb_xmlNodePtr_in 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000521static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000522 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
523 if (no == 0) return(xmlNewText(BAD_CAST "text"));
524 return(NULL);
525}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000526static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000527}
528
Daniel Veillardc8311492004-11-08 16:51:13 +0000529#ifdef LIBXML_WRITER_ENABLED
Daniel Veillarde43cc572004-11-03 11:50:29 +0000530#define gen_nb_xmlTextWriterPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000531static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000532 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
533 return(NULL);
534}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000535static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000536 if (val != NULL) xmlFreeTextWriter(val);
537}
Daniel Veillardc8311492004-11-08 16:51:13 +0000538#endif
Daniel Veillarde43cc572004-11-03 11:50:29 +0000539
Daniel Veillardc8311492004-11-08 16:51:13 +0000540#ifdef LIBXML_READER_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000541#define gen_nb_xmlTextReaderPtr 4
Daniel Veillard3d97e662004-11-04 10:49:00 +0000542static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000543 if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
544 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
545 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
546 return(NULL);
547}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000548static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000549 if (val != NULL) xmlFreeTextReader(val);
550}
Daniel Veillardc8311492004-11-08 16:51:13 +0000551#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000552
Daniel Veillard34099b42004-11-04 17:34:35 +0000553#define gen_nb_xmlBufferPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000554static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000555 if (no == 0) return(xmlBufferCreate());
Daniel Veillardce244ad2004-11-05 10:03:46 +0000556 if (no == 1) return(xmlBufferCreateStatic((void *)"a static buffer", 13));
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000557 return(NULL);
558}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000559static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000560 if (val != NULL) {
561 xmlBufferFree(val);
562 }
563}
564
565#define gen_nb_xmlListPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000566static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000567 if (no == 0) return(xmlListCreate(NULL, NULL));
568 return(NULL);
569}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000570static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000571 if (val != NULL) {
572 xmlListDelete(val);
573 }
574}
575
576#define gen_nb_xmlHashTablePtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000577static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000578 if (no == 0) return(xmlHashCreate(10));
579 return(NULL);
580}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000581static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000582 if (val != NULL) {
583 xmlHashFree(val, NULL);
584 }
585}
586
587#include <libxml/xpathInternals.h>
588
Daniel Veillardc8311492004-11-08 16:51:13 +0000589#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000590#define gen_nb_xmlXPathObjectPtr 5
Daniel Veillard3d97e662004-11-04 10:49:00 +0000591static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000592 if (no == 0) return(xmlXPathNewString(BAD_CAST "string object"));
593 if (no == 1) return(xmlXPathNewFloat(1.1));
594 if (no == 2) return(xmlXPathNewBoolean(1));
595 if (no == 3) return(xmlXPathNewNodeSet(NULL));
596 return(NULL);
597}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000598static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000599 if (val != NULL) {
600 xmlXPathFreeObject(val);
601 }
602}
Daniel Veillardc8311492004-11-08 16:51:13 +0000603#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000604
Daniel Veillardc8311492004-11-08 16:51:13 +0000605#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000606#define gen_nb_xmlOutputBufferPtr 2
607static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
608 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0));
609 return(NULL);
610}
611static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
612 if (val != NULL) {
613 xmlOutputBufferClose(val);
614 }
615}
Daniel Veillardc8311492004-11-08 16:51:13 +0000616#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +0000617
Daniel Veillardc8311492004-11-08 16:51:13 +0000618#ifdef LIBXML_FTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000619#define gen_nb_xmlNanoFTPCtxtPtr 4
620static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
621 if (no == 0) return(xmlNanoFTPNewCtxt("ftp://example.com/"));
622 if (no == 1) return(xmlNanoFTPNewCtxt("http://example.com/"));
623 if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
624 return(NULL);
625}
626static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
627 if (val != NULL) {
628 xmlNanoFTPFreeCtxt(val);
629 }
630}
Daniel Veillardc8311492004-11-08 16:51:13 +0000631#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000632
Daniel Veillardc8311492004-11-08 16:51:13 +0000633#ifdef LIBXML_HTTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000634#define gen_nb_xmlNanoHTTPCtxtPtr 1
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000635static void *gen_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard27f20102004-11-05 11:50:11 +0000636 return(NULL);
637}
638static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
639}
Daniel Veillardc8311492004-11-08 16:51:13 +0000640#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000641
Daniel Veillard3d97e662004-11-04 10:49:00 +0000642#define gen_nb_xmlCharEncoding 4
643static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) {
644 if (no == 0) return(XML_CHAR_ENCODING_UTF8);
645 if (no == 1) return(XML_CHAR_ENCODING_NONE);
646 if (no == 0) return(XML_CHAR_ENCODING_8859_1);
647 return(XML_CHAR_ENCODING_ERROR);
648}
649static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
650}
651
Daniel Veillard42595322004-11-08 10:52:06 +0000652#define gen_nb_xmlHashDeallocator 2
653static void
654test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) {
655}
656
657static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
658 if (no == 0) return(test_xmlHashDeallocator);
659 return(NULL);
660}
661static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
662}
663
Daniel Veillardd93f6252004-11-02 15:53:51 +0000664
665static void desret_int(int val ATTRIBUTE_UNUSED) {
666}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000667static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) {
668}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000669static void desret_long(long val ATTRIBUTE_UNUSED) {
670}
671static void desret_double(double val ATTRIBUTE_UNUSED) {
672}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000673static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
674}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000675#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000676static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
677}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000678#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000679static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
680}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000681static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
682}
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000683static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
684}
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000685static void desret_xmlChar_ptr(xmlChar *val) {
686 if (val != NULL)
687 xmlFree(val);
688}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000689static void desret_xmlDocPtr(xmlDocPtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000690 if (val != api_doc)
691 xmlFreeDoc(val);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000692}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000693static void desret_xmlDictPtr(xmlDictPtr val) {
694 xmlDictFree(val);
695}
Daniel Veillardc8311492004-11-08 16:51:13 +0000696#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d95c732004-11-06 22:25:14 +0000697static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
698 xmlOutputBufferClose(val);
699}
Daniel Veillardc8311492004-11-08 16:51:13 +0000700#endif
701#ifdef LIBXML_READER_ENABLED
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000702static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
703 xmlFreeTextReader(val);
704}
Daniel Veillardc8311492004-11-08 16:51:13 +0000705#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +0000706static void desret_xmlNodePtr(xmlNodePtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000707 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
708 xmlUnlinkNode(val);
709 xmlFreeNode(val);
710 }
Daniel Veillardd93f6252004-11-02 15:53:51 +0000711}
Daniel Veillard57b25162004-11-06 14:50:18 +0000712static void desret_xmlAttrPtr(xmlAttrPtr val) {
713 if (val != NULL) {
714 xmlUnlinkNode((xmlNodePtr) val);
715 xmlFreeNode((xmlNodePtr) val);
716 }
717}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000718static void desret_xmlEntityPtr(xmlEntityPtr val) {
719 if (val != NULL) {
720 xmlUnlinkNode((xmlNodePtr) val);
721 xmlFreeNode((xmlNodePtr) val);
722 }
723}
Daniel Veillard42595322004-11-08 10:52:06 +0000724static void desret_xmlElementPtr(xmlElementPtr val) {
725 if (val != NULL) {
726 xmlUnlinkNode((xmlNodePtr) val);
727 }
728}
729static void desret_xmlAttributePtr(xmlAttributePtr val) {
730 if (val != NULL) {
731 xmlUnlinkNode((xmlNodePtr) val);
732 }
733}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000734static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
735}
Daniel Veillard34099b42004-11-04 17:34:35 +0000736static void desret_xmlDtdPtr(xmlDtdPtr val) {
737 desret_xmlNodePtr((xmlNodePtr)val);
738}
Daniel Veillardc8311492004-11-08 16:51:13 +0000739#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000740static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000741 xmlXPathFreeObject(val);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000742}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000743static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) {
744 xmlXPathFreeNodeSet(val);
745}
Daniel Veillardc8311492004-11-08 16:51:13 +0000746#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000747static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
748 xmlFreeParserCtxt(val);
749}
750
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000751static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
752 xmlFreeParserInputBuffer(val);
753}
Daniel Veillard42595322004-11-08 10:52:06 +0000754static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
755 xmlFreeInputStream(val);
756}
Daniel Veillardc8311492004-11-08 16:51:13 +0000757#ifdef LIBXML_WRITER_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000758static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
759 xmlFreeTextWriter(val);
760}
Daniel Veillardc8311492004-11-08 16:51:13 +0000761#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000762static void desret_xmlBufferPtr(xmlBufferPtr val) {
763 xmlBufferFree(val);
764}
Daniel Veillardc8311492004-11-08 16:51:13 +0000765#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000766static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
767 xmlSchemaFreeParserCtxt(val);
768}
769static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
770}
771static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
772 xmlRelaxNGFreeParserCtxt(val);
773}
Daniel Veillardc8311492004-11-08 16:51:13 +0000774#endif
775#ifdef LIBXML_HTML_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000776static void desret_const_htmlEntityDesc_ptr(const htmlEntityDescPtr val ATTRIBUTE_UNUSED) {
777}
Daniel Veillardc8311492004-11-08 16:51:13 +0000778#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000779
780/************************************************************************
781 * *
782 * WARNING: end of the manually maintained part of the test code *
783 * do not remove or alter the CUT HERE line *
784 * *
785 ************************************************************************/
786
Daniel Veillard34099b42004-11-04 17:34:35 +0000787/* CUT HERE: everything below that line is generated */
Daniel Veillard57b25162004-11-06 14:50:18 +0000788#define gen_nb_htmlParserOption 4
789static htmlParserOption gen_htmlParserOption(int no, int nr ATTRIBUTE_UNUSED) {
790 if (no == 1) return(HTML_PARSE_NOBLANKS);
791 if (no == 2) return(HTML_PARSE_NOERROR);
792 if (no == 3) return(HTML_PARSE_NONET);
793 if (no == 4) return(HTML_PARSE_NOWARNING);
794 return(0);
795}
796static void des_htmlParserOption(int no ATTRIBUTE_UNUSED, htmlParserOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
797}
798static void desret_htmlParserOption(htmlParserOption val ATTRIBUTE_UNUSED) {
799}
800
801#define gen_nb_htmlStatus 4
802static htmlStatus gen_htmlStatus(int no, int nr ATTRIBUTE_UNUSED) {
803 if (no == 1) return(HTML_DEPRECATED);
804 if (no == 2) return(HTML_INVALID);
805 if (no == 3) return(HTML_NA);
806 if (no == 4) return(HTML_REQUIRED);
807 return(0);
808}
809static void des_htmlStatus(int no ATTRIBUTE_UNUSED, htmlStatus val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
810}
811static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
812}
813
814#define gen_nb_xlinkActuate 3
815static xlinkActuate gen_xlinkActuate(int no, int nr ATTRIBUTE_UNUSED) {
816 if (no == 1) return(XLINK_ACTUATE_AUTO);
817 if (no == 2) return(XLINK_ACTUATE_NONE);
818 if (no == 3) return(XLINK_ACTUATE_ONREQUEST);
819 return(0);
820}
821static void des_xlinkActuate(int no ATTRIBUTE_UNUSED, xlinkActuate val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
822}
823static void desret_xlinkActuate(xlinkActuate val ATTRIBUTE_UNUSED) {
824}
825
826#define gen_nb_xlinkShow 4
827static xlinkShow gen_xlinkShow(int no, int nr ATTRIBUTE_UNUSED) {
828 if (no == 1) return(XLINK_SHOW_EMBED);
829 if (no == 2) return(XLINK_SHOW_NEW);
830 if (no == 3) return(XLINK_SHOW_NONE);
831 if (no == 4) return(XLINK_SHOW_REPLACE);
832 return(0);
833}
834static void des_xlinkShow(int no ATTRIBUTE_UNUSED, xlinkShow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
835}
836static void desret_xlinkShow(xlinkShow val ATTRIBUTE_UNUSED) {
837}
838
839#define gen_nb_xlinkType 4
840static xlinkType gen_xlinkType(int no, int nr ATTRIBUTE_UNUSED) {
841 if (no == 1) return(XLINK_TYPE_EXTENDED);
842 if (no == 2) return(XLINK_TYPE_EXTENDED_SET);
843 if (no == 3) return(XLINK_TYPE_NONE);
844 if (no == 4) return(XLINK_TYPE_SIMPLE);
845 return(0);
846}
847static void des_xlinkType(int no ATTRIBUTE_UNUSED, xlinkType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
848}
849static void desret_xlinkType(xlinkType val ATTRIBUTE_UNUSED) {
850}
851
852#define gen_nb_xmlAttributeDefault 4
853static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
854 if (no == 1) return(XML_ATTRIBUTE_FIXED);
855 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
856 if (no == 3) return(XML_ATTRIBUTE_NONE);
857 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
858 return(0);
859}
860static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
861}
862static void desret_xmlAttributeDefault(xmlAttributeDefault val ATTRIBUTE_UNUSED) {
863}
864
865#define gen_nb_xmlAttributeType 4
866static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
867 if (no == 1) return(XML_ATTRIBUTE_CDATA);
868 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
869 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
870 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
871 return(0);
872}
873static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
874}
875static void desret_xmlAttributeType(xmlAttributeType val ATTRIBUTE_UNUSED) {
876}
877
878#define gen_nb_xmlBufferAllocationScheme 3
879static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
880 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
881 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
882 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
883 return(0);
884}
885static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
886}
887static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
888}
889
890#define gen_nb_xmlCatalogAllow 4
891static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
892 if (no == 1) return(XML_CATA_ALLOW_ALL);
893 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
894 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
895 if (no == 4) return(XML_CATA_ALLOW_NONE);
896 return(0);
897}
898static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
899}
900static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
901}
902
903#define gen_nb_xmlCatalogPrefer 3
904static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
905 if (no == 1) return(XML_CATA_PREFER_NONE);
906 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
907 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
908 return(0);
909}
910static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
911}
912static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
913}
914
915#define gen_nb_xmlElementContentOccur 4
916static xmlElementContentOccur gen_xmlElementContentOccur(int no, int nr ATTRIBUTE_UNUSED) {
917 if (no == 1) return(XML_ELEMENT_CONTENT_MULT);
918 if (no == 2) return(XML_ELEMENT_CONTENT_ONCE);
919 if (no == 3) return(XML_ELEMENT_CONTENT_OPT);
920 if (no == 4) return(XML_ELEMENT_CONTENT_PLUS);
921 return(0);
922}
923static void des_xmlElementContentOccur(int no ATTRIBUTE_UNUSED, xmlElementContentOccur val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
924}
925static void desret_xmlElementContentOccur(xmlElementContentOccur val ATTRIBUTE_UNUSED) {
926}
927
928#define gen_nb_xmlElementContentType 4
929static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
930 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
931 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
932 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
933 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
934 return(0);
935}
936static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
937}
938static void desret_xmlElementContentType(xmlElementContentType val ATTRIBUTE_UNUSED) {
939}
940
941#define gen_nb_xmlElementType 4
942static xmlElementType gen_xmlElementType(int no, int nr ATTRIBUTE_UNUSED) {
943 if (no == 1) return(XML_ATTRIBUTE_DECL);
944 if (no == 2) return(XML_ATTRIBUTE_NODE);
945 if (no == 3) return(XML_CDATA_SECTION_NODE);
946 if (no == 4) return(XML_COMMENT_NODE);
947 return(0);
948}
949static void des_xmlElementType(int no ATTRIBUTE_UNUSED, xmlElementType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
950}
951static void desret_xmlElementType(xmlElementType val ATTRIBUTE_UNUSED) {
952}
953
954#define gen_nb_xmlElementTypeVal 4
955static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
956 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
957 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
958 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
959 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
960 return(0);
961}
962static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
963}
964static void desret_xmlElementTypeVal(xmlElementTypeVal val ATTRIBUTE_UNUSED) {
965}
966
967#define gen_nb_xmlEntityType 4
968static xmlEntityType gen_xmlEntityType(int no, int nr ATTRIBUTE_UNUSED) {
969 if (no == 1) return(XML_EXTERNAL_GENERAL_PARSED_ENTITY);
970 if (no == 2) return(XML_EXTERNAL_GENERAL_UNPARSED_ENTITY);
971 if (no == 3) return(XML_EXTERNAL_PARAMETER_ENTITY);
972 if (no == 4) return(XML_INTERNAL_GENERAL_ENTITY);
973 return(0);
974}
975static void des_xmlEntityType(int no ATTRIBUTE_UNUSED, xmlEntityType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
976}
977static void desret_xmlEntityType(xmlEntityType val ATTRIBUTE_UNUSED) {
978}
979
980#define gen_nb_xmlErrorDomain 4
981static xmlErrorDomain gen_xmlErrorDomain(int no, int nr ATTRIBUTE_UNUSED) {
982 if (no == 1) return(XML_FROM_C14N);
983 if (no == 2) return(XML_FROM_CATALOG);
984 if (no == 3) return(XML_FROM_CHECK);
985 if (no == 4) return(XML_FROM_DATATYPE);
986 return(0);
987}
988static void des_xmlErrorDomain(int no ATTRIBUTE_UNUSED, xmlErrorDomain val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
989}
990static void desret_xmlErrorDomain(xmlErrorDomain val ATTRIBUTE_UNUSED) {
991}
992
993#define gen_nb_xmlErrorLevel 4
994static xmlErrorLevel gen_xmlErrorLevel(int no, int nr ATTRIBUTE_UNUSED) {
995 if (no == 1) return(XML_ERR_ERROR);
996 if (no == 2) return(XML_ERR_FATAL);
997 if (no == 3) return(XML_ERR_NONE);
998 if (no == 4) return(XML_ERR_WARNING);
999 return(0);
1000}
1001static void des_xmlErrorLevel(int no ATTRIBUTE_UNUSED, xmlErrorLevel val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1002}
1003static void desret_xmlErrorLevel(xmlErrorLevel val ATTRIBUTE_UNUSED) {
1004}
1005
1006#define gen_nb_xmlParserErrors 4
1007static xmlParserErrors gen_xmlParserErrors(int no, int nr ATTRIBUTE_UNUSED) {
1008 if (no == 1) return(XML_C14N_CREATE_CTXT);
1009 if (no == 2) return(XML_C14N_CREATE_STACK);
1010 if (no == 3) return(XML_C14N_INVALID_NODE);
1011 if (no == 4) return(XML_C14N_REQUIRES_UTF8);
1012 return(0);
1013}
1014static void des_xmlParserErrors(int no ATTRIBUTE_UNUSED, xmlParserErrors val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1015}
1016static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
1017}
1018
1019#define gen_nb_xmlParserInputState 4
1020static xmlParserInputState gen_xmlParserInputState(int no, int nr ATTRIBUTE_UNUSED) {
1021 if (no == 1) return(XML_PARSER_ATTRIBUTE_VALUE);
1022 if (no == 2) return(XML_PARSER_CDATA_SECTION);
1023 if (no == 3) return(XML_PARSER_COMMENT);
1024 if (no == 4) return(XML_PARSER_CONTENT);
1025 return(0);
1026}
1027static void des_xmlParserInputState(int no ATTRIBUTE_UNUSED, xmlParserInputState val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1028}
1029static void desret_xmlParserInputState(xmlParserInputState val ATTRIBUTE_UNUSED) {
1030}
1031
1032#define gen_nb_xmlParserMode 4
1033static xmlParserMode gen_xmlParserMode(int no, int nr ATTRIBUTE_UNUSED) {
1034 if (no == 1) return(XML_PARSE_DOM);
1035 if (no == 2) return(XML_PARSE_PUSH_DOM);
1036 if (no == 3) return(XML_PARSE_PUSH_SAX);
1037 if (no == 4) return(XML_PARSE_READER);
1038 return(0);
1039}
1040static void des_xmlParserMode(int no ATTRIBUTE_UNUSED, xmlParserMode val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1041}
1042static void desret_xmlParserMode(xmlParserMode val ATTRIBUTE_UNUSED) {
1043}
1044
1045#define gen_nb_xmlParserOption 4
1046static xmlParserOption gen_xmlParserOption(int no, int nr ATTRIBUTE_UNUSED) {
1047 if (no == 1) return(XML_PARSE_DTDATTR);
1048 if (no == 2) return(XML_PARSE_DTDLOAD);
1049 if (no == 3) return(XML_PARSE_DTDVALID);
1050 if (no == 4) return(XML_PARSE_NOBLANKS);
1051 return(0);
1052}
1053static void des_xmlParserOption(int no ATTRIBUTE_UNUSED, xmlParserOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1054}
1055static void desret_xmlParserOption(xmlParserOption val ATTRIBUTE_UNUSED) {
1056}
1057
1058#define gen_nb_xmlParserProperties 4
1059static xmlParserProperties gen_xmlParserProperties(int no, int nr ATTRIBUTE_UNUSED) {
1060 if (no == 1) return(XML_PARSER_DEFAULTATTRS);
1061 if (no == 2) return(XML_PARSER_LOADDTD);
1062 if (no == 3) return(XML_PARSER_SUBST_ENTITIES);
1063 if (no == 4) return(XML_PARSER_VALIDATE);
1064 return(0);
1065}
1066static void des_xmlParserProperties(int no ATTRIBUTE_UNUSED, xmlParserProperties val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1067}
1068static void desret_xmlParserProperties(xmlParserProperties val ATTRIBUTE_UNUSED) {
1069}
1070
1071#define gen_nb_xmlParserSeverities 4
1072static xmlParserSeverities gen_xmlParserSeverities(int no, int nr ATTRIBUTE_UNUSED) {
1073 if (no == 1) return(XML_PARSER_SEVERITY_ERROR);
1074 if (no == 2) return(XML_PARSER_SEVERITY_VALIDITY_ERROR);
1075 if (no == 3) return(XML_PARSER_SEVERITY_VALIDITY_WARNING);
1076 if (no == 4) return(XML_PARSER_SEVERITY_WARNING);
1077 return(0);
1078}
1079static void des_xmlParserSeverities(int no ATTRIBUTE_UNUSED, xmlParserSeverities val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1080}
1081static void desret_xmlParserSeverities(xmlParserSeverities val ATTRIBUTE_UNUSED) {
1082}
1083
1084#define gen_nb_xmlReaderTypes 4
1085static xmlReaderTypes gen_xmlReaderTypes(int no, int nr ATTRIBUTE_UNUSED) {
1086 if (no == 1) return(XML_READER_TYPE_ATTRIBUTE);
1087 if (no == 2) return(XML_READER_TYPE_CDATA);
1088 if (no == 3) return(XML_READER_TYPE_COMMENT);
1089 if (no == 4) return(XML_READER_TYPE_DOCUMENT);
1090 return(0);
1091}
1092static void des_xmlReaderTypes(int no ATTRIBUTE_UNUSED, xmlReaderTypes val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1093}
1094static void desret_xmlReaderTypes(xmlReaderTypes val ATTRIBUTE_UNUSED) {
1095}
1096
1097#define gen_nb_xmlRelaxNGParserFlag 3
1098static xmlRelaxNGParserFlag gen_xmlRelaxNGParserFlag(int no, int nr ATTRIBUTE_UNUSED) {
1099 if (no == 1) return(XML_RELAXNGP_CRNG);
1100 if (no == 2) return(XML_RELAXNGP_FREE_DOC);
1101 if (no == 3) return(XML_RELAXNGP_NONE);
1102 return(0);
1103}
1104static void des_xmlRelaxNGParserFlag(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserFlag val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1105}
1106static void desret_xmlRelaxNGParserFlag(xmlRelaxNGParserFlag val ATTRIBUTE_UNUSED) {
1107}
1108
1109#define gen_nb_xmlRelaxNGValidErr 4
1110static xmlRelaxNGValidErr gen_xmlRelaxNGValidErr(int no, int nr ATTRIBUTE_UNUSED) {
1111 if (no == 1) return(XML_RELAXNG_ERR_ATTREXTRANS);
1112 if (no == 2) return(XML_RELAXNG_ERR_ATTRNAME);
1113 if (no == 3) return(XML_RELAXNG_ERR_ATTRNONS);
1114 if (no == 4) return(XML_RELAXNG_ERR_ATTRVALID);
1115 return(0);
1116}
1117static void des_xmlRelaxNGValidErr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidErr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1118}
1119static void desret_xmlRelaxNGValidErr(xmlRelaxNGValidErr val ATTRIBUTE_UNUSED) {
1120}
1121
1122#define gen_nb_xmlSchemaContentType 4
1123static xmlSchemaContentType gen_xmlSchemaContentType(int no, int nr ATTRIBUTE_UNUSED) {
1124 if (no == 1) return(XML_SCHEMA_CONTENT_ANY);
1125 if (no == 2) return(XML_SCHEMA_CONTENT_BASIC);
1126 if (no == 3) return(XML_SCHEMA_CONTENT_ELEMENTS);
1127 if (no == 4) return(XML_SCHEMA_CONTENT_EMPTY);
1128 return(0);
1129}
1130static void des_xmlSchemaContentType(int no ATTRIBUTE_UNUSED, xmlSchemaContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1131}
1132static void desret_xmlSchemaContentType(xmlSchemaContentType val ATTRIBUTE_UNUSED) {
1133}
1134
1135#define gen_nb_xmlSchemaTypeType 4
1136static xmlSchemaTypeType gen_xmlSchemaTypeType(int no, int nr ATTRIBUTE_UNUSED) {
1137 if (no == 1) return(XML_SCHEMA_FACET_ENUMERATION);
1138 if (no == 2) return(XML_SCHEMA_FACET_FRACTIONDIGITS);
1139 if (no == 3) return(XML_SCHEMA_FACET_LENGTH);
1140 if (no == 4) return(XML_SCHEMA_FACET_MAXEXCLUSIVE);
1141 return(0);
1142}
1143static void des_xmlSchemaTypeType(int no ATTRIBUTE_UNUSED, xmlSchemaTypeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1144}
1145static void desret_xmlSchemaTypeType(xmlSchemaTypeType val ATTRIBUTE_UNUSED) {
1146}
1147
1148#define gen_nb_xmlSchemaValType 4
1149static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1150 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1151 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1152 if (no == 3) return(XML_SCHEMAS_ANYURI);
1153 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1154 return(0);
1155}
1156static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1157}
1158static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED) {
1159}
1160
1161#define gen_nb_xmlSchemaValidError 4
1162static xmlSchemaValidError gen_xmlSchemaValidError(int no, int nr ATTRIBUTE_UNUSED) {
1163 if (no == 1) return(XML_SCHEMAS_ERR_);
1164 if (no == 2) return(XML_SCHEMAS_ERR_ATTRINVALID);
1165 if (no == 3) return(XML_SCHEMAS_ERR_ATTRUNKNOWN);
1166 if (no == 4) return(XML_SCHEMAS_ERR_CONSTRUCT);
1167 return(0);
1168}
1169static void des_xmlSchemaValidError(int no ATTRIBUTE_UNUSED, xmlSchemaValidError val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1170}
1171static void desret_xmlSchemaValidError(xmlSchemaValidError val ATTRIBUTE_UNUSED) {
1172}
1173
1174#define gen_nb_xmlSchemaValidOption 1
1175static xmlSchemaValidOption gen_xmlSchemaValidOption(int no, int nr ATTRIBUTE_UNUSED) {
1176 if (no == 1) return(XML_SCHEMA_VAL_VC_I_CREATE);
1177 return(0);
1178}
1179static void des_xmlSchemaValidOption(int no ATTRIBUTE_UNUSED, xmlSchemaValidOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1180}
1181static void desret_xmlSchemaValidOption(xmlSchemaValidOption val ATTRIBUTE_UNUSED) {
1182}
1183
1184#define gen_nb_xmlTextReaderMode 4
1185static xmlTextReaderMode gen_xmlTextReaderMode(int no, int nr ATTRIBUTE_UNUSED) {
1186 if (no == 1) return(XML_TEXTREADER_MODE_CLOSED);
1187 if (no == 2) return(XML_TEXTREADER_MODE_EOF);
1188 if (no == 3) return(XML_TEXTREADER_MODE_ERROR);
1189 if (no == 4) return(XML_TEXTREADER_MODE_INITIAL);
1190 return(0);
1191}
1192static void des_xmlTextReaderMode(int no ATTRIBUTE_UNUSED, xmlTextReaderMode val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1193}
1194static void desret_xmlTextReaderMode(xmlTextReaderMode val ATTRIBUTE_UNUSED) {
1195}
1196
1197#define gen_nb_xmlXPathError 4
1198static xmlXPathError gen_xmlXPathError(int no, int nr ATTRIBUTE_UNUSED) {
1199 if (no == 1) return(XPATH_ENCODING_ERROR);
1200 if (no == 2) return(XPATH_EXPRESSION_OK);
1201 if (no == 3) return(XPATH_EXPR_ERROR);
1202 if (no == 4) return(XPATH_INVALID_ARITY);
1203 return(0);
1204}
1205static void des_xmlXPathError(int no ATTRIBUTE_UNUSED, xmlXPathError val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1206}
1207static void desret_xmlXPathError(xmlXPathError val ATTRIBUTE_UNUSED) {
1208}
1209
1210#define gen_nb_xmlXPathObjectType 4
1211static xmlXPathObjectType gen_xmlXPathObjectType(int no, int nr ATTRIBUTE_UNUSED) {
1212 if (no == 1) return(XPATH_BOOLEAN);
1213 if (no == 2) return(XPATH_LOCATIONSET);
1214 if (no == 3) return(XPATH_NODESET);
1215 if (no == 4) return(XPATH_NUMBER);
1216 return(0);
1217}
1218static void des_xmlXPathObjectType(int no ATTRIBUTE_UNUSED, xmlXPathObjectType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1219}
1220static void desret_xmlXPathObjectType(xmlXPathObjectType val ATTRIBUTE_UNUSED) {
1221}
1222
Daniel Veillard34099b42004-11-04 17:34:35 +00001223#include <libxml/HTMLparser.h>
1224#include <libxml/HTMLtree.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001225#include <libxml/SAX2.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001226#include <libxml/c14n.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001227#include <libxml/catalog.h>
1228#include <libxml/chvalid.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001229#include <libxml/debugXML.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001230#include <libxml/dict.h>
1231#include <libxml/encoding.h>
1232#include <libxml/entities.h>
1233#include <libxml/hash.h>
1234#include <libxml/list.h>
1235#include <libxml/nanoftp.h>
1236#include <libxml/nanohttp.h>
1237#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001238#include <libxml/parserInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001239#include <libxml/pattern.h>
1240#include <libxml/relaxng.h>
1241#include <libxml/schemasInternals.h>
1242#include <libxml/tree.h>
1243#include <libxml/uri.h>
1244#include <libxml/valid.h>
1245#include <libxml/xinclude.h>
1246#include <libxml/xmlIO.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001247#include <libxml/xmlautomata.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001248#include <libxml/xmlerror.h>
1249#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001250#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001251#include <libxml/xmlsave.h>
1252#include <libxml/xmlschemas.h>
1253#include <libxml/xmlschemastypes.h>
1254#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001255#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001256#include <libxml/xmlwriter.h>
1257#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001258#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001259#include <libxml/xpointer.h>
1260static int test_HTMLparser(void);
1261static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001262static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001263static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001264static int test_catalog(void);
1265static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001266static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001267static int test_dict(void);
1268static int test_encoding(void);
1269static int test_entities(void);
1270static int test_hash(void);
1271static int test_list(void);
1272static int test_nanoftp(void);
1273static int test_nanohttp(void);
1274static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001275static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001276static int test_pattern(void);
1277static int test_relaxng(void);
1278static int test_schemasInternals(void);
1279static int test_tree(void);
1280static int test_uri(void);
1281static int test_valid(void);
1282static int test_xinclude(void);
1283static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001284static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001285static int test_xmlerror(void);
1286static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001287static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001288static int test_xmlsave(void);
1289static int test_xmlschemas(void);
1290static int test_xmlschemastypes(void);
1291static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001292static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001293static int test_xmlwriter(void);
1294static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001295static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001296static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001297
1298/**
1299 * testlibxml2:
1300 *
1301 * Main entry point of the tester for the full libxml2 module,
1302 * it calls all the tester entry point for each module.
1303 *
1304 * Returns the number of error found
1305 */
1306static int
1307testlibxml2(void)
1308{
Daniel Veillard42595322004-11-08 10:52:06 +00001309 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001310
Daniel Veillard42595322004-11-08 10:52:06 +00001311 test_ret += test_HTMLparser();
1312 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001313 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001314 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001315 test_ret += test_catalog();
1316 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001317 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001318 test_ret += test_dict();
1319 test_ret += test_encoding();
1320 test_ret += test_entities();
1321 test_ret += test_hash();
1322 test_ret += test_list();
1323 test_ret += test_nanoftp();
1324 test_ret += test_nanohttp();
1325 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001326 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001327 test_ret += test_pattern();
1328 test_ret += test_relaxng();
1329 test_ret += test_schemasInternals();
1330 test_ret += test_tree();
1331 test_ret += test_uri();
1332 test_ret += test_valid();
1333 test_ret += test_xinclude();
1334 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001335 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001336 test_ret += test_xmlerror();
1337 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001338 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001339 test_ret += test_xmlsave();
1340 test_ret += test_xmlschemas();
1341 test_ret += test_xmlschemastypes();
1342 test_ret += test_xmlstring();
1343 test_ret += test_xmlunicode();
1344 test_ret += test_xmlwriter();
1345 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001346 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001347 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001348
Daniel Veillard3d97e662004-11-04 10:49:00 +00001349 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001350 function_tests, call_tests, test_ret);
1351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001352}
1353
1354
Daniel Veillardce682bc2004-11-05 17:22:25 +00001355#define gen_nb_unsigned_char_ptr 1
1356static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1357 return(NULL);
1358}
1359static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1360}
1361
1362#define gen_nb_const_unsigned_char_ptr 1
1363static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1364 return(NULL);
1365}
1366static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1367}
1368
Daniel Veillardd93f6252004-11-02 15:53:51 +00001369static int
1370test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001371 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001372
Daniel Veillardce682bc2004-11-05 17:22:25 +00001373#ifdef LIBXML_HTML_ENABLED
1374 int mem_base;
1375 int ret_val;
1376 unsigned char * out; /* a pointer to an array of bytes to store the result */
1377 int n_out;
1378 int * outlen; /* the length of @out */
1379 int n_outlen;
1380 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1381 int n_in;
1382 int * inlen; /* the length of @in */
1383 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001384
Daniel Veillardce682bc2004-11-05 17:22:25 +00001385 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1386 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1387 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1388 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1389 mem_base = xmlMemBlocks();
1390 out = gen_unsigned_char_ptr(n_out, 0);
1391 outlen = gen_int_ptr(n_outlen, 1);
1392 in = gen_const_unsigned_char_ptr(n_in, 2);
1393 inlen = gen_int_ptr(n_inlen, 3);
1394
1395 ret_val = UTF8ToHtml(out, outlen, in, inlen);
1396 desret_int(ret_val);
1397 call_tests++;
1398 des_unsigned_char_ptr(n_out, out, 0);
1399 des_int_ptr(n_outlen, outlen, 1);
1400 des_const_unsigned_char_ptr(n_in, in, 2);
1401 des_int_ptr(n_inlen, inlen, 3);
1402 xmlResetLastError();
1403 if (mem_base != xmlMemBlocks()) {
1404 printf("Leak of %d blocks found in UTF8ToHtml",
1405 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001406 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001407 printf(" %d", n_out);
1408 printf(" %d", n_outlen);
1409 printf(" %d", n_in);
1410 printf(" %d", n_inlen);
1411 printf("\n");
1412 }
1413 }
1414 }
1415 }
1416 }
1417#endif
1418
1419 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001420 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001421}
1422
1423
Daniel Veillardce682bc2004-11-05 17:22:25 +00001424#define gen_nb_const_htmlElemDesc_ptr 1
1425static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1426 return(NULL);
1427}
1428static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1429}
1430
Daniel Veillardd93f6252004-11-02 15:53:51 +00001431static int
1432test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001433 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001434
Daniel Veillard57b25162004-11-06 14:50:18 +00001435#ifdef LIBXML_HTML_ENABLED
1436 int mem_base;
1437 htmlStatus ret_val;
1438 htmlElemDesc * elt; /* HTML element */
1439 int n_elt;
1440 xmlChar * attr; /* HTML attribute */
1441 int n_attr;
1442 int legacy; /* whether to allow deprecated attributes */
1443 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001444
Daniel Veillard57b25162004-11-06 14:50:18 +00001445 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1446 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1447 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1448 mem_base = xmlMemBlocks();
1449 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1450 attr = gen_const_xmlChar_ptr(n_attr, 1);
1451 legacy = gen_int(n_legacy, 2);
1452
1453 ret_val = htmlAttrAllowed(elt, attr, legacy);
1454 desret_htmlStatus(ret_val);
1455 call_tests++;
1456 des_const_htmlElemDesc_ptr(n_elt, elt, 0);
1457 des_const_xmlChar_ptr(n_attr, attr, 1);
1458 des_int(n_legacy, legacy, 2);
1459 xmlResetLastError();
1460 if (mem_base != xmlMemBlocks()) {
1461 printf("Leak of %d blocks found in htmlAttrAllowed",
1462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001463 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001464 printf(" %d", n_elt);
1465 printf(" %d", n_attr);
1466 printf(" %d", n_legacy);
1467 printf("\n");
1468 }
1469 }
1470 }
1471 }
1472#endif
1473
1474 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001475 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001476}
1477
1478
1479static int
1480test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001481 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001482
Daniel Veillarda03e3652004-11-02 18:45:30 +00001483#ifdef LIBXML_HTML_ENABLED
1484 int mem_base;
1485 int ret_val;
1486 htmlDocPtr doc; /* the HTML document */
1487 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001488 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001489 int n_name;
1490 htmlNodePtr elem; /* the HTML element */
1491 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001492
Daniel Veillarda03e3652004-11-02 18:45:30 +00001493 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
1494 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1495 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
1496 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001497 doc = gen_xmlDocPtr(n_doc, 0);
1498 name = gen_const_xmlChar_ptr(n_name, 1);
1499 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001500
1501 ret_val = htmlAutoCloseTag(doc, name, elem);
1502 desret_int(ret_val);
1503 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001504 des_xmlDocPtr(n_doc, doc, 0);
1505 des_const_xmlChar_ptr(n_name, name, 1);
1506 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001507 xmlResetLastError();
1508 if (mem_base != xmlMemBlocks()) {
1509 printf("Leak of %d blocks found in htmlAutoCloseTag",
1510 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001511 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001512 printf(" %d", n_doc);
1513 printf(" %d", n_name);
1514 printf(" %d", n_elem);
1515 printf("\n");
1516 }
1517 }
1518 }
1519 }
1520#endif
1521
Daniel Veillard3d97e662004-11-04 10:49:00 +00001522 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001524}
1525
1526
1527static int
1528test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001530
Daniel Veillard34099b42004-11-04 17:34:35 +00001531#ifdef LIBXML_HTML_ENABLED
1532 int mem_base;
1533 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001534 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001535 int n_buffer;
1536 int size; /* the size of the array */
1537 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001538
Daniel Veillard34099b42004-11-04 17:34:35 +00001539 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1540 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1541 mem_base = xmlMemBlocks();
1542 buffer = gen_const_char_ptr(n_buffer, 0);
1543 size = gen_int(n_size, 1);
1544
1545 ret_val = htmlCreateMemoryParserCtxt(buffer, size);
1546 desret_xmlParserCtxtPtr(ret_val);
1547 call_tests++;
1548 des_const_char_ptr(n_buffer, buffer, 0);
1549 des_int(n_size, size, 1);
1550 xmlResetLastError();
1551 if (mem_base != xmlMemBlocks()) {
1552 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001554 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001555 printf(" %d", n_buffer);
1556 printf(" %d", n_size);
1557 printf("\n");
1558 }
1559 }
1560 }
1561#endif
1562
1563 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001565}
1566
1567
Daniel Veillardce682bc2004-11-05 17:22:25 +00001568#define gen_nb_htmlSAXHandlerPtr 1
1569static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1570 return(NULL);
1571}
1572static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1573}
1574
Daniel Veillardd93f6252004-11-02 15:53:51 +00001575static int
1576test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001577 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001578
Daniel Veillardce682bc2004-11-05 17:22:25 +00001579#ifdef LIBXML_HTML_ENABLED
1580#ifdef LIBXML_PUSH_ENABLED
1581 int mem_base;
1582 htmlParserCtxtPtr ret_val;
1583 htmlSAXHandlerPtr sax; /* a SAX handler */
1584 int n_sax;
1585 void * user_data; /* The user data returned on SAX callbacks */
1586 int n_user_data;
1587 char * chunk; /* a pointer to an array of chars */
1588 int n_chunk;
1589 int size; /* number of chars in the array */
1590 int n_size;
1591 const char * filename; /* an optional file name or URI */
1592 int n_filename;
1593 xmlCharEncoding enc; /* an optional encoding */
1594 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001595
Daniel Veillardce682bc2004-11-05 17:22:25 +00001596 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1597 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1598 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1599 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001600 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001601 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1602 mem_base = xmlMemBlocks();
1603 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1604 user_data = gen_userdata(n_user_data, 1);
1605 chunk = gen_const_char_ptr(n_chunk, 2);
1606 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001607 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001608 enc = gen_xmlCharEncoding(n_enc, 5);
1609
1610 ret_val = htmlCreatePushParserCtxt(sax, user_data, chunk, size, filename, enc);
1611 desret_xmlParserCtxtPtr(ret_val);
1612 call_tests++;
1613 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1614 des_userdata(n_user_data, user_data, 1);
1615 des_const_char_ptr(n_chunk, chunk, 2);
1616 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001617 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001618 des_xmlCharEncoding(n_enc, enc, 5);
1619 xmlResetLastError();
1620 if (mem_base != xmlMemBlocks()) {
1621 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1622 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001623 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001624 printf(" %d", n_sax);
1625 printf(" %d", n_user_data);
1626 printf(" %d", n_chunk);
1627 printf(" %d", n_size);
1628 printf(" %d", n_filename);
1629 printf(" %d", n_enc);
1630 printf("\n");
1631 }
1632 }
1633 }
1634 }
1635 }
1636 }
1637 }
1638#endif
1639#endif
1640
1641 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001643}
1644
1645
1646static int
1647test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001649
Daniel Veillarda03e3652004-11-02 18:45:30 +00001650#ifdef LIBXML_HTML_ENABLED
1651 int mem_base;
1652 htmlDocPtr ret_val;
1653 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1654 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001655 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001656 int n_cur;
1657 const char * URL; /* the base URL to use for the document */
1658 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001659 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001660 int n_encoding;
1661 int options; /* a combination of htmlParserOption(s) */
1662 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001663
Daniel Veillarda03e3652004-11-02 18:45:30 +00001664 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
1665 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1666 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1667 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1668 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1669 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001670 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
1671 cur = gen_const_xmlChar_ptr(n_cur, 1);
1672 URL = gen_filepath(n_URL, 2);
1673 encoding = gen_const_char_ptr(n_encoding, 3);
1674 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001675
Daniel Veillarda03e3652004-11-02 18:45:30 +00001676 ret_val = htmlCtxtReadDoc(ctxt, cur, URL, encoding, options);
1677 desret_xmlDocPtr(ret_val);
1678 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001679 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
1680 des_const_xmlChar_ptr(n_cur, cur, 1);
1681 des_filepath(n_URL, URL, 2);
1682 des_const_char_ptr(n_encoding, encoding, 3);
1683 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001684 xmlResetLastError();
1685 if (mem_base != xmlMemBlocks()) {
1686 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1687 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001688 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001689 printf(" %d", n_ctxt);
1690 printf(" %d", n_cur);
1691 printf(" %d", n_URL);
1692 printf(" %d", n_encoding);
1693 printf(" %d", n_options);
1694 printf("\n");
1695 }
1696 }
1697 }
1698 }
1699 }
1700 }
1701#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001702
Daniel Veillard3d97e662004-11-04 10:49:00 +00001703 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001704 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001705}
1706
1707
1708static int
1709test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001710 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001711
Daniel Veillarda03e3652004-11-02 18:45:30 +00001712#ifdef LIBXML_HTML_ENABLED
1713 int mem_base;
1714 htmlDocPtr ret_val;
1715 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1716 int n_ctxt;
1717 const char * filename; /* a file or URL */
1718 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001719 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001720 int n_encoding;
1721 int options; /* a combination of htmlParserOption(s) */
1722 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001723
Daniel Veillarda03e3652004-11-02 18:45:30 +00001724 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
1725 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1726 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1727 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1728 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001729 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
1730 filename = gen_filepath(n_filename, 1);
1731 encoding = gen_const_char_ptr(n_encoding, 2);
1732 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001733
1734 ret_val = htmlCtxtReadFile(ctxt, filename, encoding, options);
1735 desret_xmlDocPtr(ret_val);
1736 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001737 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
1738 des_filepath(n_filename, filename, 1);
1739 des_const_char_ptr(n_encoding, encoding, 2);
1740 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001741 xmlResetLastError();
1742 if (mem_base != xmlMemBlocks()) {
1743 printf("Leak of %d blocks found in htmlCtxtReadFile",
1744 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001745 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001746 printf(" %d", n_ctxt);
1747 printf(" %d", n_filename);
1748 printf(" %d", n_encoding);
1749 printf(" %d", n_options);
1750 printf("\n");
1751 }
1752 }
1753 }
1754 }
1755 }
1756#endif
1757
Daniel Veillard3d97e662004-11-04 10:49:00 +00001758 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001759 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001760}
1761
1762
1763static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001764test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001765 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001766
Daniel Veillarda03e3652004-11-02 18:45:30 +00001767#ifdef LIBXML_HTML_ENABLED
1768 int mem_base;
1769 htmlDocPtr ret_val;
1770 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1771 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001772 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001773 int n_buffer;
1774 int size; /* the size of the array */
1775 int n_size;
1776 const char * URL; /* the base URL to use for the document */
1777 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001778 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001779 int n_encoding;
1780 int options; /* a combination of htmlParserOption(s) */
1781 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001782
Daniel Veillarda03e3652004-11-02 18:45:30 +00001783 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
1784 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1785 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1786 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1787 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1788 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1789 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001790 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
1791 buffer = gen_const_char_ptr(n_buffer, 1);
1792 size = gen_int(n_size, 2);
1793 URL = gen_filepath(n_URL, 3);
1794 encoding = gen_const_char_ptr(n_encoding, 4);
1795 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001796
1797 ret_val = htmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options);
1798 desret_xmlDocPtr(ret_val);
1799 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001800 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
1801 des_const_char_ptr(n_buffer, buffer, 1);
1802 des_int(n_size, size, 2);
1803 des_filepath(n_URL, URL, 3);
1804 des_const_char_ptr(n_encoding, encoding, 4);
1805 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001806 xmlResetLastError();
1807 if (mem_base != xmlMemBlocks()) {
1808 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001810 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001811 printf(" %d", n_ctxt);
1812 printf(" %d", n_buffer);
1813 printf(" %d", n_size);
1814 printf(" %d", n_URL);
1815 printf(" %d", n_encoding);
1816 printf(" %d", n_options);
1817 printf("\n");
1818 }
1819 }
1820 }
1821 }
1822 }
1823 }
1824 }
1825#endif
1826
Daniel Veillard3d97e662004-11-04 10:49:00 +00001827 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001829}
1830
1831
1832static int
1833test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001835
Daniel Veillarda03e3652004-11-02 18:45:30 +00001836#ifdef LIBXML_HTML_ENABLED
1837 int mem_base;
1838 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1839 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001840
Daniel Veillarda03e3652004-11-02 18:45:30 +00001841 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
1842 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001843 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001844
1845 htmlCtxtReset(ctxt);
1846 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001847 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001848 xmlResetLastError();
1849 if (mem_base != xmlMemBlocks()) {
1850 printf("Leak of %d blocks found in htmlCtxtReset",
1851 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001852 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001853 printf(" %d", n_ctxt);
1854 printf("\n");
1855 }
1856 }
1857#endif
1858
Daniel Veillard3d97e662004-11-04 10:49:00 +00001859 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001860 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001861}
1862
1863
1864static int
1865test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001866 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001867
Daniel Veillarda03e3652004-11-02 18:45:30 +00001868#ifdef LIBXML_HTML_ENABLED
1869 int mem_base;
1870 int ret_val;
1871 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1872 int n_ctxt;
1873 int options; /* a combination of htmlParserOption(s) */
1874 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001875
Daniel Veillarda03e3652004-11-02 18:45:30 +00001876 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
1877 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1878 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001879 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
1880 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001881
1882 ret_val = htmlCtxtUseOptions(ctxt, options);
1883 desret_int(ret_val);
1884 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001885 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
1886 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001887 xmlResetLastError();
1888 if (mem_base != xmlMemBlocks()) {
1889 printf("Leak of %d blocks found in htmlCtxtUseOptions",
1890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001891 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001892 printf(" %d", n_ctxt);
1893 printf(" %d", n_options);
1894 printf("\n");
1895 }
1896 }
1897 }
1898#endif
1899
Daniel Veillard3d97e662004-11-04 10:49:00 +00001900 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001902}
1903
1904
1905static int
1906test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001908
Daniel Veillardce682bc2004-11-05 17:22:25 +00001909#ifdef LIBXML_HTML_ENABLED
1910 int mem_base;
1911 int ret_val;
1912 htmlElemDesc * parent; /* HTML parent element */
1913 int n_parent;
1914 xmlChar * elt; /* HTML element */
1915 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001916
Daniel Veillardce682bc2004-11-05 17:22:25 +00001917 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1918 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
1919 mem_base = xmlMemBlocks();
1920 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1921 elt = gen_const_xmlChar_ptr(n_elt, 1);
1922
1923 ret_val = htmlElementAllowedHere(parent, elt);
1924 desret_int(ret_val);
1925 call_tests++;
1926 des_const_htmlElemDesc_ptr(n_parent, parent, 0);
1927 des_const_xmlChar_ptr(n_elt, elt, 1);
1928 xmlResetLastError();
1929 if (mem_base != xmlMemBlocks()) {
1930 printf("Leak of %d blocks found in htmlElementAllowedHere",
1931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001932 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001933 printf(" %d", n_parent);
1934 printf(" %d", n_elt);
1935 printf("\n");
1936 }
1937 }
1938 }
1939#endif
1940
1941 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001942 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001943}
1944
1945
1946static int
1947test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001948 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001949
Daniel Veillard57b25162004-11-06 14:50:18 +00001950#ifdef LIBXML_HTML_ENABLED
1951 int mem_base;
1952 htmlStatus ret_val;
1953 htmlElemDesc * parent; /* HTML parent element */
1954 int n_parent;
1955 htmlElemDesc * elt; /* HTML element */
1956 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001957
Daniel Veillard57b25162004-11-06 14:50:18 +00001958 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1959 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1960 mem_base = xmlMemBlocks();
1961 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1962 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1963
1964 ret_val = htmlElementStatusHere(parent, elt);
1965 desret_htmlStatus(ret_val);
1966 call_tests++;
1967 des_const_htmlElemDesc_ptr(n_parent, parent, 0);
1968 des_const_htmlElemDesc_ptr(n_elt, elt, 1);
1969 xmlResetLastError();
1970 if (mem_base != xmlMemBlocks()) {
1971 printf("Leak of %d blocks found in htmlElementStatusHere",
1972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001973 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001974 printf(" %d", n_parent);
1975 printf(" %d", n_elt);
1976 printf("\n");
1977 }
1978 }
1979 }
1980#endif
1981
1982 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001983 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001984}
1985
1986
1987static int
1988test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001989 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001990
Daniel Veillardce682bc2004-11-05 17:22:25 +00001991#ifdef LIBXML_HTML_ENABLED
1992 int mem_base;
1993 int ret_val;
1994 unsigned char * out; /* a pointer to an array of bytes to store the result */
1995 int n_out;
1996 int * outlen; /* the length of @out */
1997 int n_outlen;
1998 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1999 int n_in;
2000 int * inlen; /* the length of @in */
2001 int n_inlen;
2002 int quoteChar; /* the quote character to escape (' or ") or zero. */
2003 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002004
Daniel Veillardce682bc2004-11-05 17:22:25 +00002005 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
2006 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
2007 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
2008 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
2009 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
2010 mem_base = xmlMemBlocks();
2011 out = gen_unsigned_char_ptr(n_out, 0);
2012 outlen = gen_int_ptr(n_outlen, 1);
2013 in = gen_const_unsigned_char_ptr(n_in, 2);
2014 inlen = gen_int_ptr(n_inlen, 3);
2015 quoteChar = gen_int(n_quoteChar, 4);
2016
2017 ret_val = htmlEncodeEntities(out, outlen, in, inlen, quoteChar);
2018 desret_int(ret_val);
2019 call_tests++;
2020 des_unsigned_char_ptr(n_out, out, 0);
2021 des_int_ptr(n_outlen, outlen, 1);
2022 des_const_unsigned_char_ptr(n_in, in, 2);
2023 des_int_ptr(n_inlen, inlen, 3);
2024 des_int(n_quoteChar, quoteChar, 4);
2025 xmlResetLastError();
2026 if (mem_base != xmlMemBlocks()) {
2027 printf("Leak of %d blocks found in htmlEncodeEntities",
2028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002029 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002030 printf(" %d", n_out);
2031 printf(" %d", n_outlen);
2032 printf(" %d", n_in);
2033 printf(" %d", n_inlen);
2034 printf(" %d", n_quoteChar);
2035 printf("\n");
2036 }
2037 }
2038 }
2039 }
2040 }
2041 }
2042#endif
2043
2044 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002046}
2047
2048
2049static int
2050test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002052
Daniel Veillard42595322004-11-08 10:52:06 +00002053#ifdef LIBXML_HTML_ENABLED
2054 int mem_base;
2055 const htmlEntityDesc * ret_val;
2056 xmlChar * name; /* the entity name */
2057 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002058
Daniel Veillard42595322004-11-08 10:52:06 +00002059 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2060 mem_base = xmlMemBlocks();
2061 name = gen_const_xmlChar_ptr(n_name, 0);
2062
2063 ret_val = htmlEntityLookup(name);
2064 desret_const_htmlEntityDesc_ptr(ret_val);
2065 call_tests++;
2066 des_const_xmlChar_ptr(n_name, name, 0);
2067 xmlResetLastError();
2068 if (mem_base != xmlMemBlocks()) {
2069 printf("Leak of %d blocks found in htmlEntityLookup",
2070 xmlMemBlocks() - mem_base);
2071 test_ret++;
2072 printf(" %d", n_name);
2073 printf("\n");
2074 }
2075 }
2076#endif
2077
2078 function_tests++;
2079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002080}
2081
2082
2083static int
2084test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002086
Daniel Veillard42595322004-11-08 10:52:06 +00002087#ifdef LIBXML_HTML_ENABLED
2088 int mem_base;
2089 const htmlEntityDesc * ret_val;
2090 unsigned int value; /* the entity's unicode value */
2091 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002092
Daniel Veillard42595322004-11-08 10:52:06 +00002093 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
2094 mem_base = xmlMemBlocks();
2095 value = gen_unsigned_int(n_value, 0);
2096
2097 ret_val = htmlEntityValueLookup(value);
2098 desret_const_htmlEntityDesc_ptr(ret_val);
2099 call_tests++;
2100 des_unsigned_int(n_value, value, 0);
2101 xmlResetLastError();
2102 if (mem_base != xmlMemBlocks()) {
2103 printf("Leak of %d blocks found in htmlEntityValueLookup",
2104 xmlMemBlocks() - mem_base);
2105 test_ret++;
2106 printf(" %d", n_value);
2107 printf("\n");
2108 }
2109 }
2110#endif
2111
2112 function_tests++;
2113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002114}
2115
2116
2117static int
2118test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002120
2121#ifdef LIBXML_HTML_ENABLED
2122 int mem_base;
2123 int ret_val;
2124 int val; /* int 0 or 1 */
2125 int n_val;
2126
2127 for (n_val = 0;n_val < gen_nb_int;n_val++) {
2128 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002129 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002130
2131 ret_val = htmlHandleOmittedElem(val);
2132 desret_int(ret_val);
2133 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002134 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002135 xmlResetLastError();
2136 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002137 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002139 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002140 printf(" %d", n_val);
2141 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002142 }
2143 }
2144#endif
2145
Daniel Veillard3d97e662004-11-04 10:49:00 +00002146 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002148}
2149
2150
2151static int
2152test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002154
Daniel Veillarda03e3652004-11-02 18:45:30 +00002155#ifdef LIBXML_HTML_ENABLED
2156 int mem_base;
2157 int ret_val;
2158 htmlDocPtr doc; /* the HTML document */
2159 int n_doc;
2160 htmlNodePtr elem; /* the HTML element */
2161 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002162
Daniel Veillarda03e3652004-11-02 18:45:30 +00002163 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
2164 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
2165 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002166 doc = gen_xmlDocPtr(n_doc, 0);
2167 elem = gen_xmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002168
2169 ret_val = htmlIsAutoClosed(doc, elem);
2170 desret_int(ret_val);
2171 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002172 des_xmlDocPtr(n_doc, doc, 0);
2173 des_xmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002174 xmlResetLastError();
2175 if (mem_base != xmlMemBlocks()) {
2176 printf("Leak of %d blocks found in htmlIsAutoClosed",
2177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002178 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002179 printf(" %d", n_doc);
2180 printf(" %d", n_elem);
2181 printf("\n");
2182 }
2183 }
2184 }
2185#endif
2186
Daniel Veillard3d97e662004-11-04 10:49:00 +00002187 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002188 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002189}
2190
2191
2192static int
2193test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002195
2196#ifdef LIBXML_HTML_ENABLED
2197 int mem_base;
2198 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002199 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002200 int n_name;
2201
2202 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2203 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002204 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002205
2206 ret_val = htmlIsScriptAttribute(name);
2207 desret_int(ret_val);
2208 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002209 des_const_xmlChar_ptr(n_name, name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002210 xmlResetLastError();
2211 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002212 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002213 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002214 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002215 printf(" %d", n_name);
2216 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002217 }
2218 }
2219#endif
2220
Daniel Veillard3d97e662004-11-04 10:49:00 +00002221 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002223}
2224
2225
Daniel Veillardce682bc2004-11-05 17:22:25 +00002226#define gen_nb_const_xmlNodePtr 1
2227static htmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2228 return(NULL);
2229}
2230static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2231}
2232
Daniel Veillardd93f6252004-11-02 15:53:51 +00002233static int
2234test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002236
Daniel Veillard57b25162004-11-06 14:50:18 +00002237#ifdef LIBXML_HTML_ENABLED
2238 int mem_base;
2239 htmlStatus ret_val;
2240 htmlNodePtr node; /* an htmlNodePtr in a tree */
2241 int n_node;
2242 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2243 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002244
Daniel Veillard57b25162004-11-06 14:50:18 +00002245 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
2246 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2247 mem_base = xmlMemBlocks();
2248 node = gen_const_xmlNodePtr(n_node, 0);
2249 legacy = gen_int(n_legacy, 1);
2250
2251 ret_val = htmlNodeStatus(node, legacy);
2252 desret_htmlStatus(ret_val);
2253 call_tests++;
2254 des_const_xmlNodePtr(n_node, node, 0);
2255 des_int(n_legacy, legacy, 1);
2256 xmlResetLastError();
2257 if (mem_base != xmlMemBlocks()) {
2258 printf("Leak of %d blocks found in htmlNodeStatus",
2259 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002260 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002261 printf(" %d", n_node);
2262 printf(" %d", n_legacy);
2263 printf("\n");
2264 }
2265 }
2266 }
2267#endif
2268
2269 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002271}
2272
2273
2274static int
2275test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002277
Daniel Veillarda03e3652004-11-02 18:45:30 +00002278#ifdef LIBXML_HTML_ENABLED
2279 int mem_base;
2280 int ret_val;
2281 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2282 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002283
Daniel Veillarda03e3652004-11-02 18:45:30 +00002284 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
2285 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002286 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002287
2288 ret_val = htmlParseCharRef(ctxt);
2289 desret_int(ret_val);
2290 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002291 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002292 xmlResetLastError();
2293 if (mem_base != xmlMemBlocks()) {
2294 printf("Leak of %d blocks found in htmlParseCharRef",
2295 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002296 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002297 printf(" %d", n_ctxt);
2298 printf("\n");
2299 }
2300 }
2301#endif
2302
Daniel Veillard3d97e662004-11-04 10:49:00 +00002303 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002304 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002305}
2306
2307
2308static int
2309test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002310 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002311
Daniel Veillarda03e3652004-11-02 18:45:30 +00002312#ifdef LIBXML_HTML_ENABLED
2313#ifdef LIBXML_PUSH_ENABLED
2314 int mem_base;
2315 int ret_val;
2316 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2317 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002318 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002319 int n_chunk;
2320 int size; /* the size in byte of the chunk */
2321 int n_size;
2322 int terminate; /* last chunk indicator */
2323 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002324
Daniel Veillarda03e3652004-11-02 18:45:30 +00002325 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
2326 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2327 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2328 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2329 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002330 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
2331 chunk = gen_const_char_ptr(n_chunk, 1);
2332 size = gen_int(n_size, 2);
2333 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002334
2335 ret_val = htmlParseChunk(ctxt, chunk, size, terminate);
2336 desret_int(ret_val);
2337 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002338 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
2339 des_const_char_ptr(n_chunk, chunk, 1);
2340 des_int(n_size, size, 2);
2341 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002342 xmlResetLastError();
2343 if (mem_base != xmlMemBlocks()) {
2344 printf("Leak of %d blocks found in htmlParseChunk",
2345 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002346 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002347 printf(" %d", n_ctxt);
2348 printf(" %d", n_chunk);
2349 printf(" %d", n_size);
2350 printf(" %d", n_terminate);
2351 printf("\n");
2352 }
2353 }
2354 }
2355 }
2356 }
2357#endif
2358#endif
2359
Daniel Veillard3d97e662004-11-04 10:49:00 +00002360 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002361 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002362}
2363
2364
2365static int
2366test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002367 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002368
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002369#ifdef LIBXML_HTML_ENABLED
2370 int mem_base;
2371 htmlDocPtr ret_val;
2372 xmlChar * cur; /* a pointer to an array of xmlChar */
2373 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002374 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002375 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002376
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002377 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2378 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2379 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002380 cur = gen_xmlChar_ptr(n_cur, 0);
2381 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002382
2383 ret_val = htmlParseDoc(cur, encoding);
2384 desret_xmlDocPtr(ret_val);
2385 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002386 des_xmlChar_ptr(n_cur, cur, 0);
2387 des_const_char_ptr(n_encoding, encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002388 xmlResetLastError();
2389 if (mem_base != xmlMemBlocks()) {
2390 printf("Leak of %d blocks found in htmlParseDoc",
2391 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002392 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002393 printf(" %d", n_cur);
2394 printf(" %d", n_encoding);
2395 printf("\n");
2396 }
2397 }
2398 }
2399#endif
2400
Daniel Veillard3d97e662004-11-04 10:49:00 +00002401 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002402 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002403}
2404
2405
2406static int
2407test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002408 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002409
Daniel Veillarda03e3652004-11-02 18:45:30 +00002410#ifdef LIBXML_HTML_ENABLED
2411 int mem_base;
2412 int ret_val;
2413 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2414 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002415
Daniel Veillarda03e3652004-11-02 18:45:30 +00002416 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
2417 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002418 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002419
2420 ret_val = htmlParseDocument(ctxt);
2421 desret_int(ret_val);
2422 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002423 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002424 xmlResetLastError();
2425 if (mem_base != xmlMemBlocks()) {
2426 printf("Leak of %d blocks found in htmlParseDocument",
2427 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002428 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002429 printf(" %d", n_ctxt);
2430 printf("\n");
2431 }
2432 }
2433#endif
2434
Daniel Veillard3d97e662004-11-04 10:49:00 +00002435 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002436 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002437}
2438
2439
2440static int
2441test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002442 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002443
Daniel Veillarda03e3652004-11-02 18:45:30 +00002444#ifdef LIBXML_HTML_ENABLED
2445 int mem_base;
2446 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2447 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002448
Daniel Veillarda03e3652004-11-02 18:45:30 +00002449 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
2450 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002451 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002452
2453 htmlParseElement(ctxt);
2454 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002455 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002456 xmlResetLastError();
2457 if (mem_base != xmlMemBlocks()) {
2458 printf("Leak of %d blocks found in htmlParseElement",
2459 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002460 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002461 printf(" %d", n_ctxt);
2462 printf("\n");
2463 }
2464 }
2465#endif
2466
Daniel Veillard3d97e662004-11-04 10:49:00 +00002467 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002469}
2470
2471
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002472#define gen_nb_const_xmlChar_ptr_ptr 1
2473static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2474 return(NULL);
2475}
2476static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2477}
2478
Daniel Veillardd93f6252004-11-02 15:53:51 +00002479static int
2480test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002481 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002482
Daniel Veillard42595322004-11-08 10:52:06 +00002483#ifdef LIBXML_HTML_ENABLED
2484 int mem_base;
2485 const htmlEntityDesc * ret_val;
2486 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2487 int n_ctxt;
2488 xmlChar ** str; /* location to store the entity name */
2489 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002490
Daniel Veillard42595322004-11-08 10:52:06 +00002491 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
2492 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2493 mem_base = xmlMemBlocks();
2494 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
2495 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2496
2497 ret_val = htmlParseEntityRef(ctxt, str);
2498 desret_const_htmlEntityDesc_ptr(ret_val);
2499 call_tests++;
2500 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
2501 des_const_xmlChar_ptr_ptr(n_str, str, 1);
2502 xmlResetLastError();
2503 if (mem_base != xmlMemBlocks()) {
2504 printf("Leak of %d blocks found in htmlParseEntityRef",
2505 xmlMemBlocks() - mem_base);
2506 test_ret++;
2507 printf(" %d", n_ctxt);
2508 printf(" %d", n_str);
2509 printf("\n");
2510 }
2511 }
2512 }
2513#endif
2514
2515 function_tests++;
2516 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002517}
2518
2519
2520static int
2521test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002522 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002523
Daniel Veillarda03e3652004-11-02 18:45:30 +00002524#ifdef LIBXML_HTML_ENABLED
2525 htmlDocPtr ret_val;
2526 const char * filename; /* the filename */
2527 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002528 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002529 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002530
Daniel Veillarda03e3652004-11-02 18:45:30 +00002531 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2532 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002533 filename = gen_filepath(n_filename, 0);
2534 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002535
2536 ret_val = htmlParseFile(filename, encoding);
2537 desret_xmlDocPtr(ret_val);
2538 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002539 des_filepath(n_filename, filename, 0);
2540 des_const_char_ptr(n_encoding, encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002541 xmlResetLastError();
2542 }
2543 }
2544#endif
2545
Daniel Veillard3d97e662004-11-04 10:49:00 +00002546 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002547 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002548}
2549
2550
2551static int
2552test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002554
Daniel Veillarda03e3652004-11-02 18:45:30 +00002555#ifdef LIBXML_HTML_ENABLED
2556 int mem_base;
2557 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002558 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002559 int n_cur;
2560 const char * URL; /* the base URL to use for the document */
2561 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002562 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002563 int n_encoding;
2564 int options; /* a combination of htmlParserOption(s) */
2565 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002566
Daniel Veillarda03e3652004-11-02 18:45:30 +00002567 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2568 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2569 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2570 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2571 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002572 cur = gen_const_xmlChar_ptr(n_cur, 0);
2573 URL = gen_filepath(n_URL, 1);
2574 encoding = gen_const_char_ptr(n_encoding, 2);
2575 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002576
Daniel Veillarda03e3652004-11-02 18:45:30 +00002577 ret_val = htmlReadDoc(cur, URL, encoding, options);
2578 desret_xmlDocPtr(ret_val);
2579 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002580 des_const_xmlChar_ptr(n_cur, cur, 0);
2581 des_filepath(n_URL, URL, 1);
2582 des_const_char_ptr(n_encoding, encoding, 2);
2583 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002584 xmlResetLastError();
2585 if (mem_base != xmlMemBlocks()) {
2586 printf("Leak of %d blocks found in htmlReadDoc",
2587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002588 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002589 printf(" %d", n_cur);
2590 printf(" %d", n_URL);
2591 printf(" %d", n_encoding);
2592 printf(" %d", n_options);
2593 printf("\n");
2594 }
2595 }
2596 }
2597 }
2598 }
2599#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002600
Daniel Veillard3d97e662004-11-04 10:49:00 +00002601 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002603}
2604
2605
2606static int
2607test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002609
Daniel Veillarda03e3652004-11-02 18:45:30 +00002610#ifdef LIBXML_HTML_ENABLED
2611 int mem_base;
2612 htmlDocPtr ret_val;
2613 const char * filename; /* a file or URL */
2614 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002615 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002616 int n_encoding;
2617 int options; /* a combination of htmlParserOption(s) */
2618 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002619
Daniel Veillarda03e3652004-11-02 18:45:30 +00002620 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2621 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2622 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2623 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002624 filename = gen_filepath(n_filename, 0);
2625 encoding = gen_const_char_ptr(n_encoding, 1);
2626 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002627
2628 ret_val = htmlReadFile(filename, encoding, options);
2629 desret_xmlDocPtr(ret_val);
2630 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002631 des_filepath(n_filename, filename, 0);
2632 des_const_char_ptr(n_encoding, encoding, 1);
2633 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002634 xmlResetLastError();
2635 if (mem_base != xmlMemBlocks()) {
2636 printf("Leak of %d blocks found in htmlReadFile",
2637 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002638 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002639 printf(" %d", n_filename);
2640 printf(" %d", n_encoding);
2641 printf(" %d", n_options);
2642 printf("\n");
2643 }
2644 }
2645 }
2646 }
2647#endif
2648
Daniel Veillard3d97e662004-11-04 10:49:00 +00002649 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002651}
2652
2653
2654static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002655test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002657
Daniel Veillarda03e3652004-11-02 18:45:30 +00002658#ifdef LIBXML_HTML_ENABLED
2659 int mem_base;
2660 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002661 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002662 int n_buffer;
2663 int size; /* the size of the array */
2664 int n_size;
2665 const char * URL; /* the base URL to use for the document */
2666 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002667 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002668 int n_encoding;
2669 int options; /* a combination of htmlParserOption(s) */
2670 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002671
Daniel Veillarda03e3652004-11-02 18:45:30 +00002672 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2673 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2674 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2675 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2676 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2677 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002678 buffer = gen_const_char_ptr(n_buffer, 0);
2679 size = gen_int(n_size, 1);
2680 URL = gen_filepath(n_URL, 2);
2681 encoding = gen_const_char_ptr(n_encoding, 3);
2682 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002683
2684 ret_val = htmlReadMemory(buffer, size, URL, encoding, options);
2685 desret_xmlDocPtr(ret_val);
2686 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002687 des_const_char_ptr(n_buffer, buffer, 0);
2688 des_int(n_size, size, 1);
2689 des_filepath(n_URL, URL, 2);
2690 des_const_char_ptr(n_encoding, encoding, 3);
2691 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002692 xmlResetLastError();
2693 if (mem_base != xmlMemBlocks()) {
2694 printf("Leak of %d blocks found in htmlReadMemory",
2695 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002696 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002697 printf(" %d", n_buffer);
2698 printf(" %d", n_size);
2699 printf(" %d", n_URL);
2700 printf(" %d", n_encoding);
2701 printf(" %d", n_options);
2702 printf("\n");
2703 }
2704 }
2705 }
2706 }
2707 }
2708 }
2709#endif
2710
Daniel Veillard3d97e662004-11-04 10:49:00 +00002711 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002713}
2714
2715
2716static int
2717test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002719
Daniel Veillardce682bc2004-11-05 17:22:25 +00002720#ifdef LIBXML_HTML_ENABLED
2721 int mem_base;
2722 htmlDocPtr ret_val;
2723 xmlChar * cur; /* a pointer to an array of xmlChar */
2724 int n_cur;
2725 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2726 int n_encoding;
2727 htmlSAXHandlerPtr sax; /* the SAX handler block */
2728 int n_sax;
2729 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2730 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002731
Daniel Veillardce682bc2004-11-05 17:22:25 +00002732 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2733 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2734 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2735 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2736 mem_base = xmlMemBlocks();
2737 cur = gen_xmlChar_ptr(n_cur, 0);
2738 encoding = gen_const_char_ptr(n_encoding, 1);
2739 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2740 userData = gen_userdata(n_userData, 3);
2741
2742 ret_val = htmlSAXParseDoc(cur, encoding, sax, userData);
2743 desret_xmlDocPtr(ret_val);
2744 call_tests++;
2745 des_xmlChar_ptr(n_cur, cur, 0);
2746 des_const_char_ptr(n_encoding, encoding, 1);
2747 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2748 des_userdata(n_userData, userData, 3);
2749 xmlResetLastError();
2750 if (mem_base != xmlMemBlocks()) {
2751 printf("Leak of %d blocks found in htmlSAXParseDoc",
2752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002753 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002754 printf(" %d", n_cur);
2755 printf(" %d", n_encoding);
2756 printf(" %d", n_sax);
2757 printf(" %d", n_userData);
2758 printf("\n");
2759 }
2760 }
2761 }
2762 }
2763 }
2764#endif
2765
2766 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002767 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002768}
2769
2770
2771static int
2772test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002773 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002774
Daniel Veillardce682bc2004-11-05 17:22:25 +00002775#ifdef LIBXML_HTML_ENABLED
2776 int mem_base;
2777 htmlDocPtr ret_val;
2778 const char * filename; /* the filename */
2779 int n_filename;
2780 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2781 int n_encoding;
2782 htmlSAXHandlerPtr sax; /* the SAX handler block */
2783 int n_sax;
2784 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2785 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002786
Daniel Veillardce682bc2004-11-05 17:22:25 +00002787 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2788 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2789 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2790 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2791 mem_base = xmlMemBlocks();
2792 filename = gen_filepath(n_filename, 0);
2793 encoding = gen_const_char_ptr(n_encoding, 1);
2794 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2795 userData = gen_userdata(n_userData, 3);
2796
2797 ret_val = htmlSAXParseFile(filename, encoding, sax, userData);
2798 desret_xmlDocPtr(ret_val);
2799 call_tests++;
2800 des_filepath(n_filename, filename, 0);
2801 des_const_char_ptr(n_encoding, encoding, 1);
2802 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2803 des_userdata(n_userData, userData, 3);
2804 xmlResetLastError();
2805 if (mem_base != xmlMemBlocks()) {
2806 printf("Leak of %d blocks found in htmlSAXParseFile",
2807 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002808 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002809 printf(" %d", n_filename);
2810 printf(" %d", n_encoding);
2811 printf(" %d", n_sax);
2812 printf(" %d", n_userData);
2813 printf("\n");
2814 }
2815 }
2816 }
2817 }
2818 }
2819#endif
2820
2821 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002823}
2824
2825
2826static int
2827test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002829
2830
2831 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002832 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002833}
2834
2835static int
2836test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002837 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002838
Daniel Veillard42595322004-11-08 10:52:06 +00002839 printf("Testing HTMLparser : 31 of 37 functions ...\n");
2840 test_ret += test_UTF8ToHtml();
2841 test_ret += test_htmlAttrAllowed();
2842 test_ret += test_htmlAutoCloseTag();
2843 test_ret += test_htmlCreateMemoryParserCtxt();
2844 test_ret += test_htmlCreatePushParserCtxt();
2845 test_ret += test_htmlCtxtReadDoc();
2846 test_ret += test_htmlCtxtReadFile();
2847 test_ret += test_htmlCtxtReadMemory();
2848 test_ret += test_htmlCtxtReset();
2849 test_ret += test_htmlCtxtUseOptions();
2850 test_ret += test_htmlElementAllowedHere();
2851 test_ret += test_htmlElementStatusHere();
2852 test_ret += test_htmlEncodeEntities();
2853 test_ret += test_htmlEntityLookup();
2854 test_ret += test_htmlEntityValueLookup();
2855 test_ret += test_htmlHandleOmittedElem();
2856 test_ret += test_htmlIsAutoClosed();
2857 test_ret += test_htmlIsScriptAttribute();
2858 test_ret += test_htmlNodeStatus();
2859 test_ret += test_htmlParseCharRef();
2860 test_ret += test_htmlParseChunk();
2861 test_ret += test_htmlParseDoc();
2862 test_ret += test_htmlParseDocument();
2863 test_ret += test_htmlParseElement();
2864 test_ret += test_htmlParseEntityRef();
2865 test_ret += test_htmlParseFile();
2866 test_ret += test_htmlReadDoc();
2867 test_ret += test_htmlReadFile();
2868 test_ret += test_htmlReadMemory();
2869 test_ret += test_htmlSAXParseDoc();
2870 test_ret += test_htmlSAXParseFile();
2871 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00002872
Daniel Veillard42595322004-11-08 10:52:06 +00002873 if (test_ret != 0)
2874 printf("Module HTMLparser: %d errors\n", test_ret);
2875 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002876}
2877
2878static int
2879test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002880 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002881
Daniel Veillard3d97e662004-11-04 10:49:00 +00002882#ifdef LIBXML_HTML_ENABLED
2883#ifdef LIBXML_OUTPUT_ENABLED
2884 int mem_base;
2885 xmlOutputBufferPtr buf; /* the HTML buffer output */
2886 int n_buf;
2887 xmlDocPtr cur; /* the document */
2888 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002889 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002890 int n_encoding;
2891 int format; /* should formatting spaces been added */
2892 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002893
Daniel Veillard3d97e662004-11-04 10:49:00 +00002894 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2895 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2896 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2897 for (n_format = 0;n_format < gen_nb_int;n_format++) {
2898 mem_base = xmlMemBlocks();
2899 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2900 cur = gen_xmlDocPtr(n_cur, 1);
2901 encoding = gen_const_char_ptr(n_encoding, 2);
2902 format = gen_int(n_format, 3);
2903
2904 htmlDocContentDumpFormatOutput(buf, cur, encoding, format);
2905 call_tests++;
2906 des_xmlOutputBufferPtr(n_buf, buf, 0);
2907 des_xmlDocPtr(n_cur, cur, 1);
2908 des_const_char_ptr(n_encoding, encoding, 2);
2909 des_int(n_format, format, 3);
2910 xmlResetLastError();
2911 if (mem_base != xmlMemBlocks()) {
2912 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2913 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002914 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002915 printf(" %d", n_buf);
2916 printf(" %d", n_cur);
2917 printf(" %d", n_encoding);
2918 printf(" %d", n_format);
2919 printf("\n");
2920 }
2921 }
2922 }
2923 }
2924 }
2925#endif
2926#endif
2927
2928 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002930}
2931
2932
2933static int
2934test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002936
Daniel Veillard3d97e662004-11-04 10:49:00 +00002937#ifdef LIBXML_HTML_ENABLED
2938#ifdef LIBXML_OUTPUT_ENABLED
2939 int mem_base;
2940 xmlOutputBufferPtr buf; /* the HTML buffer output */
2941 int n_buf;
2942 xmlDocPtr cur; /* the document */
2943 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002944 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002945 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002946
Daniel Veillard3d97e662004-11-04 10:49:00 +00002947 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2948 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2949 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2950 mem_base = xmlMemBlocks();
2951 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2952 cur = gen_xmlDocPtr(n_cur, 1);
2953 encoding = gen_const_char_ptr(n_encoding, 2);
2954
2955 htmlDocContentDumpOutput(buf, cur, encoding);
2956 call_tests++;
2957 des_xmlOutputBufferPtr(n_buf, buf, 0);
2958 des_xmlDocPtr(n_cur, cur, 1);
2959 des_const_char_ptr(n_encoding, encoding, 2);
2960 xmlResetLastError();
2961 if (mem_base != xmlMemBlocks()) {
2962 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
2963 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002964 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002965 printf(" %d", n_buf);
2966 printf(" %d", n_cur);
2967 printf(" %d", n_encoding);
2968 printf("\n");
2969 }
2970 }
2971 }
2972 }
2973#endif
2974#endif
2975
2976 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002978}
2979
2980
2981static int
2982test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002984
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002985#ifdef LIBXML_HTML_ENABLED
2986#ifdef LIBXML_OUTPUT_ENABLED
2987 int mem_base;
2988 int ret_val;
2989 FILE * f; /* the FILE* */
2990 int n_f;
2991 xmlDocPtr cur; /* the document */
2992 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002993
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002994 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
2995 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2996 mem_base = xmlMemBlocks();
2997 f = gen_FILE_ptr(n_f, 0);
2998 cur = gen_xmlDocPtr(n_cur, 1);
2999
3000 ret_val = htmlDocDump(f, cur);
3001 desret_int(ret_val);
3002 call_tests++;
3003 des_FILE_ptr(n_f, f, 0);
3004 des_xmlDocPtr(n_cur, cur, 1);
3005 xmlResetLastError();
3006 if (mem_base != xmlMemBlocks()) {
3007 printf("Leak of %d blocks found in htmlDocDump",
3008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003009 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003010 printf(" %d", n_f);
3011 printf(" %d", n_cur);
3012 printf("\n");
3013 }
3014 }
3015 }
3016#endif
3017#endif
3018
3019 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003020 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003021}
3022
3023
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003024#define gen_nb_xmlChar_ptr_ptr 1
3025static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3026 return(NULL);
3027}
3028static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3029}
3030
Daniel Veillardd93f6252004-11-02 15:53:51 +00003031static int
3032test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003033 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003034
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003035#ifdef LIBXML_HTML_ENABLED
3036#ifdef LIBXML_OUTPUT_ENABLED
3037 int mem_base;
3038 xmlDocPtr cur; /* the document */
3039 int n_cur;
3040 xmlChar ** mem; /* OUT: the memory pointer */
3041 int n_mem;
3042 int * size; /* OUT: the memory length */
3043 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003044
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003045 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3046 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
3047 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
3048 mem_base = xmlMemBlocks();
3049 cur = gen_xmlDocPtr(n_cur, 0);
3050 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
3051 size = gen_int_ptr(n_size, 2);
3052
3053 htmlDocDumpMemory(cur, mem, size);
3054 call_tests++;
3055 des_xmlDocPtr(n_cur, cur, 0);
3056 des_xmlChar_ptr_ptr(n_mem, mem, 1);
3057 des_int_ptr(n_size, size, 2);
3058 xmlResetLastError();
3059 if (mem_base != xmlMemBlocks()) {
3060 printf("Leak of %d blocks found in htmlDocDumpMemory",
3061 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003062 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003063 printf(" %d", n_cur);
3064 printf(" %d", n_mem);
3065 printf(" %d", n_size);
3066 printf("\n");
3067 }
3068 }
3069 }
3070 }
3071#endif
3072#endif
3073
3074 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003075 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003076}
3077
3078
3079static int
3080test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003081 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003082
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003083#ifdef LIBXML_HTML_ENABLED
3084 int mem_base;
3085 const xmlChar * ret_val;
3086 htmlDocPtr doc; /* the document */
3087 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003088
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003089 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3090 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003091 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003092
3093 ret_val = htmlGetMetaEncoding(doc);
3094 desret_const_xmlChar_ptr(ret_val);
3095 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003096 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003097 xmlResetLastError();
3098 if (mem_base != xmlMemBlocks()) {
3099 printf("Leak of %d blocks found in htmlGetMetaEncoding",
3100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003101 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003102 printf(" %d", n_doc);
3103 printf("\n");
3104 }
3105 }
3106#endif
3107
Daniel Veillard3d97e662004-11-04 10:49:00 +00003108 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003109 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003110}
3111
3112
3113static int
3114test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003115 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003116
3117#ifdef LIBXML_HTML_ENABLED
3118 int mem_base;
3119 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003120 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003121 int n_name;
3122
3123 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3124 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003125 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003126
3127 ret_val = htmlIsBooleanAttr(name);
3128 desret_int(ret_val);
3129 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003130 des_const_xmlChar_ptr(n_name, name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003131 xmlResetLastError();
3132 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003133 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003135 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003136 printf(" %d", n_name);
3137 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003138 }
3139 }
3140#endif
3141
Daniel Veillard3d97e662004-11-04 10:49:00 +00003142 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003143 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003144}
3145
3146
3147static int
3148test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003149 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003150
Daniel Veillarda03e3652004-11-02 18:45:30 +00003151#ifdef LIBXML_HTML_ENABLED
3152 int mem_base;
3153 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003154 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003155 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003156 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003157 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003158
Daniel Veillarda03e3652004-11-02 18:45:30 +00003159 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3160 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3161 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003162 URI = gen_const_xmlChar_ptr(n_URI, 0);
3163 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003164
3165 ret_val = htmlNewDoc(URI, ExternalID);
3166 desret_xmlDocPtr(ret_val);
3167 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003168 des_const_xmlChar_ptr(n_URI, URI, 0);
3169 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003170 xmlResetLastError();
3171 if (mem_base != xmlMemBlocks()) {
3172 printf("Leak of %d blocks found in htmlNewDoc",
3173 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003174 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003175 printf(" %d", n_URI);
3176 printf(" %d", n_ExternalID);
3177 printf("\n");
3178 }
3179 }
3180 }
3181#endif
3182
Daniel Veillard3d97e662004-11-04 10:49:00 +00003183 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003185}
3186
3187
3188static int
3189test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003191
Daniel Veillarda03e3652004-11-02 18:45:30 +00003192#ifdef LIBXML_HTML_ENABLED
3193 int mem_base;
3194 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003195 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003196 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003197 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003198 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003199
Daniel Veillarda03e3652004-11-02 18:45:30 +00003200 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3201 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3202 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003203 URI = gen_const_xmlChar_ptr(n_URI, 0);
3204 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003205
3206 ret_val = htmlNewDocNoDtD(URI, ExternalID);
3207 desret_xmlDocPtr(ret_val);
3208 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003209 des_const_xmlChar_ptr(n_URI, URI, 0);
3210 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003211 xmlResetLastError();
3212 if (mem_base != xmlMemBlocks()) {
3213 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3214 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003215 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003216 printf(" %d", n_URI);
3217 printf(" %d", n_ExternalID);
3218 printf("\n");
3219 }
3220 }
3221 }
3222#endif
3223
Daniel Veillard3d97e662004-11-04 10:49:00 +00003224 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003226}
3227
3228
3229static int
3230test_htmlNodeDump(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#ifdef LIBXML_OUTPUT_ENABLED
3235 int mem_base;
3236 int ret_val;
3237 xmlBufferPtr buf; /* the HTML buffer output */
3238 int n_buf;
3239 xmlDocPtr doc; /* the document */
3240 int n_doc;
3241 xmlNodePtr cur; /* the current node */
3242 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003243
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003244 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3245 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3246 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3247 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003248 buf = gen_xmlBufferPtr(n_buf, 0);
3249 doc = gen_xmlDocPtr(n_doc, 1);
3250 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003251
3252 ret_val = htmlNodeDump(buf, doc, cur);
3253 desret_int(ret_val);
3254 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003255 des_xmlBufferPtr(n_buf, buf, 0);
3256 des_xmlDocPtr(n_doc, doc, 1);
3257 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003258 xmlResetLastError();
3259 if (mem_base != xmlMemBlocks()) {
3260 printf("Leak of %d blocks found in htmlNodeDump",
3261 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003262 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003263 printf(" %d", n_buf);
3264 printf(" %d", n_doc);
3265 printf(" %d", n_cur);
3266 printf("\n");
3267 }
3268 }
3269 }
3270 }
3271#endif
3272#endif
3273
Daniel Veillard3d97e662004-11-04 10:49:00 +00003274 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003276}
3277
3278
3279static int
3280test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003282
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003283#ifdef LIBXML_HTML_ENABLED
3284#ifdef LIBXML_OUTPUT_ENABLED
3285 int mem_base;
3286 FILE * out; /* the FILE pointer */
3287 int n_out;
3288 xmlDocPtr doc; /* the document */
3289 int n_doc;
3290 xmlNodePtr cur; /* the current node */
3291 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003292
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003293 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3294 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3295 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3296 mem_base = xmlMemBlocks();
3297 out = gen_FILE_ptr(n_out, 0);
3298 doc = gen_xmlDocPtr(n_doc, 1);
3299 cur = gen_xmlNodePtr(n_cur, 2);
3300
3301 htmlNodeDumpFile(out, doc, cur);
3302 call_tests++;
3303 des_FILE_ptr(n_out, out, 0);
3304 des_xmlDocPtr(n_doc, doc, 1);
3305 des_xmlNodePtr(n_cur, cur, 2);
3306 xmlResetLastError();
3307 if (mem_base != xmlMemBlocks()) {
3308 printf("Leak of %d blocks found in htmlNodeDumpFile",
3309 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003310 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003311 printf(" %d", n_out);
3312 printf(" %d", n_doc);
3313 printf(" %d", n_cur);
3314 printf("\n");
3315 }
3316 }
3317 }
3318 }
3319#endif
3320#endif
3321
3322 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003324}
3325
3326
3327static int
3328test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003330
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003331#ifdef LIBXML_HTML_ENABLED
3332#ifdef LIBXML_OUTPUT_ENABLED
3333 int mem_base;
3334 int ret_val;
3335 FILE * out; /* the FILE pointer */
3336 int n_out;
3337 xmlDocPtr doc; /* the document */
3338 int n_doc;
3339 xmlNodePtr cur; /* the current node */
3340 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003341 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003342 int n_encoding;
3343 int format; /* should formatting spaces been added */
3344 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003345
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003346 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3347 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3348 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3349 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3350 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3351 mem_base = xmlMemBlocks();
3352 out = gen_FILE_ptr(n_out, 0);
3353 doc = gen_xmlDocPtr(n_doc, 1);
3354 cur = gen_xmlNodePtr(n_cur, 2);
3355 encoding = gen_const_char_ptr(n_encoding, 3);
3356 format = gen_int(n_format, 4);
3357
3358 ret_val = htmlNodeDumpFileFormat(out, doc, cur, encoding, format);
3359 desret_int(ret_val);
3360 call_tests++;
3361 des_FILE_ptr(n_out, out, 0);
3362 des_xmlDocPtr(n_doc, doc, 1);
3363 des_xmlNodePtr(n_cur, cur, 2);
3364 des_const_char_ptr(n_encoding, encoding, 3);
3365 des_int(n_format, format, 4);
3366 xmlResetLastError();
3367 if (mem_base != xmlMemBlocks()) {
3368 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3369 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003370 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003371 printf(" %d", n_out);
3372 printf(" %d", n_doc);
3373 printf(" %d", n_cur);
3374 printf(" %d", n_encoding);
3375 printf(" %d", n_format);
3376 printf("\n");
3377 }
3378 }
3379 }
3380 }
3381 }
3382 }
3383#endif
3384#endif
3385
3386 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003388}
3389
3390
3391static int
3392test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003394
Daniel Veillard3d97e662004-11-04 10:49:00 +00003395#ifdef LIBXML_HTML_ENABLED
3396#ifdef LIBXML_OUTPUT_ENABLED
3397 int mem_base;
3398 xmlOutputBufferPtr buf; /* the HTML buffer output */
3399 int n_buf;
3400 xmlDocPtr doc; /* the document */
3401 int n_doc;
3402 xmlNodePtr cur; /* the current node */
3403 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003404 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003405 int n_encoding;
3406 int format; /* should formatting spaces been added */
3407 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003408
Daniel Veillard3d97e662004-11-04 10:49:00 +00003409 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3410 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3411 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3412 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3413 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3414 mem_base = xmlMemBlocks();
3415 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3416 doc = gen_xmlDocPtr(n_doc, 1);
3417 cur = gen_xmlNodePtr(n_cur, 2);
3418 encoding = gen_const_char_ptr(n_encoding, 3);
3419 format = gen_int(n_format, 4);
3420
3421 htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format);
3422 call_tests++;
3423 des_xmlOutputBufferPtr(n_buf, buf, 0);
3424 des_xmlDocPtr(n_doc, doc, 1);
3425 des_xmlNodePtr(n_cur, cur, 2);
3426 des_const_char_ptr(n_encoding, encoding, 3);
3427 des_int(n_format, format, 4);
3428 xmlResetLastError();
3429 if (mem_base != xmlMemBlocks()) {
3430 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3431 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003432 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003433 printf(" %d", n_buf);
3434 printf(" %d", n_doc);
3435 printf(" %d", n_cur);
3436 printf(" %d", n_encoding);
3437 printf(" %d", n_format);
3438 printf("\n");
3439 }
3440 }
3441 }
3442 }
3443 }
3444 }
3445#endif
3446#endif
3447
3448 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003450}
3451
3452
3453static int
3454test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003456
Daniel Veillard3d97e662004-11-04 10:49:00 +00003457#ifdef LIBXML_HTML_ENABLED
3458#ifdef LIBXML_OUTPUT_ENABLED
3459 int mem_base;
3460 xmlOutputBufferPtr buf; /* the HTML buffer output */
3461 int n_buf;
3462 xmlDocPtr doc; /* the document */
3463 int n_doc;
3464 xmlNodePtr cur; /* the current node */
3465 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003466 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003467 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003468
Daniel Veillard3d97e662004-11-04 10:49:00 +00003469 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3470 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3471 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3472 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3473 mem_base = xmlMemBlocks();
3474 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3475 doc = gen_xmlDocPtr(n_doc, 1);
3476 cur = gen_xmlNodePtr(n_cur, 2);
3477 encoding = gen_const_char_ptr(n_encoding, 3);
3478
3479 htmlNodeDumpOutput(buf, doc, cur, encoding);
3480 call_tests++;
3481 des_xmlOutputBufferPtr(n_buf, buf, 0);
3482 des_xmlDocPtr(n_doc, doc, 1);
3483 des_xmlNodePtr(n_cur, cur, 2);
3484 des_const_char_ptr(n_encoding, encoding, 3);
3485 xmlResetLastError();
3486 if (mem_base != xmlMemBlocks()) {
3487 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3488 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003489 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003490 printf(" %d", n_buf);
3491 printf(" %d", n_doc);
3492 printf(" %d", n_cur);
3493 printf(" %d", n_encoding);
3494 printf("\n");
3495 }
3496 }
3497 }
3498 }
3499 }
3500#endif
3501#endif
3502
3503 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003504 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003505}
3506
3507
3508static int
3509test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003510 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003511
3512#ifdef LIBXML_HTML_ENABLED
3513#ifdef LIBXML_OUTPUT_ENABLED
3514 int mem_base;
3515 int ret_val;
3516 const char * filename; /* the filename (or URL) */
3517 int n_filename;
3518 xmlDocPtr cur; /* the document */
3519 int n_cur;
3520
3521 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3522 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3523 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003524 filename = gen_fileoutput(n_filename, 0);
3525 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003526
3527 ret_val = htmlSaveFile(filename, cur);
3528 desret_int(ret_val);
3529 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003530 des_fileoutput(n_filename, filename, 0);
3531 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003532 xmlResetLastError();
3533 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003534 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003536 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003537 printf(" %d", n_filename);
3538 printf(" %d", n_cur);
3539 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003540 }
3541 }
3542 }
3543#endif
3544#endif
3545
Daniel Veillard3d97e662004-11-04 10:49:00 +00003546 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003547 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003548}
3549
3550
3551static int
3552test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003554
3555#ifdef LIBXML_HTML_ENABLED
3556#ifdef LIBXML_OUTPUT_ENABLED
3557 int mem_base;
3558 int ret_val;
3559 const char * filename; /* the filename */
3560 int n_filename;
3561 xmlDocPtr cur; /* the document */
3562 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003563 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003564 int n_encoding;
3565
3566 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3567 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3568 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3569 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003570 filename = gen_fileoutput(n_filename, 0);
3571 cur = gen_xmlDocPtr(n_cur, 1);
3572 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003573
3574 ret_val = htmlSaveFileEnc(filename, cur, encoding);
3575 desret_int(ret_val);
3576 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003577 des_fileoutput(n_filename, filename, 0);
3578 des_xmlDocPtr(n_cur, cur, 1);
3579 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003580 xmlResetLastError();
3581 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003582 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003583 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003584 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003585 printf(" %d", n_filename);
3586 printf(" %d", n_cur);
3587 printf(" %d", n_encoding);
3588 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003589 }
3590 }
3591 }
3592 }
3593#endif
3594#endif
3595
Daniel Veillard3d97e662004-11-04 10:49:00 +00003596 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003597 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003598}
3599
3600
3601static int
3602test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003603 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003604
3605#ifdef LIBXML_HTML_ENABLED
3606#ifdef LIBXML_OUTPUT_ENABLED
3607 int mem_base;
3608 int ret_val;
3609 const char * filename; /* the filename */
3610 int n_filename;
3611 xmlDocPtr cur; /* the document */
3612 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003613 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003614 int n_encoding;
3615 int format; /* should formatting spaces been added */
3616 int n_format;
3617
3618 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3619 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3620 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3621 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3622 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003623 filename = gen_fileoutput(n_filename, 0);
3624 cur = gen_xmlDocPtr(n_cur, 1);
3625 encoding = gen_const_char_ptr(n_encoding, 2);
3626 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003627
3628 ret_val = htmlSaveFileFormat(filename, cur, encoding, format);
3629 desret_int(ret_val);
3630 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003631 des_fileoutput(n_filename, filename, 0);
3632 des_xmlDocPtr(n_cur, cur, 1);
3633 des_const_char_ptr(n_encoding, encoding, 2);
3634 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003635 xmlResetLastError();
3636 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003637 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003639 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003640 printf(" %d", n_filename);
3641 printf(" %d", n_cur);
3642 printf(" %d", n_encoding);
3643 printf(" %d", n_format);
3644 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003645 }
3646 }
3647 }
3648 }
3649 }
3650#endif
3651#endif
3652
Daniel Veillard3d97e662004-11-04 10:49:00 +00003653 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003655}
3656
3657
3658static int
3659test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003661
Daniel Veillarda03e3652004-11-02 18:45:30 +00003662#ifdef LIBXML_HTML_ENABLED
3663 int mem_base;
3664 int ret_val;
3665 htmlDocPtr doc; /* the document */
3666 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003667 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003668 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003669
Daniel Veillarda03e3652004-11-02 18:45:30 +00003670 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3671 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3672 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003673 doc = gen_xmlDocPtr(n_doc, 0);
3674 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003675
3676 ret_val = htmlSetMetaEncoding(doc, encoding);
3677 desret_int(ret_val);
3678 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003679 des_xmlDocPtr(n_doc, doc, 0);
3680 des_const_xmlChar_ptr(n_encoding, encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003681 xmlResetLastError();
3682 if (mem_base != xmlMemBlocks()) {
3683 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3684 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003685 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003686 printf(" %d", n_doc);
3687 printf(" %d", n_encoding);
3688 printf("\n");
3689 }
3690 }
3691 }
3692#endif
3693
Daniel Veillard3d97e662004-11-04 10:49:00 +00003694 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00003695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003696}
3697
3698static int
3699test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003700 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003701
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00003702 printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003703 test_ret += test_htmlDocContentDumpFormatOutput();
3704 test_ret += test_htmlDocContentDumpOutput();
3705 test_ret += test_htmlDocDump();
3706 test_ret += test_htmlDocDumpMemory();
3707 test_ret += test_htmlGetMetaEncoding();
3708 test_ret += test_htmlIsBooleanAttr();
3709 test_ret += test_htmlNewDoc();
3710 test_ret += test_htmlNewDocNoDtD();
3711 test_ret += test_htmlNodeDump();
3712 test_ret += test_htmlNodeDumpFile();
3713 test_ret += test_htmlNodeDumpFileFormat();
3714 test_ret += test_htmlNodeDumpFormatOutput();
3715 test_ret += test_htmlNodeDumpOutput();
3716 test_ret += test_htmlSaveFile();
3717 test_ret += test_htmlSaveFileEnc();
3718 test_ret += test_htmlSaveFileFormat();
3719 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003720
Daniel Veillard42595322004-11-08 10:52:06 +00003721 if (test_ret != 0)
3722 printf("Module HTMLtree: %d errors\n", test_ret);
3723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003724}
3725
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003726static int
3727test_docbDefaultSAXHandlerInit(void) {
3728 int test_ret = 0;
3729
3730 int mem_base;
3731
3732 mem_base = xmlMemBlocks();
3733
3734 docbDefaultSAXHandlerInit();
3735 call_tests++;
3736 xmlResetLastError();
3737 if (mem_base != xmlMemBlocks()) {
3738 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3739 xmlMemBlocks() - mem_base);
3740 test_ret++;
3741 printf("\n");
3742 }
3743
3744 function_tests++;
3745 return(test_ret);
3746}
3747
3748
3749static int
3750test_htmlDefaultSAXHandlerInit(void) {
3751 int test_ret = 0;
3752
3753 int mem_base;
3754
3755 mem_base = xmlMemBlocks();
3756
3757 htmlDefaultSAXHandlerInit();
3758 call_tests++;
3759 xmlResetLastError();
3760 if (mem_base != xmlMemBlocks()) {
3761 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3762 xmlMemBlocks() - mem_base);
3763 test_ret++;
3764 printf("\n");
3765 }
3766
3767 function_tests++;
3768 return(test_ret);
3769}
3770
3771
3772static int
3773test_xmlDefaultSAXHandlerInit(void) {
3774 int test_ret = 0;
3775
3776 int mem_base;
3777
3778 mem_base = xmlMemBlocks();
3779
3780 xmlDefaultSAXHandlerInit();
3781 call_tests++;
3782 xmlResetLastError();
3783 if (mem_base != xmlMemBlocks()) {
3784 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3785 xmlMemBlocks() - mem_base);
3786 test_ret++;
3787 printf("\n");
3788 }
3789
3790 function_tests++;
3791 return(test_ret);
3792}
3793
3794
3795#define gen_nb_xmlEnumerationPtr 1
3796static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3797 return(NULL);
3798}
3799static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3800}
3801
3802static int
3803test_xmlSAX2AttributeDecl(void) {
3804 int test_ret = 0;
3805
3806 int mem_base;
3807 void * ctx; /* the user data (XML parser context) */
3808 int n_ctx;
3809 xmlChar * elem; /* the name of the element */
3810 int n_elem;
3811 xmlChar * fullname; /* the attribute name */
3812 int n_fullname;
3813 int type; /* the attribute type */
3814 int n_type;
3815 int def; /* the type of default value */
3816 int n_def;
3817 xmlChar * defaultValue; /* the attribute default value */
3818 int n_defaultValue;
3819 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3820 int n_tree;
3821
3822 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3823 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3824 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3825 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3826 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3827 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3828 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3829 mem_base = xmlMemBlocks();
3830 ctx = gen_void_ptr(n_ctx, 0);
3831 elem = gen_const_xmlChar_ptr(n_elem, 1);
3832 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3833 type = gen_int(n_type, 3);
3834 def = gen_int(n_def, 4);
3835 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3836 tree = gen_xmlEnumerationPtr(n_tree, 6);
3837
3838 xmlSAX2AttributeDecl(ctx, elem, fullname, type, def, defaultValue, tree);
3839 call_tests++;
3840 des_void_ptr(n_ctx, ctx, 0);
3841 des_const_xmlChar_ptr(n_elem, elem, 1);
3842 des_const_xmlChar_ptr(n_fullname, fullname, 2);
3843 des_int(n_type, type, 3);
3844 des_int(n_def, def, 4);
3845 des_const_xmlChar_ptr(n_defaultValue, defaultValue, 5);
3846 des_xmlEnumerationPtr(n_tree, tree, 6);
3847 xmlResetLastError();
3848 if (mem_base != xmlMemBlocks()) {
3849 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3850 xmlMemBlocks() - mem_base);
3851 test_ret++;
3852 printf(" %d", n_ctx);
3853 printf(" %d", n_elem);
3854 printf(" %d", n_fullname);
3855 printf(" %d", n_type);
3856 printf(" %d", n_def);
3857 printf(" %d", n_defaultValue);
3858 printf(" %d", n_tree);
3859 printf("\n");
3860 }
3861 }
3862 }
3863 }
3864 }
3865 }
3866 }
3867 }
3868
3869 function_tests++;
3870 return(test_ret);
3871}
3872
3873
3874static int
3875test_xmlSAX2CDataBlock(void) {
3876 int test_ret = 0;
3877
3878 int mem_base;
3879 void * ctx; /* the user data (XML parser context) */
3880 int n_ctx;
3881 xmlChar * value; /* The pcdata content */
3882 int n_value;
3883 int len; /* the block length */
3884 int n_len;
3885
3886 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3887 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3888 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3889 mem_base = xmlMemBlocks();
3890 ctx = gen_void_ptr(n_ctx, 0);
3891 value = gen_const_xmlChar_ptr(n_value, 1);
3892 len = gen_int(n_len, 2);
3893
3894 xmlSAX2CDataBlock(ctx, value, len);
3895 call_tests++;
3896 des_void_ptr(n_ctx, ctx, 0);
3897 des_const_xmlChar_ptr(n_value, value, 1);
3898 des_int(n_len, len, 2);
3899 xmlResetLastError();
3900 if (mem_base != xmlMemBlocks()) {
3901 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
3902 xmlMemBlocks() - mem_base);
3903 test_ret++;
3904 printf(" %d", n_ctx);
3905 printf(" %d", n_value);
3906 printf(" %d", n_len);
3907 printf("\n");
3908 }
3909 }
3910 }
3911 }
3912
3913 function_tests++;
3914 return(test_ret);
3915}
3916
3917
3918static int
3919test_xmlSAX2Characters(void) {
3920 int test_ret = 0;
3921
3922 int mem_base;
3923 void * ctx; /* the user data (XML parser context) */
3924 int n_ctx;
3925 xmlChar * ch; /* a xmlChar string */
3926 int n_ch;
3927 int len; /* the number of xmlChar */
3928 int n_len;
3929
3930 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3931 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
3932 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3933 mem_base = xmlMemBlocks();
3934 ctx = gen_void_ptr(n_ctx, 0);
3935 ch = gen_const_xmlChar_ptr(n_ch, 1);
3936 len = gen_int(n_len, 2);
3937
3938 xmlSAX2Characters(ctx, ch, len);
3939 call_tests++;
3940 des_void_ptr(n_ctx, ctx, 0);
3941 des_const_xmlChar_ptr(n_ch, ch, 1);
3942 des_int(n_len, len, 2);
3943 xmlResetLastError();
3944 if (mem_base != xmlMemBlocks()) {
3945 printf("Leak of %d blocks found in xmlSAX2Characters",
3946 xmlMemBlocks() - mem_base);
3947 test_ret++;
3948 printf(" %d", n_ctx);
3949 printf(" %d", n_ch);
3950 printf(" %d", n_len);
3951 printf("\n");
3952 }
3953 }
3954 }
3955 }
3956
3957 function_tests++;
3958 return(test_ret);
3959}
3960
3961
3962static int
3963test_xmlSAX2Comment(void) {
3964 int test_ret = 0;
3965
3966 int mem_base;
3967 void * ctx; /* the user data (XML parser context) */
3968 int n_ctx;
3969 xmlChar * value; /* the xmlSAX2Comment content */
3970 int n_value;
3971
3972 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3973 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3974 mem_base = xmlMemBlocks();
3975 ctx = gen_void_ptr(n_ctx, 0);
3976 value = gen_const_xmlChar_ptr(n_value, 1);
3977
3978 xmlSAX2Comment(ctx, value);
3979 call_tests++;
3980 des_void_ptr(n_ctx, ctx, 0);
3981 des_const_xmlChar_ptr(n_value, value, 1);
3982 xmlResetLastError();
3983 if (mem_base != xmlMemBlocks()) {
3984 printf("Leak of %d blocks found in xmlSAX2Comment",
3985 xmlMemBlocks() - mem_base);
3986 test_ret++;
3987 printf(" %d", n_ctx);
3988 printf(" %d", n_value);
3989 printf("\n");
3990 }
3991 }
3992 }
3993
3994 function_tests++;
3995 return(test_ret);
3996}
3997
3998
3999#define gen_nb_xmlElementContentPtr 1
4000static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4001 return(NULL);
4002}
4003static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4004}
4005
4006static int
4007test_xmlSAX2ElementDecl(void) {
4008 int test_ret = 0;
4009
4010 int mem_base;
4011 void * ctx; /* the user data (XML parser context) */
4012 int n_ctx;
4013 xmlChar * name; /* the element name */
4014 int n_name;
4015 int type; /* the element type */
4016 int n_type;
4017 xmlElementContentPtr content; /* the element value tree */
4018 int n_content;
4019
4020 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4021 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4022 for (n_type = 0;n_type < gen_nb_int;n_type++) {
4023 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
4024 mem_base = xmlMemBlocks();
4025 ctx = gen_void_ptr(n_ctx, 0);
4026 name = gen_const_xmlChar_ptr(n_name, 1);
4027 type = gen_int(n_type, 2);
4028 content = gen_xmlElementContentPtr(n_content, 3);
4029
4030 xmlSAX2ElementDecl(ctx, name, type, content);
4031 call_tests++;
4032 des_void_ptr(n_ctx, ctx, 0);
4033 des_const_xmlChar_ptr(n_name, name, 1);
4034 des_int(n_type, type, 2);
4035 des_xmlElementContentPtr(n_content, content, 3);
4036 xmlResetLastError();
4037 if (mem_base != xmlMemBlocks()) {
4038 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
4039 xmlMemBlocks() - mem_base);
4040 test_ret++;
4041 printf(" %d", n_ctx);
4042 printf(" %d", n_name);
4043 printf(" %d", n_type);
4044 printf(" %d", n_content);
4045 printf("\n");
4046 }
4047 }
4048 }
4049 }
4050 }
4051
4052 function_tests++;
4053 return(test_ret);
4054}
4055
4056
4057static int
4058test_xmlSAX2EndDocument(void) {
4059 int test_ret = 0;
4060
4061 int mem_base;
4062 void * ctx; /* the user data (XML parser context) */
4063 int n_ctx;
4064
4065 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4066 mem_base = xmlMemBlocks();
4067 ctx = gen_void_ptr(n_ctx, 0);
4068
4069 xmlSAX2EndDocument(ctx);
4070 call_tests++;
4071 des_void_ptr(n_ctx, ctx, 0);
4072 xmlResetLastError();
4073 if (mem_base != xmlMemBlocks()) {
4074 printf("Leak of %d blocks found in xmlSAX2EndDocument",
4075 xmlMemBlocks() - mem_base);
4076 test_ret++;
4077 printf(" %d", n_ctx);
4078 printf("\n");
4079 }
4080 }
4081
4082 function_tests++;
4083 return(test_ret);
4084}
4085
4086
4087static int
4088test_xmlSAX2EndElement(void) {
4089 int test_ret = 0;
4090
4091 int mem_base;
4092 void * ctx; /* the user data (XML parser context) */
4093 int n_ctx;
4094 xmlChar * name; /* The element name */
4095 int n_name;
4096
4097 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4098 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4099 mem_base = xmlMemBlocks();
4100 ctx = gen_void_ptr(n_ctx, 0);
4101 name = gen_const_xmlChar_ptr(n_name, 1);
4102
4103 xmlSAX2EndElement(ctx, name);
4104 call_tests++;
4105 des_void_ptr(n_ctx, ctx, 0);
4106 des_const_xmlChar_ptr(n_name, name, 1);
4107 xmlResetLastError();
4108 if (mem_base != xmlMemBlocks()) {
4109 printf("Leak of %d blocks found in xmlSAX2EndElement",
4110 xmlMemBlocks() - mem_base);
4111 test_ret++;
4112 printf(" %d", n_ctx);
4113 printf(" %d", n_name);
4114 printf("\n");
4115 }
4116 }
4117 }
4118
4119 function_tests++;
4120 return(test_ret);
4121}
4122
4123
4124static int
4125test_xmlSAX2EndElementNs(void) {
4126 int test_ret = 0;
4127
4128 int mem_base;
4129 void * ctx; /* the user data (XML parser context) */
4130 int n_ctx;
4131 xmlChar * localname; /* the local name of the element */
4132 int n_localname;
4133 xmlChar * prefix; /* the element namespace prefix if available */
4134 int n_prefix;
4135 xmlChar * URI; /* the element namespace name if available */
4136 int n_URI;
4137
4138 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4139 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4140 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4141 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4142 mem_base = xmlMemBlocks();
4143 ctx = gen_void_ptr(n_ctx, 0);
4144 localname = gen_const_xmlChar_ptr(n_localname, 1);
4145 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4146 URI = gen_const_xmlChar_ptr(n_URI, 3);
4147
4148 xmlSAX2EndElementNs(ctx, localname, prefix, URI);
4149 call_tests++;
4150 des_void_ptr(n_ctx, ctx, 0);
4151 des_const_xmlChar_ptr(n_localname, localname, 1);
4152 des_const_xmlChar_ptr(n_prefix, prefix, 2);
4153 des_const_xmlChar_ptr(n_URI, URI, 3);
4154 xmlResetLastError();
4155 if (mem_base != xmlMemBlocks()) {
4156 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
4157 xmlMemBlocks() - mem_base);
4158 test_ret++;
4159 printf(" %d", n_ctx);
4160 printf(" %d", n_localname);
4161 printf(" %d", n_prefix);
4162 printf(" %d", n_URI);
4163 printf("\n");
4164 }
4165 }
4166 }
4167 }
4168 }
4169
4170 function_tests++;
4171 return(test_ret);
4172}
4173
4174
4175static int
4176test_xmlSAX2EntityDecl(void) {
4177 int test_ret = 0;
4178
4179 int mem_base;
4180 void * ctx; /* the user data (XML parser context) */
4181 int n_ctx;
4182 xmlChar * name; /* the entity name */
4183 int n_name;
4184 int type; /* the entity type */
4185 int n_type;
4186 xmlChar * publicId; /* The public ID of the entity */
4187 int n_publicId;
4188 xmlChar * systemId; /* The system ID of the entity */
4189 int n_systemId;
4190 xmlChar * content; /* the entity value (without processing). */
4191 int n_content;
4192
4193 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4194 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4195 for (n_type = 0;n_type < gen_nb_int;n_type++) {
4196 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4197 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4198 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
4199 mem_base = xmlMemBlocks();
4200 ctx = gen_void_ptr(n_ctx, 0);
4201 name = gen_const_xmlChar_ptr(n_name, 1);
4202 type = gen_int(n_type, 2);
4203 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
4204 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
4205 content = gen_xmlChar_ptr(n_content, 5);
4206
4207 xmlSAX2EntityDecl(ctx, name, type, publicId, systemId, content);
4208 call_tests++;
4209 des_void_ptr(n_ctx, ctx, 0);
4210 des_const_xmlChar_ptr(n_name, name, 1);
4211 des_int(n_type, type, 2);
4212 des_const_xmlChar_ptr(n_publicId, publicId, 3);
4213 des_const_xmlChar_ptr(n_systemId, systemId, 4);
4214 des_xmlChar_ptr(n_content, content, 5);
4215 xmlResetLastError();
4216 if (mem_base != xmlMemBlocks()) {
4217 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4218 xmlMemBlocks() - mem_base);
4219 test_ret++;
4220 printf(" %d", n_ctx);
4221 printf(" %d", n_name);
4222 printf(" %d", n_type);
4223 printf(" %d", n_publicId);
4224 printf(" %d", n_systemId);
4225 printf(" %d", n_content);
4226 printf("\n");
4227 }
4228 }
4229 }
4230 }
4231 }
4232 }
4233 }
4234
4235 function_tests++;
4236 return(test_ret);
4237}
4238
4239
4240static int
4241test_xmlSAX2ExternalSubset(void) {
4242 int test_ret = 0;
4243
4244 int mem_base;
4245 void * ctx; /* the user data (XML parser context) */
4246 int n_ctx;
4247 xmlChar * name; /* the root element name */
4248 int n_name;
4249 xmlChar * ExternalID; /* the external ID */
4250 int n_ExternalID;
4251 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4252 int n_SystemID;
4253
4254 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4255 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4256 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4257 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4258 mem_base = xmlMemBlocks();
4259 ctx = gen_void_ptr(n_ctx, 0);
4260 name = gen_const_xmlChar_ptr(n_name, 1);
4261 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4262 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4263
4264 xmlSAX2ExternalSubset(ctx, name, ExternalID, SystemID);
4265 call_tests++;
4266 des_void_ptr(n_ctx, ctx, 0);
4267 des_const_xmlChar_ptr(n_name, name, 1);
4268 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
4269 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
4270 xmlResetLastError();
4271 if (mem_base != xmlMemBlocks()) {
4272 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4273 xmlMemBlocks() - mem_base);
4274 test_ret++;
4275 printf(" %d", n_ctx);
4276 printf(" %d", n_name);
4277 printf(" %d", n_ExternalID);
4278 printf(" %d", n_SystemID);
4279 printf("\n");
4280 }
4281 }
4282 }
4283 }
4284 }
4285
4286 function_tests++;
4287 return(test_ret);
4288}
4289
4290
4291static int
4292test_xmlSAX2GetColumnNumber(void) {
4293 int test_ret = 0;
4294
4295 int mem_base;
4296 int ret_val;
4297 void * ctx; /* the user data (XML parser context) */
4298 int n_ctx;
4299
4300 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4301 mem_base = xmlMemBlocks();
4302 ctx = gen_void_ptr(n_ctx, 0);
4303
4304 ret_val = xmlSAX2GetColumnNumber(ctx);
4305 desret_int(ret_val);
4306 call_tests++;
4307 des_void_ptr(n_ctx, ctx, 0);
4308 xmlResetLastError();
4309 if (mem_base != xmlMemBlocks()) {
4310 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4311 xmlMemBlocks() - mem_base);
4312 test_ret++;
4313 printf(" %d", n_ctx);
4314 printf("\n");
4315 }
4316 }
4317
4318 function_tests++;
4319 return(test_ret);
4320}
4321
4322
4323static int
4324test_xmlSAX2GetEntity(void) {
4325 int test_ret = 0;
4326
4327 int mem_base;
4328 xmlEntityPtr ret_val;
4329 void * ctx; /* the user data (XML parser context) */
4330 int n_ctx;
4331 xmlChar * name; /* The entity name */
4332 int n_name;
4333
4334 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4335 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4336 mem_base = xmlMemBlocks();
4337 ctx = gen_void_ptr(n_ctx, 0);
4338 name = gen_const_xmlChar_ptr(n_name, 1);
4339
4340 ret_val = xmlSAX2GetEntity(ctx, name);
4341 desret_xmlEntityPtr(ret_val);
4342 call_tests++;
4343 des_void_ptr(n_ctx, ctx, 0);
4344 des_const_xmlChar_ptr(n_name, name, 1);
4345 xmlResetLastError();
4346 if (mem_base != xmlMemBlocks()) {
4347 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4348 xmlMemBlocks() - mem_base);
4349 test_ret++;
4350 printf(" %d", n_ctx);
4351 printf(" %d", n_name);
4352 printf("\n");
4353 }
4354 }
4355 }
4356
4357 function_tests++;
4358 return(test_ret);
4359}
4360
4361
4362static int
4363test_xmlSAX2GetLineNumber(void) {
4364 int test_ret = 0;
4365
4366 int mem_base;
4367 int ret_val;
4368 void * ctx; /* the user data (XML parser context) */
4369 int n_ctx;
4370
4371 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4372 mem_base = xmlMemBlocks();
4373 ctx = gen_void_ptr(n_ctx, 0);
4374
4375 ret_val = xmlSAX2GetLineNumber(ctx);
4376 desret_int(ret_val);
4377 call_tests++;
4378 des_void_ptr(n_ctx, ctx, 0);
4379 xmlResetLastError();
4380 if (mem_base != xmlMemBlocks()) {
4381 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4382 xmlMemBlocks() - mem_base);
4383 test_ret++;
4384 printf(" %d", n_ctx);
4385 printf("\n");
4386 }
4387 }
4388
4389 function_tests++;
4390 return(test_ret);
4391}
4392
4393
4394static int
4395test_xmlSAX2GetParameterEntity(void) {
4396 int test_ret = 0;
4397
4398 int mem_base;
4399 xmlEntityPtr ret_val;
4400 void * ctx; /* the user data (XML parser context) */
4401 int n_ctx;
4402 xmlChar * name; /* The entity name */
4403 int n_name;
4404
4405 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4406 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4407 mem_base = xmlMemBlocks();
4408 ctx = gen_void_ptr(n_ctx, 0);
4409 name = gen_const_xmlChar_ptr(n_name, 1);
4410
4411 ret_val = xmlSAX2GetParameterEntity(ctx, name);
4412 desret_xmlEntityPtr(ret_val);
4413 call_tests++;
4414 des_void_ptr(n_ctx, ctx, 0);
4415 des_const_xmlChar_ptr(n_name, name, 1);
4416 xmlResetLastError();
4417 if (mem_base != xmlMemBlocks()) {
4418 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4419 xmlMemBlocks() - mem_base);
4420 test_ret++;
4421 printf(" %d", n_ctx);
4422 printf(" %d", n_name);
4423 printf("\n");
4424 }
4425 }
4426 }
4427
4428 function_tests++;
4429 return(test_ret);
4430}
4431
4432
4433static int
4434test_xmlSAX2GetPublicId(void) {
4435 int test_ret = 0;
4436
4437 int mem_base;
4438 const xmlChar * ret_val;
4439 void * ctx; /* the user data (XML parser context) */
4440 int n_ctx;
4441
4442 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4443 mem_base = xmlMemBlocks();
4444 ctx = gen_void_ptr(n_ctx, 0);
4445
4446 ret_val = xmlSAX2GetPublicId(ctx);
4447 desret_const_xmlChar_ptr(ret_val);
4448 call_tests++;
4449 des_void_ptr(n_ctx, ctx, 0);
4450 xmlResetLastError();
4451 if (mem_base != xmlMemBlocks()) {
4452 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4453 xmlMemBlocks() - mem_base);
4454 test_ret++;
4455 printf(" %d", n_ctx);
4456 printf("\n");
4457 }
4458 }
4459
4460 function_tests++;
4461 return(test_ret);
4462}
4463
4464
4465static int
4466test_xmlSAX2GetSystemId(void) {
4467 int test_ret = 0;
4468
4469 int mem_base;
4470 const xmlChar * ret_val;
4471 void * ctx; /* the user data (XML parser context) */
4472 int n_ctx;
4473
4474 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4475 mem_base = xmlMemBlocks();
4476 ctx = gen_void_ptr(n_ctx, 0);
4477
4478 ret_val = xmlSAX2GetSystemId(ctx);
4479 desret_const_xmlChar_ptr(ret_val);
4480 call_tests++;
4481 des_void_ptr(n_ctx, ctx, 0);
4482 xmlResetLastError();
4483 if (mem_base != xmlMemBlocks()) {
4484 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4485 xmlMemBlocks() - mem_base);
4486 test_ret++;
4487 printf(" %d", n_ctx);
4488 printf("\n");
4489 }
4490 }
4491
4492 function_tests++;
4493 return(test_ret);
4494}
4495
4496
4497static int
4498test_xmlSAX2HasExternalSubset(void) {
4499 int test_ret = 0;
4500
4501 int mem_base;
4502 int ret_val;
4503 void * ctx; /* the user data (XML parser context) */
4504 int n_ctx;
4505
4506 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4507 mem_base = xmlMemBlocks();
4508 ctx = gen_void_ptr(n_ctx, 0);
4509
4510 ret_val = xmlSAX2HasExternalSubset(ctx);
4511 desret_int(ret_val);
4512 call_tests++;
4513 des_void_ptr(n_ctx, ctx, 0);
4514 xmlResetLastError();
4515 if (mem_base != xmlMemBlocks()) {
4516 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4517 xmlMemBlocks() - mem_base);
4518 test_ret++;
4519 printf(" %d", n_ctx);
4520 printf("\n");
4521 }
4522 }
4523
4524 function_tests++;
4525 return(test_ret);
4526}
4527
4528
4529static int
4530test_xmlSAX2HasInternalSubset(void) {
4531 int test_ret = 0;
4532
4533 int mem_base;
4534 int ret_val;
4535 void * ctx; /* the user data (XML parser context) */
4536 int n_ctx;
4537
4538 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4539 mem_base = xmlMemBlocks();
4540 ctx = gen_void_ptr(n_ctx, 0);
4541
4542 ret_val = xmlSAX2HasInternalSubset(ctx);
4543 desret_int(ret_val);
4544 call_tests++;
4545 des_void_ptr(n_ctx, ctx, 0);
4546 xmlResetLastError();
4547 if (mem_base != xmlMemBlocks()) {
4548 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4549 xmlMemBlocks() - mem_base);
4550 test_ret++;
4551 printf(" %d", n_ctx);
4552 printf("\n");
4553 }
4554 }
4555
4556 function_tests++;
4557 return(test_ret);
4558}
4559
4560
4561static int
4562test_xmlSAX2IgnorableWhitespace(void) {
4563 int test_ret = 0;
4564
4565 int mem_base;
4566 void * ctx; /* the user data (XML parser context) */
4567 int n_ctx;
4568 xmlChar * ch; /* a xmlChar string */
4569 int n_ch;
4570 int len; /* the number of xmlChar */
4571 int n_len;
4572
4573 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4574 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4575 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4576 mem_base = xmlMemBlocks();
4577 ctx = gen_void_ptr(n_ctx, 0);
4578 ch = gen_const_xmlChar_ptr(n_ch, 1);
4579 len = gen_int(n_len, 2);
4580
4581 xmlSAX2IgnorableWhitespace(ctx, ch, len);
4582 call_tests++;
4583 des_void_ptr(n_ctx, ctx, 0);
4584 des_const_xmlChar_ptr(n_ch, ch, 1);
4585 des_int(n_len, len, 2);
4586 xmlResetLastError();
4587 if (mem_base != xmlMemBlocks()) {
4588 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4589 xmlMemBlocks() - mem_base);
4590 test_ret++;
4591 printf(" %d", n_ctx);
4592 printf(" %d", n_ch);
4593 printf(" %d", n_len);
4594 printf("\n");
4595 }
4596 }
4597 }
4598 }
4599
4600 function_tests++;
4601 return(test_ret);
4602}
4603
4604
4605#define gen_nb_xmlSAXHandler_ptr 1
4606static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4607 return(NULL);
4608}
4609static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4610}
4611
4612static int
4613test_xmlSAX2InitDefaultSAXHandler(void) {
4614 int test_ret = 0;
4615
4616 int mem_base;
4617 xmlSAXHandler * hdlr; /* the SAX handler */
4618 int n_hdlr;
4619 int warning; /* flag if non-zero sets the handler warning procedure */
4620 int n_warning;
4621
4622 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4623 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4624 mem_base = xmlMemBlocks();
4625 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4626 warning = gen_int(n_warning, 1);
4627
4628 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4629 call_tests++;
4630 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4631 des_int(n_warning, warning, 1);
4632 xmlResetLastError();
4633 if (mem_base != xmlMemBlocks()) {
4634 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4635 xmlMemBlocks() - mem_base);
4636 test_ret++;
4637 printf(" %d", n_hdlr);
4638 printf(" %d", n_warning);
4639 printf("\n");
4640 }
4641 }
4642 }
4643
4644 function_tests++;
4645 return(test_ret);
4646}
4647
4648
4649static int
4650test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4651 int test_ret = 0;
4652
4653#ifdef LIBXML_DOCB_ENABLED
4654 int mem_base;
4655 xmlSAXHandler * hdlr; /* the SAX handler */
4656 int n_hdlr;
4657
4658 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4659 mem_base = xmlMemBlocks();
4660 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4661
4662 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4663 call_tests++;
4664 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4665 xmlResetLastError();
4666 if (mem_base != xmlMemBlocks()) {
4667 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4668 xmlMemBlocks() - mem_base);
4669 test_ret++;
4670 printf(" %d", n_hdlr);
4671 printf("\n");
4672 }
4673 }
4674#endif
4675
4676 function_tests++;
4677 return(test_ret);
4678}
4679
4680
4681static int
4682test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4683 int test_ret = 0;
4684
4685#ifdef LIBXML_HTML_ENABLED
4686 int mem_base;
4687 xmlSAXHandler * hdlr; /* the SAX handler */
4688 int n_hdlr;
4689
4690 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4691 mem_base = xmlMemBlocks();
4692 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4693
4694 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4695 call_tests++;
4696 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4697 xmlResetLastError();
4698 if (mem_base != xmlMemBlocks()) {
4699 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4700 xmlMemBlocks() - mem_base);
4701 test_ret++;
4702 printf(" %d", n_hdlr);
4703 printf("\n");
4704 }
4705 }
4706#endif
4707
4708 function_tests++;
4709 return(test_ret);
4710}
4711
4712
4713static int
4714test_xmlSAX2InternalSubset(void) {
4715 int test_ret = 0;
4716
4717 int mem_base;
4718 void * ctx; /* the user data (XML parser context) */
4719 int n_ctx;
4720 xmlChar * name; /* the root element name */
4721 int n_name;
4722 xmlChar * ExternalID; /* the external ID */
4723 int n_ExternalID;
4724 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4725 int n_SystemID;
4726
4727 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4728 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4729 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4730 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4731 mem_base = xmlMemBlocks();
4732 ctx = gen_void_ptr(n_ctx, 0);
4733 name = gen_const_xmlChar_ptr(n_name, 1);
4734 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4735 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4736
4737 xmlSAX2InternalSubset(ctx, name, ExternalID, SystemID);
4738 call_tests++;
4739 des_void_ptr(n_ctx, ctx, 0);
4740 des_const_xmlChar_ptr(n_name, name, 1);
4741 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
4742 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
4743 xmlResetLastError();
4744 if (mem_base != xmlMemBlocks()) {
4745 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4746 xmlMemBlocks() - mem_base);
4747 test_ret++;
4748 printf(" %d", n_ctx);
4749 printf(" %d", n_name);
4750 printf(" %d", n_ExternalID);
4751 printf(" %d", n_SystemID);
4752 printf("\n");
4753 }
4754 }
4755 }
4756 }
4757 }
4758
4759 function_tests++;
4760 return(test_ret);
4761}
4762
4763
4764static int
4765test_xmlSAX2IsStandalone(void) {
4766 int test_ret = 0;
4767
4768 int mem_base;
4769 int ret_val;
4770 void * ctx; /* the user data (XML parser context) */
4771 int n_ctx;
4772
4773 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4774 mem_base = xmlMemBlocks();
4775 ctx = gen_void_ptr(n_ctx, 0);
4776
4777 ret_val = xmlSAX2IsStandalone(ctx);
4778 desret_int(ret_val);
4779 call_tests++;
4780 des_void_ptr(n_ctx, ctx, 0);
4781 xmlResetLastError();
4782 if (mem_base != xmlMemBlocks()) {
4783 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4784 xmlMemBlocks() - mem_base);
4785 test_ret++;
4786 printf(" %d", n_ctx);
4787 printf("\n");
4788 }
4789 }
4790
4791 function_tests++;
4792 return(test_ret);
4793}
4794
4795
4796static int
4797test_xmlSAX2NotationDecl(void) {
4798 int test_ret = 0;
4799
4800 int mem_base;
4801 void * ctx; /* the user data (XML parser context) */
4802 int n_ctx;
4803 xmlChar * name; /* The name of the notation */
4804 int n_name;
4805 xmlChar * publicId; /* The public ID of the entity */
4806 int n_publicId;
4807 xmlChar * systemId; /* The system ID of the entity */
4808 int n_systemId;
4809
4810 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4811 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4812 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4813 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4814 mem_base = xmlMemBlocks();
4815 ctx = gen_void_ptr(n_ctx, 0);
4816 name = gen_const_xmlChar_ptr(n_name, 1);
4817 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4818 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4819
4820 xmlSAX2NotationDecl(ctx, name, publicId, systemId);
4821 call_tests++;
4822 des_void_ptr(n_ctx, ctx, 0);
4823 des_const_xmlChar_ptr(n_name, name, 1);
4824 des_const_xmlChar_ptr(n_publicId, publicId, 2);
4825 des_const_xmlChar_ptr(n_systemId, systemId, 3);
4826 xmlResetLastError();
4827 if (mem_base != xmlMemBlocks()) {
4828 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4829 xmlMemBlocks() - mem_base);
4830 test_ret++;
4831 printf(" %d", n_ctx);
4832 printf(" %d", n_name);
4833 printf(" %d", n_publicId);
4834 printf(" %d", n_systemId);
4835 printf("\n");
4836 }
4837 }
4838 }
4839 }
4840 }
4841
4842 function_tests++;
4843 return(test_ret);
4844}
4845
4846
4847static int
4848test_xmlSAX2ProcessingInstruction(void) {
4849 int test_ret = 0;
4850
4851 int mem_base;
4852 void * ctx; /* the user data (XML parser context) */
4853 int n_ctx;
4854 xmlChar * target; /* the target name */
4855 int n_target;
4856 xmlChar * data; /* the PI data's */
4857 int n_data;
4858
4859 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4860 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
4861 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
4862 mem_base = xmlMemBlocks();
4863 ctx = gen_void_ptr(n_ctx, 0);
4864 target = gen_const_xmlChar_ptr(n_target, 1);
4865 data = gen_const_xmlChar_ptr(n_data, 2);
4866
4867 xmlSAX2ProcessingInstruction(ctx, target, data);
4868 call_tests++;
4869 des_void_ptr(n_ctx, ctx, 0);
4870 des_const_xmlChar_ptr(n_target, target, 1);
4871 des_const_xmlChar_ptr(n_data, data, 2);
4872 xmlResetLastError();
4873 if (mem_base != xmlMemBlocks()) {
4874 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
4875 xmlMemBlocks() - mem_base);
4876 test_ret++;
4877 printf(" %d", n_ctx);
4878 printf(" %d", n_target);
4879 printf(" %d", n_data);
4880 printf("\n");
4881 }
4882 }
4883 }
4884 }
4885
4886 function_tests++;
4887 return(test_ret);
4888}
4889
4890
4891static int
4892test_xmlSAX2Reference(void) {
4893 int test_ret = 0;
4894
4895 int mem_base;
4896 void * ctx; /* the user data (XML parser context) */
4897 int n_ctx;
4898 xmlChar * name; /* The entity name */
4899 int n_name;
4900
4901 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4902 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4903 mem_base = xmlMemBlocks();
4904 ctx = gen_void_ptr(n_ctx, 0);
4905 name = gen_const_xmlChar_ptr(n_name, 1);
4906
4907 xmlSAX2Reference(ctx, name);
4908 call_tests++;
4909 des_void_ptr(n_ctx, ctx, 0);
4910 des_const_xmlChar_ptr(n_name, name, 1);
4911 xmlResetLastError();
4912 if (mem_base != xmlMemBlocks()) {
4913 printf("Leak of %d blocks found in xmlSAX2Reference",
4914 xmlMemBlocks() - mem_base);
4915 test_ret++;
4916 printf(" %d", n_ctx);
4917 printf(" %d", n_name);
4918 printf("\n");
4919 }
4920 }
4921 }
4922
4923 function_tests++;
4924 return(test_ret);
4925}
4926
4927
4928static int
4929test_xmlSAX2ResolveEntity(void) {
4930 int test_ret = 0;
4931
4932 int mem_base;
4933 xmlParserInputPtr ret_val;
4934 void * ctx; /* the user data (XML parser context) */
4935 int n_ctx;
4936 xmlChar * publicId; /* The public ID of the entity */
4937 int n_publicId;
4938 xmlChar * systemId; /* The system ID of the entity */
4939 int n_systemId;
4940
4941 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4942 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4943 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4944 mem_base = xmlMemBlocks();
4945 ctx = gen_void_ptr(n_ctx, 0);
4946 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
4947 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
4948
4949 ret_val = xmlSAX2ResolveEntity(ctx, publicId, systemId);
4950 desret_xmlParserInputPtr(ret_val);
4951 call_tests++;
4952 des_void_ptr(n_ctx, ctx, 0);
4953 des_const_xmlChar_ptr(n_publicId, publicId, 1);
4954 des_const_xmlChar_ptr(n_systemId, systemId, 2);
4955 xmlResetLastError();
4956 if (mem_base != xmlMemBlocks()) {
4957 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
4958 xmlMemBlocks() - mem_base);
4959 test_ret++;
4960 printf(" %d", n_ctx);
4961 printf(" %d", n_publicId);
4962 printf(" %d", n_systemId);
4963 printf("\n");
4964 }
4965 }
4966 }
4967 }
4968
4969 function_tests++;
4970 return(test_ret);
4971}
4972
4973
4974#define gen_nb_xmlSAXLocatorPtr 1
4975static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4976 return(NULL);
4977}
4978static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4979}
4980
4981static int
4982test_xmlSAX2SetDocumentLocator(void) {
4983 int test_ret = 0;
4984
4985 int mem_base;
4986 void * ctx; /* the user data (XML parser context) */
4987 int n_ctx;
4988 xmlSAXLocatorPtr loc; /* A SAX Locator */
4989 int n_loc;
4990
4991 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4992 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
4993 mem_base = xmlMemBlocks();
4994 ctx = gen_void_ptr(n_ctx, 0);
4995 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
4996
4997 xmlSAX2SetDocumentLocator(ctx, loc);
4998 call_tests++;
4999 des_void_ptr(n_ctx, ctx, 0);
5000 des_xmlSAXLocatorPtr(n_loc, loc, 1);
5001 xmlResetLastError();
5002 if (mem_base != xmlMemBlocks()) {
5003 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
5004 xmlMemBlocks() - mem_base);
5005 test_ret++;
5006 printf(" %d", n_ctx);
5007 printf(" %d", n_loc);
5008 printf("\n");
5009 }
5010 }
5011 }
5012
5013 function_tests++;
5014 return(test_ret);
5015}
5016
5017
5018static int
5019test_xmlSAX2StartDocument(void) {
5020 int test_ret = 0;
5021
5022 int mem_base;
5023 void * ctx; /* the user data (XML parser context) */
5024 int n_ctx;
5025
5026 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5027 mem_base = xmlMemBlocks();
5028 ctx = gen_void_ptr(n_ctx, 0);
5029
5030 xmlSAX2StartDocument(ctx);
5031 call_tests++;
5032 des_void_ptr(n_ctx, ctx, 0);
5033 xmlResetLastError();
5034 if (mem_base != xmlMemBlocks()) {
5035 printf("Leak of %d blocks found in xmlSAX2StartDocument",
5036 xmlMemBlocks() - mem_base);
5037 test_ret++;
5038 printf(" %d", n_ctx);
5039 printf("\n");
5040 }
5041 }
5042
5043 function_tests++;
5044 return(test_ret);
5045}
5046
5047
5048static int
5049test_xmlSAX2StartElement(void) {
5050 int test_ret = 0;
5051
5052 int mem_base;
5053 void * ctx; /* the user data (XML parser context) */
5054 int n_ctx;
5055 xmlChar * fullname; /* The element name, including namespace prefix */
5056 int n_fullname;
5057 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
5058 int n_atts;
5059
5060 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5061 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
5062 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
5063 mem_base = xmlMemBlocks();
5064 ctx = gen_void_ptr(n_ctx, 0);
5065 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
5066 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
5067
5068 xmlSAX2StartElement(ctx, fullname, atts);
5069 call_tests++;
5070 des_void_ptr(n_ctx, ctx, 0);
5071 des_const_xmlChar_ptr(n_fullname, fullname, 1);
5072 des_const_xmlChar_ptr_ptr(n_atts, atts, 2);
5073 xmlResetLastError();
5074 if (mem_base != xmlMemBlocks()) {
5075 printf("Leak of %d blocks found in xmlSAX2StartElement",
5076 xmlMemBlocks() - mem_base);
5077 test_ret++;
5078 printf(" %d", n_ctx);
5079 printf(" %d", n_fullname);
5080 printf(" %d", n_atts);
5081 printf("\n");
5082 }
5083 }
5084 }
5085 }
5086
5087 function_tests++;
5088 return(test_ret);
5089}
5090
5091
5092static int
5093test_xmlSAX2StartElementNs(void) {
5094 int test_ret = 0;
5095
5096 int mem_base;
5097 void * ctx; /* the user data (XML parser context) */
5098 int n_ctx;
5099 xmlChar * localname; /* the local name of the element */
5100 int n_localname;
5101 xmlChar * prefix; /* the element namespace prefix if available */
5102 int n_prefix;
5103 xmlChar * URI; /* the element namespace name if available */
5104 int n_URI;
5105 int nb_namespaces; /* number of namespace definitions on that node */
5106 int n_nb_namespaces;
5107 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
5108 int n_namespaces;
5109 int nb_attributes; /* the number of attributes on that node */
5110 int n_nb_attributes;
5111 int nb_defaulted; /* the number of defaulted attributes. */
5112 int n_nb_defaulted;
5113 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
5114 int n_attributes;
5115
5116 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5117 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
5118 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
5119 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5120 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
5121 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
5122 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
5123 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
5124 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
5125 mem_base = xmlMemBlocks();
5126 ctx = gen_void_ptr(n_ctx, 0);
5127 localname = gen_const_xmlChar_ptr(n_localname, 1);
5128 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
5129 URI = gen_const_xmlChar_ptr(n_URI, 3);
5130 nb_namespaces = gen_int(n_nb_namespaces, 4);
5131 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
5132 nb_attributes = gen_int(n_nb_attributes, 6);
5133 nb_defaulted = gen_int(n_nb_defaulted, 7);
5134 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
5135
5136 xmlSAX2StartElementNs(ctx, localname, prefix, URI, nb_namespaces, namespaces, nb_attributes, nb_defaulted, attributes);
5137 call_tests++;
5138 des_void_ptr(n_ctx, ctx, 0);
5139 des_const_xmlChar_ptr(n_localname, localname, 1);
5140 des_const_xmlChar_ptr(n_prefix, prefix, 2);
5141 des_const_xmlChar_ptr(n_URI, URI, 3);
5142 des_int(n_nb_namespaces, nb_namespaces, 4);
5143 des_const_xmlChar_ptr_ptr(n_namespaces, namespaces, 5);
5144 des_int(n_nb_attributes, nb_attributes, 6);
5145 des_int(n_nb_defaulted, nb_defaulted, 7);
5146 des_const_xmlChar_ptr_ptr(n_attributes, attributes, 8);
5147 xmlResetLastError();
5148 if (mem_base != xmlMemBlocks()) {
5149 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
5150 xmlMemBlocks() - mem_base);
5151 test_ret++;
5152 printf(" %d", n_ctx);
5153 printf(" %d", n_localname);
5154 printf(" %d", n_prefix);
5155 printf(" %d", n_URI);
5156 printf(" %d", n_nb_namespaces);
5157 printf(" %d", n_namespaces);
5158 printf(" %d", n_nb_attributes);
5159 printf(" %d", n_nb_defaulted);
5160 printf(" %d", n_attributes);
5161 printf("\n");
5162 }
5163 }
5164 }
5165 }
5166 }
5167 }
5168 }
5169 }
5170 }
5171 }
5172
5173 function_tests++;
5174 return(test_ret);
5175}
5176
5177
5178static int
5179test_xmlSAX2UnparsedEntityDecl(void) {
5180 int test_ret = 0;
5181
5182 int mem_base;
5183 void * ctx; /* the user data (XML parser context) */
5184 int n_ctx;
5185 xmlChar * name; /* The name of the entity */
5186 int n_name;
5187 xmlChar * publicId; /* The public ID of the entity */
5188 int n_publicId;
5189 xmlChar * systemId; /* The system ID of the entity */
5190 int n_systemId;
5191 xmlChar * notationName; /* the name of the notation */
5192 int n_notationName;
5193
5194 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5195 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5196 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5197 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5198 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
5199 mem_base = xmlMemBlocks();
5200 ctx = gen_void_ptr(n_ctx, 0);
5201 name = gen_const_xmlChar_ptr(n_name, 1);
5202 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
5203 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
5204 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
5205
5206 xmlSAX2UnparsedEntityDecl(ctx, name, publicId, systemId, notationName);
5207 call_tests++;
5208 des_void_ptr(n_ctx, ctx, 0);
5209 des_const_xmlChar_ptr(n_name, name, 1);
5210 des_const_xmlChar_ptr(n_publicId, publicId, 2);
5211 des_const_xmlChar_ptr(n_systemId, systemId, 3);
5212 des_const_xmlChar_ptr(n_notationName, notationName, 4);
5213 xmlResetLastError();
5214 if (mem_base != xmlMemBlocks()) {
5215 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5216 xmlMemBlocks() - mem_base);
5217 test_ret++;
5218 printf(" %d", n_ctx);
5219 printf(" %d", n_name);
5220 printf(" %d", n_publicId);
5221 printf(" %d", n_systemId);
5222 printf(" %d", n_notationName);
5223 printf("\n");
5224 }
5225 }
5226 }
5227 }
5228 }
5229 }
5230
5231 function_tests++;
5232 return(test_ret);
5233}
5234
5235
5236static int
5237test_xmlSAXDefaultVersion(void) {
5238 int test_ret = 0;
5239
5240 int mem_base;
5241 int ret_val;
5242 int version; /* the version, 1 or 2 */
5243 int n_version;
5244
5245 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5246 mem_base = xmlMemBlocks();
5247 version = gen_int(n_version, 0);
5248
5249 ret_val = xmlSAXDefaultVersion(version);
5250 desret_int(ret_val);
5251 call_tests++;
5252 des_int(n_version, version, 0);
5253 xmlResetLastError();
5254 if (mem_base != xmlMemBlocks()) {
5255 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5256 xmlMemBlocks() - mem_base);
5257 test_ret++;
5258 printf(" %d", n_version);
5259 printf("\n");
5260 }
5261 }
5262
5263 function_tests++;
5264 return(test_ret);
5265}
5266
5267
5268static int
5269test_xmlSAXVersion(void) {
5270 int test_ret = 0;
5271
5272 int mem_base;
5273 int ret_val;
5274 xmlSAXHandler * hdlr; /* the SAX handler */
5275 int n_hdlr;
5276 int version; /* the version, 1 or 2 */
5277 int n_version;
5278
5279 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5280 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5281 mem_base = xmlMemBlocks();
5282 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5283 version = gen_int(n_version, 1);
5284
5285 ret_val = xmlSAXVersion(hdlr, version);
5286 desret_int(ret_val);
5287 call_tests++;
5288 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5289 des_int(n_version, version, 1);
5290 xmlResetLastError();
5291 if (mem_base != xmlMemBlocks()) {
5292 printf("Leak of %d blocks found in xmlSAXVersion",
5293 xmlMemBlocks() - mem_base);
5294 test_ret++;
5295 printf(" %d", n_hdlr);
5296 printf(" %d", n_version);
5297 printf("\n");
5298 }
5299 }
5300 }
5301
5302 function_tests++;
5303 return(test_ret);
5304}
5305
5306static int
5307test_SAX2(void) {
5308 int test_ret = 0;
5309
5310 printf("Testing SAX2 : 38 of 38 functions ...\n");
5311 test_ret += test_docbDefaultSAXHandlerInit();
5312 test_ret += test_htmlDefaultSAXHandlerInit();
5313 test_ret += test_xmlDefaultSAXHandlerInit();
5314 test_ret += test_xmlSAX2AttributeDecl();
5315 test_ret += test_xmlSAX2CDataBlock();
5316 test_ret += test_xmlSAX2Characters();
5317 test_ret += test_xmlSAX2Comment();
5318 test_ret += test_xmlSAX2ElementDecl();
5319 test_ret += test_xmlSAX2EndDocument();
5320 test_ret += test_xmlSAX2EndElement();
5321 test_ret += test_xmlSAX2EndElementNs();
5322 test_ret += test_xmlSAX2EntityDecl();
5323 test_ret += test_xmlSAX2ExternalSubset();
5324 test_ret += test_xmlSAX2GetColumnNumber();
5325 test_ret += test_xmlSAX2GetEntity();
5326 test_ret += test_xmlSAX2GetLineNumber();
5327 test_ret += test_xmlSAX2GetParameterEntity();
5328 test_ret += test_xmlSAX2GetPublicId();
5329 test_ret += test_xmlSAX2GetSystemId();
5330 test_ret += test_xmlSAX2HasExternalSubset();
5331 test_ret += test_xmlSAX2HasInternalSubset();
5332 test_ret += test_xmlSAX2IgnorableWhitespace();
5333 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5334 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5335 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5336 test_ret += test_xmlSAX2InternalSubset();
5337 test_ret += test_xmlSAX2IsStandalone();
5338 test_ret += test_xmlSAX2NotationDecl();
5339 test_ret += test_xmlSAX2ProcessingInstruction();
5340 test_ret += test_xmlSAX2Reference();
5341 test_ret += test_xmlSAX2ResolveEntity();
5342 test_ret += test_xmlSAX2SetDocumentLocator();
5343 test_ret += test_xmlSAX2StartDocument();
5344 test_ret += test_xmlSAX2StartElement();
5345 test_ret += test_xmlSAX2StartElementNs();
5346 test_ret += test_xmlSAX2UnparsedEntityDecl();
5347 test_ret += test_xmlSAXDefaultVersion();
5348 test_ret += test_xmlSAXVersion();
5349
5350 if (test_ret != 0)
5351 printf("Module SAX2: %d errors\n", test_ret);
5352 return(test_ret);
5353}
5354
Daniel Veillarda82b1822004-11-08 16:24:57 +00005355#define gen_nb_xmlNodeSetPtr 1
5356static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5357 return(NULL);
5358}
5359static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5360}
5361
5362static int
5363test_xmlC14NDocDumpMemory(void) {
5364 int test_ret = 0;
5365
5366#ifdef LIBXML_C14N_ENABLED
5367#ifdef LIBXML_OUTPUT_ENABLED
5368 int mem_base;
5369 int ret_val;
5370 xmlDocPtr doc; /* the XML document for canonization */
5371 int n_doc;
5372 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5373 int n_nodes;
5374 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5375 int n_exclusive;
5376 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) */
5377 int n_inclusive_ns_prefixes;
5378 int with_comments; /* include comments in the result (!=0) or not (==0) */
5379 int n_with_comments;
5380 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 */
5381 int n_doc_txt_ptr;
5382
5383 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5384 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5385 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5386 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5387 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5388 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5389 mem_base = xmlMemBlocks();
5390 doc = gen_xmlDocPtr(n_doc, 0);
5391 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5392 exclusive = gen_int(n_exclusive, 2);
5393 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5394 with_comments = gen_int(n_with_comments, 4);
5395 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5396
5397 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5398 desret_int(ret_val);
5399 call_tests++;
5400 des_xmlDocPtr(n_doc, doc, 0);
5401 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5402 des_int(n_exclusive, exclusive, 2);
5403 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5404 des_int(n_with_comments, with_comments, 4);
5405 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5406 xmlResetLastError();
5407 if (mem_base != xmlMemBlocks()) {
5408 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5409 xmlMemBlocks() - mem_base);
5410 test_ret++;
5411 printf(" %d", n_doc);
5412 printf(" %d", n_nodes);
5413 printf(" %d", n_exclusive);
5414 printf(" %d", n_inclusive_ns_prefixes);
5415 printf(" %d", n_with_comments);
5416 printf(" %d", n_doc_txt_ptr);
5417 printf("\n");
5418 }
5419 }
5420 }
5421 }
5422 }
5423 }
5424 }
5425#endif
5426#endif
5427
5428 function_tests++;
5429 return(test_ret);
5430}
5431
5432
5433static int
5434test_xmlC14NDocSave(void) {
5435 int test_ret = 0;
5436
5437#ifdef LIBXML_C14N_ENABLED
5438#ifdef LIBXML_OUTPUT_ENABLED
5439 int mem_base;
5440 int ret_val;
5441 xmlDocPtr doc; /* the XML document for canonization */
5442 int n_doc;
5443 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5444 int n_nodes;
5445 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5446 int n_exclusive;
5447 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) */
5448 int n_inclusive_ns_prefixes;
5449 int with_comments; /* include comments in the result (!=0) or not (==0) */
5450 int n_with_comments;
5451 const char * filename; /* the filename to store canonical XML image */
5452 int n_filename;
5453 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5454 int n_compression;
5455
5456 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5457 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5458 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5459 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5460 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5461 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5462 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5463 mem_base = xmlMemBlocks();
5464 doc = gen_xmlDocPtr(n_doc, 0);
5465 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5466 exclusive = gen_int(n_exclusive, 2);
5467 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5468 with_comments = gen_int(n_with_comments, 4);
5469 filename = gen_fileoutput(n_filename, 5);
5470 compression = gen_int(n_compression, 6);
5471
5472 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5473 desret_int(ret_val);
5474 call_tests++;
5475 des_xmlDocPtr(n_doc, doc, 0);
5476 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5477 des_int(n_exclusive, exclusive, 2);
5478 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5479 des_int(n_with_comments, with_comments, 4);
5480 des_fileoutput(n_filename, filename, 5);
5481 des_int(n_compression, compression, 6);
5482 xmlResetLastError();
5483 if (mem_base != xmlMemBlocks()) {
5484 printf("Leak of %d blocks found in xmlC14NDocSave",
5485 xmlMemBlocks() - mem_base);
5486 test_ret++;
5487 printf(" %d", n_doc);
5488 printf(" %d", n_nodes);
5489 printf(" %d", n_exclusive);
5490 printf(" %d", n_inclusive_ns_prefixes);
5491 printf(" %d", n_with_comments);
5492 printf(" %d", n_filename);
5493 printf(" %d", n_compression);
5494 printf("\n");
5495 }
5496 }
5497 }
5498 }
5499 }
5500 }
5501 }
5502 }
5503#endif
5504#endif
5505
5506 function_tests++;
5507 return(test_ret);
5508}
5509
5510
5511static int
5512test_xmlC14NDocSaveTo(void) {
5513 int test_ret = 0;
5514
5515#ifdef LIBXML_C14N_ENABLED
5516#ifdef LIBXML_OUTPUT_ENABLED
5517 int mem_base;
5518 int ret_val;
5519 xmlDocPtr doc; /* the XML document for canonization */
5520 int n_doc;
5521 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5522 int n_nodes;
5523 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5524 int n_exclusive;
5525 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) */
5526 int n_inclusive_ns_prefixes;
5527 int with_comments; /* include comments in the result (!=0) or not (==0) */
5528 int n_with_comments;
5529 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5530 int n_buf;
5531
5532 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5533 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5534 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5535 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5536 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5537 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5538 mem_base = xmlMemBlocks();
5539 doc = gen_xmlDocPtr(n_doc, 0);
5540 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5541 exclusive = gen_int(n_exclusive, 2);
5542 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5543 with_comments = gen_int(n_with_comments, 4);
5544 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5545
5546 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5547 desret_int(ret_val);
5548 call_tests++;
5549 des_xmlDocPtr(n_doc, doc, 0);
5550 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5551 des_int(n_exclusive, exclusive, 2);
5552 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5553 des_int(n_with_comments, with_comments, 4);
5554 des_xmlOutputBufferPtr(n_buf, buf, 5);
5555 xmlResetLastError();
5556 if (mem_base != xmlMemBlocks()) {
5557 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5558 xmlMemBlocks() - mem_base);
5559 test_ret++;
5560 printf(" %d", n_doc);
5561 printf(" %d", n_nodes);
5562 printf(" %d", n_exclusive);
5563 printf(" %d", n_inclusive_ns_prefixes);
5564 printf(" %d", n_with_comments);
5565 printf(" %d", n_buf);
5566 printf("\n");
5567 }
5568 }
5569 }
5570 }
5571 }
5572 }
5573 }
5574#endif
5575#endif
5576
5577 function_tests++;
5578 return(test_ret);
5579}
5580
5581
5582static int
5583test_xmlC14NExecute(void) {
5584 int test_ret = 0;
5585
5586
5587 /* missing type support */
5588 return(test_ret);
5589}
5590
5591static int
5592test_c14n(void) {
5593 int test_ret = 0;
5594
5595 printf("Testing c14n : 3 of 4 functions ...\n");
5596 test_ret += test_xmlC14NDocDumpMemory();
5597 test_ret += test_xmlC14NDocSave();
5598 test_ret += test_xmlC14NDocSaveTo();
5599 test_ret += test_xmlC14NExecute();
5600
5601 if (test_ret != 0)
5602 printf("Module c14n: %d errors\n", test_ret);
5603 return(test_ret);
5604}
5605
Daniel Veillardce682bc2004-11-05 17:22:25 +00005606#define gen_nb_xmlCatalogPtr 1
5607static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5608 return(NULL);
5609}
5610static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5611}
5612
Daniel Veillardd93f6252004-11-02 15:53:51 +00005613static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005614test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005616
Daniel Veillardce682bc2004-11-05 17:22:25 +00005617#ifdef LIBXML_CATALOG_ENABLED
5618 int mem_base;
5619 int ret_val;
5620 xmlCatalogPtr catal; /* a Catalog */
5621 int n_catal;
5622 xmlChar * type; /* the type of record to add to the catalog */
5623 int n_type;
5624 xmlChar * orig; /* the system, public or prefix to match */
5625 int n_orig;
5626 xmlChar * replace; /* the replacement value for the match */
5627 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005628
Daniel Veillardce682bc2004-11-05 17:22:25 +00005629 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5630 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5631 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5632 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5633 mem_base = xmlMemBlocks();
5634 catal = gen_xmlCatalogPtr(n_catal, 0);
5635 type = gen_const_xmlChar_ptr(n_type, 1);
5636 orig = gen_const_xmlChar_ptr(n_orig, 2);
5637 replace = gen_const_xmlChar_ptr(n_replace, 3);
5638
5639 ret_val = xmlACatalogAdd(catal, type, orig, replace);
5640 desret_int(ret_val);
5641 call_tests++;
5642 des_xmlCatalogPtr(n_catal, catal, 0);
5643 des_const_xmlChar_ptr(n_type, type, 1);
5644 des_const_xmlChar_ptr(n_orig, orig, 2);
5645 des_const_xmlChar_ptr(n_replace, replace, 3);
5646 xmlResetLastError();
5647 if (mem_base != xmlMemBlocks()) {
5648 printf("Leak of %d blocks found in xmlACatalogAdd",
5649 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005650 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005651 printf(" %d", n_catal);
5652 printf(" %d", n_type);
5653 printf(" %d", n_orig);
5654 printf(" %d", n_replace);
5655 printf("\n");
5656 }
5657 }
5658 }
5659 }
5660 }
5661#endif
5662
5663 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005664 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005665}
5666
5667
5668static int
5669test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005670 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005671
Daniel Veillardce682bc2004-11-05 17:22:25 +00005672#ifdef LIBXML_CATALOG_ENABLED
5673#ifdef LIBXML_OUTPUT_ENABLED
5674 int mem_base;
5675 xmlCatalogPtr catal; /* a Catalog */
5676 int n_catal;
5677 FILE * out; /* the file. */
5678 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005679
Daniel Veillardce682bc2004-11-05 17:22:25 +00005680 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5681 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5682 mem_base = xmlMemBlocks();
5683 catal = gen_xmlCatalogPtr(n_catal, 0);
5684 out = gen_FILE_ptr(n_out, 1);
5685
5686 xmlACatalogDump(catal, out);
5687 call_tests++;
5688 des_xmlCatalogPtr(n_catal, catal, 0);
5689 des_FILE_ptr(n_out, out, 1);
5690 xmlResetLastError();
5691 if (mem_base != xmlMemBlocks()) {
5692 printf("Leak of %d blocks found in xmlACatalogDump",
5693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005694 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005695 printf(" %d", n_catal);
5696 printf(" %d", n_out);
5697 printf("\n");
5698 }
5699 }
5700 }
5701#endif
5702#endif
5703
5704 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005705 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005706}
5707
5708
5709static int
5710test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005712
Daniel Veillardce682bc2004-11-05 17:22:25 +00005713#ifdef LIBXML_CATALOG_ENABLED
5714 int mem_base;
5715 int ret_val;
5716 xmlCatalogPtr catal; /* a Catalog */
5717 int n_catal;
5718 xmlChar * value; /* the value to remove */
5719 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005720
Daniel Veillardce682bc2004-11-05 17:22:25 +00005721 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5722 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5723 mem_base = xmlMemBlocks();
5724 catal = gen_xmlCatalogPtr(n_catal, 0);
5725 value = gen_const_xmlChar_ptr(n_value, 1);
5726
5727 ret_val = xmlACatalogRemove(catal, value);
5728 desret_int(ret_val);
5729 call_tests++;
5730 des_xmlCatalogPtr(n_catal, catal, 0);
5731 des_const_xmlChar_ptr(n_value, value, 1);
5732 xmlResetLastError();
5733 if (mem_base != xmlMemBlocks()) {
5734 printf("Leak of %d blocks found in xmlACatalogRemove",
5735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005736 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005737 printf(" %d", n_catal);
5738 printf(" %d", n_value);
5739 printf("\n");
5740 }
5741 }
5742 }
5743#endif
5744
5745 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005746 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005747}
5748
5749
5750static int
5751test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005752 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005753
Daniel Veillardce682bc2004-11-05 17:22:25 +00005754#ifdef LIBXML_CATALOG_ENABLED
5755 int mem_base;
5756 xmlChar * ret_val;
5757 xmlCatalogPtr catal; /* a Catalog */
5758 int n_catal;
5759 xmlChar * pubID; /* the public ID string */
5760 int n_pubID;
5761 xmlChar * sysID; /* the system ID string */
5762 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005763
Daniel Veillardce682bc2004-11-05 17:22:25 +00005764 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5765 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5766 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5767 mem_base = xmlMemBlocks();
5768 catal = gen_xmlCatalogPtr(n_catal, 0);
5769 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5770 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5771
5772 ret_val = xmlACatalogResolve(catal, pubID, sysID);
5773 desret_xmlChar_ptr(ret_val);
5774 call_tests++;
5775 des_xmlCatalogPtr(n_catal, catal, 0);
5776 des_const_xmlChar_ptr(n_pubID, pubID, 1);
5777 des_const_xmlChar_ptr(n_sysID, sysID, 2);
5778 xmlResetLastError();
5779 if (mem_base != xmlMemBlocks()) {
5780 printf("Leak of %d blocks found in xmlACatalogResolve",
5781 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005782 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005783 printf(" %d", n_catal);
5784 printf(" %d", n_pubID);
5785 printf(" %d", n_sysID);
5786 printf("\n");
5787 }
5788 }
5789 }
5790 }
5791#endif
5792
5793 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005795}
5796
5797
5798static int
5799test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005801
Daniel Veillardce682bc2004-11-05 17:22:25 +00005802#ifdef LIBXML_CATALOG_ENABLED
5803 int mem_base;
5804 xmlChar * ret_val;
5805 xmlCatalogPtr catal; /* a Catalog */
5806 int n_catal;
5807 xmlChar * pubID; /* the public ID string */
5808 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005809
Daniel Veillardce682bc2004-11-05 17:22:25 +00005810 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5811 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5812 mem_base = xmlMemBlocks();
5813 catal = gen_xmlCatalogPtr(n_catal, 0);
5814 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5815
5816 ret_val = xmlACatalogResolvePublic(catal, pubID);
5817 desret_xmlChar_ptr(ret_val);
5818 call_tests++;
5819 des_xmlCatalogPtr(n_catal, catal, 0);
5820 des_const_xmlChar_ptr(n_pubID, pubID, 1);
5821 xmlResetLastError();
5822 if (mem_base != xmlMemBlocks()) {
5823 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005825 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005826 printf(" %d", n_catal);
5827 printf(" %d", n_pubID);
5828 printf("\n");
5829 }
5830 }
5831 }
5832#endif
5833
5834 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005835 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005836}
5837
5838
5839static int
5840test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005841 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005842
Daniel Veillardce682bc2004-11-05 17:22:25 +00005843#ifdef LIBXML_CATALOG_ENABLED
5844 int mem_base;
5845 xmlChar * ret_val;
5846 xmlCatalogPtr catal; /* a Catalog */
5847 int n_catal;
5848 xmlChar * sysID; /* the system ID string */
5849 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005850
Daniel Veillardce682bc2004-11-05 17:22:25 +00005851 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5852 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5853 mem_base = xmlMemBlocks();
5854 catal = gen_xmlCatalogPtr(n_catal, 0);
5855 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
5856
5857 ret_val = xmlACatalogResolveSystem(catal, sysID);
5858 desret_xmlChar_ptr(ret_val);
5859 call_tests++;
5860 des_xmlCatalogPtr(n_catal, catal, 0);
5861 des_const_xmlChar_ptr(n_sysID, sysID, 1);
5862 xmlResetLastError();
5863 if (mem_base != xmlMemBlocks()) {
5864 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
5865 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005866 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005867 printf(" %d", n_catal);
5868 printf(" %d", n_sysID);
5869 printf("\n");
5870 }
5871 }
5872 }
5873#endif
5874
5875 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005876 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005877}
5878
5879
5880static int
5881test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005882 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005883
Daniel Veillardce682bc2004-11-05 17:22:25 +00005884#ifdef LIBXML_CATALOG_ENABLED
5885 int mem_base;
5886 xmlChar * ret_val;
5887 xmlCatalogPtr catal; /* a Catalog */
5888 int n_catal;
5889 xmlChar * URI; /* the URI */
5890 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005891
Daniel Veillardce682bc2004-11-05 17:22:25 +00005892 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5893 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5894 mem_base = xmlMemBlocks();
5895 catal = gen_xmlCatalogPtr(n_catal, 0);
5896 URI = gen_const_xmlChar_ptr(n_URI, 1);
5897
5898 ret_val = xmlACatalogResolveURI(catal, URI);
5899 desret_xmlChar_ptr(ret_val);
5900 call_tests++;
5901 des_xmlCatalogPtr(n_catal, catal, 0);
5902 des_const_xmlChar_ptr(n_URI, URI, 1);
5903 xmlResetLastError();
5904 if (mem_base != xmlMemBlocks()) {
5905 printf("Leak of %d blocks found in xmlACatalogResolveURI",
5906 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005907 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005908 printf(" %d", n_catal);
5909 printf(" %d", n_URI);
5910 printf("\n");
5911 }
5912 }
5913 }
5914#endif
5915
5916 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005918}
5919
5920
5921static int
5922test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005924
5925#ifdef LIBXML_CATALOG_ENABLED
5926 int mem_base;
5927 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005928 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005929 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005930 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005931 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005932 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005933 int n_replace;
5934
5935 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5936 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5937 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5938 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005939 type = gen_const_xmlChar_ptr(n_type, 0);
5940 orig = gen_const_xmlChar_ptr(n_orig, 1);
5941 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005942
5943 ret_val = xmlCatalogAdd(type, orig, replace);
5944 desret_int(ret_val);
5945 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005946 des_const_xmlChar_ptr(n_type, type, 0);
5947 des_const_xmlChar_ptr(n_orig, orig, 1);
5948 des_const_xmlChar_ptr(n_replace, replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005949 xmlResetLastError();
5950 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005951 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005952 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005953 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005954 printf(" %d", n_type);
5955 printf(" %d", n_orig);
5956 printf(" %d", n_replace);
5957 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005958 }
5959 }
5960 }
5961 }
5962#endif
5963
Daniel Veillard3d97e662004-11-04 10:49:00 +00005964 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005966}
5967
5968
5969static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005970test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005972
5973#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00005974
Daniel Veillardd93f6252004-11-02 15:53:51 +00005975
5976 xmlCatalogCleanup();
5977 call_tests++;
5978 xmlResetLastError();
Daniel Veillardd93f6252004-11-02 15:53:51 +00005979#endif
5980
Daniel Veillard3d97e662004-11-04 10:49:00 +00005981 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00005982 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005983}
5984
5985
5986static int
5987test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005988 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005989
5990#ifdef LIBXML_CATALOG_ENABLED
5991 int ret_val;
5992
5993
5994 ret_val = xmlCatalogConvert();
5995 desret_int(ret_val);
5996 call_tests++;
5997 xmlResetLastError();
5998#endif
5999
Daniel Veillard3d97e662004-11-04 10:49:00 +00006000 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006001 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006002}
6003
6004
6005static int
6006test_xmlCatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006008
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00006009#ifdef LIBXML_CATALOG_ENABLED
6010#ifdef LIBXML_OUTPUT_ENABLED
6011 int mem_base;
6012 FILE * out; /* the file. */
6013 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006014
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00006015 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
6016 mem_base = xmlMemBlocks();
6017 out = gen_FILE_ptr(n_out, 0);
6018
6019 xmlCatalogDump(out);
6020 call_tests++;
6021 des_FILE_ptr(n_out, out, 0);
6022 xmlResetLastError();
6023 if (mem_base != xmlMemBlocks()) {
6024 printf("Leak of %d blocks found in xmlCatalogDump",
6025 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006026 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00006027 printf(" %d", n_out);
6028 printf("\n");
6029 }
6030 }
6031#endif
6032#endif
6033
6034 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006036}
6037
6038
6039static int
6040test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006042
Daniel Veillard57b25162004-11-06 14:50:18 +00006043#ifdef LIBXML_CATALOG_ENABLED
6044 int mem_base;
6045 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006046
Daniel Veillard57b25162004-11-06 14:50:18 +00006047 mem_base = xmlMemBlocks();
6048
6049 ret_val = xmlCatalogGetDefaults();
6050 desret_xmlCatalogAllow(ret_val);
6051 call_tests++;
6052 xmlResetLastError();
6053 if (mem_base != xmlMemBlocks()) {
6054 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
6055 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006056 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006057 printf("\n");
6058 }
6059#endif
6060
6061 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006063}
6064
6065
6066static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006067test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006069
Daniel Veillardce682bc2004-11-05 17:22:25 +00006070#ifdef LIBXML_CATALOG_ENABLED
6071 int mem_base;
6072 int ret_val;
6073 xmlCatalogPtr catal; /* should this create an SGML catalog */
6074 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006075
Daniel Veillardce682bc2004-11-05 17:22:25 +00006076 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6077 mem_base = xmlMemBlocks();
6078 catal = gen_xmlCatalogPtr(n_catal, 0);
6079
6080 ret_val = xmlCatalogIsEmpty(catal);
6081 desret_int(ret_val);
6082 call_tests++;
6083 des_xmlCatalogPtr(n_catal, catal, 0);
6084 xmlResetLastError();
6085 if (mem_base != xmlMemBlocks()) {
6086 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
6087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006088 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006089 printf(" %d", n_catal);
6090 printf("\n");
6091 }
6092 }
6093#endif
6094
6095 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006097}
6098
6099
6100static int
6101test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006102 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006103
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006104#ifdef LIBXML_CATALOG_ENABLED
6105 int mem_base;
6106 xmlChar * ret_val;
6107 void * catalogs; /* a document's list of catalogs */
6108 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006109 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006110 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006111 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006112 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006113
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006114 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
6115 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6116 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6117 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006118 catalogs = gen_void_ptr(n_catalogs, 0);
6119 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
6120 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006121
6122 ret_val = xmlCatalogLocalResolve(catalogs, pubID, sysID);
6123 desret_xmlChar_ptr(ret_val);
6124 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006125 des_void_ptr(n_catalogs, catalogs, 0);
6126 des_const_xmlChar_ptr(n_pubID, pubID, 1);
6127 des_const_xmlChar_ptr(n_sysID, sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006128 xmlResetLastError();
6129 if (mem_base != xmlMemBlocks()) {
6130 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
6131 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006132 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006133 printf(" %d", n_catalogs);
6134 printf(" %d", n_pubID);
6135 printf(" %d", n_sysID);
6136 printf("\n");
6137 }
6138 }
6139 }
6140 }
6141#endif
6142
Daniel Veillard3d97e662004-11-04 10:49:00 +00006143 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006144 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006145}
6146
6147
6148static int
6149test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006150 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006151
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006152#ifdef LIBXML_CATALOG_ENABLED
6153 int mem_base;
6154 xmlChar * ret_val;
6155 void * catalogs; /* a document's list of catalogs */
6156 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006157 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006158 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006159
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006160 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
6161 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6162 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006163 catalogs = gen_void_ptr(n_catalogs, 0);
6164 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006165
6166 ret_val = xmlCatalogLocalResolveURI(catalogs, URI);
6167 desret_xmlChar_ptr(ret_val);
6168 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006169 des_void_ptr(n_catalogs, catalogs, 0);
6170 des_const_xmlChar_ptr(n_URI, URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006171 xmlResetLastError();
6172 if (mem_base != xmlMemBlocks()) {
6173 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
6174 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006175 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00006176 printf(" %d", n_catalogs);
6177 printf(" %d", n_URI);
6178 printf("\n");
6179 }
6180 }
6181 }
6182#endif
6183
Daniel Veillard3d97e662004-11-04 10:49:00 +00006184 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006185 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006186}
6187
6188
6189static int
6190test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006192
6193#ifdef LIBXML_CATALOG_ENABLED
6194 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006195 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006196 int n_value;
6197
6198 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006199 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006200
6201 ret_val = xmlCatalogRemove(value);
6202 desret_int(ret_val);
6203 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006204 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006205 xmlResetLastError();
6206 }
6207#endif
6208
Daniel Veillard3d97e662004-11-04 10:49:00 +00006209 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006210 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006211}
6212
6213
6214static int
6215test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006216 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006217
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006218#ifdef LIBXML_CATALOG_ENABLED
6219 int mem_base;
6220 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006221 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006222 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006223 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006224 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006225
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006226 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6227 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6228 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006229 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6230 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006231
6232 ret_val = xmlCatalogResolve(pubID, sysID);
6233 desret_xmlChar_ptr(ret_val);
6234 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006235 des_const_xmlChar_ptr(n_pubID, pubID, 0);
6236 des_const_xmlChar_ptr(n_sysID, sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006237 xmlResetLastError();
6238 if (mem_base != xmlMemBlocks()) {
6239 printf("Leak of %d blocks found in xmlCatalogResolve",
6240 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006241 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006242 printf(" %d", n_pubID);
6243 printf(" %d", n_sysID);
6244 printf("\n");
6245 }
6246 }
6247 }
6248#endif
6249
Daniel Veillard3d97e662004-11-04 10:49:00 +00006250 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006252}
6253
6254
6255static int
6256test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006258
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006259#ifdef LIBXML_CATALOG_ENABLED
6260 int mem_base;
6261 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006262 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006263 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006264
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006265 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6266 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006267 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006268
6269 ret_val = xmlCatalogResolvePublic(pubID);
6270 desret_xmlChar_ptr(ret_val);
6271 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006272 des_const_xmlChar_ptr(n_pubID, pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006273 xmlResetLastError();
6274 if (mem_base != xmlMemBlocks()) {
6275 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
6276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006277 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006278 printf(" %d", n_pubID);
6279 printf("\n");
6280 }
6281 }
6282#endif
6283
Daniel Veillard3d97e662004-11-04 10:49:00 +00006284 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006285 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006286}
6287
6288
6289static int
6290test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006292
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006293#ifdef LIBXML_CATALOG_ENABLED
6294 int mem_base;
6295 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006296 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006297 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006298
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006299 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6300 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006301 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006302
6303 ret_val = xmlCatalogResolveSystem(sysID);
6304 desret_xmlChar_ptr(ret_val);
6305 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006306 des_const_xmlChar_ptr(n_sysID, sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006307 xmlResetLastError();
6308 if (mem_base != xmlMemBlocks()) {
6309 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006311 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006312 printf(" %d", n_sysID);
6313 printf("\n");
6314 }
6315 }
6316#endif
6317
Daniel Veillard3d97e662004-11-04 10:49:00 +00006318 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006319 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006320}
6321
6322
6323static int
6324test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006325 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006326
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006327#ifdef LIBXML_CATALOG_ENABLED
6328 int mem_base;
6329 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006330 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006331 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006332
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006333 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6334 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006335 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006336
6337 ret_val = xmlCatalogResolveURI(URI);
6338 desret_xmlChar_ptr(ret_val);
6339 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006340 des_const_xmlChar_ptr(n_URI, URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006341 xmlResetLastError();
6342 if (mem_base != xmlMemBlocks()) {
6343 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6344 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006345 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006346 printf(" %d", n_URI);
6347 printf("\n");
6348 }
6349 }
6350#endif
6351
Daniel Veillard3d97e662004-11-04 10:49:00 +00006352 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006354}
6355
6356
6357static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006358test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006360
Daniel Veillard57b25162004-11-06 14:50:18 +00006361#ifdef LIBXML_CATALOG_ENABLED
6362 int mem_base;
6363 xmlCatalogPrefer ret_val;
6364 xmlCatalogPrefer prefer; /* the default preference for delegation */
6365 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006366
Daniel Veillard57b25162004-11-06 14:50:18 +00006367 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6368 mem_base = xmlMemBlocks();
6369 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6370
6371 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6372 desret_xmlCatalogPrefer(ret_val);
6373 call_tests++;
6374 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6375 xmlResetLastError();
6376 if (mem_base != xmlMemBlocks()) {
6377 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6378 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006379 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006380 printf(" %d", n_prefer);
6381 printf("\n");
6382 }
6383 }
6384#endif
6385
6386 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006388}
6389
6390
6391static int
6392test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006394
Daniel Veillard57b25162004-11-06 14:50:18 +00006395#ifdef LIBXML_CATALOG_ENABLED
6396 int mem_base;
6397 xmlCatalogAllow allow; /* what catalogs should be accepted */
6398 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006399
Daniel Veillard57b25162004-11-06 14:50:18 +00006400 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6401 mem_base = xmlMemBlocks();
6402 allow = gen_xmlCatalogAllow(n_allow, 0);
6403
6404 xmlCatalogSetDefaults(allow);
6405 call_tests++;
6406 des_xmlCatalogAllow(n_allow, allow, 0);
6407 xmlResetLastError();
6408 if (mem_base != xmlMemBlocks()) {
6409 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6410 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006411 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006412 printf(" %d", n_allow);
6413 printf("\n");
6414 }
6415 }
6416#endif
6417
6418 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006420}
6421
6422
6423static int
6424test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006426
Daniel Veillardce682bc2004-11-05 17:22:25 +00006427#ifdef LIBXML_CATALOG_ENABLED
6428 int mem_base;
6429 int ret_val;
6430 xmlCatalogPtr catal; /* the catalog */
6431 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006432
Daniel Veillardce682bc2004-11-05 17:22:25 +00006433 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6434 mem_base = xmlMemBlocks();
6435 catal = gen_xmlCatalogPtr(n_catal, 0);
6436
6437 ret_val = xmlConvertSGMLCatalog(catal);
6438 desret_int(ret_val);
6439 call_tests++;
6440 des_xmlCatalogPtr(n_catal, catal, 0);
6441 xmlResetLastError();
6442 if (mem_base != xmlMemBlocks()) {
6443 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006445 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006446 printf(" %d", n_catal);
6447 printf("\n");
6448 }
6449 }
6450#endif
6451
6452 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006454}
6455
6456
6457static int
6458test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006460
6461#ifdef LIBXML_CATALOG_ENABLED
6462 int mem_base;
6463
6464 mem_base = xmlMemBlocks();
6465
6466 xmlInitializeCatalog();
6467 call_tests++;
6468 xmlResetLastError();
6469 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006470 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006471 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006472 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006473 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006474 }
6475#endif
6476
Daniel Veillard3d97e662004-11-04 10:49:00 +00006477 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006478 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006479}
6480
6481
6482static int
6483test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006484 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006485
6486
6487 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006489}
6490
6491
6492static int
6493test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006495
6496#ifdef LIBXML_CATALOG_ENABLED
6497 int ret_val;
6498 const char * filename; /* a file path */
6499 int n_filename;
6500
6501 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006502 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006503
6504 ret_val = xmlLoadCatalog(filename);
6505 desret_int(ret_val);
6506 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006507 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006508 xmlResetLastError();
6509 }
6510#endif
6511
Daniel Veillard3d97e662004-11-04 10:49:00 +00006512 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006513 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006514}
6515
6516
6517static int
6518test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006519 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006520
6521#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00006522 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006523 int n_pathss;
6524
6525 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006526 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006527
6528 xmlLoadCatalogs(pathss);
6529 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006530 des_const_char_ptr(n_pathss, pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006531 xmlResetLastError();
6532 }
6533#endif
6534
Daniel Veillard3d97e662004-11-04 10:49:00 +00006535 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006536 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006537}
6538
6539
6540static int
6541test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006542 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006543
6544
6545 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006547}
6548
6549
6550static int
6551test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006553
6554
6555 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006556 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006557}
6558
6559
6560static int
6561test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006562 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006563
6564#ifdef LIBXML_CATALOG_ENABLED
6565 int mem_base;
6566 xmlDocPtr ret_val;
6567 const char * filename; /* the filename */
6568 int n_filename;
6569
6570 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6571 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006572 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006573
6574 ret_val = xmlParseCatalogFile(filename);
6575 desret_xmlDocPtr(ret_val);
6576 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006577 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006578 xmlResetLastError();
6579 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006580 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006582 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006583 printf(" %d", n_filename);
6584 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006585 }
6586 }
6587#endif
6588
Daniel Veillard3d97e662004-11-04 10:49:00 +00006589 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006590 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006591}
6592
6593static int
6594test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006596
Daniel Veillardc2c894f2004-11-07 12:17:35 +00006597 printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006598 test_ret += test_xmlACatalogAdd();
6599 test_ret += test_xmlACatalogDump();
6600 test_ret += test_xmlACatalogRemove();
6601 test_ret += test_xmlACatalogResolve();
6602 test_ret += test_xmlACatalogResolvePublic();
6603 test_ret += test_xmlACatalogResolveSystem();
6604 test_ret += test_xmlACatalogResolveURI();
6605 test_ret += test_xmlCatalogAdd();
6606 test_ret += test_xmlCatalogCleanup();
6607 test_ret += test_xmlCatalogConvert();
6608 test_ret += test_xmlCatalogDump();
6609 test_ret += test_xmlCatalogGetDefaults();
6610 test_ret += test_xmlCatalogIsEmpty();
6611 test_ret += test_xmlCatalogLocalResolve();
6612 test_ret += test_xmlCatalogLocalResolveURI();
6613 test_ret += test_xmlCatalogRemove();
6614 test_ret += test_xmlCatalogResolve();
6615 test_ret += test_xmlCatalogResolvePublic();
6616 test_ret += test_xmlCatalogResolveSystem();
6617 test_ret += test_xmlCatalogResolveURI();
6618 test_ret += test_xmlCatalogSetDefaultPrefer();
6619 test_ret += test_xmlCatalogSetDefaults();
6620 test_ret += test_xmlConvertSGMLCatalog();
6621 test_ret += test_xmlInitializeCatalog();
6622 test_ret += test_xmlLoadACatalog();
6623 test_ret += test_xmlLoadCatalog();
6624 test_ret += test_xmlLoadCatalogs();
6625 test_ret += test_xmlLoadSGMLSuperCatalog();
6626 test_ret += test_xmlNewCatalog();
6627 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006628
Daniel Veillard42595322004-11-08 10:52:06 +00006629 if (test_ret != 0)
6630 printf("Module catalog: %d errors\n", test_ret);
6631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006632}
6633
Daniel Veillardce682bc2004-11-05 17:22:25 +00006634#define gen_nb_const_xmlChRangeGroupPtr 1
6635static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6636 return(NULL);
6637}
6638static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6639}
6640
Daniel Veillardd93f6252004-11-02 15:53:51 +00006641static int
6642test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006643 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006644
Daniel Veillardce682bc2004-11-05 17:22:25 +00006645 int mem_base;
6646 int ret_val;
6647 unsigned int val; /* character to be validated */
6648 int n_val;
6649 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6650 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006651
Daniel Veillardce682bc2004-11-05 17:22:25 +00006652 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6653 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6654 mem_base = xmlMemBlocks();
6655 val = gen_unsigned_int(n_val, 0);
6656 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6657
6658 ret_val = xmlCharInRange(val, rptr);
6659 desret_int(ret_val);
6660 call_tests++;
6661 des_unsigned_int(n_val, val, 0);
6662 des_const_xmlChRangeGroupPtr(n_rptr, rptr, 1);
6663 xmlResetLastError();
6664 if (mem_base != xmlMemBlocks()) {
6665 printf("Leak of %d blocks found in xmlCharInRange",
6666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006667 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006668 printf(" %d", n_val);
6669 printf(" %d", n_rptr);
6670 printf("\n");
6671 }
6672 }
6673 }
6674
6675 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006677}
6678
6679
6680static int
6681test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006683
Daniel Veillard3d97e662004-11-04 10:49:00 +00006684 int mem_base;
6685 int ret_val;
6686 unsigned int ch; /* character to validate */
6687 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006688
Daniel Veillard3d97e662004-11-04 10:49:00 +00006689 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6690 mem_base = xmlMemBlocks();
6691 ch = gen_unsigned_int(n_ch, 0);
6692
6693 ret_val = xmlIsBaseChar(ch);
6694 desret_int(ret_val);
6695 call_tests++;
6696 des_unsigned_int(n_ch, ch, 0);
6697 xmlResetLastError();
6698 if (mem_base != xmlMemBlocks()) {
6699 printf("Leak of %d blocks found in xmlIsBaseChar",
6700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006701 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006702 printf(" %d", n_ch);
6703 printf("\n");
6704 }
6705 }
6706
6707 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006709}
6710
6711
6712static int
6713test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006715
Daniel Veillard3d97e662004-11-04 10:49:00 +00006716 int mem_base;
6717 int ret_val;
6718 unsigned int ch; /* character to validate */
6719 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006720
Daniel Veillard3d97e662004-11-04 10:49:00 +00006721 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6722 mem_base = xmlMemBlocks();
6723 ch = gen_unsigned_int(n_ch, 0);
6724
6725 ret_val = xmlIsBlank(ch);
6726 desret_int(ret_val);
6727 call_tests++;
6728 des_unsigned_int(n_ch, ch, 0);
6729 xmlResetLastError();
6730 if (mem_base != xmlMemBlocks()) {
6731 printf("Leak of %d blocks found in xmlIsBlank",
6732 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006733 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006734 printf(" %d", n_ch);
6735 printf("\n");
6736 }
6737 }
6738
6739 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006741}
6742
6743
6744static int
6745test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006747
Daniel Veillard3d97e662004-11-04 10:49:00 +00006748 int mem_base;
6749 int ret_val;
6750 unsigned int ch; /* character to validate */
6751 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006752
Daniel Veillard3d97e662004-11-04 10:49:00 +00006753 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6754 mem_base = xmlMemBlocks();
6755 ch = gen_unsigned_int(n_ch, 0);
6756
6757 ret_val = xmlIsChar(ch);
6758 desret_int(ret_val);
6759 call_tests++;
6760 des_unsigned_int(n_ch, ch, 0);
6761 xmlResetLastError();
6762 if (mem_base != xmlMemBlocks()) {
6763 printf("Leak of %d blocks found in xmlIsChar",
6764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006765 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006766 printf(" %d", n_ch);
6767 printf("\n");
6768 }
6769 }
6770
6771 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006772 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006773}
6774
6775
6776static int
6777test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006778 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006779
Daniel Veillard3d97e662004-11-04 10:49:00 +00006780 int mem_base;
6781 int ret_val;
6782 unsigned int ch; /* character to validate */
6783 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006784
Daniel Veillard3d97e662004-11-04 10:49:00 +00006785 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6786 mem_base = xmlMemBlocks();
6787 ch = gen_unsigned_int(n_ch, 0);
6788
6789 ret_val = xmlIsCombining(ch);
6790 desret_int(ret_val);
6791 call_tests++;
6792 des_unsigned_int(n_ch, ch, 0);
6793 xmlResetLastError();
6794 if (mem_base != xmlMemBlocks()) {
6795 printf("Leak of %d blocks found in xmlIsCombining",
6796 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006797 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006798 printf(" %d", n_ch);
6799 printf("\n");
6800 }
6801 }
6802
6803 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006804 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006805}
6806
6807
6808static int
6809test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006810 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006811
Daniel Veillard3d97e662004-11-04 10:49:00 +00006812 int mem_base;
6813 int ret_val;
6814 unsigned int ch; /* character to validate */
6815 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006816
Daniel Veillard3d97e662004-11-04 10:49:00 +00006817 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6818 mem_base = xmlMemBlocks();
6819 ch = gen_unsigned_int(n_ch, 0);
6820
6821 ret_val = xmlIsDigit(ch);
6822 desret_int(ret_val);
6823 call_tests++;
6824 des_unsigned_int(n_ch, ch, 0);
6825 xmlResetLastError();
6826 if (mem_base != xmlMemBlocks()) {
6827 printf("Leak of %d blocks found in xmlIsDigit",
6828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006829 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006830 printf(" %d", n_ch);
6831 printf("\n");
6832 }
6833 }
6834
6835 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006837}
6838
6839
6840static int
6841test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006843
Daniel Veillard3d97e662004-11-04 10:49:00 +00006844 int mem_base;
6845 int ret_val;
6846 unsigned int ch; /* character to validate */
6847 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006848
Daniel Veillard3d97e662004-11-04 10:49:00 +00006849 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6850 mem_base = xmlMemBlocks();
6851 ch = gen_unsigned_int(n_ch, 0);
6852
6853 ret_val = xmlIsExtender(ch);
6854 desret_int(ret_val);
6855 call_tests++;
6856 des_unsigned_int(n_ch, ch, 0);
6857 xmlResetLastError();
6858 if (mem_base != xmlMemBlocks()) {
6859 printf("Leak of %d blocks found in xmlIsExtender",
6860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006861 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006862 printf(" %d", n_ch);
6863 printf("\n");
6864 }
6865 }
6866
6867 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006869}
6870
6871
6872static int
6873test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006875
Daniel Veillard3d97e662004-11-04 10:49:00 +00006876 int mem_base;
6877 int ret_val;
6878 unsigned int ch; /* character to validate */
6879 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006880
Daniel Veillard3d97e662004-11-04 10:49:00 +00006881 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6882 mem_base = xmlMemBlocks();
6883 ch = gen_unsigned_int(n_ch, 0);
6884
6885 ret_val = xmlIsIdeographic(ch);
6886 desret_int(ret_val);
6887 call_tests++;
6888 des_unsigned_int(n_ch, ch, 0);
6889 xmlResetLastError();
6890 if (mem_base != xmlMemBlocks()) {
6891 printf("Leak of %d blocks found in xmlIsIdeographic",
6892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006893 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006894 printf(" %d", n_ch);
6895 printf("\n");
6896 }
6897 }
6898
6899 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006900 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006901}
6902
6903
6904static int
6905test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006907
Daniel Veillard3d97e662004-11-04 10:49:00 +00006908 int mem_base;
6909 int ret_val;
6910 unsigned int ch; /* character to validate */
6911 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006912
Daniel Veillard3d97e662004-11-04 10:49:00 +00006913 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6914 mem_base = xmlMemBlocks();
6915 ch = gen_unsigned_int(n_ch, 0);
6916
6917 ret_val = xmlIsPubidChar(ch);
6918 desret_int(ret_val);
6919 call_tests++;
6920 des_unsigned_int(n_ch, ch, 0);
6921 xmlResetLastError();
6922 if (mem_base != xmlMemBlocks()) {
6923 printf("Leak of %d blocks found in xmlIsPubidChar",
6924 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006925 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006926 printf(" %d", n_ch);
6927 printf("\n");
6928 }
6929 }
6930
6931 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00006932 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006933}
6934
6935static int
6936test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006938
Daniel Veillardce682bc2004-11-05 17:22:25 +00006939 printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006940 test_ret += test_xmlCharInRange();
6941 test_ret += test_xmlIsBaseChar();
6942 test_ret += test_xmlIsBlank();
6943 test_ret += test_xmlIsChar();
6944 test_ret += test_xmlIsCombining();
6945 test_ret += test_xmlIsDigit();
6946 test_ret += test_xmlIsExtender();
6947 test_ret += test_xmlIsIdeographic();
6948 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006949
Daniel Veillard42595322004-11-08 10:52:06 +00006950 if (test_ret != 0)
6951 printf("Module chvalid: %d errors\n", test_ret);
6952 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006953}
6954
6955static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00006956test_xmlBoolToText(void) {
6957 int test_ret = 0;
6958
6959#ifdef LIBXML_DEBUG_ENABLED
6960 int mem_base;
6961 const char * ret_val;
6962 int boolval; /* a bool to turn into text */
6963 int n_boolval;
6964
6965 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
6966 mem_base = xmlMemBlocks();
6967 boolval = gen_int(n_boolval, 0);
6968
6969 ret_val = xmlBoolToText(boolval);
6970 desret_const_char_ptr(ret_val);
6971 call_tests++;
6972 des_int(n_boolval, boolval, 0);
6973 xmlResetLastError();
6974 if (mem_base != xmlMemBlocks()) {
6975 printf("Leak of %d blocks found in xmlBoolToText",
6976 xmlMemBlocks() - mem_base);
6977 test_ret++;
6978 printf(" %d", n_boolval);
6979 printf("\n");
6980 }
6981 }
6982#endif
6983
6984 function_tests++;
6985 return(test_ret);
6986}
6987
6988
6989static int
6990test_xmlDebugCheckDocument(void) {
6991 int test_ret = 0;
6992
6993#ifdef LIBXML_DEBUG_ENABLED
6994 int mem_base;
6995 int ret_val;
6996 FILE * output; /* the FILE * for the output */
6997 int n_output;
6998 xmlDocPtr doc; /* the document */
6999 int n_doc;
7000
7001 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7002 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7003 mem_base = xmlMemBlocks();
7004 output = gen_debug_FILE_ptr(n_output, 0);
7005 doc = gen_xmlDocPtr(n_doc, 1);
7006
7007 ret_val = xmlDebugCheckDocument(output, doc);
7008 desret_int(ret_val);
7009 call_tests++;
7010 des_debug_FILE_ptr(n_output, output, 0);
7011 des_xmlDocPtr(n_doc, doc, 1);
7012 xmlResetLastError();
7013 if (mem_base != xmlMemBlocks()) {
7014 printf("Leak of %d blocks found in xmlDebugCheckDocument",
7015 xmlMemBlocks() - mem_base);
7016 test_ret++;
7017 printf(" %d", n_output);
7018 printf(" %d", n_doc);
7019 printf("\n");
7020 }
7021 }
7022 }
7023#endif
7024
7025 function_tests++;
7026 return(test_ret);
7027}
7028
7029
7030static int
7031test_xmlDebugDumpAttr(void) {
7032 int test_ret = 0;
7033
7034#ifdef LIBXML_DEBUG_ENABLED
7035 int mem_base;
7036 FILE * output; /* the FILE * for the output */
7037 int n_output;
7038 xmlAttrPtr attr; /* the attribute */
7039 int n_attr;
7040 int depth; /* the indentation level. */
7041 int n_depth;
7042
7043 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7044 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
7045 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7046 mem_base = xmlMemBlocks();
7047 output = gen_debug_FILE_ptr(n_output, 0);
7048 attr = gen_xmlAttrPtr(n_attr, 1);
7049 depth = gen_int(n_depth, 2);
7050
7051 xmlDebugDumpAttr(output, attr, depth);
7052 call_tests++;
7053 des_debug_FILE_ptr(n_output, output, 0);
7054 des_xmlAttrPtr(n_attr, attr, 1);
7055 des_int(n_depth, depth, 2);
7056 xmlResetLastError();
7057 if (mem_base != xmlMemBlocks()) {
7058 printf("Leak of %d blocks found in xmlDebugDumpAttr",
7059 xmlMemBlocks() - mem_base);
7060 test_ret++;
7061 printf(" %d", n_output);
7062 printf(" %d", n_attr);
7063 printf(" %d", n_depth);
7064 printf("\n");
7065 }
7066 }
7067 }
7068 }
7069#endif
7070
7071 function_tests++;
7072 return(test_ret);
7073}
7074
7075
7076static int
7077test_xmlDebugDumpAttrList(void) {
7078 int test_ret = 0;
7079
7080#ifdef LIBXML_DEBUG_ENABLED
7081 int mem_base;
7082 FILE * output; /* the FILE * for the output */
7083 int n_output;
7084 xmlAttrPtr attr; /* the attribute list */
7085 int n_attr;
7086 int depth; /* the indentation level. */
7087 int n_depth;
7088
7089 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7090 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
7091 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7092 mem_base = xmlMemBlocks();
7093 output = gen_debug_FILE_ptr(n_output, 0);
7094 attr = gen_xmlAttrPtr(n_attr, 1);
7095 depth = gen_int(n_depth, 2);
7096
7097 xmlDebugDumpAttrList(output, attr, depth);
7098 call_tests++;
7099 des_debug_FILE_ptr(n_output, output, 0);
7100 des_xmlAttrPtr(n_attr, attr, 1);
7101 des_int(n_depth, depth, 2);
7102 xmlResetLastError();
7103 if (mem_base != xmlMemBlocks()) {
7104 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
7105 xmlMemBlocks() - mem_base);
7106 test_ret++;
7107 printf(" %d", n_output);
7108 printf(" %d", n_attr);
7109 printf(" %d", n_depth);
7110 printf("\n");
7111 }
7112 }
7113 }
7114 }
7115#endif
7116
7117 function_tests++;
7118 return(test_ret);
7119}
7120
7121
7122static int
7123test_xmlDebugDumpDTD(void) {
7124 int test_ret = 0;
7125
7126#ifdef LIBXML_DEBUG_ENABLED
7127 int mem_base;
7128 FILE * output; /* the FILE * for the output */
7129 int n_output;
7130 xmlDtdPtr dtd; /* the DTD */
7131 int n_dtd;
7132
7133 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7134 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
7135 mem_base = xmlMemBlocks();
7136 output = gen_debug_FILE_ptr(n_output, 0);
7137 dtd = gen_xmlDtdPtr(n_dtd, 1);
7138
7139 xmlDebugDumpDTD(output, dtd);
7140 call_tests++;
7141 des_debug_FILE_ptr(n_output, output, 0);
7142 des_xmlDtdPtr(n_dtd, dtd, 1);
7143 xmlResetLastError();
7144 if (mem_base != xmlMemBlocks()) {
7145 printf("Leak of %d blocks found in xmlDebugDumpDTD",
7146 xmlMemBlocks() - mem_base);
7147 test_ret++;
7148 printf(" %d", n_output);
7149 printf(" %d", n_dtd);
7150 printf("\n");
7151 }
7152 }
7153 }
7154#endif
7155
7156 function_tests++;
7157 return(test_ret);
7158}
7159
7160
7161static int
7162test_xmlDebugDumpDocument(void) {
7163 int test_ret = 0;
7164
7165#ifdef LIBXML_DEBUG_ENABLED
7166 int mem_base;
7167 FILE * output; /* the FILE * for the output */
7168 int n_output;
7169 xmlDocPtr doc; /* the document */
7170 int n_doc;
7171
7172 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7173 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7174 mem_base = xmlMemBlocks();
7175 output = gen_debug_FILE_ptr(n_output, 0);
7176 doc = gen_xmlDocPtr(n_doc, 1);
7177
7178 xmlDebugDumpDocument(output, doc);
7179 call_tests++;
7180 des_debug_FILE_ptr(n_output, output, 0);
7181 des_xmlDocPtr(n_doc, doc, 1);
7182 xmlResetLastError();
7183 if (mem_base != xmlMemBlocks()) {
7184 printf("Leak of %d blocks found in xmlDebugDumpDocument",
7185 xmlMemBlocks() - mem_base);
7186 test_ret++;
7187 printf(" %d", n_output);
7188 printf(" %d", n_doc);
7189 printf("\n");
7190 }
7191 }
7192 }
7193#endif
7194
7195 function_tests++;
7196 return(test_ret);
7197}
7198
7199
7200static int
7201test_xmlDebugDumpDocumentHead(void) {
7202 int test_ret = 0;
7203
7204#ifdef LIBXML_DEBUG_ENABLED
7205 int mem_base;
7206 FILE * output; /* the FILE * for the output */
7207 int n_output;
7208 xmlDocPtr doc; /* the document */
7209 int n_doc;
7210
7211 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7212 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7213 mem_base = xmlMemBlocks();
7214 output = gen_debug_FILE_ptr(n_output, 0);
7215 doc = gen_xmlDocPtr(n_doc, 1);
7216
7217 xmlDebugDumpDocumentHead(output, doc);
7218 call_tests++;
7219 des_debug_FILE_ptr(n_output, output, 0);
7220 des_xmlDocPtr(n_doc, doc, 1);
7221 xmlResetLastError();
7222 if (mem_base != xmlMemBlocks()) {
7223 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7224 xmlMemBlocks() - mem_base);
7225 test_ret++;
7226 printf(" %d", n_output);
7227 printf(" %d", n_doc);
7228 printf("\n");
7229 }
7230 }
7231 }
7232#endif
7233
7234 function_tests++;
7235 return(test_ret);
7236}
7237
7238
7239static int
7240test_xmlDebugDumpEntities(void) {
7241 int test_ret = 0;
7242
7243#ifdef LIBXML_DEBUG_ENABLED
7244 int mem_base;
7245 FILE * output; /* the FILE * for the output */
7246 int n_output;
7247 xmlDocPtr doc; /* the document */
7248 int n_doc;
7249
7250 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7251 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7252 mem_base = xmlMemBlocks();
7253 output = gen_debug_FILE_ptr(n_output, 0);
7254 doc = gen_xmlDocPtr(n_doc, 1);
7255
7256 xmlDebugDumpEntities(output, doc);
7257 call_tests++;
7258 des_debug_FILE_ptr(n_output, output, 0);
7259 des_xmlDocPtr(n_doc, doc, 1);
7260 xmlResetLastError();
7261 if (mem_base != xmlMemBlocks()) {
7262 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7263 xmlMemBlocks() - mem_base);
7264 test_ret++;
7265 printf(" %d", n_output);
7266 printf(" %d", n_doc);
7267 printf("\n");
7268 }
7269 }
7270 }
7271#endif
7272
7273 function_tests++;
7274 return(test_ret);
7275}
7276
7277
7278static int
7279test_xmlDebugDumpNode(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 xmlNodePtr node; /* the node */
7287 int n_node;
7288 int depth; /* the indentation level. */
7289 int n_depth;
7290
7291 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7292 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7293 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7294 mem_base = xmlMemBlocks();
7295 output = gen_debug_FILE_ptr(n_output, 0);
7296 node = gen_xmlNodePtr(n_node, 1);
7297 depth = gen_int(n_depth, 2);
7298
7299 xmlDebugDumpNode(output, node, depth);
7300 call_tests++;
7301 des_debug_FILE_ptr(n_output, output, 0);
7302 des_xmlNodePtr(n_node, node, 1);
7303 des_int(n_depth, depth, 2);
7304 xmlResetLastError();
7305 if (mem_base != xmlMemBlocks()) {
7306 printf("Leak of %d blocks found in xmlDebugDumpNode",
7307 xmlMemBlocks() - mem_base);
7308 test_ret++;
7309 printf(" %d", n_output);
7310 printf(" %d", n_node);
7311 printf(" %d", n_depth);
7312 printf("\n");
7313 }
7314 }
7315 }
7316 }
7317#endif
7318
7319 function_tests++;
7320 return(test_ret);
7321}
7322
7323
7324static int
7325test_xmlDebugDumpNodeList(void) {
7326 int test_ret = 0;
7327
7328#ifdef LIBXML_DEBUG_ENABLED
7329 int mem_base;
7330 FILE * output; /* the FILE * for the output */
7331 int n_output;
7332 xmlNodePtr node; /* the node list */
7333 int n_node;
7334 int depth; /* the indentation level. */
7335 int n_depth;
7336
7337 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7338 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7339 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7340 mem_base = xmlMemBlocks();
7341 output = gen_debug_FILE_ptr(n_output, 0);
7342 node = gen_xmlNodePtr(n_node, 1);
7343 depth = gen_int(n_depth, 2);
7344
7345 xmlDebugDumpNodeList(output, node, depth);
7346 call_tests++;
7347 des_debug_FILE_ptr(n_output, output, 0);
7348 des_xmlNodePtr(n_node, node, 1);
7349 des_int(n_depth, depth, 2);
7350 xmlResetLastError();
7351 if (mem_base != xmlMemBlocks()) {
7352 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7353 xmlMemBlocks() - mem_base);
7354 test_ret++;
7355 printf(" %d", n_output);
7356 printf(" %d", n_node);
7357 printf(" %d", n_depth);
7358 printf("\n");
7359 }
7360 }
7361 }
7362 }
7363#endif
7364
7365 function_tests++;
7366 return(test_ret);
7367}
7368
7369
7370static int
7371test_xmlDebugDumpOneNode(void) {
7372 int test_ret = 0;
7373
7374#ifdef LIBXML_DEBUG_ENABLED
7375 int mem_base;
7376 FILE * output; /* the FILE * for the output */
7377 int n_output;
7378 xmlNodePtr node; /* the node */
7379 int n_node;
7380 int depth; /* the indentation level. */
7381 int n_depth;
7382
7383 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7384 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7385 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7386 mem_base = xmlMemBlocks();
7387 output = gen_debug_FILE_ptr(n_output, 0);
7388 node = gen_xmlNodePtr(n_node, 1);
7389 depth = gen_int(n_depth, 2);
7390
7391 xmlDebugDumpOneNode(output, node, depth);
7392 call_tests++;
7393 des_debug_FILE_ptr(n_output, output, 0);
7394 des_xmlNodePtr(n_node, node, 1);
7395 des_int(n_depth, depth, 2);
7396 xmlResetLastError();
7397 if (mem_base != xmlMemBlocks()) {
7398 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7399 xmlMemBlocks() - mem_base);
7400 test_ret++;
7401 printf(" %d", n_output);
7402 printf(" %d", n_node);
7403 printf(" %d", n_depth);
7404 printf("\n");
7405 }
7406 }
7407 }
7408 }
7409#endif
7410
7411 function_tests++;
7412 return(test_ret);
7413}
7414
7415
7416static int
7417test_xmlDebugDumpString(void) {
7418 int test_ret = 0;
7419
7420#ifdef LIBXML_DEBUG_ENABLED
7421 int mem_base;
7422 FILE * output; /* the FILE * for the output */
7423 int n_output;
7424 xmlChar * str; /* the string */
7425 int n_str;
7426
7427 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7428 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7429 mem_base = xmlMemBlocks();
7430 output = gen_debug_FILE_ptr(n_output, 0);
7431 str = gen_const_xmlChar_ptr(n_str, 1);
7432
7433 xmlDebugDumpString(output, str);
7434 call_tests++;
7435 des_debug_FILE_ptr(n_output, output, 0);
7436 des_const_xmlChar_ptr(n_str, str, 1);
7437 xmlResetLastError();
7438 if (mem_base != xmlMemBlocks()) {
7439 printf("Leak of %d blocks found in xmlDebugDumpString",
7440 xmlMemBlocks() - mem_base);
7441 test_ret++;
7442 printf(" %d", n_output);
7443 printf(" %d", n_str);
7444 printf("\n");
7445 }
7446 }
7447 }
7448#endif
7449
7450 function_tests++;
7451 return(test_ret);
7452}
7453
7454
7455static int
7456test_xmlLsCountNode(void) {
7457 int test_ret = 0;
7458
7459#ifdef LIBXML_DEBUG_ENABLED
7460 int mem_base;
7461 int ret_val;
7462 xmlNodePtr node; /* the node to count */
7463 int n_node;
7464
7465 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7466 mem_base = xmlMemBlocks();
7467 node = gen_xmlNodePtr(n_node, 0);
7468
7469 ret_val = xmlLsCountNode(node);
7470 desret_int(ret_val);
7471 call_tests++;
7472 des_xmlNodePtr(n_node, node, 0);
7473 xmlResetLastError();
7474 if (mem_base != xmlMemBlocks()) {
7475 printf("Leak of %d blocks found in xmlLsCountNode",
7476 xmlMemBlocks() - mem_base);
7477 test_ret++;
7478 printf(" %d", n_node);
7479 printf("\n");
7480 }
7481 }
7482#endif
7483
7484 function_tests++;
7485 return(test_ret);
7486}
7487
7488
7489static int
7490test_xmlLsOneNode(void) {
7491 int test_ret = 0;
7492
7493#ifdef LIBXML_DEBUG_ENABLED
7494 int mem_base;
7495 FILE * output; /* the FILE * for the output */
7496 int n_output;
7497 xmlNodePtr node; /* the node to dump */
7498 int n_node;
7499
7500 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7501 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7502 mem_base = xmlMemBlocks();
7503 output = gen_debug_FILE_ptr(n_output, 0);
7504 node = gen_xmlNodePtr(n_node, 1);
7505
7506 xmlLsOneNode(output, node);
7507 call_tests++;
7508 des_debug_FILE_ptr(n_output, output, 0);
7509 des_xmlNodePtr(n_node, node, 1);
7510 xmlResetLastError();
7511 if (mem_base != xmlMemBlocks()) {
7512 printf("Leak of %d blocks found in xmlLsOneNode",
7513 xmlMemBlocks() - mem_base);
7514 test_ret++;
7515 printf(" %d", n_output);
7516 printf(" %d", n_node);
7517 printf("\n");
7518 }
7519 }
7520 }
7521#endif
7522
7523 function_tests++;
7524 return(test_ret);
7525}
7526
7527
7528#define gen_nb_char_ptr 1
7529static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7530 return(NULL);
7531}
7532static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7533}
7534
7535static int
7536test_xmlShell(void) {
7537 int test_ret = 0;
7538
7539
7540 /* missing type support */
7541 return(test_ret);
7542}
7543
7544
7545#define gen_nb_xmlShellCtxtPtr 1
7546static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7547 return(NULL);
7548}
7549static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7550}
7551
7552static int
7553test_xmlShellBase(void) {
7554 int test_ret = 0;
7555
7556#ifdef LIBXML_DEBUG_ENABLED
7557 int mem_base;
7558 int ret_val;
7559 xmlShellCtxtPtr ctxt; /* the shell context */
7560 int n_ctxt;
7561 char * arg; /* unused */
7562 int n_arg;
7563 xmlNodePtr node; /* a node */
7564 int n_node;
7565 xmlNodePtr node2; /* unused */
7566 int n_node2;
7567
7568 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7569 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7570 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7571 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7572 mem_base = xmlMemBlocks();
7573 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7574 arg = gen_char_ptr(n_arg, 1);
7575 node = gen_xmlNodePtr(n_node, 2);
7576 node2 = gen_xmlNodePtr(n_node2, 3);
7577
7578 ret_val = xmlShellBase(ctxt, arg, node, node2);
7579 desret_int(ret_val);
7580 call_tests++;
7581 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7582 des_char_ptr(n_arg, arg, 1);
7583 des_xmlNodePtr(n_node, node, 2);
7584 des_xmlNodePtr(n_node2, node2, 3);
7585 xmlResetLastError();
7586 if (mem_base != xmlMemBlocks()) {
7587 printf("Leak of %d blocks found in xmlShellBase",
7588 xmlMemBlocks() - mem_base);
7589 test_ret++;
7590 printf(" %d", n_ctxt);
7591 printf(" %d", n_arg);
7592 printf(" %d", n_node);
7593 printf(" %d", n_node2);
7594 printf("\n");
7595 }
7596 }
7597 }
7598 }
7599 }
7600#endif
7601
7602 function_tests++;
7603 return(test_ret);
7604}
7605
7606
7607static int
7608test_xmlShellCat(void) {
7609 int test_ret = 0;
7610
7611#ifdef LIBXML_DEBUG_ENABLED
7612 int mem_base;
7613 int ret_val;
7614 xmlShellCtxtPtr ctxt; /* the shell context */
7615 int n_ctxt;
7616 char * arg; /* unused */
7617 int n_arg;
7618 xmlNodePtr node; /* a node */
7619 int n_node;
7620 xmlNodePtr node2; /* unused */
7621 int n_node2;
7622
7623 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7624 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7625 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7626 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7627 mem_base = xmlMemBlocks();
7628 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7629 arg = gen_char_ptr(n_arg, 1);
7630 node = gen_xmlNodePtr(n_node, 2);
7631 node2 = gen_xmlNodePtr(n_node2, 3);
7632
7633 ret_val = xmlShellCat(ctxt, arg, node, node2);
7634 desret_int(ret_val);
7635 call_tests++;
7636 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7637 des_char_ptr(n_arg, arg, 1);
7638 des_xmlNodePtr(n_node, node, 2);
7639 des_xmlNodePtr(n_node2, node2, 3);
7640 xmlResetLastError();
7641 if (mem_base != xmlMemBlocks()) {
7642 printf("Leak of %d blocks found in xmlShellCat",
7643 xmlMemBlocks() - mem_base);
7644 test_ret++;
7645 printf(" %d", n_ctxt);
7646 printf(" %d", n_arg);
7647 printf(" %d", n_node);
7648 printf(" %d", n_node2);
7649 printf("\n");
7650 }
7651 }
7652 }
7653 }
7654 }
7655#endif
7656
7657 function_tests++;
7658 return(test_ret);
7659}
7660
7661
7662static int
7663test_xmlShellDir(void) {
7664 int test_ret = 0;
7665
7666#ifdef LIBXML_DEBUG_ENABLED
7667 int mem_base;
7668 int ret_val;
7669 xmlShellCtxtPtr ctxt; /* the shell context */
7670 int n_ctxt;
7671 char * arg; /* unused */
7672 int n_arg;
7673 xmlNodePtr node; /* a node */
7674 int n_node;
7675 xmlNodePtr node2; /* unused */
7676 int n_node2;
7677
7678 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7679 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7680 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7681 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7682 mem_base = xmlMemBlocks();
7683 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7684 arg = gen_char_ptr(n_arg, 1);
7685 node = gen_xmlNodePtr(n_node, 2);
7686 node2 = gen_xmlNodePtr(n_node2, 3);
7687
7688 ret_val = xmlShellDir(ctxt, arg, node, node2);
7689 desret_int(ret_val);
7690 call_tests++;
7691 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7692 des_char_ptr(n_arg, arg, 1);
7693 des_xmlNodePtr(n_node, node, 2);
7694 des_xmlNodePtr(n_node2, node2, 3);
7695 xmlResetLastError();
7696 if (mem_base != xmlMemBlocks()) {
7697 printf("Leak of %d blocks found in xmlShellDir",
7698 xmlMemBlocks() - mem_base);
7699 test_ret++;
7700 printf(" %d", n_ctxt);
7701 printf(" %d", n_arg);
7702 printf(" %d", n_node);
7703 printf(" %d", n_node2);
7704 printf("\n");
7705 }
7706 }
7707 }
7708 }
7709 }
7710#endif
7711
7712 function_tests++;
7713 return(test_ret);
7714}
7715
7716
7717static int
7718test_xmlShellDu(void) {
7719 int test_ret = 0;
7720
7721#ifdef LIBXML_DEBUG_ENABLED
7722 int mem_base;
7723 int ret_val;
7724 xmlShellCtxtPtr ctxt; /* the shell context */
7725 int n_ctxt;
7726 char * arg; /* unused */
7727 int n_arg;
7728 xmlNodePtr tree; /* a node defining a subtree */
7729 int n_tree;
7730 xmlNodePtr node2; /* unused */
7731 int n_node2;
7732
7733 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7734 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7735 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7736 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7737 mem_base = xmlMemBlocks();
7738 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7739 arg = gen_char_ptr(n_arg, 1);
7740 tree = gen_xmlNodePtr(n_tree, 2);
7741 node2 = gen_xmlNodePtr(n_node2, 3);
7742
7743 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7744 desret_int(ret_val);
7745 call_tests++;
7746 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7747 des_char_ptr(n_arg, arg, 1);
7748 des_xmlNodePtr(n_tree, tree, 2);
7749 des_xmlNodePtr(n_node2, node2, 3);
7750 xmlResetLastError();
7751 if (mem_base != xmlMemBlocks()) {
7752 printf("Leak of %d blocks found in xmlShellDu",
7753 xmlMemBlocks() - mem_base);
7754 test_ret++;
7755 printf(" %d", n_ctxt);
7756 printf(" %d", n_arg);
7757 printf(" %d", n_tree);
7758 printf(" %d", n_node2);
7759 printf("\n");
7760 }
7761 }
7762 }
7763 }
7764 }
7765#endif
7766
7767 function_tests++;
7768 return(test_ret);
7769}
7770
7771
7772static int
7773test_xmlShellList(void) {
7774 int test_ret = 0;
7775
7776#ifdef LIBXML_DEBUG_ENABLED
7777 int mem_base;
7778 int ret_val;
7779 xmlShellCtxtPtr ctxt; /* the shell context */
7780 int n_ctxt;
7781 char * arg; /* unused */
7782 int n_arg;
7783 xmlNodePtr node; /* a node */
7784 int n_node;
7785 xmlNodePtr node2; /* unused */
7786 int n_node2;
7787
7788 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7789 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7790 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7791 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7792 mem_base = xmlMemBlocks();
7793 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7794 arg = gen_char_ptr(n_arg, 1);
7795 node = gen_xmlNodePtr(n_node, 2);
7796 node2 = gen_xmlNodePtr(n_node2, 3);
7797
7798 ret_val = xmlShellList(ctxt, arg, node, node2);
7799 desret_int(ret_val);
7800 call_tests++;
7801 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7802 des_char_ptr(n_arg, arg, 1);
7803 des_xmlNodePtr(n_node, node, 2);
7804 des_xmlNodePtr(n_node2, node2, 3);
7805 xmlResetLastError();
7806 if (mem_base != xmlMemBlocks()) {
7807 printf("Leak of %d blocks found in xmlShellList",
7808 xmlMemBlocks() - mem_base);
7809 test_ret++;
7810 printf(" %d", n_ctxt);
7811 printf(" %d", n_arg);
7812 printf(" %d", n_node);
7813 printf(" %d", n_node2);
7814 printf("\n");
7815 }
7816 }
7817 }
7818 }
7819 }
7820#endif
7821
7822 function_tests++;
7823 return(test_ret);
7824}
7825
7826
7827static int
7828test_xmlShellLoad(void) {
7829 int test_ret = 0;
7830
7831#ifdef LIBXML_DEBUG_ENABLED
7832 int mem_base;
7833 int ret_val;
7834 xmlShellCtxtPtr ctxt; /* the shell context */
7835 int n_ctxt;
7836 char * filename; /* the file name */
7837 int n_filename;
7838 xmlNodePtr node; /* unused */
7839 int n_node;
7840 xmlNodePtr node2; /* unused */
7841 int n_node2;
7842
7843 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7844 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7845 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7846 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7847 mem_base = xmlMemBlocks();
7848 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7849 filename = gen_char_ptr(n_filename, 1);
7850 node = gen_xmlNodePtr(n_node, 2);
7851 node2 = gen_xmlNodePtr(n_node2, 3);
7852
7853 ret_val = xmlShellLoad(ctxt, filename, node, node2);
7854 desret_int(ret_val);
7855 call_tests++;
7856 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7857 des_char_ptr(n_filename, filename, 1);
7858 des_xmlNodePtr(n_node, node, 2);
7859 des_xmlNodePtr(n_node2, node2, 3);
7860 xmlResetLastError();
7861 if (mem_base != xmlMemBlocks()) {
7862 printf("Leak of %d blocks found in xmlShellLoad",
7863 xmlMemBlocks() - mem_base);
7864 test_ret++;
7865 printf(" %d", n_ctxt);
7866 printf(" %d", n_filename);
7867 printf(" %d", n_node);
7868 printf(" %d", n_node2);
7869 printf("\n");
7870 }
7871 }
7872 }
7873 }
7874 }
7875#endif
7876
7877 function_tests++;
7878 return(test_ret);
7879}
7880
7881
7882static int
7883test_xmlShellPrintXPathResult(void) {
7884 int test_ret = 0;
7885
7886#ifdef LIBXML_DEBUG_ENABLED
7887 int mem_base;
7888 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
7889 int n_list;
7890
7891 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
7892 mem_base = xmlMemBlocks();
7893 list = gen_xmlXPathObjectPtr(n_list, 0);
7894
7895 xmlShellPrintXPathResult(list);
7896 call_tests++;
7897 des_xmlXPathObjectPtr(n_list, list, 0);
7898 xmlResetLastError();
7899 if (mem_base != xmlMemBlocks()) {
7900 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
7901 xmlMemBlocks() - mem_base);
7902 test_ret++;
7903 printf(" %d", n_list);
7904 printf("\n");
7905 }
7906 }
7907#endif
7908
7909 function_tests++;
7910 return(test_ret);
7911}
7912
7913
7914static int
7915test_xmlShellPwd(void) {
7916 int test_ret = 0;
7917
7918#ifdef LIBXML_DEBUG_ENABLED
7919 int mem_base;
7920 int ret_val;
7921 xmlShellCtxtPtr ctxt; /* the shell context */
7922 int n_ctxt;
7923 char * buffer; /* the output buffer */
7924 int n_buffer;
7925 xmlNodePtr node; /* a node */
7926 int n_node;
7927 xmlNodePtr node2; /* unused */
7928 int n_node2;
7929
7930 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7931 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
7932 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7933 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7934 mem_base = xmlMemBlocks();
7935 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7936 buffer = gen_char_ptr(n_buffer, 1);
7937 node = gen_xmlNodePtr(n_node, 2);
7938 node2 = gen_xmlNodePtr(n_node2, 3);
7939
7940 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
7941 desret_int(ret_val);
7942 call_tests++;
7943 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7944 des_char_ptr(n_buffer, buffer, 1);
7945 des_xmlNodePtr(n_node, node, 2);
7946 des_xmlNodePtr(n_node2, node2, 3);
7947 xmlResetLastError();
7948 if (mem_base != xmlMemBlocks()) {
7949 printf("Leak of %d blocks found in xmlShellPwd",
7950 xmlMemBlocks() - mem_base);
7951 test_ret++;
7952 printf(" %d", n_ctxt);
7953 printf(" %d", n_buffer);
7954 printf(" %d", n_node);
7955 printf(" %d", n_node2);
7956 printf("\n");
7957 }
7958 }
7959 }
7960 }
7961 }
7962#endif
7963
7964 function_tests++;
7965 return(test_ret);
7966}
7967
7968
7969static int
7970test_xmlShellSave(void) {
7971 int test_ret = 0;
7972
7973#ifdef LIBXML_DEBUG_ENABLED
7974#ifdef LIBXML_OUTPUT_ENABLED
7975 int mem_base;
7976 int ret_val;
7977 xmlShellCtxtPtr ctxt; /* the shell context */
7978 int n_ctxt;
7979 char * filename; /* the file name (optional) */
7980 int n_filename;
7981 xmlNodePtr node; /* unused */
7982 int n_node;
7983 xmlNodePtr node2; /* unused */
7984 int n_node2;
7985
7986 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7987 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7988 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7989 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7990 mem_base = xmlMemBlocks();
7991 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7992 filename = gen_char_ptr(n_filename, 1);
7993 node = gen_xmlNodePtr(n_node, 2);
7994 node2 = gen_xmlNodePtr(n_node2, 3);
7995
7996 ret_val = xmlShellSave(ctxt, filename, node, node2);
7997 desret_int(ret_val);
7998 call_tests++;
7999 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8000 des_char_ptr(n_filename, filename, 1);
8001 des_xmlNodePtr(n_node, node, 2);
8002 des_xmlNodePtr(n_node2, node2, 3);
8003 xmlResetLastError();
8004 if (mem_base != xmlMemBlocks()) {
8005 printf("Leak of %d blocks found in xmlShellSave",
8006 xmlMemBlocks() - mem_base);
8007 test_ret++;
8008 printf(" %d", n_ctxt);
8009 printf(" %d", n_filename);
8010 printf(" %d", n_node);
8011 printf(" %d", n_node2);
8012 printf("\n");
8013 }
8014 }
8015 }
8016 }
8017 }
8018#endif
8019#endif
8020
8021 function_tests++;
8022 return(test_ret);
8023}
8024
8025
8026static int
8027test_xmlShellValidate(void) {
8028 int test_ret = 0;
8029
8030#ifdef LIBXML_DEBUG_ENABLED
8031 int mem_base;
8032 int ret_val;
8033 xmlShellCtxtPtr ctxt; /* the shell context */
8034 int n_ctxt;
8035 char * dtd; /* the DTD URI (optional) */
8036 int n_dtd;
8037 xmlNodePtr node; /* unused */
8038 int n_node;
8039 xmlNodePtr node2; /* unused */
8040 int n_node2;
8041
8042 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8043 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
8044 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8045 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8046 mem_base = xmlMemBlocks();
8047 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8048 dtd = gen_char_ptr(n_dtd, 1);
8049 node = gen_xmlNodePtr(n_node, 2);
8050 node2 = gen_xmlNodePtr(n_node2, 3);
8051
8052 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
8053 desret_int(ret_val);
8054 call_tests++;
8055 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8056 des_char_ptr(n_dtd, dtd, 1);
8057 des_xmlNodePtr(n_node, node, 2);
8058 des_xmlNodePtr(n_node2, node2, 3);
8059 xmlResetLastError();
8060 if (mem_base != xmlMemBlocks()) {
8061 printf("Leak of %d blocks found in xmlShellValidate",
8062 xmlMemBlocks() - mem_base);
8063 test_ret++;
8064 printf(" %d", n_ctxt);
8065 printf(" %d", n_dtd);
8066 printf(" %d", n_node);
8067 printf(" %d", n_node2);
8068 printf("\n");
8069 }
8070 }
8071 }
8072 }
8073 }
8074#endif
8075
8076 function_tests++;
8077 return(test_ret);
8078}
8079
8080
8081static int
8082test_xmlShellWrite(void) {
8083 int test_ret = 0;
8084
8085#ifdef LIBXML_DEBUG_ENABLED
8086#ifdef LIBXML_OUTPUT_ENABLED
8087 int mem_base;
8088 int ret_val;
8089 xmlShellCtxtPtr ctxt; /* the shell context */
8090 int n_ctxt;
8091 char * filename; /* the file name */
8092 int n_filename;
8093 xmlNodePtr node; /* a node in the tree */
8094 int n_node;
8095 xmlNodePtr node2; /* unused */
8096 int n_node2;
8097
8098 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
8099 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
8100 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
8101 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
8102 mem_base = xmlMemBlocks();
8103 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
8104 filename = gen_char_ptr(n_filename, 1);
8105 node = gen_xmlNodePtr(n_node, 2);
8106 node2 = gen_xmlNodePtr(n_node2, 3);
8107
8108 ret_val = xmlShellWrite(ctxt, filename, node, node2);
8109 desret_int(ret_val);
8110 call_tests++;
8111 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
8112 des_char_ptr(n_filename, filename, 1);
8113 des_xmlNodePtr(n_node, node, 2);
8114 des_xmlNodePtr(n_node2, node2, 3);
8115 xmlResetLastError();
8116 if (mem_base != xmlMemBlocks()) {
8117 printf("Leak of %d blocks found in xmlShellWrite",
8118 xmlMemBlocks() - mem_base);
8119 test_ret++;
8120 printf(" %d", n_ctxt);
8121 printf(" %d", n_filename);
8122 printf(" %d", n_node);
8123 printf(" %d", n_node2);
8124 printf("\n");
8125 }
8126 }
8127 }
8128 }
8129 }
8130#endif
8131#endif
8132
8133 function_tests++;
8134 return(test_ret);
8135}
8136
8137static int
8138test_debugXML(void) {
8139 int test_ret = 0;
8140
8141 printf("Testing debugXML : 25 of 28 functions ...\n");
8142 test_ret += test_xmlBoolToText();
8143 test_ret += test_xmlDebugCheckDocument();
8144 test_ret += test_xmlDebugDumpAttr();
8145 test_ret += test_xmlDebugDumpAttrList();
8146 test_ret += test_xmlDebugDumpDTD();
8147 test_ret += test_xmlDebugDumpDocument();
8148 test_ret += test_xmlDebugDumpDocumentHead();
8149 test_ret += test_xmlDebugDumpEntities();
8150 test_ret += test_xmlDebugDumpNode();
8151 test_ret += test_xmlDebugDumpNodeList();
8152 test_ret += test_xmlDebugDumpOneNode();
8153 test_ret += test_xmlDebugDumpString();
8154 test_ret += test_xmlLsCountNode();
8155 test_ret += test_xmlLsOneNode();
8156 test_ret += test_xmlShell();
8157 test_ret += test_xmlShellBase();
8158 test_ret += test_xmlShellCat();
8159 test_ret += test_xmlShellDir();
8160 test_ret += test_xmlShellDu();
8161 test_ret += test_xmlShellList();
8162 test_ret += test_xmlShellLoad();
8163 test_ret += test_xmlShellPrintXPathResult();
8164 test_ret += test_xmlShellPwd();
8165 test_ret += test_xmlShellSave();
8166 test_ret += test_xmlShellValidate();
8167 test_ret += test_xmlShellWrite();
8168
8169 if (test_ret != 0)
8170 printf("Module debugXML: %d errors\n", test_ret);
8171 return(test_ret);
8172}
8173
8174static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008175test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008177
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008178 int mem_base;
8179 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008180
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008181 mem_base = xmlMemBlocks();
8182
8183 ret_val = xmlDictCreate();
8184 desret_xmlDictPtr(ret_val);
8185 call_tests++;
8186 xmlResetLastError();
8187 if (mem_base != xmlMemBlocks()) {
8188 printf("Leak of %d blocks found in xmlDictCreate",
8189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008190 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008191 printf("\n");
8192 }
8193
8194 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008196}
8197
8198
8199static int
8200test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008202
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008203 int mem_base;
8204 xmlDictPtr ret_val;
8205 xmlDictPtr sub; /* an existing dictionnary */
8206 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008207
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008208 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
8209 mem_base = xmlMemBlocks();
8210 sub = gen_xmlDictPtr(n_sub, 0);
8211
8212 ret_val = xmlDictCreateSub(sub);
8213 desret_xmlDictPtr(ret_val);
8214 call_tests++;
8215 des_xmlDictPtr(n_sub, sub, 0);
8216 xmlResetLastError();
8217 if (mem_base != xmlMemBlocks()) {
8218 printf("Leak of %d blocks found in xmlDictCreateSub",
8219 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008220 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008221 printf(" %d", n_sub);
8222 printf("\n");
8223 }
8224 }
8225
8226 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008227 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008228}
8229
8230
8231static int
8232test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008234
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008235 int mem_base;
8236 const xmlChar * ret_val;
8237 xmlDictPtr dict; /* the dictionnary */
8238 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008239 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008240 int n_name;
8241 int len; /* the length of the name, if -1 it is recomputed */
8242 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008243
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008244 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8245 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8246 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8247 mem_base = xmlMemBlocks();
8248 dict = gen_xmlDictPtr(n_dict, 0);
8249 name = gen_const_xmlChar_ptr(n_name, 1);
8250 len = gen_int(n_len, 2);
8251
8252 ret_val = xmlDictLookup(dict, name, len);
8253 desret_const_xmlChar_ptr(ret_val);
8254 call_tests++;
8255 des_xmlDictPtr(n_dict, dict, 0);
8256 des_const_xmlChar_ptr(n_name, name, 1);
8257 des_int(n_len, len, 2);
8258 xmlResetLastError();
8259 if (mem_base != xmlMemBlocks()) {
8260 printf("Leak of %d blocks found in xmlDictLookup",
8261 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008262 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008263 printf(" %d", n_dict);
8264 printf(" %d", n_name);
8265 printf(" %d", n_len);
8266 printf("\n");
8267 }
8268 }
8269 }
8270 }
8271
8272 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008274}
8275
8276
8277static int
8278test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008280
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008281 int mem_base;
8282 int ret_val;
8283 xmlDictPtr dict; /* the dictionnary */
8284 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008285 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008286 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008287
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008288 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8289 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8290 mem_base = xmlMemBlocks();
8291 dict = gen_xmlDictPtr(n_dict, 0);
8292 str = gen_const_xmlChar_ptr(n_str, 1);
8293
8294 ret_val = xmlDictOwns(dict, str);
8295 desret_int(ret_val);
8296 call_tests++;
8297 des_xmlDictPtr(n_dict, dict, 0);
8298 des_const_xmlChar_ptr(n_str, str, 1);
8299 xmlResetLastError();
8300 if (mem_base != xmlMemBlocks()) {
8301 printf("Leak of %d blocks found in xmlDictOwns",
8302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008303 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008304 printf(" %d", n_dict);
8305 printf(" %d", n_str);
8306 printf("\n");
8307 }
8308 }
8309 }
8310
8311 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008313}
8314
8315
8316static int
8317test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008319
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008320 int mem_base;
8321 const xmlChar * ret_val;
8322 xmlDictPtr dict; /* the dictionnary */
8323 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008324 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008325 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008326 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008327 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008328
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008329 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8330 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8331 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8332 mem_base = xmlMemBlocks();
8333 dict = gen_xmlDictPtr(n_dict, 0);
8334 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8335 name = gen_const_xmlChar_ptr(n_name, 2);
8336
8337 ret_val = xmlDictQLookup(dict, prefix, name);
8338 desret_const_xmlChar_ptr(ret_val);
8339 call_tests++;
8340 des_xmlDictPtr(n_dict, dict, 0);
8341 des_const_xmlChar_ptr(n_prefix, prefix, 1);
8342 des_const_xmlChar_ptr(n_name, name, 2);
8343 xmlResetLastError();
8344 if (mem_base != xmlMemBlocks()) {
8345 printf("Leak of %d blocks found in xmlDictQLookup",
8346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008347 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008348 printf(" %d", n_dict);
8349 printf(" %d", n_prefix);
8350 printf(" %d", n_name);
8351 printf("\n");
8352 }
8353 }
8354 }
8355 }
8356
8357 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008359}
8360
8361
8362static int
8363test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008365
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008366 int mem_base;
8367 int ret_val;
8368 xmlDictPtr dict; /* the dictionnary */
8369 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008370
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008371 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8372 mem_base = xmlMemBlocks();
8373 dict = gen_xmlDictPtr(n_dict, 0);
8374
8375 ret_val = xmlDictReference(dict);
8376 xmlDictFree(dict);
8377 desret_int(ret_val);
8378 call_tests++;
8379 des_xmlDictPtr(n_dict, dict, 0);
8380 xmlResetLastError();
8381 if (mem_base != xmlMemBlocks()) {
8382 printf("Leak of %d blocks found in xmlDictReference",
8383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008384 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008385 printf(" %d", n_dict);
8386 printf("\n");
8387 }
8388 }
8389
8390 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008392}
8393
8394
8395static int
8396test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008397 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008398
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008399 int mem_base;
8400 int ret_val;
8401 xmlDictPtr dict; /* the dictionnary */
8402 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008403
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008404 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8405 mem_base = xmlMemBlocks();
8406 dict = gen_xmlDictPtr(n_dict, 0);
8407
8408 ret_val = xmlDictSize(dict);
8409 desret_int(ret_val);
8410 call_tests++;
8411 des_xmlDictPtr(n_dict, dict, 0);
8412 xmlResetLastError();
8413 if (mem_base != xmlMemBlocks()) {
8414 printf("Leak of %d blocks found in xmlDictSize",
8415 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008416 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008417 printf(" %d", n_dict);
8418 printf("\n");
8419 }
8420 }
8421
8422 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008423 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008424}
8425
8426static int
8427test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008428 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008429
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008430 printf("Testing dict : 7 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008431 test_ret += test_xmlDictCreate();
8432 test_ret += test_xmlDictCreateSub();
8433 test_ret += test_xmlDictLookup();
8434 test_ret += test_xmlDictOwns();
8435 test_ret += test_xmlDictQLookup();
8436 test_ret += test_xmlDictReference();
8437 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008438
Daniel Veillard42595322004-11-08 10:52:06 +00008439 if (test_ret != 0)
8440 printf("Module dict: %d errors\n", test_ret);
8441 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008442}
8443
8444static int
8445test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008447
Daniel Veillardce682bc2004-11-05 17:22:25 +00008448 int mem_base;
8449 int ret_val;
8450 unsigned char * out; /* a pointer to an array of bytes to store the result */
8451 int n_out;
8452 int * outlen; /* the length of @out */
8453 int n_outlen;
8454 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8455 int n_in;
8456 int * inlen; /* the length of @in */
8457 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008458
Daniel Veillardce682bc2004-11-05 17:22:25 +00008459 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8460 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8461 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8462 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8463 mem_base = xmlMemBlocks();
8464 out = gen_unsigned_char_ptr(n_out, 0);
8465 outlen = gen_int_ptr(n_outlen, 1);
8466 in = gen_const_unsigned_char_ptr(n_in, 2);
8467 inlen = gen_int_ptr(n_inlen, 3);
8468
8469 ret_val = UTF8Toisolat1(out, outlen, in, inlen);
8470 desret_int(ret_val);
8471 call_tests++;
8472 des_unsigned_char_ptr(n_out, out, 0);
8473 des_int_ptr(n_outlen, outlen, 1);
8474 des_const_unsigned_char_ptr(n_in, in, 2);
8475 des_int_ptr(n_inlen, inlen, 3);
8476 xmlResetLastError();
8477 if (mem_base != xmlMemBlocks()) {
8478 printf("Leak of %d blocks found in UTF8Toisolat1",
8479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008480 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008481 printf(" %d", n_out);
8482 printf(" %d", n_outlen);
8483 printf(" %d", n_in);
8484 printf(" %d", n_inlen);
8485 printf("\n");
8486 }
8487 }
8488 }
8489 }
8490 }
8491
8492 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008494}
8495
8496
8497static int
8498test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008500
Daniel Veillardce682bc2004-11-05 17:22:25 +00008501 int mem_base;
8502 int ret_val;
8503 unsigned char * out; /* a pointer to an array of bytes to store the result */
8504 int n_out;
8505 int * outlen; /* the length of @out */
8506 int n_outlen;
8507 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8508 int n_in;
8509 int * inlen; /* the length of @in */
8510 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008511
Daniel Veillardce682bc2004-11-05 17:22:25 +00008512 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8513 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8514 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8515 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8516 mem_base = xmlMemBlocks();
8517 out = gen_unsigned_char_ptr(n_out, 0);
8518 outlen = gen_int_ptr(n_outlen, 1);
8519 in = gen_const_unsigned_char_ptr(n_in, 2);
8520 inlen = gen_int_ptr(n_inlen, 3);
8521
8522 ret_val = isolat1ToUTF8(out, outlen, in, inlen);
8523 desret_int(ret_val);
8524 call_tests++;
8525 des_unsigned_char_ptr(n_out, out, 0);
8526 des_int_ptr(n_outlen, outlen, 1);
8527 des_const_unsigned_char_ptr(n_in, in, 2);
8528 des_int_ptr(n_inlen, inlen, 3);
8529 xmlResetLastError();
8530 if (mem_base != xmlMemBlocks()) {
8531 printf("Leak of %d blocks found in isolat1ToUTF8",
8532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008533 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008534 printf(" %d", n_out);
8535 printf(" %d", n_outlen);
8536 printf(" %d", n_in);
8537 printf(" %d", n_inlen);
8538 printf("\n");
8539 }
8540 }
8541 }
8542 }
8543 }
8544
8545 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008547}
8548
8549
8550static int
8551test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008553
8554 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008555 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008556 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008557 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008558 int n_alias;
8559
8560 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8561 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008562 name = gen_const_char_ptr(n_name, 0);
8563 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008564
8565 ret_val = xmlAddEncodingAlias(name, alias);
8566 desret_int(ret_val);
8567 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008568 des_const_char_ptr(n_name, name, 0);
8569 des_const_char_ptr(n_alias, alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008570 xmlResetLastError();
8571 }
8572 }
8573
Daniel Veillard3d97e662004-11-04 10:49:00 +00008574 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008576}
8577
8578
Daniel Veillardce682bc2004-11-05 17:22:25 +00008579#define gen_nb_xmlCharEncodingHandler_ptr 1
8580static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8581 return(NULL);
8582}
8583static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8584}
8585
Daniel Veillardd93f6252004-11-02 15:53:51 +00008586static int
8587test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008589
Daniel Veillardce682bc2004-11-05 17:22:25 +00008590 int mem_base;
8591 int ret_val;
8592 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8593 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008594
Daniel Veillardce682bc2004-11-05 17:22:25 +00008595 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8596 mem_base = xmlMemBlocks();
8597 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8598
8599 ret_val = xmlCharEncCloseFunc(handler);
8600 desret_int(ret_val);
8601 call_tests++;
8602 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8603 xmlResetLastError();
8604 if (mem_base != xmlMemBlocks()) {
8605 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008607 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008608 printf(" %d", n_handler);
8609 printf("\n");
8610 }
8611 }
8612
8613 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008614 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008615}
8616
8617
8618static int
8619test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008621
Daniel Veillardce682bc2004-11-05 17:22:25 +00008622 int mem_base;
8623 int ret_val;
8624 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8625 int n_handler;
8626 xmlBufferPtr out; /* an xmlBuffer for the output. */
8627 int n_out;
8628 xmlBufferPtr in; /* an xmlBuffer for the input */
8629 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008630
Daniel Veillardce682bc2004-11-05 17:22:25 +00008631 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8632 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8633 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8634 mem_base = xmlMemBlocks();
8635 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8636 out = gen_xmlBufferPtr(n_out, 1);
8637 in = gen_xmlBufferPtr(n_in, 2);
8638
8639 ret_val = xmlCharEncFirstLine(handler, out, in);
8640 desret_int(ret_val);
8641 call_tests++;
8642 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8643 des_xmlBufferPtr(n_out, out, 1);
8644 des_xmlBufferPtr(n_in, in, 2);
8645 xmlResetLastError();
8646 if (mem_base != xmlMemBlocks()) {
8647 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008649 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008650 printf(" %d", n_handler);
8651 printf(" %d", n_out);
8652 printf(" %d", n_in);
8653 printf("\n");
8654 }
8655 }
8656 }
8657 }
8658
8659 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008661}
8662
8663
8664static int
8665test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008667
Daniel Veillardce682bc2004-11-05 17:22:25 +00008668 int mem_base;
8669 int ret_val;
8670 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8671 int n_handler;
8672 xmlBufferPtr out; /* an xmlBuffer for the output. */
8673 int n_out;
8674 xmlBufferPtr in; /* an xmlBuffer for the input */
8675 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008676
Daniel Veillardce682bc2004-11-05 17:22:25 +00008677 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8678 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8679 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8680 mem_base = xmlMemBlocks();
8681 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8682 out = gen_xmlBufferPtr(n_out, 1);
8683 in = gen_xmlBufferPtr(n_in, 2);
8684
8685 ret_val = xmlCharEncInFunc(handler, out, in);
8686 desret_int(ret_val);
8687 call_tests++;
8688 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8689 des_xmlBufferPtr(n_out, out, 1);
8690 des_xmlBufferPtr(n_in, in, 2);
8691 xmlResetLastError();
8692 if (mem_base != xmlMemBlocks()) {
8693 printf("Leak of %d blocks found in xmlCharEncInFunc",
8694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008695 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008696 printf(" %d", n_handler);
8697 printf(" %d", n_out);
8698 printf(" %d", n_in);
8699 printf("\n");
8700 }
8701 }
8702 }
8703 }
8704
8705 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008706 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008707}
8708
8709
8710static int
8711test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008712 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008713
Daniel Veillardce682bc2004-11-05 17:22:25 +00008714 int mem_base;
8715 int ret_val;
8716 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8717 int n_handler;
8718 xmlBufferPtr out; /* an xmlBuffer for the output. */
8719 int n_out;
8720 xmlBufferPtr in; /* an xmlBuffer for the input */
8721 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008722
Daniel Veillardce682bc2004-11-05 17:22:25 +00008723 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8724 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8725 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8726 mem_base = xmlMemBlocks();
8727 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8728 out = gen_xmlBufferPtr(n_out, 1);
8729 in = gen_xmlBufferPtr(n_in, 2);
8730
8731 ret_val = xmlCharEncOutFunc(handler, out, in);
8732 desret_int(ret_val);
8733 call_tests++;
8734 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8735 des_xmlBufferPtr(n_out, out, 1);
8736 des_xmlBufferPtr(n_in, in, 2);
8737 xmlResetLastError();
8738 if (mem_base != xmlMemBlocks()) {
8739 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8740 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008741 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008742 printf(" %d", n_handler);
8743 printf(" %d", n_out);
8744 printf(" %d", n_in);
8745 printf("\n");
8746 }
8747 }
8748 }
8749 }
8750
8751 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008752 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008753}
8754
8755
8756static int
8757test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008759
8760
8761
8762 xmlCleanupCharEncodingHandlers();
8763 call_tests++;
8764 xmlResetLastError();
8765
Daniel Veillard3d97e662004-11-04 10:49:00 +00008766 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008767 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008768}
8769
8770
8771static int
8772test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008773 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008774
8775 int mem_base;
8776
8777 mem_base = xmlMemBlocks();
8778
8779 xmlCleanupEncodingAliases();
8780 call_tests++;
8781 xmlResetLastError();
8782 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008783 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008785 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008786 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008787 }
8788
Daniel Veillard3d97e662004-11-04 10:49:00 +00008789 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008790 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008791}
8792
8793
8794static int
8795test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008796 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008797
8798 int mem_base;
8799 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008800 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008801 int n_alias;
8802
8803 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8804 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008805 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008806
8807 ret_val = xmlDelEncodingAlias(alias);
8808 desret_int(ret_val);
8809 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008810 des_const_char_ptr(n_alias, alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008811 xmlResetLastError();
8812 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008813 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008815 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008816 printf(" %d", n_alias);
8817 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008818 }
8819 }
8820
Daniel Veillard3d97e662004-11-04 10:49:00 +00008821 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008823}
8824
8825
8826static int
8827test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008829
Daniel Veillardce682bc2004-11-05 17:22:25 +00008830 int mem_base;
8831 xmlCharEncoding ret_val;
8832 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). */
8833 int n_in;
8834 int len; /* pointer to the length of the buffer */
8835 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008836
Daniel Veillardce682bc2004-11-05 17:22:25 +00008837 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8838 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8839 mem_base = xmlMemBlocks();
8840 in = gen_const_unsigned_char_ptr(n_in, 0);
8841 len = gen_int(n_len, 1);
8842
8843 ret_val = xmlDetectCharEncoding(in, len);
8844 desret_xmlCharEncoding(ret_val);
8845 call_tests++;
8846 des_const_unsigned_char_ptr(n_in, in, 0);
8847 des_int(n_len, len, 1);
8848 xmlResetLastError();
8849 if (mem_base != xmlMemBlocks()) {
8850 printf("Leak of %d blocks found in xmlDetectCharEncoding",
8851 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008852 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008853 printf(" %d", n_in);
8854 printf(" %d", n_len);
8855 printf("\n");
8856 }
8857 }
8858 }
8859
8860 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008862}
8863
8864
8865static int
8866test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008868
8869
8870 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008872}
8873
8874
8875static int
8876test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008878
8879
8880 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008881 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008882}
8883
8884
8885static int
8886test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008887 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008888
Daniel Veillard3d97e662004-11-04 10:49:00 +00008889 int mem_base;
8890 const char * ret_val;
8891 xmlCharEncoding enc; /* the encoding */
8892 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008893
Daniel Veillard3d97e662004-11-04 10:49:00 +00008894 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
8895 mem_base = xmlMemBlocks();
8896 enc = gen_xmlCharEncoding(n_enc, 0);
8897
8898 ret_val = xmlGetCharEncodingName(enc);
8899 desret_const_char_ptr(ret_val);
8900 call_tests++;
8901 des_xmlCharEncoding(n_enc, enc, 0);
8902 xmlResetLastError();
8903 if (mem_base != xmlMemBlocks()) {
8904 printf("Leak of %d blocks found in xmlGetCharEncodingName",
8905 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008906 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008907 printf(" %d", n_enc);
8908 printf("\n");
8909 }
8910 }
8911
8912 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008913 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008914}
8915
8916
8917static int
8918test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008919 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008920
8921 int mem_base;
8922 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008923 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008924 int n_alias;
8925
8926 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8927 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008928 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008929
8930 ret_val = xmlGetEncodingAlias(alias);
8931 desret_const_char_ptr(ret_val);
8932 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008933 des_const_char_ptr(n_alias, alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008934 xmlResetLastError();
8935 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008936 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008938 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008939 printf(" %d", n_alias);
8940 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008941 }
8942 }
8943
Daniel Veillard3d97e662004-11-04 10:49:00 +00008944 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008945 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008946}
8947
8948
8949static int
8950test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008952
8953
8954
8955 xmlInitCharEncodingHandlers();
8956 call_tests++;
8957 xmlResetLastError();
8958
Daniel Veillard3d97e662004-11-04 10:49:00 +00008959 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00008960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008961}
8962
8963
8964static int
8965test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008967
8968
8969 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008971}
8972
8973
8974static int
8975test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008976 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008977
Daniel Veillard3d97e662004-11-04 10:49:00 +00008978 int mem_base;
8979 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008980 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00008981 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008982
Daniel Veillard3d97e662004-11-04 10:49:00 +00008983 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8984 mem_base = xmlMemBlocks();
8985 name = gen_const_char_ptr(n_name, 0);
8986
8987 ret_val = xmlParseCharEncoding(name);
8988 desret_xmlCharEncoding(ret_val);
8989 call_tests++;
8990 des_const_char_ptr(n_name, name, 0);
8991 xmlResetLastError();
8992 if (mem_base != xmlMemBlocks()) {
8993 printf("Leak of %d blocks found in xmlParseCharEncoding",
8994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008995 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008996 printf(" %d", n_name);
8997 printf("\n");
8998 }
8999 }
9000
9001 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009002 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009003}
9004
9005
Daniel Veillardce682bc2004-11-05 17:22:25 +00009006#define gen_nb_xmlCharEncodingHandlerPtr 1
9007static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9008 return(NULL);
9009}
9010static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9011}
9012
Daniel Veillardd93f6252004-11-02 15:53:51 +00009013static int
9014test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009015 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009016
Daniel Veillardce682bc2004-11-05 17:22:25 +00009017 int mem_base;
9018 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
9019 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009020
Daniel Veillardce682bc2004-11-05 17:22:25 +00009021 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
9022 mem_base = xmlMemBlocks();
9023 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
9024
9025 xmlRegisterCharEncodingHandler(handler);
9026 call_tests++;
9027 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
9028 xmlResetLastError();
9029 if (mem_base != xmlMemBlocks()) {
9030 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
9031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009032 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009033 printf(" %d", n_handler);
9034 printf("\n");
9035 }
9036 }
9037
9038 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009039 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009040}
9041
9042static int
9043test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009045
Daniel Veillardce682bc2004-11-05 17:22:25 +00009046 printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009047 test_ret += test_UTF8Toisolat1();
9048 test_ret += test_isolat1ToUTF8();
9049 test_ret += test_xmlAddEncodingAlias();
9050 test_ret += test_xmlCharEncCloseFunc();
9051 test_ret += test_xmlCharEncFirstLine();
9052 test_ret += test_xmlCharEncInFunc();
9053 test_ret += test_xmlCharEncOutFunc();
9054 test_ret += test_xmlCleanupCharEncodingHandlers();
9055 test_ret += test_xmlCleanupEncodingAliases();
9056 test_ret += test_xmlDelEncodingAlias();
9057 test_ret += test_xmlDetectCharEncoding();
9058 test_ret += test_xmlFindCharEncodingHandler();
9059 test_ret += test_xmlGetCharEncodingHandler();
9060 test_ret += test_xmlGetCharEncodingName();
9061 test_ret += test_xmlGetEncodingAlias();
9062 test_ret += test_xmlInitCharEncodingHandlers();
9063 test_ret += test_xmlNewCharEncodingHandler();
9064 test_ret += test_xmlParseCharEncoding();
9065 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009066
Daniel Veillard42595322004-11-08 10:52:06 +00009067 if (test_ret != 0)
9068 printf("Module encoding: %d errors\n", test_ret);
9069 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009070}
9071
9072static int
9073test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009075
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009076 int mem_base;
9077 xmlEntityPtr ret_val;
9078 xmlDocPtr doc; /* the document */
9079 int n_doc;
9080 xmlChar * name; /* the entity name */
9081 int n_name;
9082 int type; /* the entity type XML_xxx_yyy_ENTITY */
9083 int n_type;
9084 xmlChar * ExternalID; /* the entity external ID if available */
9085 int n_ExternalID;
9086 xmlChar * SystemID; /* the entity system ID if available */
9087 int n_SystemID;
9088 xmlChar * content; /* the entity content */
9089 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009090
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009091 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9092 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9093 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9094 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9095 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9096 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9097 mem_base = xmlMemBlocks();
9098 doc = gen_xmlDocPtr(n_doc, 0);
9099 name = gen_const_xmlChar_ptr(n_name, 1);
9100 type = gen_int(n_type, 2);
9101 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9102 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9103 content = gen_const_xmlChar_ptr(n_content, 5);
9104
9105 ret_val = xmlAddDocEntity(doc, name, type, ExternalID, SystemID, content);
9106 desret_xmlEntityPtr(ret_val);
9107 call_tests++;
9108 des_xmlDocPtr(n_doc, doc, 0);
9109 des_const_xmlChar_ptr(n_name, name, 1);
9110 des_int(n_type, type, 2);
9111 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3);
9112 des_const_xmlChar_ptr(n_SystemID, SystemID, 4);
9113 des_const_xmlChar_ptr(n_content, content, 5);
9114 xmlResetLastError();
9115 if (mem_base != xmlMemBlocks()) {
9116 printf("Leak of %d blocks found in xmlAddDocEntity",
9117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009118 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009119 printf(" %d", n_doc);
9120 printf(" %d", n_name);
9121 printf(" %d", n_type);
9122 printf(" %d", n_ExternalID);
9123 printf(" %d", n_SystemID);
9124 printf(" %d", n_content);
9125 printf("\n");
9126 }
9127 }
9128 }
9129 }
9130 }
9131 }
9132 }
9133
9134 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009135 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009136}
9137
9138
9139static int
9140test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009141 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009142
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009143 int mem_base;
9144 xmlEntityPtr ret_val;
9145 xmlDocPtr doc; /* the document */
9146 int n_doc;
9147 xmlChar * name; /* the entity name */
9148 int n_name;
9149 int type; /* the entity type XML_xxx_yyy_ENTITY */
9150 int n_type;
9151 xmlChar * ExternalID; /* the entity external ID if available */
9152 int n_ExternalID;
9153 xmlChar * SystemID; /* the entity system ID if available */
9154 int n_SystemID;
9155 xmlChar * content; /* the entity content */
9156 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009157
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009158 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9159 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9160 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9161 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9162 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9163 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9164 mem_base = xmlMemBlocks();
9165 doc = gen_xmlDocPtr(n_doc, 0);
9166 name = gen_const_xmlChar_ptr(n_name, 1);
9167 type = gen_int(n_type, 2);
9168 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9169 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9170 content = gen_const_xmlChar_ptr(n_content, 5);
9171
9172 ret_val = xmlAddDtdEntity(doc, name, type, ExternalID, SystemID, content);
9173 desret_xmlEntityPtr(ret_val);
9174 call_tests++;
9175 des_xmlDocPtr(n_doc, doc, 0);
9176 des_const_xmlChar_ptr(n_name, name, 1);
9177 des_int(n_type, type, 2);
9178 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3);
9179 des_const_xmlChar_ptr(n_SystemID, SystemID, 4);
9180 des_const_xmlChar_ptr(n_content, content, 5);
9181 xmlResetLastError();
9182 if (mem_base != xmlMemBlocks()) {
9183 printf("Leak of %d blocks found in xmlAddDtdEntity",
9184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009185 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009186 printf(" %d", n_doc);
9187 printf(" %d", n_name);
9188 printf(" %d", n_type);
9189 printf(" %d", n_ExternalID);
9190 printf(" %d", n_SystemID);
9191 printf(" %d", n_content);
9192 printf("\n");
9193 }
9194 }
9195 }
9196 }
9197 }
9198 }
9199 }
9200
9201 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009203}
9204
9205
9206static int
9207test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009209
9210 int mem_base;
9211
9212 mem_base = xmlMemBlocks();
9213
9214 xmlCleanupPredefinedEntities();
9215 call_tests++;
9216 xmlResetLastError();
9217 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009218 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009219 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009220 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009221 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009222 }
9223
Daniel Veillard3d97e662004-11-04 10:49:00 +00009224 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009226}
9227
9228
Daniel Veillardce682bc2004-11-05 17:22:25 +00009229#define gen_nb_xmlEntitiesTablePtr 1
9230static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9231 return(NULL);
9232}
9233static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9234}
9235
Daniel Veillardd93f6252004-11-02 15:53:51 +00009236static int
9237test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009239
9240
9241 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009242 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009243}
9244
9245
9246static int
9247test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009248 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009249
9250
9251 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009253}
9254
9255
9256static int
9257test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009259
Daniel Veillardce682bc2004-11-05 17:22:25 +00009260#ifdef LIBXML_OUTPUT_ENABLED
9261 int mem_base;
9262 xmlBufferPtr buf; /* An XML buffer. */
9263 int n_buf;
9264 xmlEntitiesTablePtr table; /* An entity table */
9265 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009266
Daniel Veillardce682bc2004-11-05 17:22:25 +00009267 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9268 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9269 mem_base = xmlMemBlocks();
9270 buf = gen_xmlBufferPtr(n_buf, 0);
9271 table = gen_xmlEntitiesTablePtr(n_table, 1);
9272
9273 xmlDumpEntitiesTable(buf, table);
9274 call_tests++;
9275 des_xmlBufferPtr(n_buf, buf, 0);
9276 des_xmlEntitiesTablePtr(n_table, table, 1);
9277 xmlResetLastError();
9278 if (mem_base != xmlMemBlocks()) {
9279 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009281 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009282 printf(" %d", n_buf);
9283 printf(" %d", n_table);
9284 printf("\n");
9285 }
9286 }
9287 }
9288#endif
9289
9290 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009292}
9293
9294
Daniel Veillardce682bc2004-11-05 17:22:25 +00009295#define gen_nb_xmlEntityPtr 1
9296static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9297 return(NULL);
9298}
9299static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9300}
9301
Daniel Veillardd93f6252004-11-02 15:53:51 +00009302static int
9303test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009304 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009305
Daniel Veillardce682bc2004-11-05 17:22:25 +00009306#ifdef LIBXML_OUTPUT_ENABLED
9307 int mem_base;
9308 xmlBufferPtr buf; /* An XML buffer. */
9309 int n_buf;
9310 xmlEntityPtr ent; /* An entity table */
9311 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009312
Daniel Veillardce682bc2004-11-05 17:22:25 +00009313 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9314 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9315 mem_base = xmlMemBlocks();
9316 buf = gen_xmlBufferPtr(n_buf, 0);
9317 ent = gen_xmlEntityPtr(n_ent, 1);
9318
9319 xmlDumpEntityDecl(buf, ent);
9320 call_tests++;
9321 des_xmlBufferPtr(n_buf, buf, 0);
9322 des_xmlEntityPtr(n_ent, ent, 1);
9323 xmlResetLastError();
9324 if (mem_base != xmlMemBlocks()) {
9325 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009327 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009328 printf(" %d", n_buf);
9329 printf(" %d", n_ent);
9330 printf("\n");
9331 }
9332 }
9333 }
9334#endif
9335
9336 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009338}
9339
9340
9341static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009342test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009344
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009345 int mem_base;
9346 xmlChar * ret_val;
9347 xmlDocPtr doc; /* the document containing the string */
9348 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009349 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009350 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009351
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009352 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9353 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9354 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009355 doc = gen_xmlDocPtr(n_doc, 0);
9356 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009357
9358 ret_val = xmlEncodeEntitiesReentrant(doc, input);
9359 desret_xmlChar_ptr(ret_val);
9360 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009361 des_xmlDocPtr(n_doc, doc, 0);
9362 des_const_xmlChar_ptr(n_input, input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009363 xmlResetLastError();
9364 if (mem_base != xmlMemBlocks()) {
9365 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009367 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009368 printf(" %d", n_doc);
9369 printf(" %d", n_input);
9370 printf("\n");
9371 }
9372 }
9373 }
9374
Daniel Veillard3d97e662004-11-04 10:49:00 +00009375 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009376 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009377}
9378
9379
9380static int
9381test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009382 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009383
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009384 int mem_base;
9385 xmlChar * ret_val;
9386 xmlDocPtr doc; /* the document containing the string */
9387 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009388 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009389 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009390
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009391 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9392 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9393 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009394 doc = gen_xmlDocPtr(n_doc, 0);
9395 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009396
9397 ret_val = xmlEncodeSpecialChars(doc, input);
9398 desret_xmlChar_ptr(ret_val);
9399 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009400 des_xmlDocPtr(n_doc, doc, 0);
9401 des_const_xmlChar_ptr(n_input, input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009402 xmlResetLastError();
9403 if (mem_base != xmlMemBlocks()) {
9404 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9405 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009406 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009407 printf(" %d", n_doc);
9408 printf(" %d", n_input);
9409 printf("\n");
9410 }
9411 }
9412 }
9413
Daniel Veillard3d97e662004-11-04 10:49:00 +00009414 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009415 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009416}
9417
9418
9419static int
9420test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009421 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009422
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009423 int mem_base;
9424 xmlEntityPtr ret_val;
9425 xmlDocPtr doc; /* the document referencing the entity */
9426 int n_doc;
9427 xmlChar * name; /* the entity name */
9428 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009429
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009430 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9431 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9432 mem_base = xmlMemBlocks();
9433 doc = gen_xmlDocPtr(n_doc, 0);
9434 name = gen_const_xmlChar_ptr(n_name, 1);
9435
9436 ret_val = xmlGetDocEntity(doc, name);
9437 desret_xmlEntityPtr(ret_val);
9438 call_tests++;
9439 des_xmlDocPtr(n_doc, doc, 0);
9440 des_const_xmlChar_ptr(n_name, name, 1);
9441 xmlResetLastError();
9442 if (mem_base != xmlMemBlocks()) {
9443 printf("Leak of %d blocks found in xmlGetDocEntity",
9444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009445 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009446 printf(" %d", n_doc);
9447 printf(" %d", n_name);
9448 printf("\n");
9449 }
9450 }
9451 }
9452
9453 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009455}
9456
9457
9458static int
9459test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009461
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009462 int mem_base;
9463 xmlEntityPtr ret_val;
9464 xmlDocPtr doc; /* the document referencing the entity */
9465 int n_doc;
9466 xmlChar * name; /* the entity name */
9467 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009468
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009469 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9470 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9471 mem_base = xmlMemBlocks();
9472 doc = gen_xmlDocPtr(n_doc, 0);
9473 name = gen_const_xmlChar_ptr(n_name, 1);
9474
9475 ret_val = xmlGetDtdEntity(doc, name);
9476 desret_xmlEntityPtr(ret_val);
9477 call_tests++;
9478 des_xmlDocPtr(n_doc, doc, 0);
9479 des_const_xmlChar_ptr(n_name, name, 1);
9480 xmlResetLastError();
9481 if (mem_base != xmlMemBlocks()) {
9482 printf("Leak of %d blocks found in xmlGetDtdEntity",
9483 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009484 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009485 printf(" %d", n_doc);
9486 printf(" %d", n_name);
9487 printf("\n");
9488 }
9489 }
9490 }
9491
9492 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009494}
9495
9496
9497static int
9498test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009500
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009501 int mem_base;
9502 xmlEntityPtr ret_val;
9503 xmlDocPtr doc; /* the document referencing the entity */
9504 int n_doc;
9505 xmlChar * name; /* the entity name */
9506 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009507
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009508 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9509 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9510 mem_base = xmlMemBlocks();
9511 doc = gen_xmlDocPtr(n_doc, 0);
9512 name = gen_const_xmlChar_ptr(n_name, 1);
9513
9514 ret_val = xmlGetParameterEntity(doc, name);
9515 desret_xmlEntityPtr(ret_val);
9516 call_tests++;
9517 des_xmlDocPtr(n_doc, doc, 0);
9518 des_const_xmlChar_ptr(n_name, name, 1);
9519 xmlResetLastError();
9520 if (mem_base != xmlMemBlocks()) {
9521 printf("Leak of %d blocks found in xmlGetParameterEntity",
9522 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009523 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009524 printf(" %d", n_doc);
9525 printf(" %d", n_name);
9526 printf("\n");
9527 }
9528 }
9529 }
9530
9531 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009532 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009533}
9534
9535
9536static int
9537test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009539
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009540 int mem_base;
9541 xmlEntityPtr ret_val;
9542 xmlChar * name; /* the entity name */
9543 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009544
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009545 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9546 mem_base = xmlMemBlocks();
9547 name = gen_const_xmlChar_ptr(n_name, 0);
9548
9549 ret_val = xmlGetPredefinedEntity(name);
9550 desret_xmlEntityPtr(ret_val);
9551 call_tests++;
9552 des_const_xmlChar_ptr(n_name, name, 0);
9553 xmlResetLastError();
9554 if (mem_base != xmlMemBlocks()) {
9555 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9556 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009557 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009558 printf(" %d", n_name);
9559 printf("\n");
9560 }
9561 }
9562
9563 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009565}
9566
9567
9568static int
9569test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009571
9572 int mem_base;
9573
9574 mem_base = xmlMemBlocks();
9575
9576 xmlInitializePredefinedEntities();
9577 call_tests++;
9578 xmlResetLastError();
9579 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009580 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009582 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009583 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009584 }
9585
Daniel Veillard3d97e662004-11-04 10:49:00 +00009586 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009588}
9589
9590static int
9591test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009593
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009594 printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009595 test_ret += test_xmlAddDocEntity();
9596 test_ret += test_xmlAddDtdEntity();
9597 test_ret += test_xmlCleanupPredefinedEntities();
9598 test_ret += test_xmlCopyEntitiesTable();
9599 test_ret += test_xmlCreateEntitiesTable();
9600 test_ret += test_xmlDumpEntitiesTable();
9601 test_ret += test_xmlDumpEntityDecl();
9602 test_ret += test_xmlEncodeEntitiesReentrant();
9603 test_ret += test_xmlEncodeSpecialChars();
9604 test_ret += test_xmlGetDocEntity();
9605 test_ret += test_xmlGetDtdEntity();
9606 test_ret += test_xmlGetParameterEntity();
9607 test_ret += test_xmlGetPredefinedEntity();
9608 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009609
Daniel Veillard42595322004-11-08 10:52:06 +00009610 if (test_ret != 0)
9611 printf("Module entities: %d errors\n", test_ret);
9612 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009613}
9614
9615static int
9616test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009618
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009619 int mem_base;
9620 int ret_val;
9621 xmlHashTablePtr table; /* the hash table */
9622 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009623 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009624 int n_name;
9625 void * userdata; /* a pointer to the userdata */
9626 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009627
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009628 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9629 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9630 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9631 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009632 table = gen_xmlHashTablePtr(n_table, 0);
9633 name = gen_const_xmlChar_ptr(n_name, 1);
9634 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009635
9636 ret_val = xmlHashAddEntry(table, name, userdata);
9637 desret_int(ret_val);
9638 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009639 des_xmlHashTablePtr(n_table, table, 0);
9640 des_const_xmlChar_ptr(n_name, name, 1);
9641 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009642 xmlResetLastError();
9643 if (mem_base != xmlMemBlocks()) {
9644 printf("Leak of %d blocks found in xmlHashAddEntry",
9645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009646 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009647 printf(" %d", n_table);
9648 printf(" %d", n_name);
9649 printf(" %d", n_userdata);
9650 printf("\n");
9651 }
9652 }
9653 }
9654 }
9655
Daniel Veillard3d97e662004-11-04 10:49:00 +00009656 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009657 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009658}
9659
9660
9661static int
9662test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009663 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009664
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009665 int mem_base;
9666 int ret_val;
9667 xmlHashTablePtr table; /* the hash table */
9668 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009669 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009670 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009671 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009672 int n_name2;
9673 void * userdata; /* a pointer to the userdata */
9674 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009675
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009676 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9677 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9678 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9679 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9680 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009681 table = gen_xmlHashTablePtr(n_table, 0);
9682 name = gen_const_xmlChar_ptr(n_name, 1);
9683 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9684 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009685
9686 ret_val = xmlHashAddEntry2(table, name, name2, userdata);
9687 desret_int(ret_val);
9688 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009689 des_xmlHashTablePtr(n_table, table, 0);
9690 des_const_xmlChar_ptr(n_name, name, 1);
9691 des_const_xmlChar_ptr(n_name2, name2, 2);
9692 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009693 xmlResetLastError();
9694 if (mem_base != xmlMemBlocks()) {
9695 printf("Leak of %d blocks found in xmlHashAddEntry2",
9696 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009697 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009698 printf(" %d", n_table);
9699 printf(" %d", n_name);
9700 printf(" %d", n_name2);
9701 printf(" %d", n_userdata);
9702 printf("\n");
9703 }
9704 }
9705 }
9706 }
9707 }
9708
Daniel Veillard3d97e662004-11-04 10:49:00 +00009709 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009710 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009711}
9712
9713
9714static int
9715test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009716 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009717
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009718 int mem_base;
9719 int ret_val;
9720 xmlHashTablePtr table; /* the hash table */
9721 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009722 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009723 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009724 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009725 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009726 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009727 int n_name3;
9728 void * userdata; /* a pointer to the userdata */
9729 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009730
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009731 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9732 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9733 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9734 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9735 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9736 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009737 table = gen_xmlHashTablePtr(n_table, 0);
9738 name = gen_const_xmlChar_ptr(n_name, 1);
9739 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9740 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9741 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009742
9743 ret_val = xmlHashAddEntry3(table, name, name2, name3, userdata);
9744 desret_int(ret_val);
9745 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009746 des_xmlHashTablePtr(n_table, table, 0);
9747 des_const_xmlChar_ptr(n_name, name, 1);
9748 des_const_xmlChar_ptr(n_name2, name2, 2);
9749 des_const_xmlChar_ptr(n_name3, name3, 3);
9750 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009751 xmlResetLastError();
9752 if (mem_base != xmlMemBlocks()) {
9753 printf("Leak of %d blocks found in xmlHashAddEntry3",
9754 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009755 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009756 printf(" %d", n_table);
9757 printf(" %d", n_name);
9758 printf(" %d", n_name2);
9759 printf(" %d", n_name3);
9760 printf(" %d", n_userdata);
9761 printf("\n");
9762 }
9763 }
9764 }
9765 }
9766 }
9767 }
9768
Daniel Veillard3d97e662004-11-04 10:49:00 +00009769 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009770 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009771}
9772
9773
9774static int
9775test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009776 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009777
9778
9779 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009780 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009781}
9782
9783
9784static int
9785test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009786 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009787
9788
9789 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009790 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009791}
9792
9793
9794static int
9795test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009796 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009797
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009798 int mem_base;
9799 void * ret_val;
9800 xmlHashTablePtr table; /* the hash table */
9801 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009802 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009803 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009804
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +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 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009808 table = gen_xmlHashTablePtr(n_table, 0);
9809 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009810
9811 ret_val = xmlHashLookup(table, name);
9812 desret_void_ptr(ret_val);
9813 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009814 des_xmlHashTablePtr(n_table, table, 0);
9815 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009816 xmlResetLastError();
9817 if (mem_base != xmlMemBlocks()) {
9818 printf("Leak of %d blocks found in xmlHashLookup",
9819 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009820 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009821 printf(" %d", n_table);
9822 printf(" %d", n_name);
9823 printf("\n");
9824 }
9825 }
9826 }
9827
Daniel Veillard3d97e662004-11-04 10:49:00 +00009828 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009829 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009830}
9831
9832
9833static int
9834test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009835 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009836
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009837 int mem_base;
9838 void * ret_val;
9839 xmlHashTablePtr table; /* the hash table */
9840 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009841 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009842 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009843 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009844 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009845
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009846 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9847 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9848 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9849 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009850 table = gen_xmlHashTablePtr(n_table, 0);
9851 name = gen_const_xmlChar_ptr(n_name, 1);
9852 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009853
9854 ret_val = xmlHashLookup2(table, name, name2);
9855 desret_void_ptr(ret_val);
9856 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009857 des_xmlHashTablePtr(n_table, table, 0);
9858 des_const_xmlChar_ptr(n_name, name, 1);
9859 des_const_xmlChar_ptr(n_name2, name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009860 xmlResetLastError();
9861 if (mem_base != xmlMemBlocks()) {
9862 printf("Leak of %d blocks found in xmlHashLookup2",
9863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009864 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009865 printf(" %d", n_table);
9866 printf(" %d", n_name);
9867 printf(" %d", n_name2);
9868 printf("\n");
9869 }
9870 }
9871 }
9872 }
9873
Daniel Veillard3d97e662004-11-04 10:49:00 +00009874 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009875 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009876}
9877
9878
9879static int
9880test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009881 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009882
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009883 int mem_base;
9884 void * ret_val;
9885 xmlHashTablePtr table; /* the hash table */
9886 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009887 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009888 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009889 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009890 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009891 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009892 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009893
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009894 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9895 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9896 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9897 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9898 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009899 table = gen_xmlHashTablePtr(n_table, 0);
9900 name = gen_const_xmlChar_ptr(n_name, 1);
9901 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9902 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009903
9904 ret_val = xmlHashLookup3(table, name, name2, name3);
9905 desret_void_ptr(ret_val);
9906 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009907 des_xmlHashTablePtr(n_table, table, 0);
9908 des_const_xmlChar_ptr(n_name, name, 1);
9909 des_const_xmlChar_ptr(n_name2, name2, 2);
9910 des_const_xmlChar_ptr(n_name3, name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009911 xmlResetLastError();
9912 if (mem_base != xmlMemBlocks()) {
9913 printf("Leak of %d blocks found in xmlHashLookup3",
9914 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009915 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009916 printf(" %d", n_table);
9917 printf(" %d", n_name);
9918 printf(" %d", n_name2);
9919 printf(" %d", n_name3);
9920 printf("\n");
9921 }
9922 }
9923 }
9924 }
9925 }
9926
Daniel Veillard3d97e662004-11-04 10:49:00 +00009927 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009929}
9930
9931
9932static int
9933test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009935
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009936 int mem_base;
9937 void * ret_val;
9938 xmlHashTablePtr table; /* the hash table */
9939 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009940 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009941 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009942 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009943 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009944
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009945 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9946 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9947 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9948 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009949 table = gen_xmlHashTablePtr(n_table, 0);
9950 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9951 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009952
9953 ret_val = xmlHashQLookup(table, prefix, name);
9954 desret_void_ptr(ret_val);
9955 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009956 des_xmlHashTablePtr(n_table, table, 0);
9957 des_const_xmlChar_ptr(n_prefix, prefix, 1);
9958 des_const_xmlChar_ptr(n_name, name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009959 xmlResetLastError();
9960 if (mem_base != xmlMemBlocks()) {
9961 printf("Leak of %d blocks found in xmlHashQLookup",
9962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009963 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009964 printf(" %d", n_table);
9965 printf(" %d", n_prefix);
9966 printf(" %d", n_name);
9967 printf("\n");
9968 }
9969 }
9970 }
9971 }
9972
Daniel Veillard3d97e662004-11-04 10:49:00 +00009973 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00009974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009975}
9976
9977
9978static int
9979test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009981
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009982 int mem_base;
9983 void * ret_val;
9984 xmlHashTablePtr table; /* the hash table */
9985 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009986 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009987 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009988 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009989 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009990 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009991 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009992 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009993 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009994
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009995 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9996 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9997 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9998 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9999 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10000 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010001 table = gen_xmlHashTablePtr(n_table, 0);
10002 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
10003 name = gen_const_xmlChar_ptr(n_name, 2);
10004 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
10005 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010006
10007 ret_val = xmlHashQLookup2(table, prefix, name, prefix2, name2);
10008 desret_void_ptr(ret_val);
10009 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010010 des_xmlHashTablePtr(n_table, table, 0);
10011 des_const_xmlChar_ptr(n_prefix, prefix, 1);
10012 des_const_xmlChar_ptr(n_name, name, 2);
10013 des_const_xmlChar_ptr(n_prefix2, prefix2, 3);
10014 des_const_xmlChar_ptr(n_name2, name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010015 xmlResetLastError();
10016 if (mem_base != xmlMemBlocks()) {
10017 printf("Leak of %d blocks found in xmlHashQLookup2",
10018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010019 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010020 printf(" %d", n_table);
10021 printf(" %d", n_prefix);
10022 printf(" %d", n_name);
10023 printf(" %d", n_prefix2);
10024 printf(" %d", n_name2);
10025 printf("\n");
10026 }
10027 }
10028 }
10029 }
10030 }
10031 }
10032
Daniel Veillard3d97e662004-11-04 10:49:00 +000010033 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010035}
10036
10037
10038static int
10039test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010041
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010042 int mem_base;
10043 void * ret_val;
10044 xmlHashTablePtr table; /* the hash table */
10045 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010046 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010047 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010048 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010049 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010050 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010051 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010052 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010053 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010054 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010055 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010056 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010057 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010058
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010059 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10060 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
10061 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10062 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
10063 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10064 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
10065 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10066 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010067 table = gen_xmlHashTablePtr(n_table, 0);
10068 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
10069 name = gen_const_xmlChar_ptr(n_name, 2);
10070 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
10071 name2 = gen_const_xmlChar_ptr(n_name2, 4);
10072 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
10073 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010074
10075 ret_val = xmlHashQLookup3(table, prefix, name, prefix2, name2, prefix3, name3);
10076 desret_void_ptr(ret_val);
10077 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010078 des_xmlHashTablePtr(n_table, table, 0);
10079 des_const_xmlChar_ptr(n_prefix, prefix, 1);
10080 des_const_xmlChar_ptr(n_name, name, 2);
10081 des_const_xmlChar_ptr(n_prefix2, prefix2, 3);
10082 des_const_xmlChar_ptr(n_name2, name2, 4);
10083 des_const_xmlChar_ptr(n_prefix3, prefix3, 5);
10084 des_const_xmlChar_ptr(n_name3, name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010085 xmlResetLastError();
10086 if (mem_base != xmlMemBlocks()) {
10087 printf("Leak of %d blocks found in xmlHashQLookup3",
10088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010089 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010090 printf(" %d", n_table);
10091 printf(" %d", n_prefix);
10092 printf(" %d", n_name);
10093 printf(" %d", n_prefix2);
10094 printf(" %d", n_name2);
10095 printf(" %d", n_prefix3);
10096 printf(" %d", n_name3);
10097 printf("\n");
10098 }
10099 }
10100 }
10101 }
10102 }
10103 }
10104 }
10105 }
10106
Daniel Veillard3d97e662004-11-04 10:49:00 +000010107 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010109}
10110
10111
10112static int
10113test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010115
Daniel Veillard42595322004-11-08 10:52:06 +000010116 int mem_base;
10117 int ret_val;
10118 xmlHashTablePtr table; /* the hash table */
10119 int n_table;
10120 xmlChar * name; /* the name of the userdata */
10121 int n_name;
10122 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10123 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010124
Daniel Veillard42595322004-11-08 10:52:06 +000010125 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10126 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10127 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10128 mem_base = xmlMemBlocks();
10129 table = gen_xmlHashTablePtr(n_table, 0);
10130 name = gen_const_xmlChar_ptr(n_name, 1);
10131 f = gen_xmlHashDeallocator(n_f, 2);
10132
10133 ret_val = xmlHashRemoveEntry(table, name, f);
10134 desret_int(ret_val);
10135 call_tests++;
10136 des_xmlHashTablePtr(n_table, table, 0);
10137 des_const_xmlChar_ptr(n_name, name, 1);
10138 des_xmlHashDeallocator(n_f, f, 2);
10139 xmlResetLastError();
10140 if (mem_base != xmlMemBlocks()) {
10141 printf("Leak of %d blocks found in xmlHashRemoveEntry",
10142 xmlMemBlocks() - mem_base);
10143 test_ret++;
10144 printf(" %d", n_table);
10145 printf(" %d", n_name);
10146 printf(" %d", n_f);
10147 printf("\n");
10148 }
10149 }
10150 }
10151 }
10152
10153 function_tests++;
10154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010155}
10156
10157
10158static int
10159test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010161
Daniel Veillard42595322004-11-08 10:52:06 +000010162 int mem_base;
10163 int ret_val;
10164 xmlHashTablePtr table; /* the hash table */
10165 int n_table;
10166 xmlChar * name; /* the name of the userdata */
10167 int n_name;
10168 xmlChar * name2; /* a second name of the userdata */
10169 int n_name2;
10170 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10171 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010172
Daniel Veillard42595322004-11-08 10:52:06 +000010173 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10174 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10175 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10176 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10177 mem_base = xmlMemBlocks();
10178 table = gen_xmlHashTablePtr(n_table, 0);
10179 name = gen_const_xmlChar_ptr(n_name, 1);
10180 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10181 f = gen_xmlHashDeallocator(n_f, 3);
10182
10183 ret_val = xmlHashRemoveEntry2(table, name, name2, f);
10184 desret_int(ret_val);
10185 call_tests++;
10186 des_xmlHashTablePtr(n_table, table, 0);
10187 des_const_xmlChar_ptr(n_name, name, 1);
10188 des_const_xmlChar_ptr(n_name2, name2, 2);
10189 des_xmlHashDeallocator(n_f, f, 3);
10190 xmlResetLastError();
10191 if (mem_base != xmlMemBlocks()) {
10192 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10193 xmlMemBlocks() - mem_base);
10194 test_ret++;
10195 printf(" %d", n_table);
10196 printf(" %d", n_name);
10197 printf(" %d", n_name2);
10198 printf(" %d", n_f);
10199 printf("\n");
10200 }
10201 }
10202 }
10203 }
10204 }
10205
10206 function_tests++;
10207 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010208}
10209
10210
10211static int
10212test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010213 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010214
Daniel Veillard42595322004-11-08 10:52:06 +000010215 int mem_base;
10216 int ret_val;
10217 xmlHashTablePtr table; /* the hash table */
10218 int n_table;
10219 xmlChar * name; /* the name of the userdata */
10220 int n_name;
10221 xmlChar * name2; /* a second name of the userdata */
10222 int n_name2;
10223 xmlChar * name3; /* a third name of the userdata */
10224 int n_name3;
10225 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10226 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010227
Daniel Veillard42595322004-11-08 10:52:06 +000010228 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10229 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10230 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10231 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10232 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10233 mem_base = xmlMemBlocks();
10234 table = gen_xmlHashTablePtr(n_table, 0);
10235 name = gen_const_xmlChar_ptr(n_name, 1);
10236 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10237 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10238 f = gen_xmlHashDeallocator(n_f, 4);
10239
10240 ret_val = xmlHashRemoveEntry3(table, name, name2, name3, f);
10241 desret_int(ret_val);
10242 call_tests++;
10243 des_xmlHashTablePtr(n_table, table, 0);
10244 des_const_xmlChar_ptr(n_name, name, 1);
10245 des_const_xmlChar_ptr(n_name2, name2, 2);
10246 des_const_xmlChar_ptr(n_name3, name3, 3);
10247 des_xmlHashDeallocator(n_f, f, 4);
10248 xmlResetLastError();
10249 if (mem_base != xmlMemBlocks()) {
10250 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10251 xmlMemBlocks() - mem_base);
10252 test_ret++;
10253 printf(" %d", n_table);
10254 printf(" %d", n_name);
10255 printf(" %d", n_name2);
10256 printf(" %d", n_name3);
10257 printf(" %d", n_f);
10258 printf("\n");
10259 }
10260 }
10261 }
10262 }
10263 }
10264 }
10265
10266 function_tests++;
10267 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010268}
10269
10270
10271static int
10272test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010273 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010274
10275
10276 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010278}
10279
10280
10281static int
10282test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010284
10285
10286 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010288}
10289
10290
10291static int
10292test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010294
10295
10296 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010298}
10299
10300
10301static int
10302test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010304
10305
10306 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010308}
10309
10310
10311static int
10312test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010314
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010315 int mem_base;
10316 int ret_val;
10317 xmlHashTablePtr table; /* the hash table */
10318 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010319
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010320 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10321 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010322 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010323
10324 ret_val = xmlHashSize(table);
10325 desret_int(ret_val);
10326 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010327 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010328 xmlResetLastError();
10329 if (mem_base != xmlMemBlocks()) {
10330 printf("Leak of %d blocks found in xmlHashSize",
10331 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010332 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010333 printf(" %d", n_table);
10334 printf("\n");
10335 }
10336 }
10337
Daniel Veillard3d97e662004-11-04 10:49:00 +000010338 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010339 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010340}
10341
10342
10343static int
10344test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010345 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010346
Daniel Veillard42595322004-11-08 10:52:06 +000010347 int mem_base;
10348 int ret_val;
10349 xmlHashTablePtr table; /* the hash table */
10350 int n_table;
10351 xmlChar * name; /* the name of the userdata */
10352 int n_name;
10353 void * userdata; /* a pointer to the userdata */
10354 int n_userdata;
10355 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10356 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010357
Daniel Veillard42595322004-11-08 10:52:06 +000010358 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10359 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10360 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10361 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10362 mem_base = xmlMemBlocks();
10363 table = gen_xmlHashTablePtr(n_table, 0);
10364 name = gen_const_xmlChar_ptr(n_name, 1);
10365 userdata = gen_userdata(n_userdata, 2);
10366 f = gen_xmlHashDeallocator(n_f, 3);
10367
10368 ret_val = xmlHashUpdateEntry(table, name, userdata, f);
10369 desret_int(ret_val);
10370 call_tests++;
10371 des_xmlHashTablePtr(n_table, table, 0);
10372 des_const_xmlChar_ptr(n_name, name, 1);
10373 des_userdata(n_userdata, userdata, 2);
10374 des_xmlHashDeallocator(n_f, f, 3);
10375 xmlResetLastError();
10376 if (mem_base != xmlMemBlocks()) {
10377 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10378 xmlMemBlocks() - mem_base);
10379 test_ret++;
10380 printf(" %d", n_table);
10381 printf(" %d", n_name);
10382 printf(" %d", n_userdata);
10383 printf(" %d", n_f);
10384 printf("\n");
10385 }
10386 }
10387 }
10388 }
10389 }
10390
10391 function_tests++;
10392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010393}
10394
10395
10396static int
10397test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010399
Daniel Veillard42595322004-11-08 10:52:06 +000010400 int mem_base;
10401 int ret_val;
10402 xmlHashTablePtr table; /* the hash table */
10403 int n_table;
10404 xmlChar * name; /* the name of the userdata */
10405 int n_name;
10406 xmlChar * name2; /* a second name of the userdata */
10407 int n_name2;
10408 void * userdata; /* a pointer to the userdata */
10409 int n_userdata;
10410 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10411 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010412
Daniel Veillard42595322004-11-08 10:52:06 +000010413 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10414 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10415 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10416 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10417 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10418 mem_base = xmlMemBlocks();
10419 table = gen_xmlHashTablePtr(n_table, 0);
10420 name = gen_const_xmlChar_ptr(n_name, 1);
10421 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10422 userdata = gen_userdata(n_userdata, 3);
10423 f = gen_xmlHashDeallocator(n_f, 4);
10424
10425 ret_val = xmlHashUpdateEntry2(table, name, name2, userdata, f);
10426 desret_int(ret_val);
10427 call_tests++;
10428 des_xmlHashTablePtr(n_table, table, 0);
10429 des_const_xmlChar_ptr(n_name, name, 1);
10430 des_const_xmlChar_ptr(n_name2, name2, 2);
10431 des_userdata(n_userdata, userdata, 3);
10432 des_xmlHashDeallocator(n_f, f, 4);
10433 xmlResetLastError();
10434 if (mem_base != xmlMemBlocks()) {
10435 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10436 xmlMemBlocks() - mem_base);
10437 test_ret++;
10438 printf(" %d", n_table);
10439 printf(" %d", n_name);
10440 printf(" %d", n_name2);
10441 printf(" %d", n_userdata);
10442 printf(" %d", n_f);
10443 printf("\n");
10444 }
10445 }
10446 }
10447 }
10448 }
10449 }
10450
10451 function_tests++;
10452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010453}
10454
10455
10456static int
10457test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010459
Daniel Veillard42595322004-11-08 10:52:06 +000010460 int mem_base;
10461 int ret_val;
10462 xmlHashTablePtr table; /* the hash table */
10463 int n_table;
10464 xmlChar * name; /* the name of the userdata */
10465 int n_name;
10466 xmlChar * name2; /* a second name of the userdata */
10467 int n_name2;
10468 xmlChar * name3; /* a third name of the userdata */
10469 int n_name3;
10470 void * userdata; /* a pointer to the userdata */
10471 int n_userdata;
10472 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10473 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010474
Daniel Veillard42595322004-11-08 10:52:06 +000010475 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10476 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10477 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10478 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10479 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10480 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10481 mem_base = xmlMemBlocks();
10482 table = gen_xmlHashTablePtr(n_table, 0);
10483 name = gen_const_xmlChar_ptr(n_name, 1);
10484 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10485 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10486 userdata = gen_userdata(n_userdata, 4);
10487 f = gen_xmlHashDeallocator(n_f, 5);
10488
10489 ret_val = xmlHashUpdateEntry3(table, name, name2, name3, userdata, f);
10490 desret_int(ret_val);
10491 call_tests++;
10492 des_xmlHashTablePtr(n_table, table, 0);
10493 des_const_xmlChar_ptr(n_name, name, 1);
10494 des_const_xmlChar_ptr(n_name2, name2, 2);
10495 des_const_xmlChar_ptr(n_name3, name3, 3);
10496 des_userdata(n_userdata, userdata, 4);
10497 des_xmlHashDeallocator(n_f, f, 5);
10498 xmlResetLastError();
10499 if (mem_base != xmlMemBlocks()) {
10500 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10501 xmlMemBlocks() - mem_base);
10502 test_ret++;
10503 printf(" %d", n_table);
10504 printf(" %d", n_name);
10505 printf(" %d", n_name2);
10506 printf(" %d", n_name3);
10507 printf(" %d", n_userdata);
10508 printf(" %d", n_f);
10509 printf("\n");
10510 }
10511 }
10512 }
10513 }
10514 }
10515 }
10516 }
10517
10518 function_tests++;
10519 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010520}
10521
10522static int
10523test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010524 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010525
Daniel Veillard42595322004-11-08 10:52:06 +000010526 printf("Testing hash : 16 of 23 functions ...\n");
10527 test_ret += test_xmlHashAddEntry();
10528 test_ret += test_xmlHashAddEntry2();
10529 test_ret += test_xmlHashAddEntry3();
10530 test_ret += test_xmlHashCopy();
10531 test_ret += test_xmlHashCreate();
10532 test_ret += test_xmlHashLookup();
10533 test_ret += test_xmlHashLookup2();
10534 test_ret += test_xmlHashLookup3();
10535 test_ret += test_xmlHashQLookup();
10536 test_ret += test_xmlHashQLookup2();
10537 test_ret += test_xmlHashQLookup3();
10538 test_ret += test_xmlHashRemoveEntry();
10539 test_ret += test_xmlHashRemoveEntry2();
10540 test_ret += test_xmlHashRemoveEntry3();
10541 test_ret += test_xmlHashScan();
10542 test_ret += test_xmlHashScan3();
10543 test_ret += test_xmlHashScanFull();
10544 test_ret += test_xmlHashScanFull3();
10545 test_ret += test_xmlHashSize();
10546 test_ret += test_xmlHashUpdateEntry();
10547 test_ret += test_xmlHashUpdateEntry2();
10548 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010549
Daniel Veillard42595322004-11-08 10:52:06 +000010550 if (test_ret != 0)
10551 printf("Module hash: %d errors\n", test_ret);
10552 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010553}
10554
Daniel Veillardce682bc2004-11-05 17:22:25 +000010555#define gen_nb_xmlLinkPtr 1
10556static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10557 return(NULL);
10558}
10559static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10560}
10561
Daniel Veillardd93f6252004-11-02 15:53:51 +000010562static int
10563test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010565
Daniel Veillardce682bc2004-11-05 17:22:25 +000010566 int mem_base;
10567 void * ret_val;
10568 xmlLinkPtr lk; /* a link */
10569 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010570
Daniel Veillardce682bc2004-11-05 17:22:25 +000010571 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10572 mem_base = xmlMemBlocks();
10573 lk = gen_xmlLinkPtr(n_lk, 0);
10574
10575 ret_val = xmlLinkGetData(lk);
10576 desret_void_ptr(ret_val);
10577 call_tests++;
10578 des_xmlLinkPtr(n_lk, lk, 0);
10579 xmlResetLastError();
10580 if (mem_base != xmlMemBlocks()) {
10581 printf("Leak of %d blocks found in xmlLinkGetData",
10582 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010583 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010584 printf(" %d", n_lk);
10585 printf("\n");
10586 }
10587 }
10588
10589 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010590 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010591}
10592
10593
10594static int
10595test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010596 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010597
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010598 int mem_base;
10599 int ret_val;
10600 xmlListPtr l; /* a list */
10601 int n_l;
10602 void * data; /* the data */
10603 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010604
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010605 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10606 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10607 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010608 l = gen_xmlListPtr(n_l, 0);
10609 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010610
10611 ret_val = xmlListAppend(l, data);
10612 desret_int(ret_val);
10613 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010614 des_xmlListPtr(n_l, l, 0);
10615 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010616 xmlResetLastError();
10617 if (mem_base != xmlMemBlocks()) {
10618 printf("Leak of %d blocks found in xmlListAppend",
10619 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010620 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010621 printf(" %d", n_l);
10622 printf(" %d", n_data);
10623 printf("\n");
10624 }
10625 }
10626 }
10627
Daniel Veillard3d97e662004-11-04 10:49:00 +000010628 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010630}
10631
10632
10633static int
10634test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010636
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010637 int mem_base;
10638 xmlListPtr l; /* a list */
10639 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010640
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010641 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10642 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010643 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010644
10645 xmlListClear(l);
10646 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010647 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010648 xmlResetLastError();
10649 if (mem_base != xmlMemBlocks()) {
10650 printf("Leak of %d blocks found in xmlListClear",
10651 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010652 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010653 printf(" %d", n_l);
10654 printf("\n");
10655 }
10656 }
10657
Daniel Veillard3d97e662004-11-04 10:49:00 +000010658 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010659 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010660}
10661
10662
Daniel Veillardce682bc2004-11-05 17:22:25 +000010663#define gen_nb_const_xmlListPtr 1
10664static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10665 return(NULL);
10666}
10667static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10668}
10669
Daniel Veillardd93f6252004-11-02 15:53:51 +000010670static int
10671test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010672 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010673
Daniel Veillardce682bc2004-11-05 17:22:25 +000010674 int mem_base;
10675 int ret_val;
10676 xmlListPtr cur; /* the new list */
10677 int n_cur;
10678 xmlListPtr old; /* the old list */
10679 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010680
Daniel Veillardce682bc2004-11-05 17:22:25 +000010681 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10682 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10683 mem_base = xmlMemBlocks();
10684 cur = gen_xmlListPtr(n_cur, 0);
10685 old = gen_const_xmlListPtr(n_old, 1);
10686
10687 ret_val = xmlListCopy(cur, old);
10688 desret_int(ret_val);
10689 call_tests++;
10690 des_xmlListPtr(n_cur, cur, 0);
10691 des_const_xmlListPtr(n_old, old, 1);
10692 xmlResetLastError();
10693 if (mem_base != xmlMemBlocks()) {
10694 printf("Leak of %d blocks found in xmlListCopy",
10695 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010696 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010697 printf(" %d", n_cur);
10698 printf(" %d", n_old);
10699 printf("\n");
10700 }
10701 }
10702 }
10703
10704 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010705 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010706}
10707
10708
10709static int
10710test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010712
10713
10714 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010715 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010716}
10717
10718
10719static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010720test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010721 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010722
10723
10724 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010725 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010726}
10727
10728
10729static int
10730test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010731 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010732
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010733 int mem_base;
10734 int ret_val;
10735 xmlListPtr l; /* a list */
10736 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010737
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010738 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10739 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010740 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010741
10742 ret_val = xmlListEmpty(l);
10743 desret_int(ret_val);
10744 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010745 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010746 xmlResetLastError();
10747 if (mem_base != xmlMemBlocks()) {
10748 printf("Leak of %d blocks found in xmlListEmpty",
10749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010750 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010751 printf(" %d", n_l);
10752 printf("\n");
10753 }
10754 }
10755
Daniel Veillard3d97e662004-11-04 10:49:00 +000010756 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010758}
10759
10760
10761static int
10762test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010764
10765
10766 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010767 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010768}
10769
10770
10771static int
10772test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010773 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010774
10775
10776 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010778}
10779
10780
10781static int
10782test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010784
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010785 int mem_base;
10786 int ret_val;
10787 xmlListPtr l; /* a list */
10788 int n_l;
10789 void * data; /* the data */
10790 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010791
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010792 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10793 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10794 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010795 l = gen_xmlListPtr(n_l, 0);
10796 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010797
10798 ret_val = xmlListInsert(l, data);
10799 desret_int(ret_val);
10800 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010801 des_xmlListPtr(n_l, l, 0);
10802 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010803 xmlResetLastError();
10804 if (mem_base != xmlMemBlocks()) {
10805 printf("Leak of %d blocks found in xmlListInsert",
10806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010807 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010808 printf(" %d", n_l);
10809 printf(" %d", n_data);
10810 printf("\n");
10811 }
10812 }
10813 }
10814
Daniel Veillard3d97e662004-11-04 10:49:00 +000010815 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010817}
10818
10819
10820static int
10821test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010822 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010823
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010824 int mem_base;
10825 xmlListPtr l1; /* the original list */
10826 int n_l1;
10827 xmlListPtr l2; /* the new list */
10828 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010829
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010830 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10831 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10832 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010833 l1 = gen_xmlListPtr(n_l1, 0);
10834 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010835
10836 xmlListMerge(l1, l2);
10837 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010838 des_xmlListPtr(n_l1, l1, 0);
10839 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010840 xmlResetLastError();
10841 if (mem_base != xmlMemBlocks()) {
10842 printf("Leak of %d blocks found in xmlListMerge",
10843 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010844 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010845 printf(" %d", n_l1);
10846 printf(" %d", n_l2);
10847 printf("\n");
10848 }
10849 }
10850 }
10851
Daniel Veillard3d97e662004-11-04 10:49:00 +000010852 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010853 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010854}
10855
10856
10857static int
10858test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010859 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010860
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010861 int mem_base;
10862 xmlListPtr l; /* a list */
10863 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010864
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010865 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10866 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010867 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010868
10869 xmlListPopBack(l);
10870 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010871 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010872 xmlResetLastError();
10873 if (mem_base != xmlMemBlocks()) {
10874 printf("Leak of %d blocks found in xmlListPopBack",
10875 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010876 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010877 printf(" %d", n_l);
10878 printf("\n");
10879 }
10880 }
10881
Daniel Veillard3d97e662004-11-04 10:49:00 +000010882 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010884}
10885
10886
10887static int
10888test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010889 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010890
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010891 int mem_base;
10892 xmlListPtr l; /* a list */
10893 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010894
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010895 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10896 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010897 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010898
10899 xmlListPopFront(l);
10900 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010901 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010902 xmlResetLastError();
10903 if (mem_base != xmlMemBlocks()) {
10904 printf("Leak of %d blocks found in xmlListPopFront",
10905 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010906 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010907 printf(" %d", n_l);
10908 printf("\n");
10909 }
10910 }
10911
Daniel Veillard3d97e662004-11-04 10:49:00 +000010912 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010913 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010914}
10915
10916
10917static int
10918test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010919 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010920
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010921 int mem_base;
10922 int ret_val;
10923 xmlListPtr l; /* a list */
10924 int n_l;
10925 void * data; /* new data */
10926 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010927
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010928 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10929 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10930 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010931 l = gen_xmlListPtr(n_l, 0);
10932 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010933
10934 ret_val = xmlListPushBack(l, data);
10935 desret_int(ret_val);
10936 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010937 des_xmlListPtr(n_l, l, 0);
10938 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010939 xmlResetLastError();
10940 if (mem_base != xmlMemBlocks()) {
10941 printf("Leak of %d blocks found in xmlListPushBack",
10942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010943 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010944 printf(" %d", n_l);
10945 printf(" %d", n_data);
10946 printf("\n");
10947 }
10948 }
10949 }
10950
Daniel Veillard3d97e662004-11-04 10:49:00 +000010951 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010952 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010953}
10954
10955
10956static int
10957test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010958 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010959
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010960 int mem_base;
10961 int ret_val;
10962 xmlListPtr l; /* a list */
10963 int n_l;
10964 void * data; /* new data */
10965 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010966
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010967 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10968 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10969 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010970 l = gen_xmlListPtr(n_l, 0);
10971 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010972
10973 ret_val = xmlListPushFront(l, data);
10974 desret_int(ret_val);
10975 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010976 des_xmlListPtr(n_l, l, 0);
10977 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010978 xmlResetLastError();
10979 if (mem_base != xmlMemBlocks()) {
10980 printf("Leak of %d blocks found in xmlListPushFront",
10981 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010982 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010983 printf(" %d", n_l);
10984 printf(" %d", n_data);
10985 printf("\n");
10986 }
10987 }
10988 }
10989
Daniel Veillard3d97e662004-11-04 10:49:00 +000010990 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000010991 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010992}
10993
10994
10995static int
10996test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010997 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010998
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010999 int mem_base;
11000 int ret_val;
11001 xmlListPtr l; /* a list */
11002 int n_l;
11003 void * data; /* list data */
11004 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011005
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011006 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11007 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11008 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011009 l = gen_xmlListPtr(n_l, 0);
11010 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011011
11012 ret_val = xmlListRemoveAll(l, data);
11013 desret_int(ret_val);
11014 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011015 des_xmlListPtr(n_l, l, 0);
11016 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011017 xmlResetLastError();
11018 if (mem_base != xmlMemBlocks()) {
11019 printf("Leak of %d blocks found in xmlListRemoveAll",
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_l);
11023 printf(" %d", n_data);
11024 printf("\n");
11025 }
11026 }
11027 }
11028
Daniel Veillard3d97e662004-11-04 10:49:00 +000011029 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011031}
11032
11033
11034static int
11035test_xmlListRemoveFirst(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 int ret_val;
11040 xmlListPtr l; /* a list */
11041 int n_l;
11042 void * data; /* list data */
11043 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011044
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011045 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11046 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11047 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011048 l = gen_xmlListPtr(n_l, 0);
11049 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011050
11051 ret_val = xmlListRemoveFirst(l, data);
11052 desret_int(ret_val);
11053 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011054 des_xmlListPtr(n_l, l, 0);
11055 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011056 xmlResetLastError();
11057 if (mem_base != xmlMemBlocks()) {
11058 printf("Leak of %d blocks found in xmlListRemoveFirst",
11059 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011060 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011061 printf(" %d", n_l);
11062 printf(" %d", n_data);
11063 printf("\n");
11064 }
11065 }
11066 }
11067
Daniel Veillard3d97e662004-11-04 10:49:00 +000011068 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011069 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011070}
11071
11072
11073static int
11074test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011075 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011076
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011077 int mem_base;
11078 int ret_val;
11079 xmlListPtr l; /* a list */
11080 int n_l;
11081 void * data; /* list data */
11082 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011083
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011084 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11085 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11086 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011087 l = gen_xmlListPtr(n_l, 0);
11088 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011089
11090 ret_val = xmlListRemoveLast(l, data);
11091 desret_int(ret_val);
11092 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011093 des_xmlListPtr(n_l, l, 0);
11094 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011095 xmlResetLastError();
11096 if (mem_base != xmlMemBlocks()) {
11097 printf("Leak of %d blocks found in xmlListRemoveLast",
11098 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011099 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011100 printf(" %d", n_l);
11101 printf(" %d", n_data);
11102 printf("\n");
11103 }
11104 }
11105 }
11106
Daniel Veillard3d97e662004-11-04 10:49:00 +000011107 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011109}
11110
11111
11112static int
11113test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011115
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011116 int mem_base;
11117 xmlListPtr l; /* a list */
11118 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011119
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011120 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11121 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011122 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011123
11124 xmlListReverse(l);
11125 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011126 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011127 xmlResetLastError();
11128 if (mem_base != xmlMemBlocks()) {
11129 printf("Leak of %d blocks found in xmlListReverse",
11130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011131 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011132 printf(" %d", n_l);
11133 printf("\n");
11134 }
11135 }
11136
Daniel Veillard3d97e662004-11-04 10:49:00 +000011137 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011139}
11140
11141
11142static int
11143test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011145
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011146 int mem_base;
11147 void * ret_val;
11148 xmlListPtr l; /* a list */
11149 int n_l;
11150 void * data; /* a search value */
11151 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011152
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011153 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11154 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11155 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011156 l = gen_xmlListPtr(n_l, 0);
11157 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011158
11159 ret_val = xmlListReverseSearch(l, data);
11160 desret_void_ptr(ret_val);
11161 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011162 des_xmlListPtr(n_l, l, 0);
11163 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011164 xmlResetLastError();
11165 if (mem_base != xmlMemBlocks()) {
11166 printf("Leak of %d blocks found in xmlListReverseSearch",
11167 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011168 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011169 printf(" %d", n_l);
11170 printf(" %d", n_data);
11171 printf("\n");
11172 }
11173 }
11174 }
11175
Daniel Veillard3d97e662004-11-04 10:49:00 +000011176 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011178}
11179
11180
11181static int
11182test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011184
11185
11186 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011187 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011188}
11189
11190
11191static int
11192test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011193 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011194
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011195 int mem_base;
11196 void * ret_val;
11197 xmlListPtr l; /* a list */
11198 int n_l;
11199 void * data; /* a search value */
11200 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011201
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011202 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11203 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11204 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011205 l = gen_xmlListPtr(n_l, 0);
11206 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011207
11208 ret_val = xmlListSearch(l, data);
11209 desret_void_ptr(ret_val);
11210 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011211 des_xmlListPtr(n_l, l, 0);
11212 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011213 xmlResetLastError();
11214 if (mem_base != xmlMemBlocks()) {
11215 printf("Leak of %d blocks found in xmlListSearch",
11216 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011217 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011218 printf(" %d", n_l);
11219 printf(" %d", n_data);
11220 printf("\n");
11221 }
11222 }
11223 }
11224
Daniel Veillard3d97e662004-11-04 10:49:00 +000011225 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011226 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011227}
11228
11229
11230static int
11231test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011232 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011233
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011234 int mem_base;
11235 int ret_val;
11236 xmlListPtr l; /* a list */
11237 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011238
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011239 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11240 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011241 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011242
11243 ret_val = xmlListSize(l);
11244 desret_int(ret_val);
11245 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011246 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011247 xmlResetLastError();
11248 if (mem_base != xmlMemBlocks()) {
11249 printf("Leak of %d blocks found in xmlListSize",
11250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011251 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011252 printf(" %d", n_l);
11253 printf("\n");
11254 }
11255 }
11256
Daniel Veillard3d97e662004-11-04 10:49:00 +000011257 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011259}
11260
11261
11262static int
11263test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011264 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011265
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011266 int mem_base;
11267 xmlListPtr l; /* a list */
11268 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011269
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011270 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11271 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011272 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011273
11274 xmlListSort(l);
11275 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011276 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011277 xmlResetLastError();
11278 if (mem_base != xmlMemBlocks()) {
11279 printf("Leak of %d blocks found in xmlListSort",
11280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011281 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011282 printf(" %d", n_l);
11283 printf("\n");
11284 }
11285 }
11286
Daniel Veillard3d97e662004-11-04 10:49:00 +000011287 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011289}
11290
11291
11292static int
11293test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011295
11296
11297 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011298 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011299}
11300
11301static int
11302test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011304
Daniel Veillardce682bc2004-11-05 17:22:25 +000011305 printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011306 test_ret += test_xmlLinkGetData();
11307 test_ret += test_xmlListAppend();
11308 test_ret += test_xmlListClear();
11309 test_ret += test_xmlListCopy();
11310 test_ret += test_xmlListCreate();
11311 test_ret += test_xmlListDup();
11312 test_ret += test_xmlListEmpty();
11313 test_ret += test_xmlListEnd();
11314 test_ret += test_xmlListFront();
11315 test_ret += test_xmlListInsert();
11316 test_ret += test_xmlListMerge();
11317 test_ret += test_xmlListPopBack();
11318 test_ret += test_xmlListPopFront();
11319 test_ret += test_xmlListPushBack();
11320 test_ret += test_xmlListPushFront();
11321 test_ret += test_xmlListRemoveAll();
11322 test_ret += test_xmlListRemoveFirst();
11323 test_ret += test_xmlListRemoveLast();
11324 test_ret += test_xmlListReverse();
11325 test_ret += test_xmlListReverseSearch();
11326 test_ret += test_xmlListReverseWalk();
11327 test_ret += test_xmlListSearch();
11328 test_ret += test_xmlListSize();
11329 test_ret += test_xmlListSort();
11330 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011331
Daniel Veillard42595322004-11-08 10:52:06 +000011332 if (test_ret != 0)
11333 printf("Module list: %d errors\n", test_ret);
11334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011335}
11336
11337static int
11338test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011340
Daniel Veillard27f20102004-11-05 11:50:11 +000011341#ifdef LIBXML_FTP_ENABLED
11342 int mem_base;
11343 int ret_val;
11344 void * ctx; /* an FTP context */
11345 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011346
Daniel Veillard27f20102004-11-05 11:50:11 +000011347 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11348 mem_base = xmlMemBlocks();
11349 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11350
11351 ret_val = xmlNanoFTPCheckResponse(ctx);
11352 desret_int(ret_val);
11353 call_tests++;
11354 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11355 xmlResetLastError();
11356 if (mem_base != xmlMemBlocks()) {
11357 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011359 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011360 printf(" %d", n_ctx);
11361 printf("\n");
11362 }
11363 }
11364#endif
11365
11366 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011368}
11369
11370
11371static int
11372test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011373 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011374
11375#ifdef LIBXML_FTP_ENABLED
11376 int mem_base;
11377
11378 mem_base = xmlMemBlocks();
11379
11380 xmlNanoFTPCleanup();
11381 call_tests++;
11382 xmlResetLastError();
11383 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011384 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011385 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011386 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011387 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011388 }
11389#endif
11390
Daniel Veillard3d97e662004-11-04 10:49:00 +000011391 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011393}
11394
11395
11396static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011397test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011399
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011400#ifdef LIBXML_FTP_ENABLED
11401 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011402 int ret_val;
11403 void * ctx; /* an FTP context */
11404 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011405
Daniel Veillard27f20102004-11-05 11:50:11 +000011406 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011407 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011408 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011409
Daniel Veillard27f20102004-11-05 11:50:11 +000011410 ret_val = xmlNanoFTPCloseConnection(ctx);
11411 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011412 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011413 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011414 xmlResetLastError();
11415 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011416 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011418 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011419 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011420 printf("\n");
11421 }
11422 }
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011423#endif
11424
Daniel Veillard3d97e662004-11-04 10:49:00 +000011425 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011426 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011427}
11428
11429
11430static int
11431test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011432 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011433
Daniel Veillard27f20102004-11-05 11:50:11 +000011434#ifdef LIBXML_FTP_ENABLED
11435 int mem_base;
11436 int ret_val;
11437 void * ctx; /* an FTP context */
11438 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011439 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011440 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011441
Daniel Veillard27f20102004-11-05 11:50:11 +000011442 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11443 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11444 mem_base = xmlMemBlocks();
11445 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11446 directory = gen_const_char_ptr(n_directory, 1);
11447
11448 ret_val = xmlNanoFTPCwd(ctx, directory);
11449 desret_int(ret_val);
11450 call_tests++;
11451 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11452 des_const_char_ptr(n_directory, directory, 1);
11453 xmlResetLastError();
11454 if (mem_base != xmlMemBlocks()) {
11455 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11456 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011457 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011458 printf(" %d", n_ctx);
11459 printf(" %d", n_directory);
11460 printf("\n");
11461 }
11462 }
11463 }
11464#endif
11465
11466 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011467 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011468}
11469
11470
11471static int
11472test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011473 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011474
Daniel Veillard27f20102004-11-05 11:50:11 +000011475#ifdef LIBXML_FTP_ENABLED
11476 int mem_base;
11477 int ret_val;
11478 void * ctx; /* an FTP context */
11479 int n_ctx;
11480 const char * file; /* a file or directory on the server */
11481 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011482
Daniel Veillard27f20102004-11-05 11:50:11 +000011483 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11484 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11485 mem_base = xmlMemBlocks();
11486 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11487 file = gen_filepath(n_file, 1);
11488
11489 ret_val = xmlNanoFTPDele(ctx, file);
11490 desret_int(ret_val);
11491 call_tests++;
11492 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11493 des_filepath(n_file, file, 1);
11494 xmlResetLastError();
11495 if (mem_base != xmlMemBlocks()) {
11496 printf("Leak of %d blocks found in xmlNanoFTPDele",
11497 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011498 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011499 printf(" %d", n_ctx);
11500 printf(" %d", n_file);
11501 printf("\n");
11502 }
11503 }
11504 }
11505#endif
11506
11507 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011508 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011509}
11510
11511
11512static int
11513test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011515
11516
11517 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011518 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011519}
11520
11521
11522static int
11523test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011524 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011525
Daniel Veillard27f20102004-11-05 11:50:11 +000011526#ifdef LIBXML_FTP_ENABLED
11527 int mem_base;
11528 int ret_val;
11529 void * ctx; /* an FTP context */
11530 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011531
Daniel Veillard27f20102004-11-05 11:50:11 +000011532 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11533 mem_base = xmlMemBlocks();
11534 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11535
11536 ret_val = xmlNanoFTPGetConnection(ctx);
11537 desret_int(ret_val);
11538 call_tests++;
11539 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11540 xmlResetLastError();
11541 if (mem_base != xmlMemBlocks()) {
11542 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11543 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011544 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011545 printf(" %d", n_ctx);
11546 printf("\n");
11547 }
11548 }
11549#endif
11550
11551 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011552 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011553}
11554
11555
11556static int
11557test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011558 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011559
Daniel Veillard27f20102004-11-05 11:50:11 +000011560#ifdef LIBXML_FTP_ENABLED
11561 int mem_base;
11562 int ret_val;
11563 void * ctx; /* an FTP context */
11564 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011565
Daniel Veillard27f20102004-11-05 11:50:11 +000011566 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11567 mem_base = xmlMemBlocks();
11568 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11569
11570 ret_val = xmlNanoFTPGetResponse(ctx);
11571 desret_int(ret_val);
11572 call_tests++;
11573 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11574 xmlResetLastError();
11575 if (mem_base != xmlMemBlocks()) {
11576 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011578 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011579 printf(" %d", n_ctx);
11580 printf("\n");
11581 }
11582 }
11583#endif
11584
11585 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011586 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011587}
11588
11589
11590static int
11591test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011593
Daniel Veillard27f20102004-11-05 11:50:11 +000011594#ifdef LIBXML_FTP_ENABLED
11595 int mem_base;
11596 int ret_val;
11597 void * ctx; /* an FTP context */
11598 int n_ctx;
11599 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11600 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011601
Daniel Veillard27f20102004-11-05 11:50:11 +000011602 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11603 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11604 mem_base = xmlMemBlocks();
11605 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11606 filename = gen_filepath(n_filename, 1);
11607
11608 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11609 desret_int(ret_val);
11610 call_tests++;
11611 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11612 des_filepath(n_filename, filename, 1);
11613 xmlResetLastError();
11614 if (mem_base != xmlMemBlocks()) {
11615 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011617 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011618 printf(" %d", n_ctx);
11619 printf(" %d", n_filename);
11620 printf("\n");
11621 }
11622 }
11623 }
11624#endif
11625
11626 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011627 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011628}
11629
11630
11631static int
11632test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011633 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011634
11635#ifdef LIBXML_FTP_ENABLED
11636 int mem_base;
11637
11638 mem_base = xmlMemBlocks();
11639
11640 xmlNanoFTPInit();
11641 call_tests++;
11642 xmlResetLastError();
11643 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011644 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011646 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011647 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011648 }
11649#endif
11650
Daniel Veillard3d97e662004-11-04 10:49:00 +000011651 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011653}
11654
11655
11656static int
11657test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011659
11660
11661 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011662 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011663}
11664
11665
11666static int
11667test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011668 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011669
11670
11671 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011672 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011673}
11674
11675
11676static int
11677test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011678 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011679
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011680#ifdef LIBXML_FTP_ENABLED
11681 int mem_base;
11682 void * ret_val;
11683 const char * URL; /* the URL to the resource */
11684 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011685
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011686 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11687 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011688 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011689
11690 ret_val = xmlNanoFTPOpen(URL);
11691 desret_void_ptr(ret_val);
11692 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011693 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011694 xmlResetLastError();
11695 if (mem_base != xmlMemBlocks()) {
11696 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11697 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011698 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011699 printf(" %d", n_URL);
11700 printf("\n");
11701 }
11702 }
11703#endif
11704
Daniel Veillard3d97e662004-11-04 10:49:00 +000011705 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011706 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011707}
11708
11709
11710static int
11711test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011712 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011713
11714#ifdef LIBXML_FTP_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000011715 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011716 int n_host;
11717 int port; /* the proxy port */
11718 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011719 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011720 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011721 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011722 int n_passwd;
11723 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11724 int n_type;
11725
11726 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11727 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11728 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11729 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11730 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011731 host = gen_const_char_ptr(n_host, 0);
11732 port = gen_int(n_port, 1);
11733 user = gen_const_char_ptr(n_user, 2);
11734 passwd = gen_const_char_ptr(n_passwd, 3);
11735 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011736
11737 xmlNanoFTPProxy(host, port, user, passwd, type);
11738 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011739 des_const_char_ptr(n_host, host, 0);
11740 des_int(n_port, port, 1);
11741 des_const_char_ptr(n_user, user, 2);
11742 des_const_char_ptr(n_passwd, passwd, 3);
11743 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011744 xmlResetLastError();
11745 }
11746 }
11747 }
11748 }
11749 }
11750#endif
11751
Daniel Veillard3d97e662004-11-04 10:49:00 +000011752 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011754}
11755
11756
11757static int
11758test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011760
Daniel Veillard27f20102004-11-05 11:50:11 +000011761#ifdef LIBXML_FTP_ENABLED
11762 int mem_base;
11763 int ret_val;
11764 void * ctx; /* an FTP context */
11765 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011766
Daniel Veillard27f20102004-11-05 11:50:11 +000011767 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11768 mem_base = xmlMemBlocks();
11769 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11770
11771 ret_val = xmlNanoFTPQuit(ctx);
11772 desret_int(ret_val);
11773 call_tests++;
11774 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11775 xmlResetLastError();
11776 if (mem_base != xmlMemBlocks()) {
11777 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011779 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011780 printf(" %d", n_ctx);
11781 printf("\n");
11782 }
11783 }
11784#endif
11785
11786 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011788}
11789
11790
11791static int
11792test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011794
Daniel Veillard27f20102004-11-05 11:50:11 +000011795#ifdef LIBXML_FTP_ENABLED
11796 int mem_base;
11797 int ret_val;
11798 void * ctx; /* the FTP context */
11799 int n_ctx;
11800 void * dest; /* a buffer */
11801 int n_dest;
11802 int len; /* the buffer length */
11803 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011804
Daniel Veillard27f20102004-11-05 11:50:11 +000011805 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11806 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11807 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11808 mem_base = xmlMemBlocks();
11809 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11810 dest = gen_void_ptr(n_dest, 1);
11811 len = gen_int(n_len, 2);
11812
11813 ret_val = xmlNanoFTPRead(ctx, dest, len);
11814 desret_int(ret_val);
11815 call_tests++;
11816 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11817 des_void_ptr(n_dest, dest, 1);
11818 des_int(n_len, len, 2);
11819 xmlResetLastError();
11820 if (mem_base != xmlMemBlocks()) {
11821 printf("Leak of %d blocks found in xmlNanoFTPRead",
11822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011823 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011824 printf(" %d", n_ctx);
11825 printf(" %d", n_dest);
11826 printf(" %d", n_len);
11827 printf("\n");
11828 }
11829 }
11830 }
11831 }
11832#endif
11833
11834 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011835 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011836}
11837
11838
11839static int
11840test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011841 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011842
11843#ifdef LIBXML_FTP_ENABLED
11844 const char * URL; /* The proxy URL used to initialize the proxy context */
11845 int n_URL;
11846
11847 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011848 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011849
11850 xmlNanoFTPScanProxy(URL);
11851 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011852 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011853 xmlResetLastError();
11854 }
11855#endif
11856
Daniel Veillard3d97e662004-11-04 10:49:00 +000011857 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011858 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011859}
11860
11861
11862static int
11863test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011864 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011865
Daniel Veillard27f20102004-11-05 11:50:11 +000011866#ifdef LIBXML_FTP_ENABLED
11867 int mem_base;
11868 int ret_val;
11869 void * ctx; /* an FTP context */
11870 int n_ctx;
11871 const char * URL; /* The URL used to update the context */
11872 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011873
Daniel Veillard27f20102004-11-05 11:50:11 +000011874 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11875 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11876 mem_base = xmlMemBlocks();
11877 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11878 URL = gen_filepath(n_URL, 1);
11879
11880 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
11881 desret_int(ret_val);
11882 call_tests++;
11883 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11884 des_filepath(n_URL, URL, 1);
11885 xmlResetLastError();
11886 if (mem_base != xmlMemBlocks()) {
11887 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
11888 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011889 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011890 printf(" %d", n_ctx);
11891 printf(" %d", n_URL);
11892 printf("\n");
11893 }
11894 }
11895 }
11896#endif
11897
11898 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011899 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011900}
11901
11902static int
11903test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011905
Daniel Veillard27f20102004-11-05 11:50:11 +000011906 printf("Testing nanoftp : 15 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011907 test_ret += test_xmlNanoFTPCheckResponse();
11908 test_ret += test_xmlNanoFTPCleanup();
11909 test_ret += test_xmlNanoFTPCloseConnection();
11910 test_ret += test_xmlNanoFTPCwd();
11911 test_ret += test_xmlNanoFTPDele();
11912 test_ret += test_xmlNanoFTPGet();
11913 test_ret += test_xmlNanoFTPGetConnection();
11914 test_ret += test_xmlNanoFTPGetResponse();
11915 test_ret += test_xmlNanoFTPGetSocket();
11916 test_ret += test_xmlNanoFTPInit();
11917 test_ret += test_xmlNanoFTPList();
11918 test_ret += test_xmlNanoFTPNewCtxt();
11919 test_ret += test_xmlNanoFTPOpen();
11920 test_ret += test_xmlNanoFTPProxy();
11921 test_ret += test_xmlNanoFTPQuit();
11922 test_ret += test_xmlNanoFTPRead();
11923 test_ret += test_xmlNanoFTPScanProxy();
11924 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011925
Daniel Veillard42595322004-11-08 10:52:06 +000011926 if (test_ret != 0)
11927 printf("Module nanoftp: %d errors\n", test_ret);
11928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011929}
11930
11931static int
11932test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011933 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011934
Daniel Veillard27f20102004-11-05 11:50:11 +000011935#ifdef LIBXML_HTTP_ENABLED
11936 int mem_base;
11937 const char * ret_val;
11938 void * ctx; /* the HTTP context */
11939 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011940
Daniel Veillard27f20102004-11-05 11:50:11 +000011941 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11942 mem_base = xmlMemBlocks();
11943 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11944
11945 ret_val = xmlNanoHTTPAuthHeader(ctx);
11946 desret_const_char_ptr(ret_val);
11947 call_tests++;
11948 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11949 xmlResetLastError();
11950 if (mem_base != xmlMemBlocks()) {
11951 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
11952 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011953 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011954 printf(" %d", n_ctx);
11955 printf("\n");
11956 }
11957 }
11958#endif
11959
11960 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011961 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011962}
11963
11964
11965static int
11966test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011967 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011968
11969#ifdef LIBXML_HTTP_ENABLED
11970 int mem_base;
11971
11972 mem_base = xmlMemBlocks();
11973
11974 xmlNanoHTTPCleanup();
11975 call_tests++;
11976 xmlResetLastError();
11977 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011978 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011980 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011981 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011982 }
11983#endif
11984
Daniel Veillard3d97e662004-11-04 10:49:00 +000011985 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000011986 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011987}
11988
11989
11990static int
11991test_xmlNanoHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011992 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011993
Daniel Veillard27f20102004-11-05 11:50:11 +000011994#ifdef LIBXML_HTTP_ENABLED
11995 int mem_base;
11996 void * ctx; /* the HTTP context */
11997 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011998
Daniel Veillard27f20102004-11-05 11:50:11 +000011999 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12000 mem_base = xmlMemBlocks();
12001 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12002
12003 xmlNanoHTTPClose(ctx);
12004 call_tests++;
12005 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12006 xmlResetLastError();
12007 if (mem_base != xmlMemBlocks()) {
12008 printf("Leak of %d blocks found in xmlNanoHTTPClose",
12009 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012010 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012011 printf(" %d", n_ctx);
12012 printf("\n");
12013 }
12014 }
12015#endif
12016
12017 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012019}
12020
12021
12022static int
12023test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012024 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012025
Daniel Veillard27f20102004-11-05 11:50:11 +000012026#ifdef LIBXML_HTTP_ENABLED
12027 int mem_base;
12028 int ret_val;
12029 void * ctx; /* the HTTP context */
12030 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012031
Daniel Veillard27f20102004-11-05 11:50:11 +000012032 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12033 mem_base = xmlMemBlocks();
12034 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12035
12036 ret_val = xmlNanoHTTPContentLength(ctx);
12037 desret_int(ret_val);
12038 call_tests++;
12039 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12040 xmlResetLastError();
12041 if (mem_base != xmlMemBlocks()) {
12042 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
12043 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012044 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012045 printf(" %d", n_ctx);
12046 printf("\n");
12047 }
12048 }
12049#endif
12050
12051 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012053}
12054
12055
12056static int
12057test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012058 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012059
Daniel Veillard27f20102004-11-05 11:50:11 +000012060#ifdef LIBXML_HTTP_ENABLED
12061 int mem_base;
12062 const char * ret_val;
12063 void * ctx; /* the HTTP context */
12064 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012065
Daniel Veillard27f20102004-11-05 11:50:11 +000012066 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12067 mem_base = xmlMemBlocks();
12068 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12069
12070 ret_val = xmlNanoHTTPEncoding(ctx);
12071 desret_const_char_ptr(ret_val);
12072 call_tests++;
12073 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12074 xmlResetLastError();
12075 if (mem_base != xmlMemBlocks()) {
12076 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
12077 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012078 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012079 printf(" %d", n_ctx);
12080 printf("\n");
12081 }
12082 }
12083#endif
12084
12085 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012086 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012087}
12088
12089
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012090#define gen_nb_char_ptr_ptr 1
12091static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12092 return(NULL);
12093}
12094static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12095}
12096
Daniel Veillardd93f6252004-11-02 15:53:51 +000012097static int
12098test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012099 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012100
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012101#ifdef LIBXML_HTTP_ENABLED
12102 int mem_base;
12103 int ret_val;
12104 const char * URL; /* The URL to load */
12105 int n_URL;
12106 const char * filename; /* the filename where the content should be saved */
12107 int n_filename;
12108 char ** contentType; /* if available the Content-Type information will be returned at that location */
12109 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012110
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012111 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12112 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12113 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12114 mem_base = xmlMemBlocks();
12115 URL = gen_filepath(n_URL, 0);
12116 filename = gen_filepath(n_filename, 1);
12117 contentType = gen_char_ptr_ptr(n_contentType, 2);
12118
12119 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
12120 desret_int(ret_val);
12121 call_tests++;
12122 des_filepath(n_URL, URL, 0);
12123 des_filepath(n_filename, filename, 1);
12124 des_char_ptr_ptr(n_contentType, contentType, 2);
12125 xmlResetLastError();
12126 if (mem_base != xmlMemBlocks()) {
12127 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
12128 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012129 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012130 printf(" %d", n_URL);
12131 printf(" %d", n_filename);
12132 printf(" %d", n_contentType);
12133 printf("\n");
12134 }
12135 }
12136 }
12137 }
12138#endif
12139
12140 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012141 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012142}
12143
12144
12145static int
12146test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012147 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012148
12149#ifdef LIBXML_HTTP_ENABLED
12150 int mem_base;
12151
12152 mem_base = xmlMemBlocks();
12153
12154 xmlNanoHTTPInit();
12155 call_tests++;
12156 xmlResetLastError();
12157 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012158 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012159 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012160 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012161 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012162 }
12163#endif
12164
Daniel Veillard3d97e662004-11-04 10:49:00 +000012165 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012167}
12168
12169
12170static int
12171test_xmlNanoHTTPMethod(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012173
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012174#ifdef LIBXML_HTTP_ENABLED
12175 int mem_base;
12176 void * ret_val;
12177 const char * URL; /* The URL to load */
12178 int n_URL;
12179 char * method; /* the HTTP method to use */
12180 int n_method;
12181 char * input; /* the input string if any */
12182 int n_input;
12183 char ** contentType; /* the Content-Type information IN and OUT */
12184 int n_contentType;
12185 char * headers; /* the extra headers */
12186 int n_headers;
12187 int ilen; /* input length */
12188 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012189
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012190 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12191 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12192 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12193 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12194 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12195 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12196 mem_base = xmlMemBlocks();
12197 URL = gen_filepath(n_URL, 0);
12198 method = gen_const_char_ptr(n_method, 1);
12199 input = gen_const_char_ptr(n_input, 2);
12200 contentType = gen_char_ptr_ptr(n_contentType, 3);
12201 headers = gen_const_char_ptr(n_headers, 4);
12202 ilen = gen_int(n_ilen, 5);
12203
12204 ret_val = xmlNanoHTTPMethod(URL, method, input, contentType, headers, ilen);
12205 desret_void_ptr(ret_val);
12206 call_tests++;
12207 des_filepath(n_URL, URL, 0);
12208 des_const_char_ptr(n_method, method, 1);
12209 des_const_char_ptr(n_input, input, 2);
12210 des_char_ptr_ptr(n_contentType, contentType, 3);
12211 des_const_char_ptr(n_headers, headers, 4);
12212 des_int(n_ilen, ilen, 5);
12213 xmlResetLastError();
12214 if (mem_base != xmlMemBlocks()) {
12215 printf("Leak of %d blocks found in xmlNanoHTTPMethod",
12216 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012217 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012218 printf(" %d", n_URL);
12219 printf(" %d", n_method);
12220 printf(" %d", n_input);
12221 printf(" %d", n_contentType);
12222 printf(" %d", n_headers);
12223 printf(" %d", n_ilen);
12224 printf("\n");
12225 }
12226 }
12227 }
12228 }
12229 }
12230 }
12231 }
12232#endif
12233
12234 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012236}
12237
12238
12239static int
12240test_xmlNanoHTTPMethodRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012242
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012243#ifdef LIBXML_HTTP_ENABLED
12244 int mem_base;
12245 void * ret_val;
12246 const char * URL; /* The URL to load */
12247 int n_URL;
12248 char * method; /* the HTTP method to use */
12249 int n_method;
12250 char * input; /* the input string if any */
12251 int n_input;
12252 char ** contentType; /* the Content-Type information IN and OUT */
12253 int n_contentType;
12254 char ** redir; /* the redirected URL OUT */
12255 int n_redir;
12256 char * headers; /* the extra headers */
12257 int n_headers;
12258 int ilen; /* input length */
12259 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012260
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012261 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12262 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12263 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12264 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12265 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12266 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12267 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12268 mem_base = xmlMemBlocks();
12269 URL = gen_filepath(n_URL, 0);
12270 method = gen_const_char_ptr(n_method, 1);
12271 input = gen_const_char_ptr(n_input, 2);
12272 contentType = gen_char_ptr_ptr(n_contentType, 3);
12273 redir = gen_char_ptr_ptr(n_redir, 4);
12274 headers = gen_const_char_ptr(n_headers, 5);
12275 ilen = gen_int(n_ilen, 6);
12276
12277 ret_val = xmlNanoHTTPMethodRedir(URL, method, input, contentType, redir, headers, ilen);
12278 desret_void_ptr(ret_val);
12279 call_tests++;
12280 des_filepath(n_URL, URL, 0);
12281 des_const_char_ptr(n_method, method, 1);
12282 des_const_char_ptr(n_input, input, 2);
12283 des_char_ptr_ptr(n_contentType, contentType, 3);
12284 des_char_ptr_ptr(n_redir, redir, 4);
12285 des_const_char_ptr(n_headers, headers, 5);
12286 des_int(n_ilen, ilen, 6);
12287 xmlResetLastError();
12288 if (mem_base != xmlMemBlocks()) {
12289 printf("Leak of %d blocks found in xmlNanoHTTPMethodRedir",
12290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012291 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012292 printf(" %d", n_URL);
12293 printf(" %d", n_method);
12294 printf(" %d", n_input);
12295 printf(" %d", n_contentType);
12296 printf(" %d", n_redir);
12297 printf(" %d", n_headers);
12298 printf(" %d", n_ilen);
12299 printf("\n");
12300 }
12301 }
12302 }
12303 }
12304 }
12305 }
12306 }
12307 }
12308#endif
12309
12310 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012312}
12313
12314
12315static int
12316test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012318
Daniel Veillard27f20102004-11-05 11:50:11 +000012319#ifdef LIBXML_HTTP_ENABLED
12320 int mem_base;
12321 const char * ret_val;
12322 void * ctx; /* the HTTP context */
12323 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012324
Daniel Veillard27f20102004-11-05 11:50:11 +000012325 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12326 mem_base = xmlMemBlocks();
12327 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12328
12329 ret_val = xmlNanoHTTPMimeType(ctx);
12330 desret_const_char_ptr(ret_val);
12331 call_tests++;
12332 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12333 xmlResetLastError();
12334 if (mem_base != xmlMemBlocks()) {
12335 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012337 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012338 printf(" %d", n_ctx);
12339 printf("\n");
12340 }
12341 }
12342#endif
12343
12344 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012346}
12347
12348
12349static int
12350test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012351 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012352
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012353#ifdef LIBXML_HTTP_ENABLED
12354 int mem_base;
12355 void * ret_val;
12356 const char * URL; /* The URL to load */
12357 int n_URL;
12358 char ** contentType; /* if available the Content-Type information will be returned at that location */
12359 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012360
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012361 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12362 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12363 mem_base = xmlMemBlocks();
12364 URL = gen_filepath(n_URL, 0);
12365 contentType = gen_char_ptr_ptr(n_contentType, 1);
12366
12367 ret_val = xmlNanoHTTPOpen(URL, contentType);
12368 desret_void_ptr(ret_val);
12369 call_tests++;
12370 des_filepath(n_URL, URL, 0);
12371 des_char_ptr_ptr(n_contentType, contentType, 1);
12372 xmlResetLastError();
12373 if (mem_base != xmlMemBlocks()) {
12374 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12375 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012376 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012377 printf(" %d", n_URL);
12378 printf(" %d", n_contentType);
12379 printf("\n");
12380 }
12381 }
12382 }
12383#endif
12384
12385 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012386 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012387}
12388
12389
12390static int
12391test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012392 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012393
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012394#ifdef LIBXML_HTTP_ENABLED
12395 int mem_base;
12396 void * ret_val;
12397 const char * URL; /* The URL to load */
12398 int n_URL;
12399 char ** contentType; /* if available the Content-Type information will be returned at that location */
12400 int n_contentType;
12401 char ** redir; /* if available the redirected URL will be returned */
12402 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012403
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012404 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12405 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12406 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12407 mem_base = xmlMemBlocks();
12408 URL = gen_filepath(n_URL, 0);
12409 contentType = gen_char_ptr_ptr(n_contentType, 1);
12410 redir = gen_char_ptr_ptr(n_redir, 2);
12411
12412 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
12413 desret_void_ptr(ret_val);
12414 call_tests++;
12415 des_filepath(n_URL, URL, 0);
12416 des_char_ptr_ptr(n_contentType, contentType, 1);
12417 des_char_ptr_ptr(n_redir, redir, 2);
12418 xmlResetLastError();
12419 if (mem_base != xmlMemBlocks()) {
12420 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12421 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012422 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012423 printf(" %d", n_URL);
12424 printf(" %d", n_contentType);
12425 printf(" %d", n_redir);
12426 printf("\n");
12427 }
12428 }
12429 }
12430 }
12431#endif
12432
12433 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012435}
12436
12437
12438static int
12439test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012441
Daniel Veillard27f20102004-11-05 11:50:11 +000012442#ifdef LIBXML_HTTP_ENABLED
12443 int mem_base;
12444 int ret_val;
12445 void * ctx; /* the HTTP context */
12446 int n_ctx;
12447 void * dest; /* a buffer */
12448 int n_dest;
12449 int len; /* the buffer length */
12450 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012451
Daniel Veillard27f20102004-11-05 11:50:11 +000012452 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12453 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12454 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12455 mem_base = xmlMemBlocks();
12456 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12457 dest = gen_void_ptr(n_dest, 1);
12458 len = gen_int(n_len, 2);
12459
12460 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12461 desret_int(ret_val);
12462 call_tests++;
12463 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12464 des_void_ptr(n_dest, dest, 1);
12465 des_int(n_len, len, 2);
12466 xmlResetLastError();
12467 if (mem_base != xmlMemBlocks()) {
12468 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12469 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012470 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012471 printf(" %d", n_ctx);
12472 printf(" %d", n_dest);
12473 printf(" %d", n_len);
12474 printf("\n");
12475 }
12476 }
12477 }
12478 }
12479#endif
12480
12481 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012483}
12484
12485
12486static int
12487test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012489
12490
12491 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012493}
12494
12495
12496static int
12497test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012499
Daniel Veillard27f20102004-11-05 11:50:11 +000012500#ifdef LIBXML_HTTP_ENABLED
12501 int mem_base;
12502 int ret_val;
12503 void * ctx; /* the HTTP context */
12504 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012505
Daniel Veillard27f20102004-11-05 11:50:11 +000012506 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12507 mem_base = xmlMemBlocks();
12508 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12509
12510 ret_val = xmlNanoHTTPReturnCode(ctx);
12511 desret_int(ret_val);
12512 call_tests++;
12513 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12514 xmlResetLastError();
12515 if (mem_base != xmlMemBlocks()) {
12516 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12517 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012518 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012519 printf(" %d", n_ctx);
12520 printf("\n");
12521 }
12522 }
12523#endif
12524
12525 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012527}
12528
12529
12530static int
12531test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012533
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012534#ifdef LIBXML_HTTP_ENABLED
12535#ifdef LIBXML_OUTPUT_ENABLED
12536 int mem_base;
12537 int ret_val;
12538 void * ctxt; /* the HTTP context */
12539 int n_ctxt;
12540 const char * filename; /* the filename where the content should be saved */
12541 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012542
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012543 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12544 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12545 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012546 ctxt = gen_void_ptr(n_ctxt, 0);
12547 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012548
12549 ret_val = xmlNanoHTTPSave(ctxt, filename);
12550 desret_int(ret_val);
12551 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012552 des_void_ptr(n_ctxt, ctxt, 0);
12553 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012554 xmlResetLastError();
12555 if (mem_base != xmlMemBlocks()) {
12556 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012558 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012559 printf(" %d", n_ctxt);
12560 printf(" %d", n_filename);
12561 printf("\n");
12562 }
12563 }
12564 }
12565#endif
12566#endif
12567
Daniel Veillard3d97e662004-11-04 10:49:00 +000012568 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012570}
12571
12572
12573static int
12574test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012576
12577#ifdef LIBXML_HTTP_ENABLED
12578 const char * URL; /* The proxy URL used to initialize the proxy context */
12579 int n_URL;
12580
12581 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012582 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012583
12584 xmlNanoHTTPScanProxy(URL);
12585 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012586 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012587 xmlResetLastError();
12588 }
12589#endif
12590
Daniel Veillard3d97e662004-11-04 10:49:00 +000012591 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012593}
12594
12595static int
12596test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012597 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012598
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012599 printf("Testing nanohttp : 16 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012600 test_ret += test_xmlNanoHTTPAuthHeader();
12601 test_ret += test_xmlNanoHTTPCleanup();
12602 test_ret += test_xmlNanoHTTPClose();
12603 test_ret += test_xmlNanoHTTPContentLength();
12604 test_ret += test_xmlNanoHTTPEncoding();
12605 test_ret += test_xmlNanoHTTPFetch();
12606 test_ret += test_xmlNanoHTTPInit();
12607 test_ret += test_xmlNanoHTTPMethod();
12608 test_ret += test_xmlNanoHTTPMethodRedir();
12609 test_ret += test_xmlNanoHTTPMimeType();
12610 test_ret += test_xmlNanoHTTPOpen();
12611 test_ret += test_xmlNanoHTTPOpenRedir();
12612 test_ret += test_xmlNanoHTTPRead();
12613 test_ret += test_xmlNanoHTTPRedir();
12614 test_ret += test_xmlNanoHTTPReturnCode();
12615 test_ret += test_xmlNanoHTTPSave();
12616 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012617
Daniel Veillard42595322004-11-08 10:52:06 +000012618 if (test_ret != 0)
12619 printf("Module nanohttp: %d errors\n", test_ret);
12620 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012621}
12622
12623static int
12624test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012626
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012627 int mem_base;
12628 long ret_val;
12629 xmlParserCtxtPtr ctxt; /* an XML parser context */
12630 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012631
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012632 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12633 mem_base = xmlMemBlocks();
12634 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12635
12636 ret_val = xmlByteConsumed(ctxt);
12637 desret_long(ret_val);
12638 call_tests++;
12639 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12640 xmlResetLastError();
12641 if (mem_base != xmlMemBlocks()) {
12642 printf("Leak of %d blocks found in xmlByteConsumed",
12643 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012644 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012645 printf(" %d", n_ctxt);
12646 printf("\n");
12647 }
12648 }
12649
12650 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012652}
12653
12654
Daniel Veillardce682bc2004-11-05 17:22:25 +000012655#define gen_nb_xmlParserNodeInfoSeqPtr 1
12656static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12657 return(NULL);
12658}
12659static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12660}
12661
Daniel Veillardd93f6252004-11-02 15:53:51 +000012662static int
12663test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012665
Daniel Veillardce682bc2004-11-05 17:22:25 +000012666 int mem_base;
12667 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12668 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012669
Daniel Veillardce682bc2004-11-05 17:22:25 +000012670 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12671 mem_base = xmlMemBlocks();
12672 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12673
12674 xmlClearNodeInfoSeq(seq);
12675 call_tests++;
12676 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12677 xmlResetLastError();
12678 if (mem_base != xmlMemBlocks()) {
12679 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012681 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012682 printf(" %d", n_seq);
12683 printf("\n");
12684 }
12685 }
12686
12687 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012689}
12690
12691
12692static int
12693test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012695
12696 int mem_base;
12697 xmlParserCtxtPtr ctxt; /* an XML parser context */
12698 int n_ctxt;
12699
12700 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12701 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012702 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012703
12704 xmlClearParserCtxt(ctxt);
12705 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012706 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012707 xmlResetLastError();
12708 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012709 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012711 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012712 printf(" %d", n_ctxt);
12713 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012714 }
12715 }
12716
Daniel Veillard3d97e662004-11-04 10:49:00 +000012717 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012718 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012719}
12720
12721
12722static int
12723test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012725
Daniel Veillard34099b42004-11-04 17:34:35 +000012726 int mem_base;
12727 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012728 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012729 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012730
Daniel Veillard34099b42004-11-04 17:34:35 +000012731 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12732 mem_base = xmlMemBlocks();
12733 cur = gen_const_xmlChar_ptr(n_cur, 0);
12734
12735 ret_val = xmlCreateDocParserCtxt(cur);
12736 desret_xmlParserCtxtPtr(ret_val);
12737 call_tests++;
12738 des_const_xmlChar_ptr(n_cur, cur, 0);
12739 xmlResetLastError();
12740 if (mem_base != xmlMemBlocks()) {
12741 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012743 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012744 printf(" %d", n_cur);
12745 printf("\n");
12746 }
12747 }
12748
12749 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012751}
12752
12753
12754static int
12755test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012757
Daniel Veillard34099b42004-11-04 17:34:35 +000012758#ifdef LIBXML_PUSH_ENABLED
12759 int mem_base;
12760 xmlParserCtxtPtr ret_val;
12761 xmlSAXHandlerPtr sax; /* a SAX handler */
12762 int n_sax;
12763 void * user_data; /* The user data returned on SAX callbacks */
12764 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012765 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012766 int n_chunk;
12767 int size; /* number of chars in the array */
12768 int n_size;
12769 const char * filename; /* an optional file name or URI */
12770 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012771
Daniel Veillard34099b42004-11-04 17:34:35 +000012772 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12773 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12774 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12775 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012776 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012777 mem_base = xmlMemBlocks();
12778 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12779 user_data = gen_userdata(n_user_data, 1);
12780 chunk = gen_const_char_ptr(n_chunk, 2);
12781 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012782 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012783
12784 ret_val = xmlCreatePushParserCtxt(sax, user_data, chunk, size, filename);
12785 desret_xmlParserCtxtPtr(ret_val);
12786 call_tests++;
12787 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12788 des_userdata(n_user_data, user_data, 1);
12789 des_const_char_ptr(n_chunk, chunk, 2);
12790 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012791 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012792 xmlResetLastError();
12793 if (mem_base != xmlMemBlocks()) {
12794 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12795 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012796 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012797 printf(" %d", n_sax);
12798 printf(" %d", n_user_data);
12799 printf(" %d", n_chunk);
12800 printf(" %d", n_size);
12801 printf(" %d", n_filename);
12802 printf("\n");
12803 }
12804 }
12805 }
12806 }
12807 }
12808 }
12809#endif
12810
12811 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012813}
12814
12815
12816static int
12817test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012819
12820 int mem_base;
12821 xmlDocPtr ret_val;
12822 xmlParserCtxtPtr ctxt; /* an XML parser context */
12823 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012824 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012825 int n_cur;
12826 const char * URL; /* the base URL to use for the document */
12827 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012828 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012829 int n_encoding;
12830 int options; /* a combination of xmlParserOption */
12831 int n_options;
12832
12833 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12834 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12835 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12836 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012837 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012838 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012839 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12840 cur = gen_const_xmlChar_ptr(n_cur, 1);
12841 URL = gen_filepath(n_URL, 2);
12842 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012843 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012844
12845 ret_val = xmlCtxtReadDoc(ctxt, cur, URL, encoding, options);
12846 desret_xmlDocPtr(ret_val);
12847 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012848 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12849 des_const_xmlChar_ptr(n_cur, cur, 1);
12850 des_filepath(n_URL, URL, 2);
12851 des_const_char_ptr(n_encoding, encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012852 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012853 xmlResetLastError();
12854 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012855 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012857 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012858 printf(" %d", n_ctxt);
12859 printf(" %d", n_cur);
12860 printf(" %d", n_URL);
12861 printf(" %d", n_encoding);
12862 printf(" %d", n_options);
12863 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012864 }
12865 }
12866 }
12867 }
12868 }
12869 }
12870
Daniel Veillard3d97e662004-11-04 10:49:00 +000012871 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012872 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012873}
12874
12875
12876static int
12877test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012878 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012879
12880 int mem_base;
12881 xmlDocPtr ret_val;
12882 xmlParserCtxtPtr ctxt; /* an XML parser context */
12883 int n_ctxt;
12884 const char * filename; /* a file or URL */
12885 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012886 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012887 int n_encoding;
12888 int options; /* a combination of xmlParserOption */
12889 int n_options;
12890
12891 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12892 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12893 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012894 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012895 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012896 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12897 filename = gen_filepath(n_filename, 1);
12898 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012899 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012900
12901 ret_val = xmlCtxtReadFile(ctxt, filename, encoding, options);
12902 desret_xmlDocPtr(ret_val);
12903 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012904 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12905 des_filepath(n_filename, filename, 1);
12906 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012907 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012908 xmlResetLastError();
12909 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012910 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012911 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012912 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012913 printf(" %d", n_ctxt);
12914 printf(" %d", n_filename);
12915 printf(" %d", n_encoding);
12916 printf(" %d", n_options);
12917 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012918 }
12919 }
12920 }
12921 }
12922 }
12923
Daniel Veillard3d97e662004-11-04 10:49:00 +000012924 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012925 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012926}
12927
12928
12929static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012930test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012931 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012932
12933 int mem_base;
12934 xmlDocPtr ret_val;
12935 xmlParserCtxtPtr ctxt; /* an XML parser context */
12936 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012937 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012938 int n_buffer;
12939 int size; /* the size of the array */
12940 int n_size;
12941 const char * URL; /* the base URL to use for the document */
12942 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012943 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012944 int n_encoding;
12945 int options; /* a combination of xmlParserOption */
12946 int n_options;
12947
12948 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12949 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12950 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12951 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12952 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012953 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012954 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012955 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12956 buffer = gen_const_char_ptr(n_buffer, 1);
12957 size = gen_int(n_size, 2);
12958 URL = gen_filepath(n_URL, 3);
12959 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012960 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012961
12962 ret_val = xmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options);
12963 desret_xmlDocPtr(ret_val);
12964 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012965 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12966 des_const_char_ptr(n_buffer, buffer, 1);
12967 des_int(n_size, size, 2);
12968 des_filepath(n_URL, URL, 3);
12969 des_const_char_ptr(n_encoding, encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012970 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012971 xmlResetLastError();
12972 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012973 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012975 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012976 printf(" %d", n_ctxt);
12977 printf(" %d", n_buffer);
12978 printf(" %d", n_size);
12979 printf(" %d", n_URL);
12980 printf(" %d", n_encoding);
12981 printf(" %d", n_options);
12982 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012983 }
12984 }
12985 }
12986 }
12987 }
12988 }
12989 }
12990
Daniel Veillard3d97e662004-11-04 10:49:00 +000012991 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000012992 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012993}
12994
12995
12996static int
12997test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012998 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012999
13000 int mem_base;
13001 xmlParserCtxtPtr ctxt; /* an XML parser context */
13002 int n_ctxt;
13003
13004 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13005 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013006 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013007
13008 xmlCtxtReset(ctxt);
13009 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013010 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013011 xmlResetLastError();
13012 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013013 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013015 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013016 printf(" %d", n_ctxt);
13017 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013018 }
13019 }
13020
Daniel Veillard3d97e662004-11-04 10:49:00 +000013021 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013022 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013023}
13024
13025
13026static int
13027test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013028 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013029
13030 int mem_base;
13031 int ret_val;
13032 xmlParserCtxtPtr ctxt; /* an XML parser context */
13033 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013034 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013035 int n_chunk;
13036 int size; /* number of chars in the array */
13037 int n_size;
13038 const char * filename; /* an optional file name or URI */
13039 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013040 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013041 int n_encoding;
13042
13043 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13044 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13045 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13046 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13047 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
13048 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013049 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13050 chunk = gen_const_char_ptr(n_chunk, 1);
13051 size = gen_int(n_size, 2);
13052 filename = gen_filepath(n_filename, 3);
13053 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013054
13055 ret_val = xmlCtxtResetPush(ctxt, chunk, size, filename, encoding);
13056 desret_int(ret_val);
13057 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013058 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13059 des_const_char_ptr(n_chunk, chunk, 1);
13060 des_int(n_size, size, 2);
13061 des_filepath(n_filename, filename, 3);
13062 des_const_char_ptr(n_encoding, encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013063 xmlResetLastError();
13064 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013065 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013066 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013067 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013068 printf(" %d", n_ctxt);
13069 printf(" %d", n_chunk);
13070 printf(" %d", n_size);
13071 printf(" %d", n_filename);
13072 printf(" %d", n_encoding);
13073 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013074 }
13075 }
13076 }
13077 }
13078 }
13079 }
13080
Daniel Veillard3d97e662004-11-04 10:49:00 +000013081 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013083}
13084
13085
13086static int
13087test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013089
13090 int mem_base;
13091 int ret_val;
13092 xmlParserCtxtPtr ctxt; /* an XML parser context */
13093 int n_ctxt;
13094 int options; /* a combination of xmlParserOption */
13095 int n_options;
13096
13097 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013098 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000013099 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013100 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000013101 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013102
13103 ret_val = xmlCtxtUseOptions(ctxt, options);
13104 desret_int(ret_val);
13105 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013106 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000013107 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013108 xmlResetLastError();
13109 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013110 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013112 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013113 printf(" %d", n_ctxt);
13114 printf(" %d", n_options);
13115 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013116 }
13117 }
13118 }
13119
Daniel Veillard3d97e662004-11-04 10:49:00 +000013120 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013122}
13123
13124
13125static int
13126test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013128
13129
13130 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000013131 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013132}
13133
13134
13135static int
13136test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013137 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013138
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013139 int mem_base;
13140 int ret_val;
13141 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
13142 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013143 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013144 int n_name;
13145 void * result; /* location to store the result */
13146 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013147
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013148 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13149 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
13150 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
13151 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013152 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13153 name = gen_const_char_ptr(n_name, 1);
13154 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013155
13156 ret_val = xmlGetFeature(ctxt, name, result);
13157 desret_int(ret_val);
13158 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013159 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13160 des_const_char_ptr(n_name, name, 1);
13161 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013162 xmlResetLastError();
13163 if (mem_base != xmlMemBlocks()) {
13164 printf("Leak of %d blocks found in xmlGetFeature",
13165 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013166 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000013167 printf(" %d", n_ctxt);
13168 printf(" %d", n_name);
13169 printf(" %d", n_result);
13170 printf("\n");
13171 }
13172 }
13173 }
13174 }
13175
Daniel Veillard3d97e662004-11-04 10:49:00 +000013176 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013178}
13179
13180
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013181#define gen_nb_const_char_ptr_ptr 1
13182static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13183 return(NULL);
13184}
13185static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13186}
13187
Daniel Veillardd93f6252004-11-02 15:53:51 +000013188static int
13189test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013191
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013192 int mem_base;
13193 int ret_val;
13194 int * len; /* the length of the features name array (input/output) */
13195 int n_len;
13196 char ** result; /* an array of string to be filled with the features name. */
13197 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013198
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013199 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
13200 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
13201 mem_base = xmlMemBlocks();
13202 len = gen_int_ptr(n_len, 0);
13203 result = gen_const_char_ptr_ptr(n_result, 1);
13204
13205 ret_val = xmlGetFeaturesList(len, result);
13206 desret_int(ret_val);
13207 call_tests++;
13208 des_int_ptr(n_len, len, 0);
13209 des_const_char_ptr_ptr(n_result, result, 1);
13210 xmlResetLastError();
13211 if (mem_base != xmlMemBlocks()) {
13212 printf("Leak of %d blocks found in xmlGetFeaturesList",
13213 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013214 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013215 printf(" %d", n_len);
13216 printf(" %d", n_result);
13217 printf("\n");
13218 }
13219 }
13220 }
13221
13222 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013223 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013224}
13225
13226
13227static int
13228test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013229 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013230
Daniel Veillard34099b42004-11-04 17:34:35 +000013231 int mem_base;
13232 xmlDtdPtr ret_val;
13233 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
13234 int n_sax;
13235 xmlParserInputBufferPtr input; /* an Input Buffer */
13236 int n_input;
13237 xmlCharEncoding enc; /* the charset encoding if known */
13238 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013239
Daniel Veillard34099b42004-11-04 17:34:35 +000013240 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13241 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13242 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13243 mem_base = xmlMemBlocks();
13244 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
13245 input = gen_xmlParserInputBufferPtr(n_input, 1);
13246 enc = gen_xmlCharEncoding(n_enc, 2);
13247
13248 ret_val = xmlIOParseDTD(sax, input, enc);
13249 input = NULL;
13250 desret_xmlDtdPtr(ret_val);
13251 call_tests++;
13252 des_xmlSAXHandlerPtr(n_sax, sax, 0);
13253 des_xmlParserInputBufferPtr(n_input, input, 1);
13254 des_xmlCharEncoding(n_enc, enc, 2);
13255 xmlResetLastError();
13256 if (mem_base != xmlMemBlocks()) {
13257 printf("Leak of %d blocks found in xmlIOParseDTD",
13258 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013259 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013260 printf(" %d", n_sax);
13261 printf(" %d", n_input);
13262 printf(" %d", n_enc);
13263 printf("\n");
13264 }
13265 }
13266 }
13267 }
13268
13269 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013271}
13272
13273
13274static int
13275test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013277
Daniel Veillardce682bc2004-11-05 17:22:25 +000013278 int mem_base;
13279 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13280 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013281
Daniel Veillardce682bc2004-11-05 17:22:25 +000013282 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13283 mem_base = xmlMemBlocks();
13284 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13285
13286 xmlInitNodeInfoSeq(seq);
13287 call_tests++;
13288 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13289 xmlResetLastError();
13290 if (mem_base != xmlMemBlocks()) {
13291 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13292 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013293 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013294 printf(" %d", n_seq);
13295 printf("\n");
13296 }
13297 }
13298
13299 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013300 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013301}
13302
13303
13304static int
13305test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013307
13308 int mem_base;
13309
13310 mem_base = xmlMemBlocks();
13311
13312 xmlInitParser();
13313 call_tests++;
13314 xmlResetLastError();
13315 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013316 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013317 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013318 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013319 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013320 }
13321
Daniel Veillard3d97e662004-11-04 10:49:00 +000013322 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013324}
13325
13326
13327static int
13328test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013330
13331 int mem_base;
13332 int ret_val;
13333 xmlParserCtxtPtr ctxt; /* an XML parser context */
13334 int n_ctxt;
13335
13336 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13337 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013338 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013339
13340 ret_val = xmlInitParserCtxt(ctxt);
13341 desret_int(ret_val);
13342 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013343 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013344 xmlResetLastError();
13345 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013346 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013347 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013348 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013349 printf(" %d", n_ctxt);
13350 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013351 }
13352 }
13353
Daniel Veillard3d97e662004-11-04 10:49:00 +000013354 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013355 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013356}
13357
13358
13359static int
13360test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013361 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013362
13363 int mem_base;
13364 int ret_val;
13365 int val; /* int 0 or 1 */
13366 int n_val;
13367
13368 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13369 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013370 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013371
13372 ret_val = xmlKeepBlanksDefault(val);
13373 desret_int(ret_val);
13374 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013375 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013376 xmlResetLastError();
13377 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013378 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013380 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013381 printf(" %d", n_val);
13382 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013383 }
13384 }
13385
Daniel Veillard3d97e662004-11-04 10:49:00 +000013386 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013388}
13389
13390
13391static int
13392test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013394
13395 int mem_base;
13396 int ret_val;
13397 int val; /* int 0 or 1 */
13398 int n_val;
13399
13400 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13401 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013402 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013403
13404 ret_val = xmlLineNumbersDefault(val);
13405 desret_int(ret_val);
13406 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013407 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013408 xmlResetLastError();
13409 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013410 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013411 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013412 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013413 printf(" %d", n_val);
13414 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013415 }
13416 }
13417
Daniel Veillard3d97e662004-11-04 10:49:00 +000013418 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013420}
13421
13422
13423static int
13424test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013426
Daniel Veillard42595322004-11-08 10:52:06 +000013427 int mem_base;
13428 xmlParserInputPtr ret_val;
13429 const char * URL; /* the URL for the entity to load */
13430 int n_URL;
13431 char * ID; /* the Public ID for the entity to load */
13432 int n_ID;
13433 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13434 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013435
Daniel Veillard42595322004-11-08 10:52:06 +000013436 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13437 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13438 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13439 mem_base = xmlMemBlocks();
13440 URL = gen_filepath(n_URL, 0);
13441 ID = gen_const_char_ptr(n_ID, 1);
13442 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13443
13444 ret_val = xmlLoadExternalEntity(URL, ID, ctxt);
13445 desret_xmlParserInputPtr(ret_val);
13446 call_tests++;
13447 des_filepath(n_URL, URL, 0);
13448 des_const_char_ptr(n_ID, ID, 1);
13449 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13450 xmlResetLastError();
13451 if (mem_base != xmlMemBlocks()) {
13452 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13453 xmlMemBlocks() - mem_base);
13454 test_ret++;
13455 printf(" %d", n_URL);
13456 printf(" %d", n_ID);
13457 printf(" %d", n_ctxt);
13458 printf("\n");
13459 }
13460 }
13461 }
13462 }
13463
13464 function_tests++;
13465 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013466}
13467
13468
13469static int
13470test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013471 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013472
Daniel Veillard42595322004-11-08 10:52:06 +000013473 int mem_base;
13474 xmlParserInputPtr ret_val;
13475 xmlParserCtxtPtr ctxt; /* an XML parser context */
13476 int n_ctxt;
13477 xmlParserInputBufferPtr input; /* an I/O Input */
13478 int n_input;
13479 xmlCharEncoding enc; /* the charset encoding if known */
13480 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013481
Daniel Veillard42595322004-11-08 10:52:06 +000013482 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13483 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13484 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13485 mem_base = xmlMemBlocks();
13486 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13487 input = gen_xmlParserInputBufferPtr(n_input, 1);
13488 enc = gen_xmlCharEncoding(n_enc, 2);
13489
13490 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13491 if (ret_val != NULL) input = NULL;
13492 desret_xmlParserInputPtr(ret_val);
13493 call_tests++;
13494 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13495 des_xmlParserInputBufferPtr(n_input, input, 1);
13496 des_xmlCharEncoding(n_enc, enc, 2);
13497 xmlResetLastError();
13498 if (mem_base != xmlMemBlocks()) {
13499 printf("Leak of %d blocks found in xmlNewIOInputStream",
13500 xmlMemBlocks() - mem_base);
13501 test_ret++;
13502 printf(" %d", n_ctxt);
13503 printf(" %d", n_input);
13504 printf(" %d", n_enc);
13505 printf("\n");
13506 }
13507 }
13508 }
13509 }
13510
13511 function_tests++;
13512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013513}
13514
13515
13516static int
13517test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013519
Daniel Veillard34099b42004-11-04 17:34:35 +000013520 int mem_base;
13521 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013522
Daniel Veillard34099b42004-11-04 17:34:35 +000013523 mem_base = xmlMemBlocks();
13524
13525 ret_val = xmlNewParserCtxt();
13526 desret_xmlParserCtxtPtr(ret_val);
13527 call_tests++;
13528 xmlResetLastError();
13529 if (mem_base != xmlMemBlocks()) {
13530 printf("Leak of %d blocks found in xmlNewParserCtxt",
13531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013532 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013533 printf("\n");
13534 }
13535
13536 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013538}
13539
13540
Daniel Veillardce682bc2004-11-05 17:22:25 +000013541#define gen_nb_xmlNodePtr_ptr 1
13542static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13543 return(NULL);
13544}
13545static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13546}
13547
Daniel Veillardd93f6252004-11-02 15:53:51 +000013548static int
13549test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013551
Daniel Veillardce682bc2004-11-05 17:22:25 +000013552 int mem_base;
13553 int ret_val;
13554 xmlDocPtr doc; /* the document the chunk pertains to */
13555 int n_doc;
13556 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13557 int n_sax;
13558 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13559 int n_user_data;
13560 int depth; /* Used for loop detection, use 0 */
13561 int n_depth;
13562 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13563 int n_string;
13564 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13565 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013566
Daniel Veillardce682bc2004-11-05 17:22:25 +000013567 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13568 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13569 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13570 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13571 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13572 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13573 mem_base = xmlMemBlocks();
13574 doc = gen_xmlDocPtr(n_doc, 0);
13575 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13576 user_data = gen_userdata(n_user_data, 2);
13577 depth = gen_int(n_depth, 3);
13578 string = gen_const_xmlChar_ptr(n_string, 4);
13579 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13580 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
13581
13582 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, string, lst);
13583 desret_int(ret_val);
13584 call_tests++;
13585 des_xmlDocPtr(n_doc, doc, 0);
13586 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13587 des_userdata(n_user_data, user_data, 2);
13588 des_int(n_depth, depth, 3);
13589 des_const_xmlChar_ptr(n_string, string, 4);
13590 des_xmlNodePtr_ptr(n_lst, lst, 5);
13591 xmlResetLastError();
13592 if (mem_base != xmlMemBlocks()) {
13593 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013595 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013596 printf(" %d", n_doc);
13597 printf(" %d", n_sax);
13598 printf(" %d", n_user_data);
13599 printf(" %d", n_depth);
13600 printf(" %d", n_string);
13601 printf(" %d", n_lst);
13602 printf("\n");
13603 }
13604 }
13605 }
13606 }
13607 }
13608 }
13609 }
13610
13611 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013612 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013613}
13614
13615
13616static int
13617test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013618 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013619
Daniel Veillardce682bc2004-11-05 17:22:25 +000013620 int mem_base;
13621 int ret_val;
13622 xmlDocPtr doc; /* the document the chunk pertains to */
13623 int n_doc;
13624 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13625 int n_sax;
13626 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13627 int n_user_data;
13628 int depth; /* Used for loop detection, use 0 */
13629 int n_depth;
13630 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13631 int n_string;
13632 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13633 int n_lst;
13634 int recover; /* return nodes even if the data is broken (use 0) */
13635 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013636
Daniel Veillardce682bc2004-11-05 17:22:25 +000013637 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13638 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13639 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13640 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13641 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13642 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13643 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13644 mem_base = xmlMemBlocks();
13645 doc = gen_xmlDocPtr(n_doc, 0);
13646 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13647 user_data = gen_userdata(n_user_data, 2);
13648 depth = gen_int(n_depth, 3);
13649 string = gen_const_xmlChar_ptr(n_string, 4);
13650 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13651 recover = gen_int(n_recover, 6);
13652 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
13653
13654 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, string, lst, recover);
13655 desret_int(ret_val);
13656 call_tests++;
13657 des_xmlDocPtr(n_doc, doc, 0);
13658 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13659 des_userdata(n_user_data, user_data, 2);
13660 des_int(n_depth, depth, 3);
13661 des_const_xmlChar_ptr(n_string, string, 4);
13662 des_xmlNodePtr_ptr(n_lst, lst, 5);
13663 des_int(n_recover, recover, 6);
13664 xmlResetLastError();
13665 if (mem_base != xmlMemBlocks()) {
13666 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13667 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013668 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013669 printf(" %d", n_doc);
13670 printf(" %d", n_sax);
13671 printf(" %d", n_user_data);
13672 printf(" %d", n_depth);
13673 printf(" %d", n_string);
13674 printf(" %d", n_lst);
13675 printf(" %d", n_recover);
13676 printf("\n");
13677 }
13678 }
13679 }
13680 }
13681 }
13682 }
13683 }
13684 }
13685
13686 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013688}
13689
13690
13691static int
13692test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013693 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013694
13695#ifdef LIBXML_PUSH_ENABLED
13696 int mem_base;
13697 int ret_val;
13698 xmlParserCtxtPtr ctxt; /* an XML parser context */
13699 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013700 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013701 int n_chunk;
13702 int size; /* the size in byte of the chunk */
13703 int n_size;
13704 int terminate; /* last chunk indicator */
13705 int n_terminate;
13706
13707 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13708 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13709 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13710 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13711 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013712 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13713 chunk = gen_const_char_ptr(n_chunk, 1);
13714 size = gen_int(n_size, 2);
13715 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013716
13717 ret_val = xmlParseChunk(ctxt, chunk, size, terminate);
13718 desret_int(ret_val);
13719 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013720 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13721 des_const_char_ptr(n_chunk, chunk, 1);
13722 des_int(n_size, size, 2);
13723 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013724 xmlResetLastError();
13725 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013726 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013728 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013729 printf(" %d", n_ctxt);
13730 printf(" %d", n_chunk);
13731 printf(" %d", n_size);
13732 printf(" %d", n_terminate);
13733 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013734 }
13735 }
13736 }
13737 }
13738 }
13739#endif
13740
Daniel Veillard3d97e662004-11-04 10:49:00 +000013741 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013742 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013743}
13744
13745
13746static int
13747test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013748 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013749
Daniel Veillardce682bc2004-11-05 17:22:25 +000013750 int mem_base;
13751 int ret_val;
13752 xmlParserCtxtPtr ctx; /* the existing parsing context */
13753 int n_ctx;
13754 xmlChar * URL; /* the URL for the entity to load */
13755 int n_URL;
13756 xmlChar * ID; /* the System ID for the entity to load */
13757 int n_ID;
13758 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13759 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013760
Daniel Veillardce682bc2004-11-05 17:22:25 +000013761 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13762 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13763 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13764 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13765 mem_base = xmlMemBlocks();
13766 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13767 URL = gen_const_xmlChar_ptr(n_URL, 1);
13768 ID = gen_const_xmlChar_ptr(n_ID, 2);
13769 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13770
13771 ret_val = xmlParseCtxtExternalEntity(ctx, URL, ID, lst);
13772 desret_int(ret_val);
13773 call_tests++;
13774 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
13775 des_const_xmlChar_ptr(n_URL, URL, 1);
13776 des_const_xmlChar_ptr(n_ID, ID, 2);
13777 des_xmlNodePtr_ptr(n_lst, lst, 3);
13778 xmlResetLastError();
13779 if (mem_base != xmlMemBlocks()) {
13780 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13781 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013782 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013783 printf(" %d", n_ctx);
13784 printf(" %d", n_URL);
13785 printf(" %d", n_ID);
13786 printf(" %d", n_lst);
13787 printf("\n");
13788 }
13789 }
13790 }
13791 }
13792 }
13793
13794 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013795 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013796}
13797
13798
13799static int
13800test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013801 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013802
Daniel Veillard34099b42004-11-04 17:34:35 +000013803 int mem_base;
13804 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013805 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013806 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013807 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013808 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013809
Daniel Veillard34099b42004-11-04 17:34:35 +000013810 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13811 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13812 mem_base = xmlMemBlocks();
13813 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13814 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13815
13816 ret_val = xmlParseDTD(ExternalID, SystemID);
13817 desret_xmlDtdPtr(ret_val);
13818 call_tests++;
13819 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 0);
13820 des_const_xmlChar_ptr(n_SystemID, SystemID, 1);
13821 xmlResetLastError();
13822 if (mem_base != xmlMemBlocks()) {
13823 printf("Leak of %d blocks found in xmlParseDTD",
13824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013825 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013826 printf(" %d", n_ExternalID);
13827 printf(" %d", n_SystemID);
13828 printf("\n");
13829 }
13830 }
13831 }
13832
13833 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013834 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013835}
13836
13837
13838static int
13839test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013840 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013841
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013842 int mem_base;
13843 xmlDocPtr ret_val;
13844 xmlChar * cur; /* a pointer to an array of xmlChar */
13845 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013846
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013847 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
13848 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013849 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013850
13851 ret_val = xmlParseDoc(cur);
13852 desret_xmlDocPtr(ret_val);
13853 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013854 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013855 xmlResetLastError();
13856 if (mem_base != xmlMemBlocks()) {
13857 printf("Leak of %d blocks found in xmlParseDoc",
13858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013859 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013860 printf(" %d", n_cur);
13861 printf("\n");
13862 }
13863 }
13864
Daniel Veillard3d97e662004-11-04 10:49:00 +000013865 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013867}
13868
13869
13870static int
13871test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013872 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013873
13874 int mem_base;
13875 int ret_val;
13876 xmlParserCtxtPtr ctxt; /* an XML parser context */
13877 int n_ctxt;
13878
13879 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13880 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013881 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013882
13883 ret_val = xmlParseDocument(ctxt);
13884 desret_int(ret_val);
13885 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013886 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013887 xmlResetLastError();
13888 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013889 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013891 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013892 printf(" %d", n_ctxt);
13893 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013894 }
13895 }
13896
Daniel Veillard3d97e662004-11-04 10:49:00 +000013897 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013899}
13900
13901
13902static int
13903test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013905
13906 int mem_base;
13907 xmlDocPtr ret_val;
13908 const char * filename; /* the filename */
13909 int n_filename;
13910
13911 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13912 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013913 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013914
13915 ret_val = xmlParseEntity(filename);
13916 desret_xmlDocPtr(ret_val);
13917 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013918 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013919 xmlResetLastError();
13920 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013921 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013922 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013923 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013924 printf(" %d", n_filename);
13925 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013926 }
13927 }
13928
Daniel Veillard3d97e662004-11-04 10:49:00 +000013929 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013931}
13932
13933
13934static int
13935test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013937
13938 int mem_base;
13939 int ret_val;
13940 xmlParserCtxtPtr ctxt; /* an XML parser context */
13941 int n_ctxt;
13942
13943 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13944 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013945 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013946
13947 ret_val = xmlParseExtParsedEnt(ctxt);
13948 desret_int(ret_val);
13949 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013950 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013951 xmlResetLastError();
13952 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013953 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013954 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013955 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013956 printf(" %d", n_ctxt);
13957 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013958 }
13959 }
13960
Daniel Veillard3d97e662004-11-04 10:49:00 +000013961 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000013962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013963}
13964
13965
13966static int
13967test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013969
Daniel Veillardce682bc2004-11-05 17:22:25 +000013970 int mem_base;
13971 int ret_val;
13972 xmlDocPtr doc; /* the document the chunk pertains to */
13973 int n_doc;
13974 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13975 int n_sax;
13976 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13977 int n_user_data;
13978 int depth; /* Used for loop detection, use 0 */
13979 int n_depth;
13980 xmlChar * URL; /* the URL for the entity to load */
13981 int n_URL;
13982 xmlChar * ID; /* the System ID for the entity to load */
13983 int n_ID;
13984 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13985 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013986
Daniel Veillardce682bc2004-11-05 17:22:25 +000013987 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13988 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13989 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13990 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13991 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13992 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13993 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13994 mem_base = xmlMemBlocks();
13995 doc = gen_xmlDocPtr(n_doc, 0);
13996 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13997 user_data = gen_userdata(n_user_data, 2);
13998 depth = gen_int(n_depth, 3);
13999 URL = gen_const_xmlChar_ptr(n_URL, 4);
14000 ID = gen_const_xmlChar_ptr(n_ID, 5);
14001 lst = gen_xmlNodePtr_ptr(n_lst, 6);
14002
14003 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, URL, ID, lst);
14004 desret_int(ret_val);
14005 call_tests++;
14006 des_xmlDocPtr(n_doc, doc, 0);
14007 des_xmlSAXHandlerPtr(n_sax, sax, 1);
14008 des_userdata(n_user_data, user_data, 2);
14009 des_int(n_depth, depth, 3);
14010 des_const_xmlChar_ptr(n_URL, URL, 4);
14011 des_const_xmlChar_ptr(n_ID, ID, 5);
14012 des_xmlNodePtr_ptr(n_lst, lst, 6);
14013 xmlResetLastError();
14014 if (mem_base != xmlMemBlocks()) {
14015 printf("Leak of %d blocks found in xmlParseExternalEntity",
14016 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014017 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014018 printf(" %d", n_doc);
14019 printf(" %d", n_sax);
14020 printf(" %d", n_user_data);
14021 printf(" %d", n_depth);
14022 printf(" %d", n_URL);
14023 printf(" %d", n_ID);
14024 printf(" %d", n_lst);
14025 printf("\n");
14026 }
14027 }
14028 }
14029 }
14030 }
14031 }
14032 }
14033 }
14034
14035 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014036 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014037}
14038
14039
14040static int
14041test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014042 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014043
14044 int mem_base;
14045 xmlDocPtr ret_val;
14046 const char * filename; /* the filename */
14047 int n_filename;
14048
14049 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14050 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014051 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014052
14053 ret_val = xmlParseFile(filename);
14054 desret_xmlDocPtr(ret_val);
14055 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014056 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014057 xmlResetLastError();
14058 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014059 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014061 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014062 printf(" %d", n_filename);
14063 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014064 }
14065 }
14066
Daniel Veillard3d97e662004-11-04 10:49:00 +000014067 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014069}
14070
14071
14072static int
14073test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014075
Daniel Veillard57b25162004-11-06 14:50:18 +000014076 int mem_base;
14077 xmlParserErrors ret_val;
14078 xmlNodePtr node; /* the context node */
14079 int n_node;
14080 char * data; /* the input string */
14081 int n_data;
14082 int datalen; /* the input string length in bytes */
14083 int n_datalen;
14084 int options; /* a combination of xmlParserOption */
14085 int n_options;
14086 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
14087 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014088
Daniel Veillard57b25162004-11-06 14:50:18 +000014089 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
14090 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
14091 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014092 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000014093 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
14094 mem_base = xmlMemBlocks();
14095 node = gen_xmlNodePtr(n_node, 0);
14096 data = gen_const_char_ptr(n_data, 1);
14097 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014098 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000014099 lst = gen_xmlNodePtr_ptr(n_lst, 4);
14100
14101 ret_val = xmlParseInNodeContext(node, data, datalen, options, lst);
14102 desret_xmlParserErrors(ret_val);
14103 call_tests++;
14104 des_xmlNodePtr(n_node, node, 0);
14105 des_const_char_ptr(n_data, data, 1);
14106 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014107 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000014108 des_xmlNodePtr_ptr(n_lst, lst, 4);
14109 xmlResetLastError();
14110 if (mem_base != xmlMemBlocks()) {
14111 printf("Leak of %d blocks found in xmlParseInNodeContext",
14112 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014113 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000014114 printf(" %d", n_node);
14115 printf(" %d", n_data);
14116 printf(" %d", n_datalen);
14117 printf(" %d", n_options);
14118 printf(" %d", n_lst);
14119 printf("\n");
14120 }
14121 }
14122 }
14123 }
14124 }
14125 }
14126
14127 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014128 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014129}
14130
14131
14132static int
14133test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014134 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014135
14136 int mem_base;
14137 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014138 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014139 int n_buffer;
14140 int size; /* the size of the array */
14141 int n_size;
14142
14143 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14144 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14145 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014146 buffer = gen_const_char_ptr(n_buffer, 0);
14147 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014148
14149 ret_val = xmlParseMemory(buffer, size);
14150 desret_xmlDocPtr(ret_val);
14151 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014152 des_const_char_ptr(n_buffer, buffer, 0);
14153 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014154 xmlResetLastError();
14155 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014156 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014157 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014158 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014159 printf(" %d", n_buffer);
14160 printf(" %d", n_size);
14161 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014162 }
14163 }
14164 }
14165
Daniel Veillard3d97e662004-11-04 10:49:00 +000014166 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014167 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014168}
14169
14170
Daniel Veillardce682bc2004-11-05 17:22:25 +000014171#define gen_nb_const_xmlParserNodeInfoPtr 1
14172static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14173 return(NULL);
14174}
14175static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14176}
14177
Daniel Veillardd93f6252004-11-02 15:53:51 +000014178static int
14179test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014180 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014181
Daniel Veillardce682bc2004-11-05 17:22:25 +000014182 int mem_base;
14183 xmlParserCtxtPtr ctxt; /* an XML parser context */
14184 int n_ctxt;
14185 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
14186 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014187
Daniel Veillardce682bc2004-11-05 17:22:25 +000014188 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14189 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
14190 mem_base = xmlMemBlocks();
14191 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
14192 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
14193
14194 xmlParserAddNodeInfo(ctxt, info);
14195 call_tests++;
14196 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
14197 des_const_xmlParserNodeInfoPtr(n_info, info, 1);
14198 xmlResetLastError();
14199 if (mem_base != xmlMemBlocks()) {
14200 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
14201 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014202 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014203 printf(" %d", n_ctxt);
14204 printf(" %d", n_info);
14205 printf("\n");
14206 }
14207 }
14208 }
14209
14210 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014212}
14213
14214
Daniel Veillardce682bc2004-11-05 17:22:25 +000014215#define gen_nb_const_xmlParserCtxtPtr 1
14216static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14217 return(NULL);
14218}
14219static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14220}
14221
Daniel Veillardd93f6252004-11-02 15:53:51 +000014222static int
14223test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014225
14226
14227 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000014228 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014229}
14230
14231
Daniel Veillardce682bc2004-11-05 17:22:25 +000014232#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14233static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14234 return(NULL);
14235}
14236static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14237}
14238
Daniel Veillardd93f6252004-11-02 15:53:51 +000014239static int
14240test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014242
14243
14244 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000014245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014246}
14247
14248
Daniel Veillardce682bc2004-11-05 17:22:25 +000014249#define gen_nb_xmlParserInputPtr 1
14250static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14251 return(NULL);
14252}
14253static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14254}
14255
Daniel Veillardd93f6252004-11-02 15:53:51 +000014256static int
14257test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014259
Daniel Veillardce682bc2004-11-05 17:22:25 +000014260 int mem_base;
14261 int ret_val;
14262 xmlParserInputPtr in; /* an XML parser input */
14263 int n_in;
14264 int len; /* an indicative size for the lookahead */
14265 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014266
Daniel Veillardce682bc2004-11-05 17:22:25 +000014267 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14268 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14269 mem_base = xmlMemBlocks();
14270 in = gen_xmlParserInputPtr(n_in, 0);
14271 len = gen_int(n_len, 1);
14272
14273 ret_val = xmlParserInputGrow(in, len);
14274 desret_int(ret_val);
14275 call_tests++;
14276 des_xmlParserInputPtr(n_in, in, 0);
14277 des_int(n_len, len, 1);
14278 xmlResetLastError();
14279 if (mem_base != xmlMemBlocks()) {
14280 printf("Leak of %d blocks found in xmlParserInputGrow",
14281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014282 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014283 printf(" %d", n_in);
14284 printf(" %d", n_len);
14285 printf("\n");
14286 }
14287 }
14288 }
14289
14290 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014292}
14293
14294
14295static int
14296test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014298
Daniel Veillardce682bc2004-11-05 17:22:25 +000014299 int mem_base;
14300 int ret_val;
14301 xmlParserInputPtr in; /* an XML parser input */
14302 int n_in;
14303 int len; /* an indicative size for the lookahead */
14304 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014305
Daniel Veillardce682bc2004-11-05 17:22:25 +000014306 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14307 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14308 mem_base = xmlMemBlocks();
14309 in = gen_xmlParserInputPtr(n_in, 0);
14310 len = gen_int(n_len, 1);
14311
14312 ret_val = xmlParserInputRead(in, len);
14313 desret_int(ret_val);
14314 call_tests++;
14315 des_xmlParserInputPtr(n_in, in, 0);
14316 des_int(n_len, len, 1);
14317 xmlResetLastError();
14318 if (mem_base != xmlMemBlocks()) {
14319 printf("Leak of %d blocks found in xmlParserInputRead",
14320 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014321 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014322 printf(" %d", n_in);
14323 printf(" %d", n_len);
14324 printf("\n");
14325 }
14326 }
14327 }
14328
14329 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014330 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014331}
14332
14333
14334static int
14335test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014336 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014337
14338 int mem_base;
14339 int ret_val;
14340 int val; /* int 0 or 1 */
14341 int n_val;
14342
14343 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14344 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014345 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014346
14347 ret_val = xmlPedanticParserDefault(val);
14348 desret_int(ret_val);
14349 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014350 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014351 xmlResetLastError();
14352 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014353 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014355 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014356 printf(" %d", n_val);
14357 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014358 }
14359 }
14360
Daniel Veillard3d97e662004-11-04 10:49:00 +000014361 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014363}
14364
14365
14366static int
14367test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014369
14370 int mem_base;
14371 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014372 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014373 int n_cur;
14374 const char * URL; /* the base URL to use for the document */
14375 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014376 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014377 int n_encoding;
14378 int options; /* a combination of xmlParserOption */
14379 int n_options;
14380
14381 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14382 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14383 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014384 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014385 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014386 cur = gen_const_xmlChar_ptr(n_cur, 0);
14387 URL = gen_filepath(n_URL, 1);
14388 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014389 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014390
14391 ret_val = xmlReadDoc(cur, URL, encoding, options);
14392 desret_xmlDocPtr(ret_val);
14393 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014394 des_const_xmlChar_ptr(n_cur, cur, 0);
14395 des_filepath(n_URL, URL, 1);
14396 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014397 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014398 xmlResetLastError();
14399 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014400 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014402 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014403 printf(" %d", n_cur);
14404 printf(" %d", n_URL);
14405 printf(" %d", n_encoding);
14406 printf(" %d", n_options);
14407 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014408 }
14409 }
14410 }
14411 }
14412 }
14413
Daniel Veillard3d97e662004-11-04 10:49:00 +000014414 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014415 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014416}
14417
14418
14419static int
14420test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014421 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014422
14423 int mem_base;
14424 xmlDocPtr ret_val;
14425 const char * filename; /* a file or URL */
14426 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014427 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014428 int n_encoding;
14429 int options; /* a combination of xmlParserOption */
14430 int n_options;
14431
14432 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14433 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014434 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014435 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014436 filename = gen_filepath(n_filename, 0);
14437 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014438 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014439
14440 ret_val = xmlReadFile(filename, encoding, options);
14441 desret_xmlDocPtr(ret_val);
14442 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014443 des_filepath(n_filename, filename, 0);
14444 des_const_char_ptr(n_encoding, encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014445 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014446 xmlResetLastError();
14447 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014448 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014449 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014450 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014451 printf(" %d", n_filename);
14452 printf(" %d", n_encoding);
14453 printf(" %d", n_options);
14454 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014455 }
14456 }
14457 }
14458 }
14459
Daniel Veillard3d97e662004-11-04 10:49:00 +000014460 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014461 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014462}
14463
14464
14465static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014466test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014467 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014468
14469 int mem_base;
14470 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014471 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014472 int n_buffer;
14473 int size; /* the size of the array */
14474 int n_size;
14475 const char * URL; /* the base URL to use for the document */
14476 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014477 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014478 int n_encoding;
14479 int options; /* a combination of xmlParserOption */
14480 int n_options;
14481
14482 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14483 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14484 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14485 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014486 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014487 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014488 buffer = gen_const_char_ptr(n_buffer, 0);
14489 size = gen_int(n_size, 1);
14490 URL = gen_filepath(n_URL, 2);
14491 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014492 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014493
14494 ret_val = xmlReadMemory(buffer, size, URL, encoding, options);
14495 desret_xmlDocPtr(ret_val);
14496 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014497 des_const_char_ptr(n_buffer, buffer, 0);
14498 des_int(n_size, size, 1);
14499 des_filepath(n_URL, URL, 2);
14500 des_const_char_ptr(n_encoding, encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014501 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014502 xmlResetLastError();
14503 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014504 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014505 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014506 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014507 printf(" %d", n_buffer);
14508 printf(" %d", n_size);
14509 printf(" %d", n_URL);
14510 printf(" %d", n_encoding);
14511 printf(" %d", n_options);
14512 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014513 }
14514 }
14515 }
14516 }
14517 }
14518 }
14519
Daniel Veillard3d97e662004-11-04 10:49:00 +000014520 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014521 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014522}
14523
14524
14525static int
14526test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014527 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014528
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014529 int mem_base;
14530 xmlDocPtr ret_val;
14531 xmlChar * cur; /* a pointer to an array of xmlChar */
14532 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014533
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014534 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14535 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014536 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014537
14538 ret_val = xmlRecoverDoc(cur);
14539 desret_xmlDocPtr(ret_val);
14540 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014541 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014542 xmlResetLastError();
14543 if (mem_base != xmlMemBlocks()) {
14544 printf("Leak of %d blocks found in xmlRecoverDoc",
14545 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014546 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014547 printf(" %d", n_cur);
14548 printf("\n");
14549 }
14550 }
14551
Daniel Veillard3d97e662004-11-04 10:49:00 +000014552 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014553 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014554}
14555
14556
14557static int
14558test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014559 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014560
14561 int mem_base;
14562 xmlDocPtr ret_val;
14563 const char * filename; /* the filename */
14564 int n_filename;
14565
14566 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14567 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014568 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014569
14570 ret_val = xmlRecoverFile(filename);
14571 desret_xmlDocPtr(ret_val);
14572 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014573 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014574 xmlResetLastError();
14575 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014576 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014578 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014579 printf(" %d", n_filename);
14580 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014581 }
14582 }
14583
Daniel Veillard3d97e662004-11-04 10:49:00 +000014584 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014586}
14587
14588
14589static int
14590test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014592
14593 int mem_base;
14594 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014595 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014596 int n_buffer;
14597 int size; /* the size of the array */
14598 int n_size;
14599
14600 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14601 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14602 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014603 buffer = gen_const_char_ptr(n_buffer, 0);
14604 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014605
14606 ret_val = xmlRecoverMemory(buffer, size);
14607 desret_xmlDocPtr(ret_val);
14608 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014609 des_const_char_ptr(n_buffer, buffer, 0);
14610 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014611 xmlResetLastError();
14612 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014613 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014614 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014615 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014616 printf(" %d", n_buffer);
14617 printf(" %d", n_size);
14618 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014619 }
14620 }
14621 }
14622
Daniel Veillard3d97e662004-11-04 10:49:00 +000014623 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014625}
14626
14627
14628static int
14629test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014631
Daniel Veillard34099b42004-11-04 17:34:35 +000014632 int mem_base;
14633 xmlDtdPtr ret_val;
14634 xmlSAXHandlerPtr sax; /* the SAX handler block */
14635 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014636 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014637 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014638 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014639 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014640
Daniel Veillard34099b42004-11-04 17:34:35 +000014641 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14642 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14643 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14644 mem_base = xmlMemBlocks();
14645 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14646 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14647 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14648
14649 ret_val = xmlSAXParseDTD(sax, ExternalID, SystemID);
14650 desret_xmlDtdPtr(ret_val);
14651 call_tests++;
14652 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14653 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
14654 des_const_xmlChar_ptr(n_SystemID, SystemID, 2);
14655 xmlResetLastError();
14656 if (mem_base != xmlMemBlocks()) {
14657 printf("Leak of %d blocks found in xmlSAXParseDTD",
14658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014659 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014660 printf(" %d", n_sax);
14661 printf(" %d", n_ExternalID);
14662 printf(" %d", n_SystemID);
14663 printf("\n");
14664 }
14665 }
14666 }
14667 }
14668
14669 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014670 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014671}
14672
14673
14674static int
14675test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014676 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014677
Daniel Veillard34099b42004-11-04 17:34:35 +000014678 int mem_base;
14679 xmlDocPtr ret_val;
14680 xmlSAXHandlerPtr sax; /* the SAX handler block */
14681 int n_sax;
14682 xmlChar * cur; /* a pointer to an array of xmlChar */
14683 int n_cur;
14684 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14685 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014686
Daniel Veillard34099b42004-11-04 17:34:35 +000014687 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14688 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14689 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14690 mem_base = xmlMemBlocks();
14691 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14692 cur = gen_xmlChar_ptr(n_cur, 1);
14693 recovery = gen_int(n_recovery, 2);
14694
14695 ret_val = xmlSAXParseDoc(sax, cur, recovery);
14696 desret_xmlDocPtr(ret_val);
14697 call_tests++;
14698 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14699 des_xmlChar_ptr(n_cur, cur, 1);
14700 des_int(n_recovery, recovery, 2);
14701 xmlResetLastError();
14702 if (mem_base != xmlMemBlocks()) {
14703 printf("Leak of %d blocks found in xmlSAXParseDoc",
14704 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014705 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014706 printf(" %d", n_sax);
14707 printf(" %d", n_cur);
14708 printf(" %d", n_recovery);
14709 printf("\n");
14710 }
14711 }
14712 }
14713 }
14714
14715 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014716 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014717}
14718
14719
14720static int
14721test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014722 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014723
Daniel Veillard34099b42004-11-04 17:34:35 +000014724 int mem_base;
14725 xmlDocPtr ret_val;
14726 xmlSAXHandlerPtr sax; /* the SAX handler block */
14727 int n_sax;
14728 const char * filename; /* the filename */
14729 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014730
Daniel Veillard34099b42004-11-04 17:34:35 +000014731 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14732 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14733 mem_base = xmlMemBlocks();
14734 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14735 filename = gen_filepath(n_filename, 1);
14736
14737 ret_val = xmlSAXParseEntity(sax, filename);
14738 desret_xmlDocPtr(ret_val);
14739 call_tests++;
14740 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14741 des_filepath(n_filename, filename, 1);
14742 xmlResetLastError();
14743 if (mem_base != xmlMemBlocks()) {
14744 printf("Leak of %d blocks found in xmlSAXParseEntity",
14745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014746 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014747 printf(" %d", n_sax);
14748 printf(" %d", n_filename);
14749 printf("\n");
14750 }
14751 }
14752 }
14753
14754 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014756}
14757
14758
14759static int
14760test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014762
Daniel Veillard34099b42004-11-04 17:34:35 +000014763 int mem_base;
14764 xmlDocPtr ret_val;
14765 xmlSAXHandlerPtr sax; /* the SAX handler block */
14766 int n_sax;
14767 const char * filename; /* the filename */
14768 int n_filename;
14769 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14770 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014771
Daniel Veillard34099b42004-11-04 17:34:35 +000014772 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14773 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14774 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14775 mem_base = xmlMemBlocks();
14776 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14777 filename = gen_filepath(n_filename, 1);
14778 recovery = gen_int(n_recovery, 2);
14779
14780 ret_val = xmlSAXParseFile(sax, filename, recovery);
14781 desret_xmlDocPtr(ret_val);
14782 call_tests++;
14783 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14784 des_filepath(n_filename, filename, 1);
14785 des_int(n_recovery, recovery, 2);
14786 xmlResetLastError();
14787 if (mem_base != xmlMemBlocks()) {
14788 printf("Leak of %d blocks found in xmlSAXParseFile",
14789 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014790 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014791 printf(" %d", n_sax);
14792 printf(" %d", n_filename);
14793 printf(" %d", n_recovery);
14794 printf("\n");
14795 }
14796 }
14797 }
14798 }
14799
14800 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014802}
14803
14804
14805static int
14806test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014808
Daniel Veillard34099b42004-11-04 17:34:35 +000014809 int mem_base;
14810 xmlDocPtr ret_val;
14811 xmlSAXHandlerPtr sax; /* the SAX handler block */
14812 int n_sax;
14813 const char * filename; /* the filename */
14814 int n_filename;
14815 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14816 int n_recovery;
14817 void * data; /* the userdata */
14818 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014819
Daniel Veillard34099b42004-11-04 17:34:35 +000014820 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14821 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14822 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14823 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14824 mem_base = xmlMemBlocks();
14825 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14826 filename = gen_filepath(n_filename, 1);
14827 recovery = gen_int(n_recovery, 2);
14828 data = gen_userdata(n_data, 3);
14829
14830 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
14831 desret_xmlDocPtr(ret_val);
14832 call_tests++;
14833 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14834 des_filepath(n_filename, filename, 1);
14835 des_int(n_recovery, recovery, 2);
14836 des_userdata(n_data, data, 3);
14837 xmlResetLastError();
14838 if (mem_base != xmlMemBlocks()) {
14839 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
14840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014841 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014842 printf(" %d", n_sax);
14843 printf(" %d", n_filename);
14844 printf(" %d", n_recovery);
14845 printf(" %d", n_data);
14846 printf("\n");
14847 }
14848 }
14849 }
14850 }
14851 }
14852
14853 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014854 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014855}
14856
14857
14858static int
14859test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014860 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014861
Daniel Veillard34099b42004-11-04 17:34:35 +000014862 int mem_base;
14863 xmlDocPtr ret_val;
14864 xmlSAXHandlerPtr sax; /* the SAX handler block */
14865 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014866 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014867 int n_buffer;
14868 int size; /* the size of the array */
14869 int n_size;
14870 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
14871 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014872
Daniel Veillard34099b42004-11-04 17:34:35 +000014873 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14874 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14875 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14876 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14877 mem_base = xmlMemBlocks();
14878 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14879 buffer = gen_const_char_ptr(n_buffer, 1);
14880 size = gen_int(n_size, 2);
14881 recovery = gen_int(n_recovery, 3);
14882
14883 ret_val = xmlSAXParseMemory(sax, buffer, size, recovery);
14884 desret_xmlDocPtr(ret_val);
14885 call_tests++;
14886 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14887 des_const_char_ptr(n_buffer, buffer, 1);
14888 des_int(n_size, size, 2);
14889 des_int(n_recovery, recovery, 3);
14890 xmlResetLastError();
14891 if (mem_base != xmlMemBlocks()) {
14892 printf("Leak of %d blocks found in xmlSAXParseMemory",
14893 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014894 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014895 printf(" %d", n_sax);
14896 printf(" %d", n_buffer);
14897 printf(" %d", n_size);
14898 printf(" %d", n_recovery);
14899 printf("\n");
14900 }
14901 }
14902 }
14903 }
14904 }
14905
14906 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014907 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014908}
14909
14910
14911static int
14912test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014913 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014914
Daniel Veillard34099b42004-11-04 17:34:35 +000014915 int mem_base;
14916 xmlDocPtr ret_val;
14917 xmlSAXHandlerPtr sax; /* the SAX handler block */
14918 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014919 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014920 int n_buffer;
14921 int size; /* the size of the array */
14922 int n_size;
14923 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14924 int n_recovery;
14925 void * data; /* the userdata */
14926 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014927
Daniel Veillard34099b42004-11-04 17:34:35 +000014928 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14929 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14930 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14931 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14932 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14933 mem_base = xmlMemBlocks();
14934 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14935 buffer = gen_const_char_ptr(n_buffer, 1);
14936 size = gen_int(n_size, 2);
14937 recovery = gen_int(n_recovery, 3);
14938 data = gen_userdata(n_data, 4);
14939
14940 ret_val = xmlSAXParseMemoryWithData(sax, buffer, size, recovery, data);
14941 desret_xmlDocPtr(ret_val);
14942 call_tests++;
14943 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14944 des_const_char_ptr(n_buffer, buffer, 1);
14945 des_int(n_size, size, 2);
14946 des_int(n_recovery, recovery, 3);
14947 des_userdata(n_data, data, 4);
14948 xmlResetLastError();
14949 if (mem_base != xmlMemBlocks()) {
14950 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
14951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014952 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014953 printf(" %d", n_sax);
14954 printf(" %d", n_buffer);
14955 printf(" %d", n_size);
14956 printf(" %d", n_recovery);
14957 printf(" %d", n_data);
14958 printf("\n");
14959 }
14960 }
14961 }
14962 }
14963 }
14964 }
14965
14966 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000014967 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014968}
14969
14970
14971static int
14972test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014973 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014974
Daniel Veillard34099b42004-11-04 17:34:35 +000014975 int mem_base;
14976 int ret_val;
14977 xmlSAXHandlerPtr sax; /* a SAX handler */
14978 int n_sax;
14979 void * user_data; /* The user data returned on SAX callbacks */
14980 int n_user_data;
14981 const char * filename; /* a file name */
14982 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014983
Daniel Veillard34099b42004-11-04 17:34:35 +000014984 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14985 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14986 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14987 mem_base = xmlMemBlocks();
14988 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14989 user_data = gen_userdata(n_user_data, 1);
14990 filename = gen_filepath(n_filename, 2);
Daniel Veillardce244ad2004-11-05 10:03:46 +000014991 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillard34099b42004-11-04 17:34:35 +000014992
14993 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
14994 desret_int(ret_val);
14995 call_tests++;
14996 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14997 des_userdata(n_user_data, user_data, 1);
14998 des_filepath(n_filename, filename, 2);
14999 xmlResetLastError();
15000 if (mem_base != xmlMemBlocks()) {
15001 printf("Leak of %d blocks found in xmlSAXUserParseFile",
15002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015003 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015004 printf(" %d", n_sax);
15005 printf(" %d", n_user_data);
15006 printf(" %d", n_filename);
15007 printf("\n");
15008 }
15009 }
15010 }
15011 }
15012
15013 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015015}
15016
15017
15018static int
15019test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015021
Daniel Veillard34099b42004-11-04 17:34:35 +000015022 int mem_base;
15023 int ret_val;
15024 xmlSAXHandlerPtr sax; /* a SAX handler */
15025 int n_sax;
15026 void * user_data; /* The user data returned on SAX callbacks */
15027 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015028 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000015029 int n_buffer;
15030 int size; /* the length of the XML document in bytes */
15031 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015032
Daniel Veillard34099b42004-11-04 17:34:35 +000015033 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15034 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
15035 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15036 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15037 mem_base = xmlMemBlocks();
15038 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15039 user_data = gen_userdata(n_user_data, 1);
15040 buffer = gen_const_char_ptr(n_buffer, 2);
15041 size = gen_int(n_size, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000015042 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillard34099b42004-11-04 17:34:35 +000015043
15044 ret_val = xmlSAXUserParseMemory(sax, user_data, buffer, size);
15045 desret_int(ret_val);
15046 call_tests++;
15047 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15048 des_userdata(n_user_data, user_data, 1);
15049 des_const_char_ptr(n_buffer, buffer, 2);
15050 des_int(n_size, size, 3);
15051 xmlResetLastError();
15052 if (mem_base != xmlMemBlocks()) {
15053 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
15054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015055 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015056 printf(" %d", n_sax);
15057 printf(" %d", n_user_data);
15058 printf(" %d", n_buffer);
15059 printf(" %d", n_size);
15060 printf("\n");
15061 }
15062 }
15063 }
15064 }
15065 }
15066
15067 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015069}
15070
15071
15072static int
15073test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015075
15076
15077 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000015078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015079}
15080
15081
15082static int
15083test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015085
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015086 int mem_base;
15087 int ret_val;
15088 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
15089 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015090 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015091 int n_name;
15092 void * value; /* pointer to the location of the new value */
15093 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015094
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015095 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15096 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15097 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15098 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015099 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15100 name = gen_const_char_ptr(n_name, 1);
15101 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015102
15103 ret_val = xmlSetFeature(ctxt, name, value);
15104 desret_int(ret_val);
15105 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015106 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15107 des_const_char_ptr(n_name, name, 1);
15108 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015109 xmlResetLastError();
15110 if (mem_base != xmlMemBlocks()) {
15111 printf("Leak of %d blocks found in xmlSetFeature",
15112 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015113 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015114 printf(" %d", n_ctxt);
15115 printf(" %d", n_name);
15116 printf(" %d", n_value);
15117 printf("\n");
15118 }
15119 }
15120 }
15121 }
15122
Daniel Veillard3d97e662004-11-04 10:49:00 +000015123 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015125}
15126
15127
15128static int
15129test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015131
15132 int mem_base;
15133 xmlParserCtxtPtr ctxt; /* an XML parser context */
15134 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015135 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015136 int n_buffer;
15137 const char * filename; /* a file name */
15138 int n_filename;
15139
15140 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15141 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15142 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15143 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015144 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15145 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15146 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015147
15148 xmlSetupParserForBuffer(ctxt, buffer, filename);
15149 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015150 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15151 des_const_xmlChar_ptr(n_buffer, buffer, 1);
15152 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015153 xmlResetLastError();
15154 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015155 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015157 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015158 printf(" %d", n_ctxt);
15159 printf(" %d", n_buffer);
15160 printf(" %d", n_filename);
15161 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015162 }
15163 }
15164 }
15165 }
15166
Daniel Veillard3d97e662004-11-04 10:49:00 +000015167 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015169}
15170
15171
15172static int
15173test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015175
15176 int mem_base;
15177 xmlParserCtxtPtr ctxt; /* an XML parser context */
15178 int n_ctxt;
15179
15180 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15181 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015182 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015183
15184 xmlStopParser(ctxt);
15185 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015186 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015187 xmlResetLastError();
15188 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015189 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015191 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015192 printf(" %d", n_ctxt);
15193 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015194 }
15195 }
15196
Daniel Veillard3d97e662004-11-04 10:49:00 +000015197 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015199}
15200
15201
15202static int
15203test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015205
15206 int mem_base;
15207 int ret_val;
15208 int val; /* int 0 or 1 */
15209 int n_val;
15210
15211 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15212 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015213 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015214
15215 ret_val = xmlSubstituteEntitiesDefault(val);
15216 desret_int(ret_val);
15217 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015218 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015219 xmlResetLastError();
15220 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015221 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015222 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015223 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015224 printf(" %d", n_val);
15225 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015226 }
15227 }
15228
Daniel Veillard3d97e662004-11-04 10:49:00 +000015229 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000015230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015231}
15232
15233static int
15234test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015236
Daniel Veillard42595322004-11-08 10:52:06 +000015237 printf("Testing parser : 58 of 69 functions ...\n");
15238 test_ret += test_xmlByteConsumed();
15239 test_ret += test_xmlClearNodeInfoSeq();
15240 test_ret += test_xmlClearParserCtxt();
15241 test_ret += test_xmlCreateDocParserCtxt();
15242 test_ret += test_xmlCreatePushParserCtxt();
15243 test_ret += test_xmlCtxtReadDoc();
15244 test_ret += test_xmlCtxtReadFile();
15245 test_ret += test_xmlCtxtReadMemory();
15246 test_ret += test_xmlCtxtReset();
15247 test_ret += test_xmlCtxtResetPush();
15248 test_ret += test_xmlCtxtUseOptions();
15249 test_ret += test_xmlGetExternalEntityLoader();
15250 test_ret += test_xmlGetFeature();
15251 test_ret += test_xmlGetFeaturesList();
15252 test_ret += test_xmlIOParseDTD();
15253 test_ret += test_xmlInitNodeInfoSeq();
15254 test_ret += test_xmlInitParser();
15255 test_ret += test_xmlInitParserCtxt();
15256 test_ret += test_xmlKeepBlanksDefault();
15257 test_ret += test_xmlLineNumbersDefault();
15258 test_ret += test_xmlLoadExternalEntity();
15259 test_ret += test_xmlNewIOInputStream();
15260 test_ret += test_xmlNewParserCtxt();
15261 test_ret += test_xmlParseBalancedChunkMemory();
15262 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15263 test_ret += test_xmlParseChunk();
15264 test_ret += test_xmlParseCtxtExternalEntity();
15265 test_ret += test_xmlParseDTD();
15266 test_ret += test_xmlParseDoc();
15267 test_ret += test_xmlParseDocument();
15268 test_ret += test_xmlParseEntity();
15269 test_ret += test_xmlParseExtParsedEnt();
15270 test_ret += test_xmlParseExternalEntity();
15271 test_ret += test_xmlParseFile();
15272 test_ret += test_xmlParseInNodeContext();
15273 test_ret += test_xmlParseMemory();
15274 test_ret += test_xmlParserAddNodeInfo();
15275 test_ret += test_xmlParserFindNodeInfo();
15276 test_ret += test_xmlParserFindNodeInfoIndex();
15277 test_ret += test_xmlParserInputGrow();
15278 test_ret += test_xmlParserInputRead();
15279 test_ret += test_xmlPedanticParserDefault();
15280 test_ret += test_xmlReadDoc();
15281 test_ret += test_xmlReadFile();
15282 test_ret += test_xmlReadMemory();
15283 test_ret += test_xmlRecoverDoc();
15284 test_ret += test_xmlRecoverFile();
15285 test_ret += test_xmlRecoverMemory();
15286 test_ret += test_xmlSAXParseDTD();
15287 test_ret += test_xmlSAXParseDoc();
15288 test_ret += test_xmlSAXParseEntity();
15289 test_ret += test_xmlSAXParseFile();
15290 test_ret += test_xmlSAXParseFileWithData();
15291 test_ret += test_xmlSAXParseMemory();
15292 test_ret += test_xmlSAXParseMemoryWithData();
15293 test_ret += test_xmlSAXUserParseFile();
15294 test_ret += test_xmlSAXUserParseMemory();
15295 test_ret += test_xmlSetExternalEntityLoader();
15296 test_ret += test_xmlSetFeature();
15297 test_ret += test_xmlSetupParserForBuffer();
15298 test_ret += test_xmlStopParser();
15299 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015300
Daniel Veillard42595322004-11-08 10:52:06 +000015301 if (test_ret != 0)
15302 printf("Module parser: %d errors\n", test_ret);
15303 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015304}
15305
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015306static int
15307test_htmlCreateFileParserCtxt(void) {
15308 int test_ret = 0;
15309
15310#ifdef LIBXML_HTML_ENABLED
15311 int mem_base;
15312 htmlParserCtxtPtr ret_val;
15313 const char * filename; /* the filename */
15314 int n_filename;
15315 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15316 int n_encoding;
15317
15318 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15319 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15320 mem_base = xmlMemBlocks();
15321 filename = gen_fileoutput(n_filename, 0);
15322 encoding = gen_const_char_ptr(n_encoding, 1);
15323
15324 ret_val = htmlCreateFileParserCtxt(filename, encoding);
15325 desret_xmlParserCtxtPtr(ret_val);
15326 call_tests++;
15327 des_fileoutput(n_filename, filename, 0);
15328 des_const_char_ptr(n_encoding, encoding, 1);
15329 xmlResetLastError();
15330 if (mem_base != xmlMemBlocks()) {
15331 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15332 xmlMemBlocks() - mem_base);
15333 test_ret++;
15334 printf(" %d", n_filename);
15335 printf(" %d", n_encoding);
15336 printf("\n");
15337 }
15338 }
15339 }
15340#endif
15341
15342 function_tests++;
15343 return(test_ret);
15344}
15345
15346
15347static int
15348test_htmlInitAutoClose(void) {
15349 int test_ret = 0;
15350
15351#ifdef LIBXML_HTML_ENABLED
15352 int mem_base;
15353
15354 mem_base = xmlMemBlocks();
15355
15356 htmlInitAutoClose();
15357 call_tests++;
15358 xmlResetLastError();
15359 if (mem_base != xmlMemBlocks()) {
15360 printf("Leak of %d blocks found in htmlInitAutoClose",
15361 xmlMemBlocks() - mem_base);
15362 test_ret++;
15363 printf("\n");
15364 }
15365#endif
15366
15367 function_tests++;
15368 return(test_ret);
15369}
15370
15371
15372static int
15373test_inputPop(void) {
15374 int test_ret = 0;
15375
15376 int mem_base;
15377 xmlParserInputPtr ret_val;
15378 xmlParserCtxtPtr ctxt; /* an XML parser context */
15379 int n_ctxt;
15380
15381 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15382 mem_base = xmlMemBlocks();
15383 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15384
15385 ret_val = inputPop(ctxt);
15386 desret_xmlParserInputPtr(ret_val);
15387 call_tests++;
15388 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15389 xmlResetLastError();
15390 if (mem_base != xmlMemBlocks()) {
15391 printf("Leak of %d blocks found in inputPop",
15392 xmlMemBlocks() - mem_base);
15393 test_ret++;
15394 printf(" %d", n_ctxt);
15395 printf("\n");
15396 }
15397 }
15398
15399 function_tests++;
15400 return(test_ret);
15401}
15402
15403
15404static int
15405test_inputPush(void) {
15406 int test_ret = 0;
15407
15408 int mem_base;
15409 int ret_val;
15410 xmlParserCtxtPtr ctxt; /* an XML parser context */
15411 int n_ctxt;
15412 xmlParserInputPtr value; /* the parser input */
15413 int n_value;
15414
15415 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15416 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15417 mem_base = xmlMemBlocks();
15418 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15419 value = gen_xmlParserInputPtr(n_value, 1);
15420
15421 ret_val = inputPush(ctxt, value);
15422 desret_int(ret_val);
15423 call_tests++;
15424 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15425 des_xmlParserInputPtr(n_value, value, 1);
15426 xmlResetLastError();
15427 if (mem_base != xmlMemBlocks()) {
15428 printf("Leak of %d blocks found in inputPush",
15429 xmlMemBlocks() - mem_base);
15430 test_ret++;
15431 printf(" %d", n_ctxt);
15432 printf(" %d", n_value);
15433 printf("\n");
15434 }
15435 }
15436 }
15437
15438 function_tests++;
15439 return(test_ret);
15440}
15441
15442
15443static int
15444test_namePop(void) {
15445 int test_ret = 0;
15446
15447 int mem_base;
15448 const xmlChar * ret_val;
15449 xmlParserCtxtPtr ctxt; /* an XML parser context */
15450 int n_ctxt;
15451
15452 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15453 mem_base = xmlMemBlocks();
15454 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15455
15456 ret_val = namePop(ctxt);
15457 desret_const_xmlChar_ptr(ret_val);
15458 call_tests++;
15459 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15460 xmlResetLastError();
15461 if (mem_base != xmlMemBlocks()) {
15462 printf("Leak of %d blocks found in namePop",
15463 xmlMemBlocks() - mem_base);
15464 test_ret++;
15465 printf(" %d", n_ctxt);
15466 printf("\n");
15467 }
15468 }
15469
15470 function_tests++;
15471 return(test_ret);
15472}
15473
15474
15475static int
15476test_namePush(void) {
15477 int test_ret = 0;
15478
15479 int mem_base;
15480 int ret_val;
15481 xmlParserCtxtPtr ctxt; /* an XML parser context */
15482 int n_ctxt;
15483 xmlChar * value; /* the element name */
15484 int n_value;
15485
15486 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15487 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15488 mem_base = xmlMemBlocks();
15489 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15490 value = gen_const_xmlChar_ptr(n_value, 1);
15491
15492 ret_val = namePush(ctxt, value);
15493 desret_int(ret_val);
15494 call_tests++;
15495 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15496 des_const_xmlChar_ptr(n_value, value, 1);
15497 xmlResetLastError();
15498 if (mem_base != xmlMemBlocks()) {
15499 printf("Leak of %d blocks found in namePush",
15500 xmlMemBlocks() - mem_base);
15501 test_ret++;
15502 printf(" %d", n_ctxt);
15503 printf(" %d", n_value);
15504 printf("\n");
15505 }
15506 }
15507 }
15508
15509 function_tests++;
15510 return(test_ret);
15511}
15512
15513
15514static int
15515test_nodePop(void) {
15516 int test_ret = 0;
15517
15518 int mem_base;
15519 xmlNodePtr ret_val;
15520 xmlParserCtxtPtr ctxt; /* an XML parser context */
15521 int n_ctxt;
15522
15523 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15524 mem_base = xmlMemBlocks();
15525 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15526
15527 ret_val = nodePop(ctxt);
15528 desret_xmlNodePtr(ret_val);
15529 call_tests++;
15530 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15531 xmlResetLastError();
15532 if (mem_base != xmlMemBlocks()) {
15533 printf("Leak of %d blocks found in nodePop",
15534 xmlMemBlocks() - mem_base);
15535 test_ret++;
15536 printf(" %d", n_ctxt);
15537 printf("\n");
15538 }
15539 }
15540
15541 function_tests++;
15542 return(test_ret);
15543}
15544
15545
15546static int
15547test_nodePush(void) {
15548 int test_ret = 0;
15549
15550 int mem_base;
15551 int ret_val;
15552 xmlParserCtxtPtr ctxt; /* an XML parser context */
15553 int n_ctxt;
15554 xmlNodePtr value; /* the element node */
15555 int n_value;
15556
15557 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15558 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15559 mem_base = xmlMemBlocks();
15560 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15561 value = gen_xmlNodePtr(n_value, 1);
15562
15563 ret_val = nodePush(ctxt, value);
15564 desret_int(ret_val);
15565 call_tests++;
15566 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15567 des_xmlNodePtr(n_value, value, 1);
15568 xmlResetLastError();
15569 if (mem_base != xmlMemBlocks()) {
15570 printf("Leak of %d blocks found in nodePush",
15571 xmlMemBlocks() - mem_base);
15572 test_ret++;
15573 printf(" %d", n_ctxt);
15574 printf(" %d", n_value);
15575 printf("\n");
15576 }
15577 }
15578 }
15579
15580 function_tests++;
15581 return(test_ret);
15582}
15583
15584
15585static int
15586test_xmlCheckLanguageID(void) {
15587 int test_ret = 0;
15588
15589 int mem_base;
15590 int ret_val;
15591 xmlChar * lang; /* pointer to the string value */
15592 int n_lang;
15593
15594 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15595 mem_base = xmlMemBlocks();
15596 lang = gen_const_xmlChar_ptr(n_lang, 0);
15597
15598 ret_val = xmlCheckLanguageID(lang);
15599 desret_int(ret_val);
15600 call_tests++;
15601 des_const_xmlChar_ptr(n_lang, lang, 0);
15602 xmlResetLastError();
15603 if (mem_base != xmlMemBlocks()) {
15604 printf("Leak of %d blocks found in xmlCheckLanguageID",
15605 xmlMemBlocks() - mem_base);
15606 test_ret++;
15607 printf(" %d", n_lang);
15608 printf("\n");
15609 }
15610 }
15611
15612 function_tests++;
15613 return(test_ret);
15614}
15615
15616
15617static int
15618test_xmlCopyChar(void) {
15619 int test_ret = 0;
15620
15621 int mem_base;
15622 int ret_val;
15623 int len; /* Ignored, compatibility */
15624 int n_len;
15625 xmlChar * out; /* pointer to an array of xmlChar */
15626 int n_out;
15627 int val; /* the char value */
15628 int n_val;
15629
15630 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15631 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15632 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15633 mem_base = xmlMemBlocks();
15634 len = gen_int(n_len, 0);
15635 out = gen_xmlChar_ptr(n_out, 1);
15636 val = gen_int(n_val, 2);
15637
15638 ret_val = xmlCopyChar(len, out, val);
15639 desret_int(ret_val);
15640 call_tests++;
15641 des_int(n_len, len, 0);
15642 des_xmlChar_ptr(n_out, out, 1);
15643 des_int(n_val, val, 2);
15644 xmlResetLastError();
15645 if (mem_base != xmlMemBlocks()) {
15646 printf("Leak of %d blocks found in xmlCopyChar",
15647 xmlMemBlocks() - mem_base);
15648 test_ret++;
15649 printf(" %d", n_len);
15650 printf(" %d", n_out);
15651 printf(" %d", n_val);
15652 printf("\n");
15653 }
15654 }
15655 }
15656 }
15657
15658 function_tests++;
15659 return(test_ret);
15660}
15661
15662
15663static int
15664test_xmlCopyCharMultiByte(void) {
15665 int test_ret = 0;
15666
15667 int mem_base;
15668 int ret_val;
15669 xmlChar * out; /* pointer to an array of xmlChar */
15670 int n_out;
15671 int val; /* the char value */
15672 int n_val;
15673
15674 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15675 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15676 mem_base = xmlMemBlocks();
15677 out = gen_xmlChar_ptr(n_out, 0);
15678 val = gen_int(n_val, 1);
15679
15680 ret_val = xmlCopyCharMultiByte(out, val);
15681 desret_int(ret_val);
15682 call_tests++;
15683 des_xmlChar_ptr(n_out, out, 0);
15684 des_int(n_val, val, 1);
15685 xmlResetLastError();
15686 if (mem_base != xmlMemBlocks()) {
15687 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15688 xmlMemBlocks() - mem_base);
15689 test_ret++;
15690 printf(" %d", n_out);
15691 printf(" %d", n_val);
15692 printf("\n");
15693 }
15694 }
15695 }
15696
15697 function_tests++;
15698 return(test_ret);
15699}
15700
15701
15702static int
15703test_xmlCreateEntityParserCtxt(void) {
15704 int test_ret = 0;
15705
15706 int mem_base;
15707 xmlParserCtxtPtr ret_val;
15708 xmlChar * URL; /* the entity URL */
15709 int n_URL;
15710 xmlChar * ID; /* the entity PUBLIC ID */
15711 int n_ID;
15712 xmlChar * base; /* a possible base for the target URI */
15713 int n_base;
15714
15715 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15716 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15717 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15718 mem_base = xmlMemBlocks();
15719 URL = gen_const_xmlChar_ptr(n_URL, 0);
15720 ID = gen_const_xmlChar_ptr(n_ID, 1);
15721 base = gen_const_xmlChar_ptr(n_base, 2);
15722
15723 ret_val = xmlCreateEntityParserCtxt(URL, ID, base);
15724 desret_xmlParserCtxtPtr(ret_val);
15725 call_tests++;
15726 des_const_xmlChar_ptr(n_URL, URL, 0);
15727 des_const_xmlChar_ptr(n_ID, ID, 1);
15728 des_const_xmlChar_ptr(n_base, base, 2);
15729 xmlResetLastError();
15730 if (mem_base != xmlMemBlocks()) {
15731 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15732 xmlMemBlocks() - mem_base);
15733 test_ret++;
15734 printf(" %d", n_URL);
15735 printf(" %d", n_ID);
15736 printf(" %d", n_base);
15737 printf("\n");
15738 }
15739 }
15740 }
15741 }
15742
15743 function_tests++;
15744 return(test_ret);
15745}
15746
15747
15748static int
15749test_xmlCreateFileParserCtxt(void) {
15750 int test_ret = 0;
15751
15752 int mem_base;
15753 xmlParserCtxtPtr ret_val;
15754 const char * filename; /* the filename */
15755 int n_filename;
15756
15757 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15758 mem_base = xmlMemBlocks();
15759 filename = gen_fileoutput(n_filename, 0);
15760
15761 ret_val = xmlCreateFileParserCtxt(filename);
15762 desret_xmlParserCtxtPtr(ret_val);
15763 call_tests++;
15764 des_fileoutput(n_filename, filename, 0);
15765 xmlResetLastError();
15766 if (mem_base != xmlMemBlocks()) {
15767 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15768 xmlMemBlocks() - mem_base);
15769 test_ret++;
15770 printf(" %d", n_filename);
15771 printf("\n");
15772 }
15773 }
15774
15775 function_tests++;
15776 return(test_ret);
15777}
15778
15779
15780static int
15781test_xmlCreateMemoryParserCtxt(void) {
15782 int test_ret = 0;
15783
15784 int mem_base;
15785 xmlParserCtxtPtr ret_val;
15786 char * buffer; /* a pointer to a char array */
15787 int n_buffer;
15788 int size; /* the size of the array */
15789 int n_size;
15790
15791 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15792 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15793 mem_base = xmlMemBlocks();
15794 buffer = gen_const_char_ptr(n_buffer, 0);
15795 size = gen_int(n_size, 1);
15796
15797 ret_val = xmlCreateMemoryParserCtxt(buffer, size);
15798 desret_xmlParserCtxtPtr(ret_val);
15799 call_tests++;
15800 des_const_char_ptr(n_buffer, buffer, 0);
15801 des_int(n_size, size, 1);
15802 xmlResetLastError();
15803 if (mem_base != xmlMemBlocks()) {
15804 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
15805 xmlMemBlocks() - mem_base);
15806 test_ret++;
15807 printf(" %d", n_buffer);
15808 printf(" %d", n_size);
15809 printf("\n");
15810 }
15811 }
15812 }
15813
15814 function_tests++;
15815 return(test_ret);
15816}
15817
15818
15819static int
15820test_xmlCreateURLParserCtxt(void) {
15821 int test_ret = 0;
15822
15823 int mem_base;
15824 xmlParserCtxtPtr ret_val;
15825 const char * filename; /* the filename or URL */
15826 int n_filename;
15827 int options; /* a combination of xmlParserOption */
15828 int n_options;
15829
15830 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15831 for (n_options = 0;n_options < gen_nb_int;n_options++) {
15832 mem_base = xmlMemBlocks();
15833 filename = gen_fileoutput(n_filename, 0);
15834 options = gen_int(n_options, 1);
15835
15836 ret_val = xmlCreateURLParserCtxt(filename, options);
15837 desret_xmlParserCtxtPtr(ret_val);
15838 call_tests++;
15839 des_fileoutput(n_filename, filename, 0);
15840 des_int(n_options, options, 1);
15841 xmlResetLastError();
15842 if (mem_base != xmlMemBlocks()) {
15843 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
15844 xmlMemBlocks() - mem_base);
15845 test_ret++;
15846 printf(" %d", n_filename);
15847 printf(" %d", n_options);
15848 printf("\n");
15849 }
15850 }
15851 }
15852
15853 function_tests++;
15854 return(test_ret);
15855}
15856
15857
15858static int
15859test_xmlCurrentChar(void) {
15860 int test_ret = 0;
15861
15862 int mem_base;
15863 int ret_val;
15864 xmlParserCtxtPtr ctxt; /* the XML parser context */
15865 int n_ctxt;
15866 int * len; /* pointer to the length of the char read */
15867 int n_len;
15868
15869 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15870 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
15871 mem_base = xmlMemBlocks();
15872 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15873 len = gen_int_ptr(n_len, 1);
15874
15875 ret_val = xmlCurrentChar(ctxt, len);
15876 desret_int(ret_val);
15877 call_tests++;
15878 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15879 des_int_ptr(n_len, len, 1);
15880 xmlResetLastError();
15881 if (mem_base != xmlMemBlocks()) {
15882 printf("Leak of %d blocks found in xmlCurrentChar",
15883 xmlMemBlocks() - mem_base);
15884 test_ret++;
15885 printf(" %d", n_ctxt);
15886 printf(" %d", n_len);
15887 printf("\n");
15888 }
15889 }
15890 }
15891
15892 function_tests++;
15893 return(test_ret);
15894}
15895
15896
15897static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015898test_xmlErrMemory(void) {
15899 int test_ret = 0;
15900
15901 int mem_base;
15902 xmlParserCtxtPtr ctxt; /* an XML parser context */
15903 int n_ctxt;
15904 char * extra; /* extra informations */
15905 int n_extra;
15906
15907 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15908 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
15909 mem_base = xmlMemBlocks();
15910 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15911 extra = gen_const_char_ptr(n_extra, 1);
15912
15913 xmlErrMemory(ctxt, extra);
15914 call_tests++;
15915 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15916 des_const_char_ptr(n_extra, extra, 1);
15917 xmlResetLastError();
15918 if (mem_base != xmlMemBlocks()) {
15919 printf("Leak of %d blocks found in xmlErrMemory",
15920 xmlMemBlocks() - mem_base);
15921 test_ret++;
15922 printf(" %d", n_ctxt);
15923 printf(" %d", n_extra);
15924 printf("\n");
15925 }
15926 }
15927 }
15928
15929 function_tests++;
15930 return(test_ret);
15931}
15932
15933
15934static int
15935test_xmlIsLetter(void) {
15936 int test_ret = 0;
15937
15938 int mem_base;
15939 int ret_val;
15940 int c; /* an unicode character (int) */
15941 int n_c;
15942
15943 for (n_c = 0;n_c < gen_nb_int;n_c++) {
15944 mem_base = xmlMemBlocks();
15945 c = gen_int(n_c, 0);
15946
15947 ret_val = xmlIsLetter(c);
15948 desret_int(ret_val);
15949 call_tests++;
15950 des_int(n_c, c, 0);
15951 xmlResetLastError();
15952 if (mem_base != xmlMemBlocks()) {
15953 printf("Leak of %d blocks found in xmlIsLetter",
15954 xmlMemBlocks() - mem_base);
15955 test_ret++;
15956 printf(" %d", n_c);
15957 printf("\n");
15958 }
15959 }
15960
15961 function_tests++;
15962 return(test_ret);
15963}
15964
15965
15966static int
15967test_xmlNewEntityInputStream(void) {
15968 int test_ret = 0;
15969
15970 int mem_base;
15971 xmlParserInputPtr ret_val;
15972 xmlParserCtxtPtr ctxt; /* an XML parser context */
15973 int n_ctxt;
15974 xmlEntityPtr entity; /* an Entity pointer */
15975 int n_entity;
15976
15977 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15978 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
15979 mem_base = xmlMemBlocks();
15980 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15981 entity = gen_xmlEntityPtr(n_entity, 1);
15982
15983 ret_val = xmlNewEntityInputStream(ctxt, entity);
15984 desret_xmlParserInputPtr(ret_val);
15985 call_tests++;
15986 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15987 des_xmlEntityPtr(n_entity, entity, 1);
15988 xmlResetLastError();
15989 if (mem_base != xmlMemBlocks()) {
15990 printf("Leak of %d blocks found in xmlNewEntityInputStream",
15991 xmlMemBlocks() - mem_base);
15992 test_ret++;
15993 printf(" %d", n_ctxt);
15994 printf(" %d", n_entity);
15995 printf("\n");
15996 }
15997 }
15998 }
15999
16000 function_tests++;
16001 return(test_ret);
16002}
16003
16004
16005static int
16006test_xmlNewInputFromFile(void) {
16007 int test_ret = 0;
16008
16009 int mem_base;
16010 xmlParserInputPtr ret_val;
16011 xmlParserCtxtPtr ctxt; /* an XML parser context */
16012 int n_ctxt;
16013 const char * filename; /* the filename to use as entity */
16014 int n_filename;
16015
16016 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16017 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
16018 mem_base = xmlMemBlocks();
16019 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16020 filename = gen_filepath(n_filename, 1);
16021
16022 ret_val = xmlNewInputFromFile(ctxt, filename);
16023 desret_xmlParserInputPtr(ret_val);
16024 call_tests++;
16025 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16026 des_filepath(n_filename, filename, 1);
16027 xmlResetLastError();
16028 if (mem_base != xmlMemBlocks()) {
16029 printf("Leak of %d blocks found in xmlNewInputFromFile",
16030 xmlMemBlocks() - mem_base);
16031 test_ret++;
16032 printf(" %d", n_ctxt);
16033 printf(" %d", n_filename);
16034 printf("\n");
16035 }
16036 }
16037 }
16038
16039 function_tests++;
16040 return(test_ret);
16041}
16042
16043
16044static int
16045test_xmlNewInputStream(void) {
16046 int test_ret = 0;
16047
16048 int mem_base;
16049 xmlParserInputPtr ret_val;
16050 xmlParserCtxtPtr ctxt; /* an XML parser context */
16051 int n_ctxt;
16052
16053 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16054 mem_base = xmlMemBlocks();
16055 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16056
16057 ret_val = xmlNewInputStream(ctxt);
16058 desret_xmlParserInputPtr(ret_val);
16059 call_tests++;
16060 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16061 xmlResetLastError();
16062 if (mem_base != xmlMemBlocks()) {
16063 printf("Leak of %d blocks found in xmlNewInputStream",
16064 xmlMemBlocks() - mem_base);
16065 test_ret++;
16066 printf(" %d", n_ctxt);
16067 printf("\n");
16068 }
16069 }
16070
16071 function_tests++;
16072 return(test_ret);
16073}
16074
16075
16076static int
16077test_xmlNewStringInputStream(void) {
16078 int test_ret = 0;
16079
16080 int mem_base;
16081 xmlParserInputPtr ret_val;
16082 xmlParserCtxtPtr ctxt; /* an XML parser context */
16083 int n_ctxt;
16084 xmlChar * buffer; /* an memory buffer */
16085 int n_buffer;
16086
16087 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16088 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16089 mem_base = xmlMemBlocks();
16090 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16091 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16092
16093 ret_val = xmlNewStringInputStream(ctxt, buffer);
16094 desret_xmlParserInputPtr(ret_val);
16095 call_tests++;
16096 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16097 des_const_xmlChar_ptr(n_buffer, buffer, 1);
16098 xmlResetLastError();
16099 if (mem_base != xmlMemBlocks()) {
16100 printf("Leak of %d blocks found in xmlNewStringInputStream",
16101 xmlMemBlocks() - mem_base);
16102 test_ret++;
16103 printf(" %d", n_ctxt);
16104 printf(" %d", n_buffer);
16105 printf("\n");
16106 }
16107 }
16108 }
16109
16110 function_tests++;
16111 return(test_ret);
16112}
16113
16114
16115static int
16116test_xmlNextChar(void) {
16117 int test_ret = 0;
16118
16119 int mem_base;
16120 xmlParserCtxtPtr ctxt; /* the XML parser context */
16121 int n_ctxt;
16122
16123 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16124 mem_base = xmlMemBlocks();
16125 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16126
16127 xmlNextChar(ctxt);
16128 call_tests++;
16129 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16130 xmlResetLastError();
16131 if (mem_base != xmlMemBlocks()) {
16132 printf("Leak of %d blocks found in xmlNextChar",
16133 xmlMemBlocks() - mem_base);
16134 test_ret++;
16135 printf(" %d", n_ctxt);
16136 printf("\n");
16137 }
16138 }
16139
16140 function_tests++;
16141 return(test_ret);
16142}
16143
16144
16145static int
16146test_xmlParserInputShrink(void) {
16147 int test_ret = 0;
16148
16149 int mem_base;
16150 xmlParserInputPtr in; /* an XML parser input */
16151 int n_in;
16152
16153 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16154 mem_base = xmlMemBlocks();
16155 in = gen_xmlParserInputPtr(n_in, 0);
16156
16157 xmlParserInputShrink(in);
16158 call_tests++;
16159 des_xmlParserInputPtr(n_in, in, 0);
16160 xmlResetLastError();
16161 if (mem_base != xmlMemBlocks()) {
16162 printf("Leak of %d blocks found in xmlParserInputShrink",
16163 xmlMemBlocks() - mem_base);
16164 test_ret++;
16165 printf(" %d", n_in);
16166 printf("\n");
16167 }
16168 }
16169
16170 function_tests++;
16171 return(test_ret);
16172}
16173
16174
16175static int
16176test_xmlPopInput(void) {
16177 int test_ret = 0;
16178
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016179 int mem_base;
16180 xmlChar ret_val;
16181 xmlParserCtxtPtr ctxt; /* an XML parser context */
16182 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016183
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016184 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16185 mem_base = xmlMemBlocks();
16186 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16187
16188 ret_val = xmlPopInput(ctxt);
16189 desret_xmlChar(ret_val);
16190 call_tests++;
16191 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16192 xmlResetLastError();
16193 if (mem_base != xmlMemBlocks()) {
16194 printf("Leak of %d blocks found in xmlPopInput",
16195 xmlMemBlocks() - mem_base);
16196 test_ret++;
16197 printf(" %d", n_ctxt);
16198 printf("\n");
16199 }
16200 }
16201
16202 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016203 return(test_ret);
16204}
16205
16206
16207static int
16208test_xmlPushInput(void) {
16209 int test_ret = 0;
16210
16211 int mem_base;
16212 xmlParserCtxtPtr ctxt; /* an XML parser context */
16213 int n_ctxt;
16214 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16215 int n_input;
16216
16217 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16218 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16219 mem_base = xmlMemBlocks();
16220 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16221 input = gen_xmlParserInputPtr(n_input, 1);
16222
16223 xmlPushInput(ctxt, input);
16224 call_tests++;
16225 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16226 des_xmlParserInputPtr(n_input, input, 1);
16227 xmlResetLastError();
16228 if (mem_base != xmlMemBlocks()) {
16229 printf("Leak of %d blocks found in xmlPushInput",
16230 xmlMemBlocks() - mem_base);
16231 test_ret++;
16232 printf(" %d", n_ctxt);
16233 printf(" %d", n_input);
16234 printf("\n");
16235 }
16236 }
16237 }
16238
16239 function_tests++;
16240 return(test_ret);
16241}
16242
16243
16244static int
16245test_xmlSetEntityReferenceFunc(void) {
16246 int test_ret = 0;
16247
16248
16249 /* missing type support */
16250 return(test_ret);
16251}
16252
16253
16254static int
16255test_xmlSplitQName(void) {
16256 int test_ret = 0;
16257
16258 int mem_base;
16259 xmlChar * ret_val;
16260 xmlParserCtxtPtr ctxt; /* an XML parser context */
16261 int n_ctxt;
16262 xmlChar * name; /* an XML parser context */
16263 int n_name;
16264 xmlChar ** prefix; /* a xmlChar ** */
16265 int n_prefix;
16266
16267 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16268 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16269 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16270 mem_base = xmlMemBlocks();
16271 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16272 name = gen_const_xmlChar_ptr(n_name, 1);
16273 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16274
16275 ret_val = xmlSplitQName(ctxt, name, prefix);
16276 desret_xmlChar_ptr(ret_val);
16277 call_tests++;
16278 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16279 des_const_xmlChar_ptr(n_name, name, 1);
16280 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16281 xmlResetLastError();
16282 if (mem_base != xmlMemBlocks()) {
16283 printf("Leak of %d blocks found in xmlSplitQName",
16284 xmlMemBlocks() - mem_base);
16285 test_ret++;
16286 printf(" %d", n_ctxt);
16287 printf(" %d", n_name);
16288 printf(" %d", n_prefix);
16289 printf("\n");
16290 }
16291 }
16292 }
16293 }
16294
16295 function_tests++;
16296 return(test_ret);
16297}
16298
16299
16300static int
16301test_xmlStringCurrentChar(void) {
16302 int test_ret = 0;
16303
16304 int mem_base;
16305 int ret_val;
16306 xmlParserCtxtPtr ctxt; /* the XML parser context */
16307 int n_ctxt;
16308 xmlChar * cur; /* pointer to the beginning of the char */
16309 int n_cur;
16310 int * len; /* pointer to the length of the char read */
16311 int n_len;
16312
16313 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16314 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16315 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16316 mem_base = xmlMemBlocks();
16317 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16318 cur = gen_const_xmlChar_ptr(n_cur, 1);
16319 len = gen_int_ptr(n_len, 2);
16320
16321 ret_val = xmlStringCurrentChar(ctxt, cur, len);
16322 desret_int(ret_val);
16323 call_tests++;
16324 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16325 des_const_xmlChar_ptr(n_cur, cur, 1);
16326 des_int_ptr(n_len, len, 2);
16327 xmlResetLastError();
16328 if (mem_base != xmlMemBlocks()) {
16329 printf("Leak of %d blocks found in xmlStringCurrentChar",
16330 xmlMemBlocks() - mem_base);
16331 test_ret++;
16332 printf(" %d", n_ctxt);
16333 printf(" %d", n_cur);
16334 printf(" %d", n_len);
16335 printf("\n");
16336 }
16337 }
16338 }
16339 }
16340
16341 function_tests++;
16342 return(test_ret);
16343}
16344
16345
16346static int
16347test_xmlStringDecodeEntities(void) {
16348 int test_ret = 0;
16349
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016350 int mem_base;
16351 xmlChar * ret_val;
16352 xmlParserCtxtPtr ctxt; /* the parser context */
16353 int n_ctxt;
16354 xmlChar * str; /* the input string */
16355 int n_str;
16356 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16357 int n_what;
16358 xmlChar end; /* an end marker xmlChar, 0 if none */
16359 int n_end;
16360 xmlChar end2; /* an end marker xmlChar, 0 if none */
16361 int n_end2;
16362 xmlChar end3; /* an end marker xmlChar, 0 if none */
16363 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016364
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016365 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16366 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16367 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16368 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16369 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16370 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16371 mem_base = xmlMemBlocks();
16372 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16373 str = gen_const_xmlChar_ptr(n_str, 1);
16374 what = gen_int(n_what, 2);
16375 end = gen_xmlChar(n_end, 3);
16376 end2 = gen_xmlChar(n_end2, 4);
16377 end3 = gen_xmlChar(n_end3, 5);
16378
16379 ret_val = xmlStringDecodeEntities(ctxt, str, what, end, end2, end3);
16380 desret_xmlChar_ptr(ret_val);
16381 call_tests++;
16382 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16383 des_const_xmlChar_ptr(n_str, str, 1);
16384 des_int(n_what, what, 2);
16385 des_xmlChar(n_end, end, 3);
16386 des_xmlChar(n_end2, end2, 4);
16387 des_xmlChar(n_end3, end3, 5);
16388 xmlResetLastError();
16389 if (mem_base != xmlMemBlocks()) {
16390 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16391 xmlMemBlocks() - mem_base);
16392 test_ret++;
16393 printf(" %d", n_ctxt);
16394 printf(" %d", n_str);
16395 printf(" %d", n_what);
16396 printf(" %d", n_end);
16397 printf(" %d", n_end2);
16398 printf(" %d", n_end3);
16399 printf("\n");
16400 }
16401 }
16402 }
16403 }
16404 }
16405 }
16406 }
16407
16408 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016409 return(test_ret);
16410}
16411
16412
16413static int
16414test_xmlStringLenDecodeEntities(void) {
16415 int test_ret = 0;
16416
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016417 int mem_base;
16418 xmlChar * ret_val;
16419 xmlParserCtxtPtr ctxt; /* the parser context */
16420 int n_ctxt;
16421 xmlChar * str; /* the input string */
16422 int n_str;
16423 int len; /* the string length */
16424 int n_len;
16425 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16426 int n_what;
16427 xmlChar end; /* an end marker xmlChar, 0 if none */
16428 int n_end;
16429 xmlChar end2; /* an end marker xmlChar, 0 if none */
16430 int n_end2;
16431 xmlChar end3; /* an end marker xmlChar, 0 if none */
16432 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016433
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016434 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16435 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16436 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16437 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16438 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16439 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16440 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16441 mem_base = xmlMemBlocks();
16442 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16443 str = gen_const_xmlChar_ptr(n_str, 1);
16444 len = gen_int(n_len, 2);
16445 what = gen_int(n_what, 3);
16446 end = gen_xmlChar(n_end, 4);
16447 end2 = gen_xmlChar(n_end2, 5);
16448 end3 = gen_xmlChar(n_end3, 6);
16449
16450 ret_val = xmlStringLenDecodeEntities(ctxt, str, len, what, end, end2, end3);
16451 desret_xmlChar_ptr(ret_val);
16452 call_tests++;
16453 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16454 des_const_xmlChar_ptr(n_str, str, 1);
16455 des_int(n_len, len, 2);
16456 des_int(n_what, what, 3);
16457 des_xmlChar(n_end, end, 4);
16458 des_xmlChar(n_end2, end2, 5);
16459 des_xmlChar(n_end3, end3, 6);
16460 xmlResetLastError();
16461 if (mem_base != xmlMemBlocks()) {
16462 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16463 xmlMemBlocks() - mem_base);
16464 test_ret++;
16465 printf(" %d", n_ctxt);
16466 printf(" %d", n_str);
16467 printf(" %d", n_len);
16468 printf(" %d", n_what);
16469 printf(" %d", n_end);
16470 printf(" %d", n_end2);
16471 printf(" %d", n_end3);
16472 printf("\n");
16473 }
16474 }
16475 }
16476 }
16477 }
16478 }
16479 }
16480 }
16481
16482 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016483 return(test_ret);
16484}
16485
16486
16487static int
16488test_xmlSwitchEncoding(void) {
16489 int test_ret = 0;
16490
16491 int mem_base;
16492 int ret_val;
16493 xmlParserCtxtPtr ctxt; /* the parser context */
16494 int n_ctxt;
16495 xmlCharEncoding enc; /* the encoding value (number) */
16496 int n_enc;
16497
16498 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16499 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16500 mem_base = xmlMemBlocks();
16501 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16502 enc = gen_xmlCharEncoding(n_enc, 1);
16503
16504 ret_val = xmlSwitchEncoding(ctxt, enc);
16505 desret_int(ret_val);
16506 call_tests++;
16507 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16508 des_xmlCharEncoding(n_enc, enc, 1);
16509 xmlResetLastError();
16510 if (mem_base != xmlMemBlocks()) {
16511 printf("Leak of %d blocks found in xmlSwitchEncoding",
16512 xmlMemBlocks() - mem_base);
16513 test_ret++;
16514 printf(" %d", n_ctxt);
16515 printf(" %d", n_enc);
16516 printf("\n");
16517 }
16518 }
16519 }
16520
16521 function_tests++;
16522 return(test_ret);
16523}
16524
16525
16526static int
16527test_xmlSwitchInputEncoding(void) {
16528 int test_ret = 0;
16529
16530 int mem_base;
16531 int ret_val;
16532 xmlParserCtxtPtr ctxt; /* the parser context */
16533 int n_ctxt;
16534 xmlParserInputPtr input; /* the input stream */
16535 int n_input;
16536 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16537 int n_handler;
16538
16539 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16540 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16541 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16542 mem_base = xmlMemBlocks();
16543 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16544 input = gen_xmlParserInputPtr(n_input, 1);
16545 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16546
16547 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16548 desret_int(ret_val);
16549 call_tests++;
16550 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16551 des_xmlParserInputPtr(n_input, input, 1);
16552 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16553 xmlResetLastError();
16554 if (mem_base != xmlMemBlocks()) {
16555 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16556 xmlMemBlocks() - mem_base);
16557 test_ret++;
16558 printf(" %d", n_ctxt);
16559 printf(" %d", n_input);
16560 printf(" %d", n_handler);
16561 printf("\n");
16562 }
16563 }
16564 }
16565 }
16566
16567 function_tests++;
16568 return(test_ret);
16569}
16570
16571
16572static int
16573test_xmlSwitchToEncoding(void) {
16574 int test_ret = 0;
16575
16576 int mem_base;
16577 int ret_val;
16578 xmlParserCtxtPtr ctxt; /* the parser context */
16579 int n_ctxt;
16580 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16581 int n_handler;
16582
16583 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16584 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16585 mem_base = xmlMemBlocks();
16586 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16587 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16588
16589 ret_val = xmlSwitchToEncoding(ctxt, handler);
16590 desret_int(ret_val);
16591 call_tests++;
16592 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16593 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16594 xmlResetLastError();
16595 if (mem_base != xmlMemBlocks()) {
16596 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16597 xmlMemBlocks() - mem_base);
16598 test_ret++;
16599 printf(" %d", n_ctxt);
16600 printf(" %d", n_handler);
16601 printf("\n");
16602 }
16603 }
16604 }
16605
16606 function_tests++;
16607 return(test_ret);
16608}
16609
16610static int
16611test_parserInternals(void) {
16612 int test_ret = 0;
16613
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016614 printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016615 test_ret += test_htmlCreateFileParserCtxt();
16616 test_ret += test_htmlInitAutoClose();
16617 test_ret += test_inputPop();
16618 test_ret += test_inputPush();
16619 test_ret += test_namePop();
16620 test_ret += test_namePush();
16621 test_ret += test_nodePop();
16622 test_ret += test_nodePush();
16623 test_ret += test_xmlCheckLanguageID();
16624 test_ret += test_xmlCopyChar();
16625 test_ret += test_xmlCopyCharMultiByte();
16626 test_ret += test_xmlCreateEntityParserCtxt();
16627 test_ret += test_xmlCreateFileParserCtxt();
16628 test_ret += test_xmlCreateMemoryParserCtxt();
16629 test_ret += test_xmlCreateURLParserCtxt();
16630 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016631 test_ret += test_xmlErrMemory();
16632 test_ret += test_xmlIsLetter();
16633 test_ret += test_xmlNewEntityInputStream();
16634 test_ret += test_xmlNewInputFromFile();
16635 test_ret += test_xmlNewInputStream();
16636 test_ret += test_xmlNewStringInputStream();
16637 test_ret += test_xmlNextChar();
16638 test_ret += test_xmlParserInputShrink();
16639 test_ret += test_xmlPopInput();
16640 test_ret += test_xmlPushInput();
16641 test_ret += test_xmlSetEntityReferenceFunc();
16642 test_ret += test_xmlSplitQName();
16643 test_ret += test_xmlStringCurrentChar();
16644 test_ret += test_xmlStringDecodeEntities();
16645 test_ret += test_xmlStringLenDecodeEntities();
16646 test_ret += test_xmlSwitchEncoding();
16647 test_ret += test_xmlSwitchInputEncoding();
16648 test_ret += test_xmlSwitchToEncoding();
16649
16650 if (test_ret != 0)
16651 printf("Module parserInternals: %d errors\n", test_ret);
16652 return(test_ret);
16653}
16654
Daniel Veillardce682bc2004-11-05 17:22:25 +000016655#define gen_nb_xmlPatternPtr 1
16656static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16657 return(NULL);
16658}
16659static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16660}
16661
Daniel Veillardd93f6252004-11-02 15:53:51 +000016662static int
16663test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016665
Daniel Veillardce682bc2004-11-05 17:22:25 +000016666#ifdef LIBXML_PATTERN_ENABLED
16667 int mem_base;
16668 int ret_val;
16669 xmlPatternPtr comp; /* the precompiled pattern */
16670 int n_comp;
16671 xmlNodePtr node; /* a node */
16672 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016673
Daniel Veillardce682bc2004-11-05 17:22:25 +000016674 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16675 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16676 mem_base = xmlMemBlocks();
16677 comp = gen_xmlPatternPtr(n_comp, 0);
16678 node = gen_xmlNodePtr(n_node, 1);
16679
16680 ret_val = xmlPatternMatch(comp, node);
16681 desret_int(ret_val);
16682 call_tests++;
16683 des_xmlPatternPtr(n_comp, comp, 0);
16684 des_xmlNodePtr(n_node, node, 1);
16685 xmlResetLastError();
16686 if (mem_base != xmlMemBlocks()) {
16687 printf("Leak of %d blocks found in xmlPatternMatch",
16688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016689 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016690 printf(" %d", n_comp);
16691 printf(" %d", n_node);
16692 printf("\n");
16693 }
16694 }
16695 }
16696#endif
16697
16698 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016700}
16701
16702
16703static int
16704test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016706
16707
16708 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016710}
16711
16712static int
16713test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016715
Daniel Veillardce682bc2004-11-05 17:22:25 +000016716 printf("Testing pattern : 1 of 4 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000016717 test_ret += test_xmlPatternMatch();
16718 test_ret += test_xmlPatterncompile();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016719
Daniel Veillard42595322004-11-08 10:52:06 +000016720 if (test_ret != 0)
16721 printf("Module pattern: %d errors\n", test_ret);
16722 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016723}
16724
Daniel Veillardce682bc2004-11-05 17:22:25 +000016725#define gen_nb_xmlRelaxNGPtr 1
16726static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16727 return(NULL);
16728}
16729static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16730}
16731
Daniel Veillardd93f6252004-11-02 15:53:51 +000016732static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016733test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016735
Daniel Veillardce682bc2004-11-05 17:22:25 +000016736#ifdef LIBXML_SCHEMAS_ENABLED
16737#ifdef LIBXML_OUTPUT_ENABLED
16738 int mem_base;
16739 FILE * output; /* the file output */
16740 int n_output;
16741 xmlRelaxNGPtr schema; /* a schema structure */
16742 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016743
Daniel Veillardce682bc2004-11-05 17:22:25 +000016744 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16745 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16746 mem_base = xmlMemBlocks();
16747 output = gen_FILE_ptr(n_output, 0);
16748 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16749
16750 xmlRelaxNGDump(output, schema);
16751 call_tests++;
16752 des_FILE_ptr(n_output, output, 0);
16753 des_xmlRelaxNGPtr(n_schema, schema, 1);
16754 xmlResetLastError();
16755 if (mem_base != xmlMemBlocks()) {
16756 printf("Leak of %d blocks found in xmlRelaxNGDump",
16757 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016758 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016759 printf(" %d", n_output);
16760 printf(" %d", n_schema);
16761 printf("\n");
16762 }
16763 }
16764 }
16765#endif
16766#endif
16767
16768 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016770}
16771
16772
16773static int
16774test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016776
Daniel Veillardce682bc2004-11-05 17:22:25 +000016777#ifdef LIBXML_SCHEMAS_ENABLED
16778#ifdef LIBXML_OUTPUT_ENABLED
16779 int mem_base;
16780 FILE * output; /* the file output */
16781 int n_output;
16782 xmlRelaxNGPtr schema; /* a schema structure */
16783 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016784
Daniel Veillardce682bc2004-11-05 17:22:25 +000016785 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16786 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16787 mem_base = xmlMemBlocks();
16788 output = gen_FILE_ptr(n_output, 0);
16789 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16790
16791 xmlRelaxNGDumpTree(output, schema);
16792 call_tests++;
16793 des_FILE_ptr(n_output, output, 0);
16794 des_xmlRelaxNGPtr(n_schema, schema, 1);
16795 xmlResetLastError();
16796 if (mem_base != xmlMemBlocks()) {
16797 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
16798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016799 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016800 printf(" %d", n_output);
16801 printf(" %d", n_schema);
16802 printf("\n");
16803 }
16804 }
16805 }
16806#endif
16807#endif
16808
16809 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016811}
16812
16813
Daniel Veillardce682bc2004-11-05 17:22:25 +000016814#define gen_nb_xmlRelaxNGParserCtxtPtr 1
16815static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16816 return(NULL);
16817}
16818static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16819}
16820
16821#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
16822static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16823 return(NULL);
16824}
16825static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16826}
16827
16828#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
16829static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16830 return(NULL);
16831}
16832static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16833}
16834
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016835#define gen_nb_void_ptr_ptr 1
16836static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16837 return(NULL);
16838}
16839static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16840}
16841
Daniel Veillardd93f6252004-11-02 15:53:51 +000016842static int
16843test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016844 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016845
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016846#ifdef LIBXML_SCHEMAS_ENABLED
16847 int mem_base;
16848 int ret_val;
16849 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
16850 int n_ctxt;
16851 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
16852 int n_err;
16853 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
16854 int n_warn;
16855 void ** ctx; /* contextual data for the callbacks result */
16856 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016857
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016858 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
16859 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16860 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16861 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16862 mem_base = xmlMemBlocks();
16863 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
16864 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16865 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16866 ctx = gen_void_ptr_ptr(n_ctx, 3);
16867
16868 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
16869 desret_int(ret_val);
16870 call_tests++;
16871 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
16872 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16873 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16874 des_void_ptr_ptr(n_ctx, ctx, 3);
16875 xmlResetLastError();
16876 if (mem_base != xmlMemBlocks()) {
16877 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
16878 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016879 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016880 printf(" %d", n_ctxt);
16881 printf(" %d", n_err);
16882 printf(" %d", n_warn);
16883 printf(" %d", n_ctx);
16884 printf("\n");
16885 }
16886 }
16887 }
16888 }
16889 }
16890#endif
16891
16892 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016894}
16895
16896
Daniel Veillardce682bc2004-11-05 17:22:25 +000016897#define gen_nb_xmlRelaxNGValidCtxtPtr 1
16898static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16899 return(NULL);
16900}
16901static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16902}
16903
Daniel Veillardd93f6252004-11-02 15:53:51 +000016904static int
16905test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016907
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016908#ifdef LIBXML_SCHEMAS_ENABLED
16909 int mem_base;
16910 int ret_val;
16911 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
16912 int n_ctxt;
16913 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
16914 int n_err;
16915 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
16916 int n_warn;
16917 void ** ctx; /* the functions context result */
16918 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016919
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016920 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
16921 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16922 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16923 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16924 mem_base = xmlMemBlocks();
16925 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
16926 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16927 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16928 ctx = gen_void_ptr_ptr(n_ctx, 3);
16929
16930 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
16931 desret_int(ret_val);
16932 call_tests++;
16933 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
16934 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16935 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16936 des_void_ptr_ptr(n_ctx, ctx, 3);
16937 xmlResetLastError();
16938 if (mem_base != xmlMemBlocks()) {
16939 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
16940 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016941 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016942 printf(" %d", n_ctxt);
16943 printf(" %d", n_err);
16944 printf(" %d", n_warn);
16945 printf(" %d", n_ctx);
16946 printf("\n");
16947 }
16948 }
16949 }
16950 }
16951 }
16952#endif
16953
16954 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016956}
16957
16958
16959static int
Daniel Veillard34099b42004-11-04 17:34:35 +000016960test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016961 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000016962
16963#ifdef LIBXML_SCHEMAS_ENABLED
16964 int mem_base;
16965 int ret_val;
16966
16967 mem_base = xmlMemBlocks();
16968
16969 ret_val = xmlRelaxNGInitTypes();
16970 desret_int(ret_val);
16971 call_tests++;
16972 xmlResetLastError();
16973 if (mem_base != xmlMemBlocks()) {
16974 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
16975 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016976 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000016977 printf("\n");
16978 }
16979#endif
16980
16981 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000016982 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000016983}
16984
16985
16986static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016987test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016988 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016989
Daniel Veillard42595322004-11-08 10:52:06 +000016990#ifdef LIBXML_SCHEMAS_ENABLED
16991 int mem_base;
16992 xmlRelaxNGParserCtxtPtr ret_val;
16993 xmlDocPtr doc; /* a preparsed document tree */
16994 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016995
Daniel Veillard42595322004-11-08 10:52:06 +000016996 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
16997 mem_base = xmlMemBlocks();
16998 doc = gen_xmlDocPtr(n_doc, 0);
16999
17000 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17001 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17002 call_tests++;
17003 des_xmlDocPtr(n_doc, doc, 0);
17004 xmlResetLastError();
17005 if (mem_base != xmlMemBlocks()) {
17006 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17007 xmlMemBlocks() - mem_base);
17008 test_ret++;
17009 printf(" %d", n_doc);
17010 printf("\n");
17011 }
17012 }
17013#endif
17014
17015 function_tests++;
17016 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017017}
17018
17019
17020static int
17021test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017022 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017023
Daniel Veillard42595322004-11-08 10:52:06 +000017024#ifdef LIBXML_SCHEMAS_ENABLED
17025 int mem_base;
17026 xmlRelaxNGParserCtxtPtr ret_val;
17027 char * buffer; /* a pointer to a char array containing the schemas */
17028 int n_buffer;
17029 int size; /* the size of the array */
17030 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017031
Daniel Veillard42595322004-11-08 10:52:06 +000017032 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17033 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17034 mem_base = xmlMemBlocks();
17035 buffer = gen_const_char_ptr(n_buffer, 0);
17036 size = gen_int(n_size, 1);
17037
17038 ret_val = xmlRelaxNGNewMemParserCtxt(buffer, size);
17039 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17040 call_tests++;
17041 des_const_char_ptr(n_buffer, buffer, 0);
17042 des_int(n_size, size, 1);
17043 xmlResetLastError();
17044 if (mem_base != xmlMemBlocks()) {
17045 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17046 xmlMemBlocks() - mem_base);
17047 test_ret++;
17048 printf(" %d", n_buffer);
17049 printf(" %d", n_size);
17050 printf("\n");
17051 }
17052 }
17053 }
17054#endif
17055
17056 function_tests++;
17057 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017058}
17059
17060
17061static int
17062test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017064
Daniel Veillard42595322004-11-08 10:52:06 +000017065#ifdef LIBXML_SCHEMAS_ENABLED
17066 int mem_base;
17067 xmlRelaxNGParserCtxtPtr ret_val;
17068 char * URL; /* the location of the schema */
17069 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017070
Daniel Veillard42595322004-11-08 10:52:06 +000017071 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17072 mem_base = xmlMemBlocks();
17073 URL = gen_const_char_ptr(n_URL, 0);
17074
17075 ret_val = xmlRelaxNGNewParserCtxt(URL);
17076 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17077 call_tests++;
17078 des_const_char_ptr(n_URL, URL, 0);
17079 xmlResetLastError();
17080 if (mem_base != xmlMemBlocks()) {
17081 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17082 xmlMemBlocks() - mem_base);
17083 test_ret++;
17084 printf(" %d", n_URL);
17085 printf("\n");
17086 }
17087 }
17088#endif
17089
17090 function_tests++;
17091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017092}
17093
17094
17095static int
17096test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017098
17099
17100 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017102}
17103
17104
17105static int
17106test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017108
17109
17110 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017111 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017112}
17113
17114
17115static int
17116test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017117 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017118
17119
17120 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017122}
17123
17124
17125static int
17126test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017128
17129
17130 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017131 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017132}
17133
17134
17135static int
17136test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017137 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017138
Daniel Veillardce682bc2004-11-05 17:22:25 +000017139#ifdef LIBXML_SCHEMAS_ENABLED
17140 int mem_base;
17141 int ret_val;
17142 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17143 int n_ctxt;
17144 xmlDocPtr doc; /* a parsed document tree */
17145 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017146
Daniel Veillardce682bc2004-11-05 17:22:25 +000017147 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17148 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17149 mem_base = xmlMemBlocks();
17150 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17151 doc = gen_xmlDocPtr(n_doc, 1);
17152
17153 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17154 desret_int(ret_val);
17155 call_tests++;
17156 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17157 des_xmlDocPtr(n_doc, doc, 1);
17158 xmlResetLastError();
17159 if (mem_base != xmlMemBlocks()) {
17160 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017162 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017163 printf(" %d", n_ctxt);
17164 printf(" %d", n_doc);
17165 printf("\n");
17166 }
17167 }
17168 }
17169#endif
17170
17171 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017173}
17174
17175
17176static int
17177test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017179
Daniel Veillardce682bc2004-11-05 17:22:25 +000017180#ifdef LIBXML_SCHEMAS_ENABLED
17181 int mem_base;
17182 int ret_val;
17183 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17184 int n_ctxt;
17185 xmlDocPtr doc; /* a document instance */
17186 int n_doc;
17187 xmlNodePtr elem; /* an element instance */
17188 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017189
Daniel Veillardce682bc2004-11-05 17:22:25 +000017190 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17191 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17192 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17193 mem_base = xmlMemBlocks();
17194 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17195 doc = gen_xmlDocPtr(n_doc, 1);
17196 elem = gen_xmlNodePtr(n_elem, 2);
17197
17198 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17199 desret_int(ret_val);
17200 call_tests++;
17201 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17202 des_xmlDocPtr(n_doc, doc, 1);
17203 des_xmlNodePtr(n_elem, elem, 2);
17204 xmlResetLastError();
17205 if (mem_base != xmlMemBlocks()) {
17206 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017208 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017209 printf(" %d", n_ctxt);
17210 printf(" %d", n_doc);
17211 printf(" %d", n_elem);
17212 printf("\n");
17213 }
17214 }
17215 }
17216 }
17217#endif
17218
17219 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017221}
17222
17223
17224static int
17225test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017227
Daniel Veillardce682bc2004-11-05 17:22:25 +000017228#ifdef LIBXML_SCHEMAS_ENABLED
17229 int mem_base;
17230 int ret_val;
17231 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17232 int n_ctxt;
17233 xmlDocPtr doc; /* a document instance */
17234 int n_doc;
17235 xmlNodePtr elem; /* an element instance */
17236 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017237
Daniel Veillardce682bc2004-11-05 17:22:25 +000017238 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17239 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17240 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17241 mem_base = xmlMemBlocks();
17242 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17243 doc = gen_xmlDocPtr(n_doc, 1);
17244 elem = gen_xmlNodePtr(n_elem, 2);
17245
17246 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17247 desret_int(ret_val);
17248 call_tests++;
17249 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17250 des_xmlDocPtr(n_doc, doc, 1);
17251 des_xmlNodePtr(n_elem, elem, 2);
17252 xmlResetLastError();
17253 if (mem_base != xmlMemBlocks()) {
17254 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17255 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017256 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017257 printf(" %d", n_ctxt);
17258 printf(" %d", n_doc);
17259 printf(" %d", n_elem);
17260 printf("\n");
17261 }
17262 }
17263 }
17264 }
17265#endif
17266
17267 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017268 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017269}
17270
17271
17272static int
17273test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017274 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017275
Daniel Veillardce682bc2004-11-05 17:22:25 +000017276#ifdef LIBXML_SCHEMAS_ENABLED
17277 int mem_base;
17278 int ret_val;
17279 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17280 int n_ctxt;
17281 xmlChar * data; /* some character data read */
17282 int n_data;
17283 int len; /* the lenght of the data */
17284 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017285
Daniel Veillardce682bc2004-11-05 17:22:25 +000017286 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17287 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17288 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17289 mem_base = xmlMemBlocks();
17290 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17291 data = gen_const_xmlChar_ptr(n_data, 1);
17292 len = gen_int(n_len, 2);
17293
17294 ret_val = xmlRelaxNGValidatePushCData(ctxt, data, len);
17295 desret_int(ret_val);
17296 call_tests++;
17297 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17298 des_const_xmlChar_ptr(n_data, data, 1);
17299 des_int(n_len, len, 2);
17300 xmlResetLastError();
17301 if (mem_base != xmlMemBlocks()) {
17302 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17303 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017304 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017305 printf(" %d", n_ctxt);
17306 printf(" %d", n_data);
17307 printf(" %d", n_len);
17308 printf("\n");
17309 }
17310 }
17311 }
17312 }
17313#endif
17314
17315 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017317}
17318
17319
17320static int
17321test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017323
Daniel Veillardce682bc2004-11-05 17:22:25 +000017324#ifdef LIBXML_SCHEMAS_ENABLED
17325 int mem_base;
17326 int ret_val;
17327 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17328 int n_ctxt;
17329 xmlDocPtr doc; /* a document instance */
17330 int n_doc;
17331 xmlNodePtr elem; /* an element instance */
17332 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017333
Daniel Veillardce682bc2004-11-05 17:22:25 +000017334 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17335 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17336 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17337 mem_base = xmlMemBlocks();
17338 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17339 doc = gen_xmlDocPtr(n_doc, 1);
17340 elem = gen_xmlNodePtr(n_elem, 2);
17341
17342 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17343 desret_int(ret_val);
17344 call_tests++;
17345 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17346 des_xmlDocPtr(n_doc, doc, 1);
17347 des_xmlNodePtr(n_elem, elem, 2);
17348 xmlResetLastError();
17349 if (mem_base != xmlMemBlocks()) {
17350 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17351 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017352 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017353 printf(" %d", n_ctxt);
17354 printf(" %d", n_doc);
17355 printf(" %d", n_elem);
17356 printf("\n");
17357 }
17358 }
17359 }
17360 }
17361#endif
17362
17363 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017364 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017365}
17366
17367
17368static int
17369test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017370 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017371
Daniel Veillardce682bc2004-11-05 17:22:25 +000017372#ifdef LIBXML_SCHEMAS_ENABLED
17373 int mem_base;
17374 int ret_val;
17375 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17376 int n_ctxt;
17377 int flags; /* a set of flags values */
17378 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017379
Daniel Veillardce682bc2004-11-05 17:22:25 +000017380 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17381 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17382 mem_base = xmlMemBlocks();
17383 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17384 flags = gen_int(n_flags, 1);
17385
17386 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17387 desret_int(ret_val);
17388 call_tests++;
17389 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17390 des_int(n_flags, flags, 1);
17391 xmlResetLastError();
17392 if (mem_base != xmlMemBlocks()) {
17393 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017395 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017396 printf(" %d", n_ctxt);
17397 printf(" %d", n_flags);
17398 printf("\n");
17399 }
17400 }
17401 }
17402#endif
17403
17404 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017406}
17407
17408static int
17409test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017411
Daniel Veillard42595322004-11-08 10:52:06 +000017412 printf("Testing relaxng : 14 of 22 functions ...\n");
17413 test_ret += test_xmlRelaxNGDump();
17414 test_ret += test_xmlRelaxNGDumpTree();
17415 test_ret += test_xmlRelaxNGGetParserErrors();
17416 test_ret += test_xmlRelaxNGGetValidErrors();
17417 test_ret += test_xmlRelaxNGInitTypes();
17418 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17419 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17420 test_ret += test_xmlRelaxNGNewParserCtxt();
17421 test_ret += test_xmlRelaxNGNewValidCtxt();
17422 test_ret += test_xmlRelaxNGParse();
17423 test_ret += test_xmlRelaxNGSetParserErrors();
17424 test_ret += test_xmlRelaxNGSetValidErrors();
17425 test_ret += test_xmlRelaxNGValidateDoc();
17426 test_ret += test_xmlRelaxNGValidateFullElement();
17427 test_ret += test_xmlRelaxNGValidatePopElement();
17428 test_ret += test_xmlRelaxNGValidatePushCData();
17429 test_ret += test_xmlRelaxNGValidatePushElement();
17430 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017431
Daniel Veillard42595322004-11-08 10:52:06 +000017432 if (test_ret != 0)
17433 printf("Module relaxng: %d errors\n", test_ret);
17434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017435}
17436static int
17437test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017438 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017439
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000017440 printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017441
Daniel Veillard42595322004-11-08 10:52:06 +000017442 if (test_ret != 0)
17443 printf("Module schemasInternals: %d errors\n", test_ret);
17444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017445}
17446
17447static int
17448test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017449 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017450
17451 int mem_base;
17452 xmlNodePtr ret_val;
17453 xmlNodePtr parent; /* the parent node */
17454 int n_parent;
17455 xmlNodePtr cur; /* the child node */
17456 int n_cur;
17457
Daniel Veillarda03e3652004-11-02 18:45:30 +000017458 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017459 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17460 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017461 parent = gen_xmlNodePtr(n_parent, 0);
17462 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017463
17464 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017465 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017466 desret_xmlNodePtr(ret_val);
17467 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017468 des_xmlNodePtr(n_parent, parent, 0);
17469 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017470 xmlResetLastError();
17471 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017472 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017474 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017475 printf(" %d", n_parent);
17476 printf(" %d", n_cur);
17477 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017478 }
17479 }
17480 }
17481
Daniel Veillard3d97e662004-11-04 10:49:00 +000017482 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017484}
17485
17486
17487static int
17488test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017490
17491 int mem_base;
17492 xmlNodePtr ret_val;
17493 xmlNodePtr parent; /* the parent node */
17494 int n_parent;
17495 xmlNodePtr cur; /* the first node in the list */
17496 int n_cur;
17497
Daniel Veillarda03e3652004-11-02 18:45:30 +000017498 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017499 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17500 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017501 parent = gen_xmlNodePtr(n_parent, 0);
17502 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017503
17504 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017505 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017506 desret_xmlNodePtr(ret_val);
17507 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017508 des_xmlNodePtr(n_parent, parent, 0);
17509 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017510 xmlResetLastError();
17511 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017512 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017513 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017514 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017515 printf(" %d", n_parent);
17516 printf(" %d", n_cur);
17517 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017518 }
17519 }
17520 }
17521
Daniel Veillard3d97e662004-11-04 10:49:00 +000017522 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017524}
17525
17526
17527static int
17528test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017530
17531 int mem_base;
17532 xmlNodePtr ret_val;
17533 xmlNodePtr cur; /* the child node */
17534 int n_cur;
17535 xmlNodePtr elem; /* the new node */
17536 int n_elem;
17537
17538 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017539 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017540 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017541 cur = gen_xmlNodePtr(n_cur, 0);
17542 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017543
17544 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017545 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017546 desret_xmlNodePtr(ret_val);
17547 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017548 des_xmlNodePtr(n_cur, cur, 0);
17549 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017550 xmlResetLastError();
17551 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017552 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017554 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017555 printf(" %d", n_cur);
17556 printf(" %d", n_elem);
17557 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017558 }
17559 }
17560 }
17561
Daniel Veillard3d97e662004-11-04 10:49:00 +000017562 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017564}
17565
17566
17567static int
17568test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017570
17571#ifdef LIBXML_TREE_ENABLED
17572 int mem_base;
17573 xmlNodePtr ret_val;
17574 xmlNodePtr cur; /* the child node */
17575 int n_cur;
17576 xmlNodePtr elem; /* the new node */
17577 int n_elem;
17578
17579 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017580 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017581 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017582 cur = gen_xmlNodePtr(n_cur, 0);
17583 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017584
17585 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017586 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017587 desret_xmlNodePtr(ret_val);
17588 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017589 des_xmlNodePtr(n_cur, cur, 0);
17590 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017591 xmlResetLastError();
17592 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017593 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017595 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017596 printf(" %d", n_cur);
17597 printf(" %d", n_elem);
17598 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017599 }
17600 }
17601 }
17602#endif
17603
Daniel Veillard3d97e662004-11-04 10:49:00 +000017604 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017606}
17607
17608
17609static int
17610test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017612
17613 int mem_base;
17614 xmlNodePtr ret_val;
17615 xmlNodePtr cur; /* the child node */
17616 int n_cur;
17617 xmlNodePtr elem; /* the new node */
17618 int n_elem;
17619
17620 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017621 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017622 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017623 cur = gen_xmlNodePtr(n_cur, 0);
17624 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017625
17626 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017627 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017628 desret_xmlNodePtr(ret_val);
17629 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017630 des_xmlNodePtr(n_cur, cur, 0);
17631 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017632 xmlResetLastError();
17633 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017634 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017635 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017636 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017637 printf(" %d", n_cur);
17638 printf(" %d", n_elem);
17639 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017640 }
17641 }
17642 }
17643
Daniel Veillard3d97e662004-11-04 10:49:00 +000017644 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017646}
17647
17648
17649static int
17650test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017652
Daniel Veillardce244ad2004-11-05 10:03:46 +000017653 int mem_base;
17654 xmlBufferPtr buf; /* the XML buffer output */
17655 int n_buf;
17656 xmlDocPtr doc; /* the document */
17657 int n_doc;
17658 xmlAttrPtr attr; /* the attribute node */
17659 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017660 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017661 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017662
Daniel Veillardce244ad2004-11-05 10:03:46 +000017663 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17664 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17665 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17666 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17667 mem_base = xmlMemBlocks();
17668 buf = gen_xmlBufferPtr(n_buf, 0);
17669 doc = gen_xmlDocPtr(n_doc, 1);
17670 attr = gen_xmlAttrPtr(n_attr, 2);
17671 string = gen_const_xmlChar_ptr(n_string, 3);
17672
17673 xmlAttrSerializeTxtContent(buf, doc, attr, string);
17674 call_tests++;
17675 des_xmlBufferPtr(n_buf, buf, 0);
17676 des_xmlDocPtr(n_doc, doc, 1);
17677 des_xmlAttrPtr(n_attr, attr, 2);
17678 des_const_xmlChar_ptr(n_string, string, 3);
17679 xmlResetLastError();
17680 if (mem_base != xmlMemBlocks()) {
17681 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017683 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017684 printf(" %d", n_buf);
17685 printf(" %d", n_doc);
17686 printf(" %d", n_attr);
17687 printf(" %d", n_string);
17688 printf("\n");
17689 }
17690 }
17691 }
17692 }
17693 }
17694
17695 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017696 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017697}
17698
17699
17700static int
17701test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017702 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017703
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017704 int mem_base;
17705 int ret_val;
17706 xmlBufferPtr buf; /* the buffer to dump */
17707 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017708 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017709 int n_str;
17710 int len; /* the number of #xmlChar to add */
17711 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017712
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017713 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17714 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17715 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17716 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017717 buf = gen_xmlBufferPtr(n_buf, 0);
17718 str = gen_const_xmlChar_ptr(n_str, 1);
17719 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017720
17721 ret_val = xmlBufferAdd(buf, str, len);
17722 desret_int(ret_val);
17723 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017724 des_xmlBufferPtr(n_buf, buf, 0);
17725 des_const_xmlChar_ptr(n_str, str, 1);
17726 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017727 xmlResetLastError();
17728 if (mem_base != xmlMemBlocks()) {
17729 printf("Leak of %d blocks found in xmlBufferAdd",
17730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017731 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017732 printf(" %d", n_buf);
17733 printf(" %d", n_str);
17734 printf(" %d", n_len);
17735 printf("\n");
17736 }
17737 }
17738 }
17739 }
17740
Daniel Veillard3d97e662004-11-04 10:49:00 +000017741 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017742 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017743}
17744
17745
17746static int
17747test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017748 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017749
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017750 int mem_base;
17751 int ret_val;
17752 xmlBufferPtr buf; /* the buffer */
17753 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017754 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017755 int n_str;
17756 int len; /* the number of #xmlChar to add */
17757 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017758
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017759 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17760 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17761 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17762 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017763 buf = gen_xmlBufferPtr(n_buf, 0);
17764 str = gen_const_xmlChar_ptr(n_str, 1);
17765 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017766
17767 ret_val = xmlBufferAddHead(buf, str, len);
17768 desret_int(ret_val);
17769 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017770 des_xmlBufferPtr(n_buf, buf, 0);
17771 des_const_xmlChar_ptr(n_str, str, 1);
17772 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017773 xmlResetLastError();
17774 if (mem_base != xmlMemBlocks()) {
17775 printf("Leak of %d blocks found in xmlBufferAddHead",
17776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017777 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017778 printf(" %d", n_buf);
17779 printf(" %d", n_str);
17780 printf(" %d", n_len);
17781 printf("\n");
17782 }
17783 }
17784 }
17785 }
17786
Daniel Veillard3d97e662004-11-04 10:49:00 +000017787 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017789}
17790
17791
17792static int
17793test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017795
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017796 int mem_base;
17797 int ret_val;
17798 xmlBufferPtr buf; /* the buffer to dump */
17799 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017800 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017801 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017802
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017803 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17804 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
17805 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017806 buf = gen_xmlBufferPtr(n_buf, 0);
17807 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017808
17809 ret_val = xmlBufferCCat(buf, str);
17810 desret_int(ret_val);
17811 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017812 des_xmlBufferPtr(n_buf, buf, 0);
17813 des_const_char_ptr(n_str, str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017814 xmlResetLastError();
17815 if (mem_base != xmlMemBlocks()) {
17816 printf("Leak of %d blocks found in xmlBufferCCat",
17817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017818 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017819 printf(" %d", n_buf);
17820 printf(" %d", n_str);
17821 printf("\n");
17822 }
17823 }
17824 }
17825
Daniel Veillard3d97e662004-11-04 10:49:00 +000017826 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017827 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017828}
17829
17830
17831static int
17832test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017833 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017834
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017835 int mem_base;
17836 int ret_val;
17837 xmlBufferPtr buf; /* the buffer to add to */
17838 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017839 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017840 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017841
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017842 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17843 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17844 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017845 buf = gen_xmlBufferPtr(n_buf, 0);
17846 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017847
17848 ret_val = xmlBufferCat(buf, str);
17849 desret_int(ret_val);
17850 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017851 des_xmlBufferPtr(n_buf, buf, 0);
17852 des_const_xmlChar_ptr(n_str, str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017853 xmlResetLastError();
17854 if (mem_base != xmlMemBlocks()) {
17855 printf("Leak of %d blocks found in xmlBufferCat",
17856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017857 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017858 printf(" %d", n_buf);
17859 printf(" %d", n_str);
17860 printf("\n");
17861 }
17862 }
17863 }
17864
Daniel Veillard3d97e662004-11-04 10:49:00 +000017865 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017867}
17868
17869
Daniel Veillardce682bc2004-11-05 17:22:25 +000017870#define gen_nb_const_xmlBufferPtr 1
17871static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17872 return(NULL);
17873}
17874static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17875}
17876
Daniel Veillardd93f6252004-11-02 15:53:51 +000017877static int
17878test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017879 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017880
Daniel Veillardce682bc2004-11-05 17:22:25 +000017881 int mem_base;
17882 const xmlChar * ret_val;
17883 xmlBufferPtr buf; /* the buffer */
17884 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017885
Daniel Veillardce682bc2004-11-05 17:22:25 +000017886 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
17887 mem_base = xmlMemBlocks();
17888 buf = gen_const_xmlBufferPtr(n_buf, 0);
17889
17890 ret_val = xmlBufferContent(buf);
17891 desret_const_xmlChar_ptr(ret_val);
17892 call_tests++;
17893 des_const_xmlBufferPtr(n_buf, buf, 0);
17894 xmlResetLastError();
17895 if (mem_base != xmlMemBlocks()) {
17896 printf("Leak of %d blocks found in xmlBufferContent",
17897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017898 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017899 printf(" %d", n_buf);
17900 printf("\n");
17901 }
17902 }
17903
17904 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017906}
17907
17908
17909static int
17910test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017912
Daniel Veillard3d95c732004-11-06 22:25:14 +000017913 int mem_base;
17914 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017915
Daniel Veillard3d95c732004-11-06 22:25:14 +000017916 mem_base = xmlMemBlocks();
17917
17918 ret_val = xmlBufferCreate();
17919 desret_xmlBufferPtr(ret_val);
17920 call_tests++;
17921 xmlResetLastError();
17922 if (mem_base != xmlMemBlocks()) {
17923 printf("Leak of %d blocks found in xmlBufferCreate",
17924 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017925 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000017926 printf("\n");
17927 }
17928
17929 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017931}
17932
17933
17934static int
17935test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017937
17938
17939 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017941}
17942
17943
17944static int
17945test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017947
17948
17949 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017951}
17952
17953
17954static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017955test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017957
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017958 int mem_base;
17959 xmlBufferPtr buf; /* the buffer */
17960 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017961
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017962 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17963 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017964 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017965
17966 xmlBufferEmpty(buf);
17967 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017968 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017969 xmlResetLastError();
17970 if (mem_base != xmlMemBlocks()) {
17971 printf("Leak of %d blocks found in xmlBufferEmpty",
17972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017973 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017974 printf(" %d", n_buf);
17975 printf("\n");
17976 }
17977 }
17978
Daniel Veillard3d97e662004-11-04 10:49:00 +000017979 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017981}
17982
17983
17984static int
17985test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017987
Daniel Veillard3d97e662004-11-04 10:49:00 +000017988 int mem_base;
17989 int ret_val;
17990 xmlBufferPtr buf; /* the buffer */
17991 int n_buf;
17992 unsigned int len; /* the minimum free size to allocate */
17993 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017994
Daniel Veillard3d97e662004-11-04 10:49:00 +000017995 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17996 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
17997 mem_base = xmlMemBlocks();
17998 buf = gen_xmlBufferPtr(n_buf, 0);
17999 len = gen_unsigned_int(n_len, 1);
18000
18001 ret_val = xmlBufferGrow(buf, len);
18002 desret_int(ret_val);
18003 call_tests++;
18004 des_xmlBufferPtr(n_buf, buf, 0);
18005 des_unsigned_int(n_len, len, 1);
18006 xmlResetLastError();
18007 if (mem_base != xmlMemBlocks()) {
18008 printf("Leak of %d blocks found in xmlBufferGrow",
18009 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018010 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018011 printf(" %d", n_buf);
18012 printf(" %d", n_len);
18013 printf("\n");
18014 }
18015 }
18016 }
18017
18018 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018020}
18021
18022
18023static int
18024test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018025 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018026
Daniel Veillardce682bc2004-11-05 17:22:25 +000018027 int mem_base;
18028 int ret_val;
18029 xmlBufferPtr buf; /* the buffer */
18030 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018031
Daniel Veillardce682bc2004-11-05 17:22:25 +000018032 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18033 mem_base = xmlMemBlocks();
18034 buf = gen_const_xmlBufferPtr(n_buf, 0);
18035
18036 ret_val = xmlBufferLength(buf);
18037 desret_int(ret_val);
18038 call_tests++;
18039 des_const_xmlBufferPtr(n_buf, buf, 0);
18040 xmlResetLastError();
18041 if (mem_base != xmlMemBlocks()) {
18042 printf("Leak of %d blocks found in xmlBufferLength",
18043 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018044 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018045 printf(" %d", n_buf);
18046 printf("\n");
18047 }
18048 }
18049
18050 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018051 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018052}
18053
18054
18055static int
18056test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018057 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018058
Daniel Veillard3d97e662004-11-04 10:49:00 +000018059 int mem_base;
18060 int ret_val;
18061 xmlBufferPtr buf; /* the buffer to resize */
18062 int n_buf;
18063 unsigned int size; /* the desired size */
18064 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018065
Daniel Veillard3d97e662004-11-04 10:49:00 +000018066 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18067 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18068 mem_base = xmlMemBlocks();
18069 buf = gen_xmlBufferPtr(n_buf, 0);
18070 size = gen_unsigned_int(n_size, 1);
18071
18072 ret_val = xmlBufferResize(buf, size);
18073 desret_int(ret_val);
18074 call_tests++;
18075 des_xmlBufferPtr(n_buf, buf, 0);
18076 des_unsigned_int(n_size, size, 1);
18077 xmlResetLastError();
18078 if (mem_base != xmlMemBlocks()) {
18079 printf("Leak of %d blocks found in xmlBufferResize",
18080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018081 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018082 printf(" %d", n_buf);
18083 printf(" %d", n_size);
18084 printf("\n");
18085 }
18086 }
18087 }
18088
18089 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018090 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018091}
18092
18093
18094static int
18095test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018096 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018097
Daniel Veillard57b25162004-11-06 14:50:18 +000018098 int mem_base;
18099 xmlBufferPtr buf; /* the buffer to tune */
18100 int n_buf;
18101 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18102 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018103
Daniel Veillard57b25162004-11-06 14:50:18 +000018104 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18105 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18106 mem_base = xmlMemBlocks();
18107 buf = gen_xmlBufferPtr(n_buf, 0);
18108 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18109
18110 xmlBufferSetAllocationScheme(buf, scheme);
18111 call_tests++;
18112 des_xmlBufferPtr(n_buf, buf, 0);
18113 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18114 xmlResetLastError();
18115 if (mem_base != xmlMemBlocks()) {
18116 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018118 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018119 printf(" %d", n_buf);
18120 printf(" %d", n_scheme);
18121 printf("\n");
18122 }
18123 }
18124 }
18125
18126 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018127 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018128}
18129
18130
18131static int
18132test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018133 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018134
Daniel Veillard3d97e662004-11-04 10:49:00 +000018135 int mem_base;
18136 int ret_val;
18137 xmlBufferPtr buf; /* the buffer to dump */
18138 int n_buf;
18139 unsigned int len; /* the number of xmlChar to remove */
18140 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018141
Daniel Veillard3d97e662004-11-04 10:49:00 +000018142 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18143 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18144 mem_base = xmlMemBlocks();
18145 buf = gen_xmlBufferPtr(n_buf, 0);
18146 len = gen_unsigned_int(n_len, 1);
18147
18148 ret_val = xmlBufferShrink(buf, len);
18149 desret_int(ret_val);
18150 call_tests++;
18151 des_xmlBufferPtr(n_buf, buf, 0);
18152 des_unsigned_int(n_len, len, 1);
18153 xmlResetLastError();
18154 if (mem_base != xmlMemBlocks()) {
18155 printf("Leak of %d blocks found in xmlBufferShrink",
18156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018157 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018158 printf(" %d", n_buf);
18159 printf(" %d", n_len);
18160 printf("\n");
18161 }
18162 }
18163 }
18164
18165 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018167}
18168
18169
18170static int
18171test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018173
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018174 int mem_base;
18175 xmlBufferPtr buf; /* the XML buffer */
18176 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018177 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018178 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018179
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018180 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18181 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18182 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018183 buf = gen_xmlBufferPtr(n_buf, 0);
18184 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018185
18186 xmlBufferWriteCHAR(buf, string);
18187 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018188 des_xmlBufferPtr(n_buf, buf, 0);
18189 des_const_xmlChar_ptr(n_string, string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018190 xmlResetLastError();
18191 if (mem_base != xmlMemBlocks()) {
18192 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18193 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018194 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018195 printf(" %d", n_buf);
18196 printf(" %d", n_string);
18197 printf("\n");
18198 }
18199 }
18200 }
18201
Daniel Veillard3d97e662004-11-04 10:49:00 +000018202 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018204}
18205
18206
18207static int
18208test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018210
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018211 int mem_base;
18212 xmlBufferPtr buf; /* the XML buffer output */
18213 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018214 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018215 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018216
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018217 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18218 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18219 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018220 buf = gen_xmlBufferPtr(n_buf, 0);
18221 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018222
18223 xmlBufferWriteChar(buf, string);
18224 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018225 des_xmlBufferPtr(n_buf, buf, 0);
18226 des_const_char_ptr(n_string, string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018227 xmlResetLastError();
18228 if (mem_base != xmlMemBlocks()) {
18229 printf("Leak of %d blocks found in xmlBufferWriteChar",
18230 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018231 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018232 printf(" %d", n_buf);
18233 printf(" %d", n_string);
18234 printf("\n");
18235 }
18236 }
18237 }
18238
Daniel Veillard3d97e662004-11-04 10:49:00 +000018239 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018241}
18242
18243
18244static int
18245test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018247
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018248 int mem_base;
18249 xmlBufferPtr buf; /* the XML buffer output */
18250 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018251 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018252 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018253
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018254 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18255 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18256 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018257 buf = gen_xmlBufferPtr(n_buf, 0);
18258 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018259
18260 xmlBufferWriteQuotedString(buf, string);
18261 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018262 des_xmlBufferPtr(n_buf, buf, 0);
18263 des_const_xmlChar_ptr(n_string, string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018264 xmlResetLastError();
18265 if (mem_base != xmlMemBlocks()) {
18266 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18267 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018268 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018269 printf(" %d", n_buf);
18270 printf(" %d", n_string);
18271 printf("\n");
18272 }
18273 }
18274 }
18275
Daniel Veillard3d97e662004-11-04 10:49:00 +000018276 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018278}
18279
18280
18281static int
18282test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018284
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018285 int mem_base;
18286 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018287 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018288 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018289 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018290 int n_prefix;
18291 xmlChar * memory; /* preallocated memory */
18292 int n_memory;
18293 int len; /* preallocated memory length */
18294 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018295
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018296 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18297 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18298 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18299 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18300 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018301 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18302 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18303 memory = gen_xmlChar_ptr(n_memory, 2);
18304 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018305
18306 ret_val = xmlBuildQName(ncname, prefix, memory, len);
18307 if ((ret_val != NULL) && (ret_val != ncname) &&
18308 (ret_val != prefix) && (ret_val != memory))
18309 xmlFree(ret_val);
18310 ret_val = NULL;
18311 desret_xmlChar_ptr(ret_val);
18312 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018313 des_const_xmlChar_ptr(n_ncname, ncname, 0);
18314 des_const_xmlChar_ptr(n_prefix, prefix, 1);
18315 des_xmlChar_ptr(n_memory, memory, 2);
18316 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018317 xmlResetLastError();
18318 if (mem_base != xmlMemBlocks()) {
18319 printf("Leak of %d blocks found in xmlBuildQName",
18320 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018321 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018322 printf(" %d", n_ncname);
18323 printf(" %d", n_prefix);
18324 printf(" %d", n_memory);
18325 printf(" %d", n_len);
18326 printf("\n");
18327 }
18328 }
18329 }
18330 }
18331 }
18332
Daniel Veillard3d97e662004-11-04 10:49:00 +000018333 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018335}
18336
18337
18338static int
18339test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018341
18342#ifdef LIBXML_TREE_ENABLED
18343 int mem_base;
18344 xmlDocPtr ret_val;
18345 xmlDocPtr doc; /* the document */
18346 int n_doc;
18347 int recursive; /* if not zero do a recursive copy. */
18348 int n_recursive;
18349
18350 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18351 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18352 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018353 doc = gen_xmlDocPtr(n_doc, 0);
18354 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018355
18356 ret_val = xmlCopyDoc(doc, recursive);
18357 desret_xmlDocPtr(ret_val);
18358 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018359 des_xmlDocPtr(n_doc, doc, 0);
18360 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018361 xmlResetLastError();
18362 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018363 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018365 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018366 printf(" %d", n_doc);
18367 printf(" %d", n_recursive);
18368 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018369 }
18370 }
18371 }
18372#endif
18373
Daniel Veillard3d97e662004-11-04 10:49:00 +000018374 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018376}
18377
18378
18379static int
18380test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018382
Daniel Veillard27f20102004-11-05 11:50:11 +000018383#ifdef LIBXML_TREE_ENABLED
18384 int mem_base;
18385 xmlDtdPtr ret_val;
18386 xmlDtdPtr dtd; /* the dtd */
18387 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018388
Daniel Veillard27f20102004-11-05 11:50:11 +000018389 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18390 mem_base = xmlMemBlocks();
18391 dtd = gen_xmlDtdPtr(n_dtd, 0);
18392
18393 ret_val = xmlCopyDtd(dtd);
18394 desret_xmlDtdPtr(ret_val);
18395 call_tests++;
18396 des_xmlDtdPtr(n_dtd, dtd, 0);
18397 xmlResetLastError();
18398 if (mem_base != xmlMemBlocks()) {
18399 printf("Leak of %d blocks found in xmlCopyDtd",
18400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018401 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018402 printf(" %d", n_dtd);
18403 printf("\n");
18404 }
18405 }
18406#endif
18407
18408 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018409 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018410}
18411
18412
18413static int
18414test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018415 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018416
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018417 int mem_base;
18418 xmlNsPtr ret_val;
18419 xmlNsPtr cur; /* the namespace */
18420 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018421
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018422 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18423 mem_base = xmlMemBlocks();
18424 cur = gen_xmlNsPtr(n_cur, 0);
18425
18426 ret_val = xmlCopyNamespace(cur);
18427 if (ret_val != NULL) xmlFreeNs(ret_val);
18428 desret_xmlNsPtr(ret_val);
18429 call_tests++;
18430 des_xmlNsPtr(n_cur, cur, 0);
18431 xmlResetLastError();
18432 if (mem_base != xmlMemBlocks()) {
18433 printf("Leak of %d blocks found in xmlCopyNamespace",
18434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018435 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018436 printf(" %d", n_cur);
18437 printf("\n");
18438 }
18439 }
18440
18441 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018442 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018443}
18444
18445
18446static int
18447test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018449
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018450 int mem_base;
18451 xmlNsPtr ret_val;
18452 xmlNsPtr cur; /* the first namespace */
18453 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018454
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018455 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18456 mem_base = xmlMemBlocks();
18457 cur = gen_xmlNsPtr(n_cur, 0);
18458
18459 ret_val = xmlCopyNamespaceList(cur);
18460 if (ret_val != NULL) xmlFreeNsList(ret_val);
18461 desret_xmlNsPtr(ret_val);
18462 call_tests++;
18463 des_xmlNsPtr(n_cur, cur, 0);
18464 xmlResetLastError();
18465 if (mem_base != xmlMemBlocks()) {
18466 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18467 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018468 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018469 printf(" %d", n_cur);
18470 printf("\n");
18471 }
18472 }
18473
18474 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018475 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018476}
18477
18478
18479static int
18480test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018481 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018482
Daniel Veillardce682bc2004-11-05 17:22:25 +000018483 int mem_base;
18484 xmlNodePtr ret_val;
18485 xmlNodePtr node; /* the node */
18486 int n_node;
18487 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18488 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018489
Daniel Veillardce682bc2004-11-05 17:22:25 +000018490 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18491 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18492 mem_base = xmlMemBlocks();
18493 node = gen_const_xmlNodePtr(n_node, 0);
18494 extended = gen_int(n_extended, 1);
18495
18496 ret_val = xmlCopyNode(node, extended);
18497 desret_xmlNodePtr(ret_val);
18498 call_tests++;
18499 des_const_xmlNodePtr(n_node, node, 0);
18500 des_int(n_extended, extended, 1);
18501 xmlResetLastError();
18502 if (mem_base != xmlMemBlocks()) {
18503 printf("Leak of %d blocks found in xmlCopyNode",
18504 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018505 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018506 printf(" %d", n_node);
18507 printf(" %d", n_extended);
18508 printf("\n");
18509 }
18510 }
18511 }
18512
18513 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018515}
18516
18517
18518static int
18519test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018520 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018521
Daniel Veillardce682bc2004-11-05 17:22:25 +000018522 int mem_base;
18523 xmlNodePtr ret_val;
18524 xmlNodePtr node; /* the first node in the list. */
18525 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018526
Daniel Veillardce682bc2004-11-05 17:22:25 +000018527 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18528 mem_base = xmlMemBlocks();
18529 node = gen_const_xmlNodePtr(n_node, 0);
18530
18531 ret_val = xmlCopyNodeList(node);
18532 desret_xmlNodePtr(ret_val);
18533 call_tests++;
18534 des_const_xmlNodePtr(n_node, node, 0);
18535 xmlResetLastError();
18536 if (mem_base != xmlMemBlocks()) {
18537 printf("Leak of %d blocks found in xmlCopyNodeList",
18538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018539 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018540 printf(" %d", n_node);
18541 printf("\n");
18542 }
18543 }
18544
18545 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018547}
18548
18549
18550static int
18551test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018553
Daniel Veillard57b25162004-11-06 14:50:18 +000018554 int mem_base;
18555 xmlAttrPtr ret_val;
18556 xmlNodePtr target; /* the element where the attribute will be grafted */
18557 int n_target;
18558 xmlAttrPtr cur; /* the attribute */
18559 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018560
Daniel Veillard57b25162004-11-06 14:50:18 +000018561 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18562 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18563 mem_base = xmlMemBlocks();
18564 target = gen_xmlNodePtr(n_target, 0);
18565 cur = gen_xmlAttrPtr(n_cur, 1);
18566
18567 ret_val = xmlCopyProp(target, cur);
18568 desret_xmlAttrPtr(ret_val);
18569 call_tests++;
18570 des_xmlNodePtr(n_target, target, 0);
18571 des_xmlAttrPtr(n_cur, cur, 1);
18572 xmlResetLastError();
18573 if (mem_base != xmlMemBlocks()) {
18574 printf("Leak of %d blocks found in xmlCopyProp",
18575 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018576 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018577 printf(" %d", n_target);
18578 printf(" %d", n_cur);
18579 printf("\n");
18580 }
18581 }
18582 }
18583
18584 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018586}
18587
18588
18589static int
18590test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018592
Daniel Veillard57b25162004-11-06 14:50:18 +000018593 int mem_base;
18594 xmlAttrPtr ret_val;
18595 xmlNodePtr target; /* the element where the attributes will be grafted */
18596 int n_target;
18597 xmlAttrPtr cur; /* the first attribute */
18598 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018599
Daniel Veillard57b25162004-11-06 14:50:18 +000018600 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18601 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18602 mem_base = xmlMemBlocks();
18603 target = gen_xmlNodePtr(n_target, 0);
18604 cur = gen_xmlAttrPtr(n_cur, 1);
18605
18606 ret_val = xmlCopyPropList(target, cur);
18607 desret_xmlAttrPtr(ret_val);
18608 call_tests++;
18609 des_xmlNodePtr(n_target, target, 0);
18610 des_xmlAttrPtr(n_cur, cur, 1);
18611 xmlResetLastError();
18612 if (mem_base != xmlMemBlocks()) {
18613 printf("Leak of %d blocks found in xmlCopyPropList",
18614 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018615 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018616 printf(" %d", n_target);
18617 printf(" %d", n_cur);
18618 printf("\n");
18619 }
18620 }
18621 }
18622
18623 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018625}
18626
18627
18628static int
18629test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018631
Daniel Veillard34099b42004-11-04 17:34:35 +000018632 int mem_base;
18633 xmlDtdPtr ret_val;
18634 xmlDocPtr doc; /* the document pointer */
18635 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018636 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018637 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018638 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018639 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018640 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018641 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018642
Daniel Veillard34099b42004-11-04 17:34:35 +000018643 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18644 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18645 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18646 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18647 mem_base = xmlMemBlocks();
18648 doc = gen_xmlDocPtr(n_doc, 0);
18649 name = gen_const_xmlChar_ptr(n_name, 1);
18650 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18651 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18652
18653 ret_val = xmlCreateIntSubset(doc, name, ExternalID, SystemID);
18654 desret_xmlDtdPtr(ret_val);
18655 call_tests++;
18656 des_xmlDocPtr(n_doc, doc, 0);
18657 des_const_xmlChar_ptr(n_name, name, 1);
18658 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
18659 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
18660 xmlResetLastError();
18661 if (mem_base != xmlMemBlocks()) {
18662 printf("Leak of %d blocks found in xmlCreateIntSubset",
18663 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018664 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018665 printf(" %d", n_doc);
18666 printf(" %d", n_name);
18667 printf(" %d", n_ExternalID);
18668 printf(" %d", n_SystemID);
18669 printf("\n");
18670 }
18671 }
18672 }
18673 }
18674 }
18675
18676 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018677 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018678}
18679
18680
18681static int
18682test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018683 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018684
Daniel Veillardce682bc2004-11-05 17:22:25 +000018685 int mem_base;
18686 xmlNodePtr ret_val;
18687 xmlNodePtr node; /* the node */
18688 int n_node;
18689 xmlDocPtr doc; /* the document */
18690 int n_doc;
18691 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18692 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018693
Daniel Veillardce682bc2004-11-05 17:22:25 +000018694 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18695 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18696 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18697 mem_base = xmlMemBlocks();
18698 node = gen_const_xmlNodePtr(n_node, 0);
18699 doc = gen_xmlDocPtr(n_doc, 1);
18700 extended = gen_int(n_extended, 2);
18701
18702 ret_val = xmlDocCopyNode(node, doc, extended);
18703 desret_xmlNodePtr(ret_val);
18704 call_tests++;
18705 des_const_xmlNodePtr(n_node, node, 0);
18706 des_xmlDocPtr(n_doc, doc, 1);
18707 des_int(n_extended, extended, 2);
18708 xmlResetLastError();
18709 if (mem_base != xmlMemBlocks()) {
18710 printf("Leak of %d blocks found in xmlDocCopyNode",
18711 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018712 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018713 printf(" %d", n_node);
18714 printf(" %d", n_doc);
18715 printf(" %d", n_extended);
18716 printf("\n");
18717 }
18718 }
18719 }
18720 }
18721
18722 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018724}
18725
18726
18727static int
18728test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018730
Daniel Veillardce682bc2004-11-05 17:22:25 +000018731 int mem_base;
18732 xmlNodePtr ret_val;
18733 xmlDocPtr doc; /* the target document */
18734 int n_doc;
18735 xmlNodePtr node; /* the first node in the list. */
18736 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018737
Daniel Veillardce682bc2004-11-05 17:22:25 +000018738 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18739 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18740 mem_base = xmlMemBlocks();
18741 doc = gen_xmlDocPtr(n_doc, 0);
18742 node = gen_const_xmlNodePtr(n_node, 1);
18743
18744 ret_val = xmlDocCopyNodeList(doc, node);
18745 desret_xmlNodePtr(ret_val);
18746 call_tests++;
18747 des_xmlDocPtr(n_doc, doc, 0);
18748 des_const_xmlNodePtr(n_node, node, 1);
18749 xmlResetLastError();
18750 if (mem_base != xmlMemBlocks()) {
18751 printf("Leak of %d blocks found in xmlDocCopyNodeList",
18752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018753 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018754 printf(" %d", n_doc);
18755 printf(" %d", n_node);
18756 printf("\n");
18757 }
18758 }
18759 }
18760
18761 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018762 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018763}
18764
18765
18766static int
18767test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018769
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018770#ifdef LIBXML_OUTPUT_ENABLED
18771 int mem_base;
18772 int ret_val;
18773 FILE * f; /* the FILE* */
18774 int n_f;
18775 xmlDocPtr cur; /* the document */
18776 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018777
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018778 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
18779 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18780 mem_base = xmlMemBlocks();
18781 f = gen_FILE_ptr(n_f, 0);
18782 cur = gen_xmlDocPtr(n_cur, 1);
18783
18784 ret_val = xmlDocDump(f, cur);
18785 desret_int(ret_val);
18786 call_tests++;
18787 des_FILE_ptr(n_f, f, 0);
18788 des_xmlDocPtr(n_cur, cur, 1);
18789 xmlResetLastError();
18790 if (mem_base != xmlMemBlocks()) {
18791 printf("Leak of %d blocks found in xmlDocDump",
18792 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018793 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018794 printf(" %d", n_f);
18795 printf(" %d", n_cur);
18796 printf("\n");
18797 }
18798 }
18799 }
18800#endif
18801
18802 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018803 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018804}
18805
18806
18807static int
18808test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018809 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018810
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018811#ifdef LIBXML_OUTPUT_ENABLED
18812 int mem_base;
18813 xmlDocPtr cur; /* the document */
18814 int n_cur;
18815 xmlChar ** mem; /* OUT: the memory pointer */
18816 int n_mem;
18817 int * size; /* OUT: the memory length */
18818 int n_size;
18819 int format; /* should formatting spaces been added */
18820 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018821
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018822 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18823 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18824 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18825 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18826 mem_base = xmlMemBlocks();
18827 cur = gen_xmlDocPtr(n_cur, 0);
18828 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18829 size = gen_int_ptr(n_size, 2);
18830 format = gen_int(n_format, 3);
18831
18832 xmlDocDumpFormatMemory(cur, mem, size, format);
18833 call_tests++;
18834 des_xmlDocPtr(n_cur, cur, 0);
18835 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18836 des_int_ptr(n_size, size, 2);
18837 des_int(n_format, format, 3);
18838 xmlResetLastError();
18839 if (mem_base != xmlMemBlocks()) {
18840 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
18841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018842 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018843 printf(" %d", n_cur);
18844 printf(" %d", n_mem);
18845 printf(" %d", n_size);
18846 printf(" %d", n_format);
18847 printf("\n");
18848 }
18849 }
18850 }
18851 }
18852 }
18853#endif
18854
18855 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018857}
18858
18859
18860static int
18861test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018862 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018863
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018864#ifdef LIBXML_OUTPUT_ENABLED
18865 int mem_base;
18866 xmlDocPtr out_doc; /* Document to generate XML text from */
18867 int n_out_doc;
18868 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18869 int n_doc_txt_ptr;
18870 int * doc_txt_len; /* Length of the generated XML text */
18871 int n_doc_txt_len;
18872 char * txt_encoding; /* Character encoding to use when generating XML text */
18873 int n_txt_encoding;
18874 int format; /* should formatting spaces been added */
18875 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018876
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018877 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18878 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
18879 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
18880 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
18881 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18882 mem_base = xmlMemBlocks();
18883 out_doc = gen_xmlDocPtr(n_out_doc, 0);
18884 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
18885 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
18886 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
18887 format = gen_int(n_format, 4);
18888
18889 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, txt_encoding, format);
18890 call_tests++;
18891 des_xmlDocPtr(n_out_doc, out_doc, 0);
18892 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
18893 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
18894 des_const_char_ptr(n_txt_encoding, txt_encoding, 3);
18895 des_int(n_format, format, 4);
18896 xmlResetLastError();
18897 if (mem_base != xmlMemBlocks()) {
18898 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
18899 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018900 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018901 printf(" %d", n_out_doc);
18902 printf(" %d", n_doc_txt_ptr);
18903 printf(" %d", n_doc_txt_len);
18904 printf(" %d", n_txt_encoding);
18905 printf(" %d", n_format);
18906 printf("\n");
18907 }
18908 }
18909 }
18910 }
18911 }
18912 }
18913#endif
18914
18915 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018916 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018917}
18918
18919
18920static int
18921test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018922 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018923
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018924#ifdef LIBXML_OUTPUT_ENABLED
18925 int mem_base;
18926 xmlDocPtr cur; /* the document */
18927 int n_cur;
18928 xmlChar ** mem; /* OUT: the memory pointer */
18929 int n_mem;
18930 int * size; /* OUT: the memory length */
18931 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018932
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018933 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18934 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18935 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18936 mem_base = xmlMemBlocks();
18937 cur = gen_xmlDocPtr(n_cur, 0);
18938 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18939 size = gen_int_ptr(n_size, 2);
18940
18941 xmlDocDumpMemory(cur, mem, size);
18942 call_tests++;
18943 des_xmlDocPtr(n_cur, cur, 0);
18944 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18945 des_int_ptr(n_size, size, 2);
18946 xmlResetLastError();
18947 if (mem_base != xmlMemBlocks()) {
18948 printf("Leak of %d blocks found in xmlDocDumpMemory",
18949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018950 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018951 printf(" %d", n_cur);
18952 printf(" %d", n_mem);
18953 printf(" %d", n_size);
18954 printf("\n");
18955 }
18956 }
18957 }
18958 }
18959#endif
18960
18961 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000018962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018963}
18964
18965
18966static int
18967test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018969
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018970#ifdef LIBXML_OUTPUT_ENABLED
18971 int mem_base;
18972 xmlDocPtr out_doc; /* Document to generate XML text from */
18973 int n_out_doc;
18974 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18975 int n_doc_txt_ptr;
18976 int * doc_txt_len; /* Length of the generated XML text */
18977 int n_doc_txt_len;
18978 char * txt_encoding; /* Character encoding to use when generating XML text */
18979 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018980
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018981 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18982 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
18983 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
18984 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
18985 mem_base = xmlMemBlocks();
18986 out_doc = gen_xmlDocPtr(n_out_doc, 0);
18987 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
18988 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
18989 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
18990
18991 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, txt_encoding);
18992 call_tests++;
18993 des_xmlDocPtr(n_out_doc, out_doc, 0);
18994 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
18995 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
18996 des_const_char_ptr(n_txt_encoding, txt_encoding, 3);
18997 xmlResetLastError();
18998 if (mem_base != xmlMemBlocks()) {
18999 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
19000 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019001 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019002 printf(" %d", n_out_doc);
19003 printf(" %d", n_doc_txt_ptr);
19004 printf(" %d", n_doc_txt_len);
19005 printf(" %d", n_txt_encoding);
19006 printf("\n");
19007 }
19008 }
19009 }
19010 }
19011 }
19012#endif
19013
19014 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019015 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019016}
19017
19018
19019static int
19020test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019021 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019022
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019023#ifdef LIBXML_OUTPUT_ENABLED
19024 int mem_base;
19025 int ret_val;
19026 FILE * f; /* the FILE* */
19027 int n_f;
19028 xmlDocPtr cur; /* the document */
19029 int n_cur;
19030 int format; /* should formatting spaces been added */
19031 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019032
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019033 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19034 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19035 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19036 mem_base = xmlMemBlocks();
19037 f = gen_FILE_ptr(n_f, 0);
19038 cur = gen_xmlDocPtr(n_cur, 1);
19039 format = gen_int(n_format, 2);
19040
19041 ret_val = xmlDocFormatDump(f, cur, format);
19042 desret_int(ret_val);
19043 call_tests++;
19044 des_FILE_ptr(n_f, f, 0);
19045 des_xmlDocPtr(n_cur, cur, 1);
19046 des_int(n_format, format, 2);
19047 xmlResetLastError();
19048 if (mem_base != xmlMemBlocks()) {
19049 printf("Leak of %d blocks found in xmlDocFormatDump",
19050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019051 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019052 printf(" %d", n_f);
19053 printf(" %d", n_cur);
19054 printf(" %d", n_format);
19055 printf("\n");
19056 }
19057 }
19058 }
19059 }
19060#endif
19061
19062 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019064}
19065
19066
19067static int
19068test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019070
19071 int mem_base;
19072 xmlNodePtr ret_val;
19073 xmlDocPtr doc; /* the document */
19074 int n_doc;
19075
19076 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19077 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019078 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019079
19080 ret_val = xmlDocGetRootElement(doc);
19081 desret_xmlNodePtr(ret_val);
19082 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019083 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019084 xmlResetLastError();
19085 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019086 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019088 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019089 printf(" %d", n_doc);
19090 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019091 }
19092 }
19093
Daniel Veillard3d97e662004-11-04 10:49:00 +000019094 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019096}
19097
19098
19099static int
19100test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019102
19103#ifdef LIBXML_TREE_ENABLED
19104 int mem_base;
19105 xmlNodePtr ret_val;
19106 xmlDocPtr doc; /* the document */
19107 int n_doc;
19108 xmlNodePtr root; /* the new document root element */
19109 int n_root;
19110
19111 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019112 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019113 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019114 doc = gen_xmlDocPtr(n_doc, 0);
19115 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019116
19117 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019118 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019119 desret_xmlNodePtr(ret_val);
19120 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019121 des_xmlDocPtr(n_doc, doc, 0);
19122 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019123 xmlResetLastError();
19124 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019125 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019126 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019127 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019128 printf(" %d", n_doc);
19129 printf(" %d", n_root);
19130 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019131 }
19132 }
19133 }
19134#endif
19135
Daniel Veillard3d97e662004-11-04 10:49:00 +000019136 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019137 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019138}
19139
19140
19141static int
19142test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019143 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019144
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019145#ifdef LIBXML_OUTPUT_ENABLED
19146 int mem_base;
19147 FILE * f; /* the FILE * for the output */
19148 int n_f;
19149 xmlDocPtr doc; /* the document */
19150 int n_doc;
19151 xmlNodePtr cur; /* the current node */
19152 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019153
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019154 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19155 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19156 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19157 mem_base = xmlMemBlocks();
19158 f = gen_FILE_ptr(n_f, 0);
19159 doc = gen_xmlDocPtr(n_doc, 1);
19160 cur = gen_xmlNodePtr(n_cur, 2);
19161
19162 xmlElemDump(f, doc, cur);
19163 call_tests++;
19164 des_FILE_ptr(n_f, f, 0);
19165 des_xmlDocPtr(n_doc, doc, 1);
19166 des_xmlNodePtr(n_cur, cur, 2);
19167 xmlResetLastError();
19168 if (mem_base != xmlMemBlocks()) {
19169 printf("Leak of %d blocks found in xmlElemDump",
19170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019171 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019172 printf(" %d", n_f);
19173 printf(" %d", n_doc);
19174 printf(" %d", n_cur);
19175 printf("\n");
19176 }
19177 }
19178 }
19179 }
19180#endif
19181
19182 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019184}
19185
19186
19187static int
19188test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019190
Daniel Veillard57b25162004-11-06 14:50:18 +000019191 int mem_base;
19192 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019193
Daniel Veillard57b25162004-11-06 14:50:18 +000019194 mem_base = xmlMemBlocks();
19195
19196 ret_val = xmlGetBufferAllocationScheme();
19197 desret_xmlBufferAllocationScheme(ret_val);
19198 call_tests++;
19199 xmlResetLastError();
19200 if (mem_base != xmlMemBlocks()) {
19201 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19202 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019203 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019204 printf("\n");
19205 }
19206
19207 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019209}
19210
19211
19212static int
19213test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019215
19216 int mem_base;
19217 int ret_val;
19218
19219 mem_base = xmlMemBlocks();
19220
19221 ret_val = xmlGetCompressMode();
19222 desret_int(ret_val);
19223 call_tests++;
19224 xmlResetLastError();
19225 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019226 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019228 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019229 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019230 }
19231
Daniel Veillard3d97e662004-11-04 10:49:00 +000019232 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019234}
19235
19236
19237static int
19238test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019240
19241 int mem_base;
19242 int ret_val;
19243 xmlDocPtr doc; /* the document */
19244 int n_doc;
19245
19246 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19247 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019248 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019249
19250 ret_val = xmlGetDocCompressMode(doc);
19251 desret_int(ret_val);
19252 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019253 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019254 xmlResetLastError();
19255 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019256 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019258 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019259 printf(" %d", n_doc);
19260 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019261 }
19262 }
19263
Daniel Veillard3d97e662004-11-04 10:49:00 +000019264 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019266}
19267
19268
19269static int
19270test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019272
Daniel Veillard34099b42004-11-04 17:34:35 +000019273 int mem_base;
19274 xmlDtdPtr ret_val;
19275 xmlDocPtr doc; /* the document pointer */
19276 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019277
Daniel Veillard34099b42004-11-04 17:34:35 +000019278 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19279 mem_base = xmlMemBlocks();
19280 doc = gen_xmlDocPtr(n_doc, 0);
19281
19282 ret_val = xmlGetIntSubset(doc);
19283 desret_xmlDtdPtr(ret_val);
19284 call_tests++;
19285 des_xmlDocPtr(n_doc, doc, 0);
19286 xmlResetLastError();
19287 if (mem_base != xmlMemBlocks()) {
19288 printf("Leak of %d blocks found in xmlGetIntSubset",
19289 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019290 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019291 printf(" %d", n_doc);
19292 printf("\n");
19293 }
19294 }
19295
19296 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019297 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019298}
19299
19300
19301static int
19302test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019303 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019304
19305 int mem_base;
19306 xmlNodePtr ret_val;
19307 xmlNodePtr parent; /* the parent node */
19308 int n_parent;
19309
19310 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19311 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019312 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019313
19314 ret_val = xmlGetLastChild(parent);
19315 desret_xmlNodePtr(ret_val);
19316 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019317 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019318 xmlResetLastError();
19319 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019320 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019321 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019322 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019323 printf(" %d", n_parent);
19324 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019325 }
19326 }
19327
Daniel Veillard3d97e662004-11-04 10:49:00 +000019328 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019330}
19331
19332
19333static int
19334test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019336
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019337 int mem_base;
19338 long ret_val;
19339 xmlNodePtr node; /* valid node */
19340 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019341
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019342 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19343 mem_base = xmlMemBlocks();
19344 node = gen_xmlNodePtr(n_node, 0);
19345
19346 ret_val = xmlGetLineNo(node);
19347 desret_long(ret_val);
19348 call_tests++;
19349 des_xmlNodePtr(n_node, node, 0);
19350 xmlResetLastError();
19351 if (mem_base != xmlMemBlocks()) {
19352 printf("Leak of %d blocks found in xmlGetLineNo",
19353 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019354 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019355 printf(" %d", n_node);
19356 printf("\n");
19357 }
19358 }
19359
19360 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019361 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019362}
19363
19364
19365static int
19366test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019367 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019368
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019369 int mem_base;
19370 xmlChar * ret_val;
19371 xmlNodePtr node; /* the node */
19372 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019373 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019374 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019375
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019376 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19377 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19378 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019379 node = gen_xmlNodePtr(n_node, 0);
19380 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019381
19382 ret_val = xmlGetNoNsProp(node, name);
19383 desret_xmlChar_ptr(ret_val);
19384 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019385 des_xmlNodePtr(n_node, node, 0);
19386 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019387 xmlResetLastError();
19388 if (mem_base != xmlMemBlocks()) {
19389 printf("Leak of %d blocks found in xmlGetNoNsProp",
19390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019391 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019392 printf(" %d", n_node);
19393 printf(" %d", n_name);
19394 printf("\n");
19395 }
19396 }
19397 }
19398
Daniel Veillard3d97e662004-11-04 10:49:00 +000019399 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019401}
19402
19403
19404static int
19405test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019406 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019407
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019408#ifdef LIBXML_TREE_ENABLED
19409 int mem_base;
19410 xmlChar * ret_val;
19411 xmlNodePtr node; /* a node */
19412 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019413
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019414 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19415 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019416 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019417
19418 ret_val = xmlGetNodePath(node);
19419 desret_xmlChar_ptr(ret_val);
19420 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019421 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019422 xmlResetLastError();
19423 if (mem_base != xmlMemBlocks()) {
19424 printf("Leak of %d blocks found in xmlGetNodePath",
19425 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019426 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019427 printf(" %d", n_node);
19428 printf("\n");
19429 }
19430 }
19431#endif
19432
Daniel Veillard3d97e662004-11-04 10:49:00 +000019433 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019435}
19436
19437
19438static int
19439test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019440 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019441
19442
19443 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019445}
19446
19447
19448static int
19449test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019451
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019452 int mem_base;
19453 xmlChar * ret_val;
19454 xmlNodePtr node; /* the node */
19455 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019456 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019457 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019458 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019459 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019460
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019461 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19462 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19463 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19464 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019465 node = gen_xmlNodePtr(n_node, 0);
19466 name = gen_const_xmlChar_ptr(n_name, 1);
19467 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019468
19469 ret_val = xmlGetNsProp(node, name, nameSpace);
19470 desret_xmlChar_ptr(ret_val);
19471 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019472 des_xmlNodePtr(n_node, node, 0);
19473 des_const_xmlChar_ptr(n_name, name, 1);
19474 des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019475 xmlResetLastError();
19476 if (mem_base != xmlMemBlocks()) {
19477 printf("Leak of %d blocks found in xmlGetNsProp",
19478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019479 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019480 printf(" %d", n_node);
19481 printf(" %d", n_name);
19482 printf(" %d", n_nameSpace);
19483 printf("\n");
19484 }
19485 }
19486 }
19487 }
19488
Daniel Veillard3d97e662004-11-04 10:49:00 +000019489 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019491}
19492
19493
19494static int
19495test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019497
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019498 int mem_base;
19499 xmlChar * ret_val;
19500 xmlNodePtr node; /* the node */
19501 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019502 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019503 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019504
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019505 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19506 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19507 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019508 node = gen_xmlNodePtr(n_node, 0);
19509 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019510
19511 ret_val = xmlGetProp(node, name);
19512 desret_xmlChar_ptr(ret_val);
19513 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019514 des_xmlNodePtr(n_node, node, 0);
19515 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019516 xmlResetLastError();
19517 if (mem_base != xmlMemBlocks()) {
19518 printf("Leak of %d blocks found in xmlGetProp",
19519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019520 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019521 printf(" %d", n_node);
19522 printf(" %d", n_name);
19523 printf("\n");
19524 }
19525 }
19526 }
19527
Daniel Veillard3d97e662004-11-04 10:49:00 +000019528 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019530}
19531
19532
19533static int
19534test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019536
Daniel Veillard57b25162004-11-06 14:50:18 +000019537 int mem_base;
19538 xmlAttrPtr ret_val;
19539 xmlNodePtr node; /* the node */
19540 int n_node;
19541 xmlChar * name; /* the attribute name */
19542 int n_name;
19543 xmlChar * nameSpace; /* the URI of the namespace */
19544 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019545
Daniel Veillard57b25162004-11-06 14:50:18 +000019546 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19547 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19548 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19549 mem_base = xmlMemBlocks();
19550 node = gen_xmlNodePtr(n_node, 0);
19551 name = gen_const_xmlChar_ptr(n_name, 1);
19552 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19553
19554 ret_val = xmlHasNsProp(node, name, nameSpace);
19555 desret_xmlAttrPtr(ret_val);
19556 call_tests++;
19557 des_xmlNodePtr(n_node, node, 0);
19558 des_const_xmlChar_ptr(n_name, name, 1);
19559 des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
19560 xmlResetLastError();
19561 if (mem_base != xmlMemBlocks()) {
19562 printf("Leak of %d blocks found in xmlHasNsProp",
19563 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019564 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019565 printf(" %d", n_node);
19566 printf(" %d", n_name);
19567 printf(" %d", n_nameSpace);
19568 printf("\n");
19569 }
19570 }
19571 }
19572 }
19573
19574 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019576}
19577
19578
19579static int
19580test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019582
Daniel Veillard57b25162004-11-06 14:50:18 +000019583 int mem_base;
19584 xmlAttrPtr ret_val;
19585 xmlNodePtr node; /* the node */
19586 int n_node;
19587 xmlChar * name; /* the attribute name */
19588 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019589
Daniel Veillard57b25162004-11-06 14:50:18 +000019590 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19591 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19592 mem_base = xmlMemBlocks();
19593 node = gen_xmlNodePtr(n_node, 0);
19594 name = gen_const_xmlChar_ptr(n_name, 1);
19595
19596 ret_val = xmlHasProp(node, name);
19597 desret_xmlAttrPtr(ret_val);
19598 call_tests++;
19599 des_xmlNodePtr(n_node, node, 0);
19600 des_const_xmlChar_ptr(n_name, name, 1);
19601 xmlResetLastError();
19602 if (mem_base != xmlMemBlocks()) {
19603 printf("Leak of %d blocks found in xmlHasProp",
19604 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019605 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019606 printf(" %d", n_node);
19607 printf(" %d", n_name);
19608 printf("\n");
19609 }
19610 }
19611 }
19612
19613 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019614 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019615}
19616
19617
19618static int
19619test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019621
19622 int mem_base;
19623 int ret_val;
19624 xmlNodePtr node; /* the node */
19625 int n_node;
19626
19627 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19628 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019629 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019630
19631 ret_val = xmlIsBlankNode(node);
19632 desret_int(ret_val);
19633 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019634 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019635 xmlResetLastError();
19636 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019637 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019639 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019640 printf(" %d", n_node);
19641 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019642 }
19643 }
19644
Daniel Veillard3d97e662004-11-04 10:49:00 +000019645 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019646 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019647}
19648
19649
19650static int
19651test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019652 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019653
19654 int mem_base;
19655 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019656 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019657 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019658 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019659 int n_publicID;
19660
19661 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19662 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19663 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019664 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19665 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019666
19667 ret_val = xmlIsXHTML(systemID, publicID);
19668 desret_int(ret_val);
19669 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019670 des_const_xmlChar_ptr(n_systemID, systemID, 0);
19671 des_const_xmlChar_ptr(n_publicID, publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019672 xmlResetLastError();
19673 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019674 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019675 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019676 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019677 printf(" %d", n_systemID);
19678 printf(" %d", n_publicID);
19679 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019680 }
19681 }
19682 }
19683
Daniel Veillard3d97e662004-11-04 10:49:00 +000019684 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019686}
19687
19688
19689static int
19690test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019692
19693 int mem_base;
19694 xmlNodePtr ret_val;
19695 xmlDocPtr doc; /* the document */
19696 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019697 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019698 int n_content;
19699 int len; /* the length of the block */
19700 int n_len;
19701
19702 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19703 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19704 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19705 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019706 doc = gen_xmlDocPtr(n_doc, 0);
19707 content = gen_const_xmlChar_ptr(n_content, 1);
19708 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019709
19710 ret_val = xmlNewCDataBlock(doc, content, len);
19711 desret_xmlNodePtr(ret_val);
19712 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019713 des_xmlDocPtr(n_doc, doc, 0);
19714 des_const_xmlChar_ptr(n_content, content, 1);
19715 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019716 xmlResetLastError();
19717 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019718 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019719 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019720 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019721 printf(" %d", n_doc);
19722 printf(" %d", n_content);
19723 printf(" %d", n_len);
19724 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019725 }
19726 }
19727 }
19728 }
19729
Daniel Veillard3d97e662004-11-04 10:49:00 +000019730 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019732}
19733
19734
19735static int
19736test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019738
19739 int mem_base;
19740 xmlNodePtr ret_val;
19741 xmlDocPtr doc; /* the document */
19742 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019743 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019744 int n_name;
19745
19746 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19747 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19748 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019749 doc = gen_xmlDocPtr(n_doc, 0);
19750 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019751
19752 ret_val = xmlNewCharRef(doc, name);
19753 desret_xmlNodePtr(ret_val);
19754 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019755 des_xmlDocPtr(n_doc, doc, 0);
19756 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019757 xmlResetLastError();
19758 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019759 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019761 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019762 printf(" %d", n_doc);
19763 printf(" %d", n_name);
19764 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019765 }
19766 }
19767 }
19768
Daniel Veillard3d97e662004-11-04 10:49:00 +000019769 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019770 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019771}
19772
19773
19774static int
19775test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019776 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019777
Daniel Veillard27f20102004-11-05 11:50:11 +000019778 int mem_base;
19779 xmlNodePtr ret_val;
19780 xmlNodePtr parent; /* the parent node */
19781 int n_parent;
19782 xmlNsPtr ns; /* a namespace if any */
19783 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019784 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000019785 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019786 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000019787 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019788
Daniel Veillard27f20102004-11-05 11:50:11 +000019789 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19790 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19791 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19792 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19793 mem_base = xmlMemBlocks();
19794 parent = gen_xmlNodePtr(n_parent, 0);
19795 ns = gen_xmlNsPtr(n_ns, 1);
19796 name = gen_const_xmlChar_ptr(n_name, 2);
19797 content = gen_const_xmlChar_ptr(n_content, 3);
19798
19799 ret_val = xmlNewChild(parent, ns, name, content);
19800 desret_xmlNodePtr(ret_val);
19801 call_tests++;
19802 des_xmlNodePtr(n_parent, parent, 0);
19803 des_xmlNsPtr(n_ns, ns, 1);
19804 des_const_xmlChar_ptr(n_name, name, 2);
19805 des_const_xmlChar_ptr(n_content, content, 3);
19806 xmlResetLastError();
19807 if (mem_base != xmlMemBlocks()) {
19808 printf("Leak of %d blocks found in xmlNewChild",
19809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019810 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000019811 printf(" %d", n_parent);
19812 printf(" %d", n_ns);
19813 printf(" %d", n_name);
19814 printf(" %d", n_content);
19815 printf("\n");
19816 }
19817 }
19818 }
19819 }
19820 }
19821
19822 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019824}
19825
19826
19827static int
19828test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019830
19831 int mem_base;
19832 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019833 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019834 int n_content;
19835
19836 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19837 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019838 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019839
19840 ret_val = xmlNewComment(content);
19841 desret_xmlNodePtr(ret_val);
19842 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019843 des_const_xmlChar_ptr(n_content, content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019844 xmlResetLastError();
19845 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019846 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019847 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019848 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019849 printf(" %d", n_content);
19850 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019851 }
19852 }
19853
Daniel Veillard3d97e662004-11-04 10:49:00 +000019854 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019855 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019856}
19857
19858
19859static int
19860test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019861 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019862
19863 int mem_base;
19864 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019865 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019866 int n_version;
19867
19868 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
19869 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019870 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019871
19872 ret_val = xmlNewDoc(version);
19873 desret_xmlDocPtr(ret_val);
19874 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019875 des_const_xmlChar_ptr(n_version, version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019876 xmlResetLastError();
19877 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019878 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019879 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019880 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019881 printf(" %d", n_version);
19882 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019883 }
19884 }
19885
Daniel Veillard3d97e662004-11-04 10:49:00 +000019886 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019887 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019888}
19889
19890
19891static int
19892test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019893 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019894
19895 int mem_base;
19896 xmlNodePtr ret_val;
19897 xmlDocPtr doc; /* the document */
19898 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019899 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019900 int n_content;
19901
19902 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19903 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19904 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019905 doc = gen_xmlDocPtr(n_doc, 0);
19906 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019907
19908 ret_val = xmlNewDocComment(doc, content);
19909 desret_xmlNodePtr(ret_val);
19910 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019911 des_xmlDocPtr(n_doc, doc, 0);
19912 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019913 xmlResetLastError();
19914 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019915 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019916 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019917 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019918 printf(" %d", n_doc);
19919 printf(" %d", n_content);
19920 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019921 }
19922 }
19923 }
19924
Daniel Veillard3d97e662004-11-04 10:49:00 +000019925 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019926 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019927}
19928
19929
19930static int
19931test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019932 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019933
19934#ifdef LIBXML_TREE_ENABLED
19935 int mem_base;
19936 xmlNodePtr ret_val;
19937 xmlDocPtr doc; /* the document owning the fragment */
19938 int n_doc;
19939
19940 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19941 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019942 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019943
19944 ret_val = xmlNewDocFragment(doc);
19945 desret_xmlNodePtr(ret_val);
19946 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019947 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019948 xmlResetLastError();
19949 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019950 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019952 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019953 printf(" %d", n_doc);
19954 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019955 }
19956 }
19957#endif
19958
Daniel Veillard3d97e662004-11-04 10:49:00 +000019959 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000019960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019961}
19962
19963
19964static int
19965test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019967
Daniel Veillard27f20102004-11-05 11:50:11 +000019968 int mem_base;
19969 xmlNodePtr ret_val;
19970 xmlDocPtr doc; /* the document */
19971 int n_doc;
19972 xmlNsPtr ns; /* namespace if any */
19973 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019974 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000019975 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019976 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000019977 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019978
Daniel Veillard27f20102004-11-05 11:50:11 +000019979 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19980 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19981 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19982 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19983 mem_base = xmlMemBlocks();
19984 doc = gen_xmlDocPtr(n_doc, 0);
19985 ns = gen_xmlNsPtr(n_ns, 1);
19986 name = gen_const_xmlChar_ptr(n_name, 2);
19987 content = gen_const_xmlChar_ptr(n_content, 3);
19988
19989 ret_val = xmlNewDocNode(doc, ns, name, content);
19990 desret_xmlNodePtr(ret_val);
19991 call_tests++;
19992 des_xmlDocPtr(n_doc, doc, 0);
19993 des_xmlNsPtr(n_ns, ns, 1);
19994 des_const_xmlChar_ptr(n_name, name, 2);
19995 des_const_xmlChar_ptr(n_content, content, 3);
19996 xmlResetLastError();
19997 if (mem_base != xmlMemBlocks()) {
19998 printf("Leak of %d blocks found in xmlNewDocNode",
19999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020000 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020001 printf(" %d", n_doc);
20002 printf(" %d", n_ns);
20003 printf(" %d", n_name);
20004 printf(" %d", n_content);
20005 printf("\n");
20006 }
20007 }
20008 }
20009 }
20010 }
20011
20012 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020014}
20015
20016
20017static int
20018test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020020
Daniel Veillard27f20102004-11-05 11:50:11 +000020021 int mem_base;
20022 xmlNodePtr ret_val;
20023 xmlDocPtr doc; /* the document */
20024 int n_doc;
20025 xmlNsPtr ns; /* namespace if any */
20026 int n_ns;
20027 xmlChar * name; /* the node name */
20028 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020029 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020030 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020031
Daniel Veillard27f20102004-11-05 11:50:11 +000020032 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20033 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20034 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20035 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20036 mem_base = xmlMemBlocks();
20037 doc = gen_xmlDocPtr(n_doc, 0);
20038 ns = gen_xmlNsPtr(n_ns, 1);
20039 name = gen_eaten_name(n_name, 2);
20040 content = gen_const_xmlChar_ptr(n_content, 3);
20041
20042 ret_val = xmlNewDocNodeEatName(doc, ns, name, content);
20043 desret_xmlNodePtr(ret_val);
20044 call_tests++;
20045 des_xmlDocPtr(n_doc, doc, 0);
20046 des_xmlNsPtr(n_ns, ns, 1);
20047 des_eaten_name(n_name, name, 2);
20048 des_const_xmlChar_ptr(n_content, content, 3);
20049 xmlResetLastError();
20050 if (mem_base != xmlMemBlocks()) {
20051 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20052 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020053 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020054 printf(" %d", n_doc);
20055 printf(" %d", n_ns);
20056 printf(" %d", n_name);
20057 printf(" %d", n_content);
20058 printf("\n");
20059 }
20060 }
20061 }
20062 }
20063 }
20064
20065 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020067}
20068
20069
20070static int
20071test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020073
20074 int mem_base;
20075 xmlNodePtr ret_val;
20076 xmlDocPtr doc; /* the target document */
20077 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020078 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020079 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020080 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020081 int n_content;
20082
20083 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20084 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20085 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20086 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020087 doc = gen_xmlDocPtr(n_doc, 0);
20088 name = gen_const_xmlChar_ptr(n_name, 1);
20089 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020090
20091 ret_val = xmlNewDocPI(doc, name, content);
20092 desret_xmlNodePtr(ret_val);
20093 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020094 des_xmlDocPtr(n_doc, doc, 0);
20095 des_const_xmlChar_ptr(n_name, name, 1);
20096 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020097 xmlResetLastError();
20098 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020099 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020101 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020102 printf(" %d", n_doc);
20103 printf(" %d", n_name);
20104 printf(" %d", n_content);
20105 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020106 }
20107 }
20108 }
20109 }
20110
Daniel Veillard3d97e662004-11-04 10:49:00 +000020111 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020113}
20114
20115
20116static int
20117test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020119
Daniel Veillard57b25162004-11-06 14:50:18 +000020120 int mem_base;
20121 xmlAttrPtr ret_val;
20122 xmlDocPtr doc; /* the document */
20123 int n_doc;
20124 xmlChar * name; /* the name of the attribute */
20125 int n_name;
20126 xmlChar * value; /* the value of the attribute */
20127 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020128
Daniel Veillard57b25162004-11-06 14:50:18 +000020129 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20130 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20131 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20132 mem_base = xmlMemBlocks();
20133 doc = gen_xmlDocPtr(n_doc, 0);
20134 name = gen_const_xmlChar_ptr(n_name, 1);
20135 value = gen_const_xmlChar_ptr(n_value, 2);
20136
20137 ret_val = xmlNewDocProp(doc, name, value);
20138 desret_xmlAttrPtr(ret_val);
20139 call_tests++;
20140 des_xmlDocPtr(n_doc, doc, 0);
20141 des_const_xmlChar_ptr(n_name, name, 1);
20142 des_const_xmlChar_ptr(n_value, value, 2);
20143 xmlResetLastError();
20144 if (mem_base != xmlMemBlocks()) {
20145 printf("Leak of %d blocks found in xmlNewDocProp",
20146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020147 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020148 printf(" %d", n_doc);
20149 printf(" %d", n_name);
20150 printf(" %d", n_value);
20151 printf("\n");
20152 }
20153 }
20154 }
20155 }
20156
20157 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020159}
20160
20161
20162static int
20163test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020164 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020165
Daniel Veillard27f20102004-11-05 11:50:11 +000020166 int mem_base;
20167 xmlNodePtr ret_val;
20168 xmlDocPtr doc; /* the document */
20169 int n_doc;
20170 xmlNsPtr ns; /* namespace if any */
20171 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020172 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020173 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020174 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020175 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020176
Daniel Veillard27f20102004-11-05 11:50:11 +000020177 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20178 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20179 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20180 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20181 mem_base = xmlMemBlocks();
20182 doc = gen_xmlDocPtr(n_doc, 0);
20183 ns = gen_xmlNsPtr(n_ns, 1);
20184 name = gen_const_xmlChar_ptr(n_name, 2);
20185 content = gen_const_xmlChar_ptr(n_content, 3);
20186
20187 ret_val = xmlNewDocRawNode(doc, ns, name, content);
20188 desret_xmlNodePtr(ret_val);
20189 call_tests++;
20190 des_xmlDocPtr(n_doc, doc, 0);
20191 des_xmlNsPtr(n_ns, ns, 1);
20192 des_const_xmlChar_ptr(n_name, name, 2);
20193 des_const_xmlChar_ptr(n_content, content, 3);
20194 xmlResetLastError();
20195 if (mem_base != xmlMemBlocks()) {
20196 printf("Leak of %d blocks found in xmlNewDocRawNode",
20197 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020198 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020199 printf(" %d", n_doc);
20200 printf(" %d", n_ns);
20201 printf(" %d", n_name);
20202 printf(" %d", n_content);
20203 printf("\n");
20204 }
20205 }
20206 }
20207 }
20208 }
20209
20210 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020212}
20213
20214
20215static int
20216test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020218
20219 int mem_base;
20220 xmlNodePtr ret_val;
20221 xmlDocPtr doc; /* the document */
20222 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020223 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020224 int n_content;
20225
20226 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20227 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20228 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020229 doc = gen_xmlDocPtr(n_doc, 0);
20230 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020231
20232 ret_val = xmlNewDocText(doc, content);
20233 desret_xmlNodePtr(ret_val);
20234 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020235 des_xmlDocPtr(n_doc, doc, 0);
20236 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020237 xmlResetLastError();
20238 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020239 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020240 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020241 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020242 printf(" %d", n_doc);
20243 printf(" %d", n_content);
20244 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020245 }
20246 }
20247 }
20248
Daniel Veillard3d97e662004-11-04 10:49:00 +000020249 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020251}
20252
20253
20254static int
20255test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020257
20258 int mem_base;
20259 xmlNodePtr ret_val;
20260 xmlDocPtr doc; /* the document */
20261 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020262 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020263 int n_content;
20264 int len; /* the text len. */
20265 int n_len;
20266
20267 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20268 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20269 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20270 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020271 doc = gen_xmlDocPtr(n_doc, 0);
20272 content = gen_const_xmlChar_ptr(n_content, 1);
20273 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020274
20275 ret_val = xmlNewDocTextLen(doc, content, len);
20276 desret_xmlNodePtr(ret_val);
20277 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020278 des_xmlDocPtr(n_doc, doc, 0);
20279 des_const_xmlChar_ptr(n_content, content, 1);
20280 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020281 xmlResetLastError();
20282 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020283 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020285 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020286 printf(" %d", n_doc);
20287 printf(" %d", n_content);
20288 printf(" %d", n_len);
20289 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020290 }
20291 }
20292 }
20293 }
20294
Daniel Veillard3d97e662004-11-04 10:49:00 +000020295 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020296 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020297}
20298
20299
20300static int
20301test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020302 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020303
Daniel Veillard34099b42004-11-04 17:34:35 +000020304 int mem_base;
20305 xmlDtdPtr ret_val;
20306 xmlDocPtr doc; /* the document pointer */
20307 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020308 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020309 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020310 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020311 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020312 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020313 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020314
Daniel Veillard34099b42004-11-04 17:34:35 +000020315 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20316 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20317 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20318 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20319 mem_base = xmlMemBlocks();
20320 doc = gen_xmlDocPtr(n_doc, 0);
20321 name = gen_const_xmlChar_ptr(n_name, 1);
20322 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20323 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20324
20325 ret_val = xmlNewDtd(doc, name, ExternalID, SystemID);
20326 desret_xmlDtdPtr(ret_val);
20327 call_tests++;
20328 des_xmlDocPtr(n_doc, doc, 0);
20329 des_const_xmlChar_ptr(n_name, name, 1);
20330 des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
20331 des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
20332 xmlResetLastError();
20333 if (mem_base != xmlMemBlocks()) {
20334 printf("Leak of %d blocks found in xmlNewDtd",
20335 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020336 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020337 printf(" %d", n_doc);
20338 printf(" %d", n_name);
20339 printf(" %d", n_ExternalID);
20340 printf(" %d", n_SystemID);
20341 printf("\n");
20342 }
20343 }
20344 }
20345 }
20346 }
20347
20348 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020350}
20351
20352
20353static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020354test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020356
Daniel Veillard27f20102004-11-05 11:50:11 +000020357 int mem_base;
20358 xmlNodePtr ret_val;
20359 xmlNsPtr ns; /* namespace if any */
20360 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020361 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020362 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020363
Daniel Veillard27f20102004-11-05 11:50:11 +000020364 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20365 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20366 mem_base = xmlMemBlocks();
20367 ns = gen_xmlNsPtr(n_ns, 0);
20368 name = gen_const_xmlChar_ptr(n_name, 1);
20369
20370 ret_val = xmlNewNode(ns, name);
20371 desret_xmlNodePtr(ret_val);
20372 call_tests++;
20373 des_xmlNsPtr(n_ns, ns, 0);
20374 des_const_xmlChar_ptr(n_name, name, 1);
20375 xmlResetLastError();
20376 if (mem_base != xmlMemBlocks()) {
20377 printf("Leak of %d blocks found in xmlNewNode",
20378 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020379 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020380 printf(" %d", n_ns);
20381 printf(" %d", n_name);
20382 printf("\n");
20383 }
20384 }
20385 }
20386
20387 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020388 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020389}
20390
20391
20392static int
20393test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020394 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020395
Daniel Veillard27f20102004-11-05 11:50:11 +000020396 int mem_base;
20397 xmlNodePtr ret_val;
20398 xmlNsPtr ns; /* namespace if any */
20399 int n_ns;
20400 xmlChar * name; /* the node name */
20401 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020402
Daniel Veillard27f20102004-11-05 11:50:11 +000020403 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20404 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20405 mem_base = xmlMemBlocks();
20406 ns = gen_xmlNsPtr(n_ns, 0);
20407 name = gen_eaten_name(n_name, 1);
20408
20409 ret_val = xmlNewNodeEatName(ns, name);
20410 desret_xmlNodePtr(ret_val);
20411 call_tests++;
20412 des_xmlNsPtr(n_ns, ns, 0);
20413 des_eaten_name(n_name, name, 1);
20414 xmlResetLastError();
20415 if (mem_base != xmlMemBlocks()) {
20416 printf("Leak of %d blocks found in xmlNewNodeEatName",
20417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020418 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020419 printf(" %d", n_ns);
20420 printf(" %d", n_name);
20421 printf("\n");
20422 }
20423 }
20424 }
20425
20426 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020427 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020428}
20429
20430
20431static int
20432test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020433 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020434
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020435 int mem_base;
20436 xmlNsPtr ret_val;
20437 xmlNodePtr node; /* the element carrying the namespace */
20438 int n_node;
20439 xmlChar * href; /* the URI associated */
20440 int n_href;
20441 xmlChar * prefix; /* the prefix for the namespace */
20442 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020443
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020444 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20445 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20446 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20447 mem_base = xmlMemBlocks();
20448 node = gen_xmlNodePtr(n_node, 0);
20449 href = gen_const_xmlChar_ptr(n_href, 1);
20450 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20451
20452 ret_val = xmlNewNs(node, href, prefix);
20453 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20454 desret_xmlNsPtr(ret_val);
20455 call_tests++;
20456 des_xmlNodePtr(n_node, node, 0);
20457 des_const_xmlChar_ptr(n_href, href, 1);
20458 des_const_xmlChar_ptr(n_prefix, prefix, 2);
20459 xmlResetLastError();
20460 if (mem_base != xmlMemBlocks()) {
20461 printf("Leak of %d blocks found in xmlNewNs",
20462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020463 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020464 printf(" %d", n_node);
20465 printf(" %d", n_href);
20466 printf(" %d", n_prefix);
20467 printf("\n");
20468 }
20469 }
20470 }
20471 }
20472
20473 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020475}
20476
20477
20478static int
20479test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020481
Daniel Veillard57b25162004-11-06 14:50:18 +000020482 int mem_base;
20483 xmlAttrPtr ret_val;
20484 xmlNodePtr node; /* the holding node */
20485 int n_node;
20486 xmlNsPtr ns; /* the namespace */
20487 int n_ns;
20488 xmlChar * name; /* the name of the attribute */
20489 int n_name;
20490 xmlChar * value; /* the value of the attribute */
20491 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020492
Daniel Veillard57b25162004-11-06 14:50:18 +000020493 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20494 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20495 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20496 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20497 mem_base = xmlMemBlocks();
20498 node = gen_xmlNodePtr(n_node, 0);
20499 ns = gen_xmlNsPtr(n_ns, 1);
20500 name = gen_const_xmlChar_ptr(n_name, 2);
20501 value = gen_const_xmlChar_ptr(n_value, 3);
20502
20503 ret_val = xmlNewNsProp(node, ns, name, value);
20504 desret_xmlAttrPtr(ret_val);
20505 call_tests++;
20506 des_xmlNodePtr(n_node, node, 0);
20507 des_xmlNsPtr(n_ns, ns, 1);
20508 des_const_xmlChar_ptr(n_name, name, 2);
20509 des_const_xmlChar_ptr(n_value, value, 3);
20510 xmlResetLastError();
20511 if (mem_base != xmlMemBlocks()) {
20512 printf("Leak of %d blocks found in xmlNewNsProp",
20513 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020514 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020515 printf(" %d", n_node);
20516 printf(" %d", n_ns);
20517 printf(" %d", n_name);
20518 printf(" %d", n_value);
20519 printf("\n");
20520 }
20521 }
20522 }
20523 }
20524 }
20525
20526 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020528}
20529
20530
20531static int
20532test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020534
Daniel Veillard57b25162004-11-06 14:50:18 +000020535 int mem_base;
20536 xmlAttrPtr ret_val;
20537 xmlNodePtr node; /* the holding node */
20538 int n_node;
20539 xmlNsPtr ns; /* the namespace */
20540 int n_ns;
20541 xmlChar * name; /* the name of the attribute */
20542 int n_name;
20543 xmlChar * value; /* the value of the attribute */
20544 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020545
Daniel Veillard57b25162004-11-06 14:50:18 +000020546 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20547 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20548 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20549 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20550 mem_base = xmlMemBlocks();
20551 node = gen_xmlNodePtr(n_node, 0);
20552 ns = gen_xmlNsPtr(n_ns, 1);
20553 name = gen_eaten_name(n_name, 2);
20554 value = gen_const_xmlChar_ptr(n_value, 3);
20555
20556 ret_val = xmlNewNsPropEatName(node, ns, name, value);
20557 desret_xmlAttrPtr(ret_val);
20558 call_tests++;
20559 des_xmlNodePtr(n_node, node, 0);
20560 des_xmlNsPtr(n_ns, ns, 1);
20561 des_eaten_name(n_name, name, 2);
20562 des_const_xmlChar_ptr(n_value, value, 3);
20563 xmlResetLastError();
20564 if (mem_base != xmlMemBlocks()) {
20565 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020567 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020568 printf(" %d", n_node);
20569 printf(" %d", n_ns);
20570 printf(" %d", n_name);
20571 printf(" %d", n_value);
20572 printf("\n");
20573 }
20574 }
20575 }
20576 }
20577 }
20578
20579 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020580 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020581}
20582
20583
20584static int
20585test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020587
20588 int mem_base;
20589 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020590 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020591 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020592 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020593 int n_content;
20594
20595 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20596 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20597 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020598 name = gen_const_xmlChar_ptr(n_name, 0);
20599 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020600
20601 ret_val = xmlNewPI(name, content);
20602 desret_xmlNodePtr(ret_val);
20603 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020604 des_const_xmlChar_ptr(n_name, name, 0);
20605 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020606 xmlResetLastError();
20607 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020608 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020610 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020611 printf(" %d", n_name);
20612 printf(" %d", n_content);
20613 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020614 }
20615 }
20616 }
20617
Daniel Veillard3d97e662004-11-04 10:49:00 +000020618 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020620}
20621
20622
20623static int
20624test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020626
Daniel Veillard57b25162004-11-06 14:50:18 +000020627 int mem_base;
20628 xmlAttrPtr ret_val;
20629 xmlNodePtr node; /* the holding node */
20630 int n_node;
20631 xmlChar * name; /* the name of the attribute */
20632 int n_name;
20633 xmlChar * value; /* the value of the attribute */
20634 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020635
Daniel Veillard57b25162004-11-06 14:50:18 +000020636 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20637 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20638 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20639 mem_base = xmlMemBlocks();
20640 node = gen_xmlNodePtr(n_node, 0);
20641 name = gen_const_xmlChar_ptr(n_name, 1);
20642 value = gen_const_xmlChar_ptr(n_value, 2);
20643
20644 ret_val = xmlNewProp(node, name, value);
20645 desret_xmlAttrPtr(ret_val);
20646 call_tests++;
20647 des_xmlNodePtr(n_node, node, 0);
20648 des_const_xmlChar_ptr(n_name, name, 1);
20649 des_const_xmlChar_ptr(n_value, value, 2);
20650 xmlResetLastError();
20651 if (mem_base != xmlMemBlocks()) {
20652 printf("Leak of %d blocks found in xmlNewProp",
20653 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020654 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020655 printf(" %d", n_node);
20656 printf(" %d", n_name);
20657 printf(" %d", n_value);
20658 printf("\n");
20659 }
20660 }
20661 }
20662 }
20663
20664 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020666}
20667
20668
20669static int
20670test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020672
20673 int mem_base;
20674 xmlNodePtr ret_val;
20675 xmlDocPtr doc; /* the document */
20676 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020677 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020678 int n_name;
20679
20680 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20681 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20682 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020683 doc = gen_xmlDocPtr(n_doc, 0);
20684 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020685
20686 ret_val = xmlNewReference(doc, name);
20687 desret_xmlNodePtr(ret_val);
20688 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020689 des_xmlDocPtr(n_doc, doc, 0);
20690 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020691 xmlResetLastError();
20692 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020693 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020695 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020696 printf(" %d", n_doc);
20697 printf(" %d", n_name);
20698 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020699 }
20700 }
20701 }
20702
Daniel Veillard3d97e662004-11-04 10:49:00 +000020703 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020704 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020705}
20706
20707
20708static int
20709test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020710 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020711
20712 int mem_base;
20713 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020714 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020715 int n_content;
20716
20717 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20718 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020719 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020720
20721 ret_val = xmlNewText(content);
20722 desret_xmlNodePtr(ret_val);
20723 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020724 des_const_xmlChar_ptr(n_content, content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020725 xmlResetLastError();
20726 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020727 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020729 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020730 printf(" %d", n_content);
20731 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020732 }
20733 }
20734
Daniel Veillard3d97e662004-11-04 10:49:00 +000020735 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020736 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020737}
20738
20739
20740static int
20741test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020742 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020743
Daniel Veillard27f20102004-11-05 11:50:11 +000020744 int mem_base;
20745 xmlNodePtr ret_val;
20746 xmlNodePtr parent; /* the parent node */
20747 int n_parent;
20748 xmlNsPtr ns; /* a namespace if any */
20749 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020750 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020751 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020752 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020753 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020754
Daniel Veillard27f20102004-11-05 11:50:11 +000020755 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20756 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20757 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20758 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20759 mem_base = xmlMemBlocks();
20760 parent = gen_xmlNodePtr(n_parent, 0);
20761 ns = gen_xmlNsPtr(n_ns, 1);
20762 name = gen_const_xmlChar_ptr(n_name, 2);
20763 content = gen_const_xmlChar_ptr(n_content, 3);
20764
20765 ret_val = xmlNewTextChild(parent, ns, name, content);
20766 desret_xmlNodePtr(ret_val);
20767 call_tests++;
20768 des_xmlNodePtr(n_parent, parent, 0);
20769 des_xmlNsPtr(n_ns, ns, 1);
20770 des_const_xmlChar_ptr(n_name, name, 2);
20771 des_const_xmlChar_ptr(n_content, content, 3);
20772 xmlResetLastError();
20773 if (mem_base != xmlMemBlocks()) {
20774 printf("Leak of %d blocks found in xmlNewTextChild",
20775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020776 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020777 printf(" %d", n_parent);
20778 printf(" %d", n_ns);
20779 printf(" %d", n_name);
20780 printf(" %d", n_content);
20781 printf("\n");
20782 }
20783 }
20784 }
20785 }
20786 }
20787
20788 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020789 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020790}
20791
20792
20793static int
20794test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020795 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020796
20797 int mem_base;
20798 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020799 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020800 int n_content;
20801 int len; /* the text len. */
20802 int n_len;
20803
20804 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20805 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20806 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020807 content = gen_const_xmlChar_ptr(n_content, 0);
20808 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020809
20810 ret_val = xmlNewTextLen(content, len);
20811 desret_xmlNodePtr(ret_val);
20812 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020813 des_const_xmlChar_ptr(n_content, content, 0);
20814 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020815 xmlResetLastError();
20816 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020817 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020818 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020819 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020820 printf(" %d", n_content);
20821 printf(" %d", n_len);
20822 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020823 }
20824 }
20825 }
20826
Daniel Veillard3d97e662004-11-04 10:49:00 +000020827 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020829}
20830
20831
20832static int
20833test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020835
20836 int mem_base;
20837 xmlNodePtr cur; /* the node being modified */
20838 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020839 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020840 int n_content;
20841
20842 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20843 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20844 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020845 cur = gen_xmlNodePtr(n_cur, 0);
20846 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020847
20848 xmlNodeAddContent(cur, content);
20849 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020850 des_xmlNodePtr(n_cur, cur, 0);
20851 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020852 xmlResetLastError();
20853 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020854 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020855 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020856 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020857 printf(" %d", n_cur);
20858 printf(" %d", n_content);
20859 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020860 }
20861 }
20862 }
20863
Daniel Veillard3d97e662004-11-04 10:49:00 +000020864 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020865 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020866}
20867
20868
20869static int
20870test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020871 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020872
20873 int mem_base;
20874 xmlNodePtr cur; /* the node being modified */
20875 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020876 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020877 int n_content;
20878 int len; /* the size of @content */
20879 int n_len;
20880
20881 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20882 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20883 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20884 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020885 cur = gen_xmlNodePtr(n_cur, 0);
20886 content = gen_const_xmlChar_ptr(n_content, 1);
20887 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020888
20889 xmlNodeAddContentLen(cur, content, len);
20890 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020891 des_xmlNodePtr(n_cur, cur, 0);
20892 des_const_xmlChar_ptr(n_content, content, 1);
20893 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020894 xmlResetLastError();
20895 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020896 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020898 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020899 printf(" %d", n_cur);
20900 printf(" %d", n_content);
20901 printf(" %d", n_len);
20902 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020903 }
20904 }
20905 }
20906 }
20907
Daniel Veillard3d97e662004-11-04 10:49:00 +000020908 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020910}
20911
20912
20913static int
20914test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020916
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020917 int mem_base;
20918 int ret_val;
20919 xmlBufferPtr buffer; /* a buffer */
20920 int n_buffer;
20921 xmlNodePtr cur; /* the node being read */
20922 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020923
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020924 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
20925 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20926 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020927 buffer = gen_xmlBufferPtr(n_buffer, 0);
20928 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020929
20930 ret_val = xmlNodeBufGetContent(buffer, cur);
20931 desret_int(ret_val);
20932 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020933 des_xmlBufferPtr(n_buffer, buffer, 0);
20934 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020935 xmlResetLastError();
20936 if (mem_base != xmlMemBlocks()) {
20937 printf("Leak of %d blocks found in xmlNodeBufGetContent",
20938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020939 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020940 printf(" %d", n_buffer);
20941 printf(" %d", n_cur);
20942 printf("\n");
20943 }
20944 }
20945 }
20946
Daniel Veillard3d97e662004-11-04 10:49:00 +000020947 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000020948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020949}
20950
20951
20952static int
20953test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020954 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020955
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020956#ifdef LIBXML_OUTPUT_ENABLED
20957 int mem_base;
20958 int ret_val;
20959 xmlBufferPtr buf; /* the XML buffer output */
20960 int n_buf;
20961 xmlDocPtr doc; /* the document */
20962 int n_doc;
20963 xmlNodePtr cur; /* the current node */
20964 int n_cur;
20965 int level; /* the imbrication level for indenting */
20966 int n_level;
20967 int format; /* is formatting allowed */
20968 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020969
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020970 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
20971 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20972 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20973 for (n_level = 0;n_level < gen_nb_int;n_level++) {
20974 for (n_format = 0;n_format < gen_nb_int;n_format++) {
20975 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020976 buf = gen_xmlBufferPtr(n_buf, 0);
20977 doc = gen_xmlDocPtr(n_doc, 1);
20978 cur = gen_xmlNodePtr(n_cur, 2);
20979 level = gen_int(n_level, 3);
20980 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020981
20982 ret_val = xmlNodeDump(buf, doc, cur, level, format);
20983 desret_int(ret_val);
20984 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020985 des_xmlBufferPtr(n_buf, buf, 0);
20986 des_xmlDocPtr(n_doc, doc, 1);
20987 des_xmlNodePtr(n_cur, cur, 2);
20988 des_int(n_level, level, 3);
20989 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020990 xmlResetLastError();
20991 if (mem_base != xmlMemBlocks()) {
20992 printf("Leak of %d blocks found in xmlNodeDump",
20993 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020994 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020995 printf(" %d", n_buf);
20996 printf(" %d", n_doc);
20997 printf(" %d", n_cur);
20998 printf(" %d", n_level);
20999 printf(" %d", n_format);
21000 printf("\n");
21001 }
21002 }
21003 }
21004 }
21005 }
21006 }
21007#endif
21008
Daniel Veillard3d97e662004-11-04 10:49:00 +000021009 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021011}
21012
21013
21014static int
21015test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021016 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021017
Daniel Veillard3d97e662004-11-04 10:49:00 +000021018#ifdef LIBXML_OUTPUT_ENABLED
21019 int mem_base;
21020 xmlOutputBufferPtr buf; /* the XML buffer output */
21021 int n_buf;
21022 xmlDocPtr doc; /* the document */
21023 int n_doc;
21024 xmlNodePtr cur; /* the current node */
21025 int n_cur;
21026 int level; /* the imbrication level for indenting */
21027 int n_level;
21028 int format; /* is formatting allowed */
21029 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021030 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021031 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021032
Daniel Veillard3d97e662004-11-04 10:49:00 +000021033 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21034 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21035 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21036 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21037 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21038 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21039 mem_base = xmlMemBlocks();
21040 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21041 doc = gen_xmlDocPtr(n_doc, 1);
21042 cur = gen_xmlNodePtr(n_cur, 2);
21043 level = gen_int(n_level, 3);
21044 format = gen_int(n_format, 4);
21045 encoding = gen_const_char_ptr(n_encoding, 5);
21046
21047 xmlNodeDumpOutput(buf, doc, cur, level, format, encoding);
21048 call_tests++;
21049 des_xmlOutputBufferPtr(n_buf, buf, 0);
21050 des_xmlDocPtr(n_doc, doc, 1);
21051 des_xmlNodePtr(n_cur, cur, 2);
21052 des_int(n_level, level, 3);
21053 des_int(n_format, format, 4);
21054 des_const_char_ptr(n_encoding, encoding, 5);
21055 xmlResetLastError();
21056 if (mem_base != xmlMemBlocks()) {
21057 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21058 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021059 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021060 printf(" %d", n_buf);
21061 printf(" %d", n_doc);
21062 printf(" %d", n_cur);
21063 printf(" %d", n_level);
21064 printf(" %d", n_format);
21065 printf(" %d", n_encoding);
21066 printf("\n");
21067 }
21068 }
21069 }
21070 }
21071 }
21072 }
21073 }
21074#endif
21075
21076 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021078}
21079
21080
21081static int
21082test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021084
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021085 int mem_base;
21086 xmlChar * ret_val;
21087 xmlDocPtr doc; /* the document the node pertains to */
21088 int n_doc;
21089 xmlNodePtr cur; /* the node being checked */
21090 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021091
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021092 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21093 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21094 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021095 doc = gen_xmlDocPtr(n_doc, 0);
21096 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021097
21098 ret_val = xmlNodeGetBase(doc, cur);
21099 desret_xmlChar_ptr(ret_val);
21100 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021101 des_xmlDocPtr(n_doc, doc, 0);
21102 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021103 xmlResetLastError();
21104 if (mem_base != xmlMemBlocks()) {
21105 printf("Leak of %d blocks found in xmlNodeGetBase",
21106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021107 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021108 printf(" %d", n_doc);
21109 printf(" %d", n_cur);
21110 printf("\n");
21111 }
21112 }
21113 }
21114
Daniel Veillard3d97e662004-11-04 10:49:00 +000021115 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021116 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021117}
21118
21119
21120static int
21121test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021123
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021124 int mem_base;
21125 xmlChar * ret_val;
21126 xmlNodePtr cur; /* the node being read */
21127 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021128
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021129 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21130 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021131 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021132
21133 ret_val = xmlNodeGetContent(cur);
21134 desret_xmlChar_ptr(ret_val);
21135 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021136 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021137 xmlResetLastError();
21138 if (mem_base != xmlMemBlocks()) {
21139 printf("Leak of %d blocks found in xmlNodeGetContent",
21140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021141 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021142 printf(" %d", n_cur);
21143 printf("\n");
21144 }
21145 }
21146
Daniel Veillard3d97e662004-11-04 10:49:00 +000021147 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021148 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021149}
21150
21151
21152static int
21153test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021155
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021156 int mem_base;
21157 xmlChar * ret_val;
21158 xmlNodePtr cur; /* the node being checked */
21159 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021160
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021161 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21162 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021163 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021164
21165 ret_val = xmlNodeGetLang(cur);
21166 desret_xmlChar_ptr(ret_val);
21167 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021168 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021169 xmlResetLastError();
21170 if (mem_base != xmlMemBlocks()) {
21171 printf("Leak of %d blocks found in xmlNodeGetLang",
21172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021173 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021174 printf(" %d", n_cur);
21175 printf("\n");
21176 }
21177 }
21178
Daniel Veillard3d97e662004-11-04 10:49:00 +000021179 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021181}
21182
21183
21184static int
21185test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021187
21188 int mem_base;
21189 int ret_val;
21190 xmlNodePtr cur; /* the node being checked */
21191 int n_cur;
21192
21193 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21194 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021195 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021196
21197 ret_val = xmlNodeGetSpacePreserve(cur);
21198 desret_int(ret_val);
21199 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021200 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021201 xmlResetLastError();
21202 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021203 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021204 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021205 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021206 printf(" %d", n_cur);
21207 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021208 }
21209 }
21210
Daniel Veillard3d97e662004-11-04 10:49:00 +000021211 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021212 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021213}
21214
21215
21216static int
21217test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021218 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021219
21220 int mem_base;
21221 int ret_val;
21222 xmlNodePtr node; /* the node */
21223 int n_node;
21224
21225 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21226 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021227 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021228
21229 ret_val = xmlNodeIsText(node);
21230 desret_int(ret_val);
21231 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021232 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021233 xmlResetLastError();
21234 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021235 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021237 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021238 printf(" %d", n_node);
21239 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021240 }
21241 }
21242
Daniel Veillard3d97e662004-11-04 10:49:00 +000021243 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021244 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021245}
21246
21247
21248static int
21249test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021250 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021251
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021252#ifdef LIBXML_TREE_ENABLED
21253 int mem_base;
21254 xmlChar * ret_val;
21255 xmlDocPtr doc; /* the document */
21256 int n_doc;
21257 xmlNodePtr list; /* a Node list */
21258 int n_list;
21259 int inLine; /* should we replace entity contents or show their external form */
21260 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021261
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021262 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21263 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21264 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21265 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021266 doc = gen_xmlDocPtr(n_doc, 0);
21267 list = gen_xmlNodePtr(n_list, 1);
21268 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021269
21270 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21271 desret_xmlChar_ptr(ret_val);
21272 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021273 des_xmlDocPtr(n_doc, doc, 0);
21274 des_xmlNodePtr(n_list, list, 1);
21275 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021276 xmlResetLastError();
21277 if (mem_base != xmlMemBlocks()) {
21278 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021280 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021281 printf(" %d", n_doc);
21282 printf(" %d", n_list);
21283 printf(" %d", n_inLine);
21284 printf("\n");
21285 }
21286 }
21287 }
21288 }
21289#endif
21290
Daniel Veillard3d97e662004-11-04 10:49:00 +000021291 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021293}
21294
21295
21296static int
21297test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021299
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021300 int mem_base;
21301 xmlChar * ret_val;
21302 xmlDocPtr doc; /* the document */
21303 int n_doc;
21304 xmlNodePtr list; /* a Node list */
21305 int n_list;
21306 int inLine; /* should we replace entity contents or show their external form */
21307 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021308
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021309 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21310 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21311 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21312 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021313 doc = gen_xmlDocPtr(n_doc, 0);
21314 list = gen_xmlNodePtr(n_list, 1);
21315 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021316
21317 ret_val = xmlNodeListGetString(doc, list, inLine);
21318 desret_xmlChar_ptr(ret_val);
21319 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021320 des_xmlDocPtr(n_doc, doc, 0);
21321 des_xmlNodePtr(n_list, list, 1);
21322 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021323 xmlResetLastError();
21324 if (mem_base != xmlMemBlocks()) {
21325 printf("Leak of %d blocks found in xmlNodeListGetString",
21326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021327 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021328 printf(" %d", n_doc);
21329 printf(" %d", n_list);
21330 printf(" %d", n_inLine);
21331 printf("\n");
21332 }
21333 }
21334 }
21335 }
21336
Daniel Veillard3d97e662004-11-04 10:49:00 +000021337 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021338 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021339}
21340
21341
21342static int
21343test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021344 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021345
21346#ifdef LIBXML_TREE_ENABLED
21347 int mem_base;
21348 xmlNodePtr cur; /* the node being changed */
21349 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021350 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021351 int n_uri;
21352
21353 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21354 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21355 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021356 cur = gen_xmlNodePtr(n_cur, 0);
21357 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021358
21359 xmlNodeSetBase(cur, uri);
21360 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021361 des_xmlNodePtr(n_cur, cur, 0);
21362 des_const_xmlChar_ptr(n_uri, uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021363 xmlResetLastError();
21364 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021365 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021367 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021368 printf(" %d", n_cur);
21369 printf(" %d", n_uri);
21370 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021371 }
21372 }
21373 }
21374#endif
21375
Daniel Veillard3d97e662004-11-04 10:49:00 +000021376 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021378}
21379
21380
21381static int
21382test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021384
21385 int mem_base;
21386 xmlNodePtr cur; /* the node being modified */
21387 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021388 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021389 int n_content;
21390
21391 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21392 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21393 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021394 cur = gen_xmlNodePtr(n_cur, 0);
21395 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021396
21397 xmlNodeSetContent(cur, content);
21398 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021399 des_xmlNodePtr(n_cur, cur, 0);
21400 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021401 xmlResetLastError();
21402 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021403 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021405 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021406 printf(" %d", n_cur);
21407 printf(" %d", n_content);
21408 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021409 }
21410 }
21411 }
21412
Daniel Veillard3d97e662004-11-04 10:49:00 +000021413 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021414 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021415}
21416
21417
21418static int
21419test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021421
21422#ifdef LIBXML_TREE_ENABLED
21423 int mem_base;
21424 xmlNodePtr cur; /* the node being modified */
21425 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021426 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021427 int n_content;
21428 int len; /* the size of @content */
21429 int n_len;
21430
21431 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21432 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21433 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21434 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021435 cur = gen_xmlNodePtr(n_cur, 0);
21436 content = gen_const_xmlChar_ptr(n_content, 1);
21437 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021438
21439 xmlNodeSetContentLen(cur, content, len);
21440 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021441 des_xmlNodePtr(n_cur, cur, 0);
21442 des_const_xmlChar_ptr(n_content, content, 1);
21443 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021444 xmlResetLastError();
21445 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021446 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021448 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021449 printf(" %d", n_cur);
21450 printf(" %d", n_content);
21451 printf(" %d", n_len);
21452 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021453 }
21454 }
21455 }
21456 }
21457#endif
21458
Daniel Veillard3d97e662004-11-04 10:49:00 +000021459 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021460 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021461}
21462
21463
21464static int
21465test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021467
21468#ifdef LIBXML_TREE_ENABLED
21469 int mem_base;
21470 xmlNodePtr cur; /* the node being changed */
21471 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021472 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021473 int n_lang;
21474
21475 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21476 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21477 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021478 cur = gen_xmlNodePtr(n_cur, 0);
21479 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021480
21481 xmlNodeSetLang(cur, lang);
21482 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021483 des_xmlNodePtr(n_cur, cur, 0);
21484 des_const_xmlChar_ptr(n_lang, lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021485 xmlResetLastError();
21486 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021487 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021488 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021489 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021490 printf(" %d", n_cur);
21491 printf(" %d", n_lang);
21492 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021493 }
21494 }
21495 }
21496#endif
21497
Daniel Veillard3d97e662004-11-04 10:49:00 +000021498 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021499 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021500}
21501
21502
21503static int
21504test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021505 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021506
21507#ifdef LIBXML_TREE_ENABLED
21508 int mem_base;
21509 xmlNodePtr cur; /* the node being changed */
21510 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021511 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021512 int n_name;
21513
21514 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21515 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21516 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021517 cur = gen_xmlNodePtr(n_cur, 0);
21518 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021519
21520 xmlNodeSetName(cur, name);
21521 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021522 des_xmlNodePtr(n_cur, cur, 0);
21523 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021524 xmlResetLastError();
21525 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021526 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021527 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021528 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021529 printf(" %d", n_cur);
21530 printf(" %d", n_name);
21531 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021532 }
21533 }
21534 }
21535#endif
21536
Daniel Veillard3d97e662004-11-04 10:49:00 +000021537 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021539}
21540
21541
21542static int
21543test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021545
21546#ifdef LIBXML_TREE_ENABLED
21547 int mem_base;
21548 xmlNodePtr cur; /* the node being changed */
21549 int n_cur;
21550 int val; /* the xml:space value ("0": default, 1: "preserve") */
21551 int n_val;
21552
21553 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21554 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21555 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021556 cur = gen_xmlNodePtr(n_cur, 0);
21557 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021558
21559 xmlNodeSetSpacePreserve(cur, val);
21560 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021561 des_xmlNodePtr(n_cur, cur, 0);
21562 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021563 xmlResetLastError();
21564 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021565 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021567 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021568 printf(" %d", n_cur);
21569 printf(" %d", n_val);
21570 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021571 }
21572 }
21573 }
21574#endif
21575
Daniel Veillard3d97e662004-11-04 10:49:00 +000021576 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021577 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021578}
21579
21580
21581static int
21582test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021583 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021584
21585 int mem_base;
21586 int ret_val;
21587 xmlDocPtr doc; /* the document */
21588 int n_doc;
21589 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21590 int n_tree;
21591
21592 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21593 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21594 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021595 doc = gen_xmlDocPtr(n_doc, 0);
21596 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021597
21598 ret_val = xmlReconciliateNs(doc, tree);
21599 desret_int(ret_val);
21600 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021601 des_xmlDocPtr(n_doc, doc, 0);
21602 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021603 xmlResetLastError();
21604 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021605 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021607 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021608 printf(" %d", n_doc);
21609 printf(" %d", n_tree);
21610 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021611 }
21612 }
21613 }
21614
Daniel Veillard3d97e662004-11-04 10:49:00 +000021615 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021616 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021617}
21618
21619
21620static int
21621test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021622 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021623
Daniel Veillardce244ad2004-11-05 10:03:46 +000021624#ifdef LIBXML_TREE_ENABLED
21625 int mem_base;
21626 int ret_val;
21627 xmlAttrPtr cur; /* an attribute */
21628 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021629
Daniel Veillardce244ad2004-11-05 10:03:46 +000021630 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21631 mem_base = xmlMemBlocks();
21632 cur = gen_xmlAttrPtr(n_cur, 0);
21633
21634 ret_val = xmlRemoveProp(cur);
21635 cur = NULL;
21636 desret_int(ret_val);
21637 call_tests++;
21638 des_xmlAttrPtr(n_cur, cur, 0);
21639 xmlResetLastError();
21640 if (mem_base != xmlMemBlocks()) {
21641 printf("Leak of %d blocks found in xmlRemoveProp",
21642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021643 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021644 printf(" %d", n_cur);
21645 printf("\n");
21646 }
21647 }
21648#endif
21649
21650 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021652}
21653
21654
21655static int
21656test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021658
21659#ifdef LIBXML_TREE_ENABLED
21660 int mem_base;
21661 xmlNodePtr ret_val;
21662 xmlNodePtr old; /* the old node */
21663 int n_old;
21664 xmlNodePtr cur; /* the node */
21665 int n_cur;
21666
21667 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021668 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021669 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021670 old = gen_xmlNodePtr(n_old, 0);
21671 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021672
21673 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021674 if (cur != NULL) {
21675 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021676 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021677 if (old != NULL) {
21678 xmlUnlinkNode(old);
21679 xmlFreeNode(old) ; old = NULL ; }
21680 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021681 desret_xmlNodePtr(ret_val);
21682 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021683 des_xmlNodePtr(n_old, old, 0);
21684 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021685 xmlResetLastError();
21686 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021687 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021689 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021690 printf(" %d", n_old);
21691 printf(" %d", n_cur);
21692 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021693 }
21694 }
21695 }
21696#endif
21697
Daniel Veillard3d97e662004-11-04 10:49:00 +000021698 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021700}
21701
21702
21703static int
21704test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021706
21707#ifdef LIBXML_OUTPUT_ENABLED
21708 int mem_base;
21709 int ret_val;
21710 const char * filename; /* the filename (or URL) */
21711 int n_filename;
21712 xmlDocPtr cur; /* the document */
21713 int n_cur;
21714
21715 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21716 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21717 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021718 filename = gen_fileoutput(n_filename, 0);
21719 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021720
21721 ret_val = xmlSaveFile(filename, cur);
21722 desret_int(ret_val);
21723 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021724 des_fileoutput(n_filename, filename, 0);
21725 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021726 xmlResetLastError();
21727 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021728 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021729 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021730 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021731 printf(" %d", n_filename);
21732 printf(" %d", n_cur);
21733 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021734 }
21735 }
21736 }
21737#endif
21738
Daniel Veillard3d97e662004-11-04 10:49:00 +000021739 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021741}
21742
21743
21744static int
21745test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021747
21748#ifdef LIBXML_OUTPUT_ENABLED
21749 int mem_base;
21750 int ret_val;
21751 const char * filename; /* the filename (or URL) */
21752 int n_filename;
21753 xmlDocPtr cur; /* the document */
21754 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021755 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021756 int n_encoding;
21757
21758 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21759 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21760 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21761 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021762 filename = gen_fileoutput(n_filename, 0);
21763 cur = gen_xmlDocPtr(n_cur, 1);
21764 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021765
21766 ret_val = xmlSaveFileEnc(filename, cur, encoding);
21767 desret_int(ret_val);
21768 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021769 des_fileoutput(n_filename, filename, 0);
21770 des_xmlDocPtr(n_cur, cur, 1);
21771 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021772 xmlResetLastError();
21773 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021774 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021776 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021777 printf(" %d", n_filename);
21778 printf(" %d", n_cur);
21779 printf(" %d", n_encoding);
21780 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021781 }
21782 }
21783 }
21784 }
21785#endif
21786
Daniel Veillard3d97e662004-11-04 10:49:00 +000021787 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021789}
21790
21791
21792static int
21793test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021795
Daniel Veillard3d97e662004-11-04 10:49:00 +000021796#ifdef LIBXML_OUTPUT_ENABLED
21797 int mem_base;
21798 int ret_val;
21799 xmlOutputBufferPtr buf; /* an output I/O buffer */
21800 int n_buf;
21801 xmlDocPtr cur; /* the document */
21802 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021803 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021804 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021805
Daniel Veillard3d97e662004-11-04 10:49:00 +000021806 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21807 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21808 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21809 mem_base = xmlMemBlocks();
21810 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21811 cur = gen_xmlDocPtr(n_cur, 1);
21812 encoding = gen_const_char_ptr(n_encoding, 2);
21813
21814 ret_val = xmlSaveFileTo(buf, cur, encoding);
21815 buf = NULL;
21816 desret_int(ret_val);
21817 call_tests++;
21818 des_xmlOutputBufferPtr(n_buf, buf, 0);
21819 des_xmlDocPtr(n_cur, cur, 1);
21820 des_const_char_ptr(n_encoding, encoding, 2);
21821 xmlResetLastError();
21822 if (mem_base != xmlMemBlocks()) {
21823 printf("Leak of %d blocks found in xmlSaveFileTo",
21824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021825 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021826 printf(" %d", n_buf);
21827 printf(" %d", n_cur);
21828 printf(" %d", n_encoding);
21829 printf("\n");
21830 }
21831 }
21832 }
21833 }
21834#endif
21835
21836 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021838}
21839
21840
21841static int
21842test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021844
21845#ifdef LIBXML_OUTPUT_ENABLED
21846 int mem_base;
21847 int ret_val;
21848 const char * filename; /* the filename (or URL) */
21849 int n_filename;
21850 xmlDocPtr cur; /* the document */
21851 int n_cur;
21852 int format; /* should formatting spaces been added */
21853 int n_format;
21854
21855 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21856 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21857 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21858 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021859 filename = gen_fileoutput(n_filename, 0);
21860 cur = gen_xmlDocPtr(n_cur, 1);
21861 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021862
21863 ret_val = xmlSaveFormatFile(filename, cur, format);
21864 desret_int(ret_val);
21865 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021866 des_fileoutput(n_filename, filename, 0);
21867 des_xmlDocPtr(n_cur, cur, 1);
21868 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021869 xmlResetLastError();
21870 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021871 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021873 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021874 printf(" %d", n_filename);
21875 printf(" %d", n_cur);
21876 printf(" %d", n_format);
21877 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021878 }
21879 }
21880 }
21881 }
21882#endif
21883
Daniel Veillard3d97e662004-11-04 10:49:00 +000021884 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021885 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021886}
21887
21888
21889static int
21890test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021892
21893#ifdef LIBXML_OUTPUT_ENABLED
21894 int mem_base;
21895 int ret_val;
21896 const char * filename; /* the filename or URL to output */
21897 int n_filename;
21898 xmlDocPtr cur; /* the document being saved */
21899 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021900 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021901 int n_encoding;
21902 int format; /* should formatting spaces be added. */
21903 int n_format;
21904
21905 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21906 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21907 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21908 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21909 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021910 filename = gen_fileoutput(n_filename, 0);
21911 cur = gen_xmlDocPtr(n_cur, 1);
21912 encoding = gen_const_char_ptr(n_encoding, 2);
21913 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021914
21915 ret_val = xmlSaveFormatFileEnc(filename, cur, encoding, format);
21916 desret_int(ret_val);
21917 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021918 des_fileoutput(n_filename, filename, 0);
21919 des_xmlDocPtr(n_cur, cur, 1);
21920 des_const_char_ptr(n_encoding, encoding, 2);
21921 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021922 xmlResetLastError();
21923 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021924 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021926 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021927 printf(" %d", n_filename);
21928 printf(" %d", n_cur);
21929 printf(" %d", n_encoding);
21930 printf(" %d", n_format);
21931 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021932 }
21933 }
21934 }
21935 }
21936 }
21937#endif
21938
Daniel Veillard3d97e662004-11-04 10:49:00 +000021939 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021941}
21942
21943
21944static int
21945test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021947
Daniel Veillard3d97e662004-11-04 10:49:00 +000021948#ifdef LIBXML_OUTPUT_ENABLED
21949 int mem_base;
21950 int ret_val;
21951 xmlOutputBufferPtr buf; /* an output I/O buffer */
21952 int n_buf;
21953 xmlDocPtr cur; /* the document */
21954 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021955 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021956 int n_encoding;
21957 int format; /* should formatting spaces been added */
21958 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021959
Daniel Veillard3d97e662004-11-04 10:49:00 +000021960 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21961 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21962 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21963 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21964 mem_base = xmlMemBlocks();
21965 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21966 cur = gen_xmlDocPtr(n_cur, 1);
21967 encoding = gen_const_char_ptr(n_encoding, 2);
21968 format = gen_int(n_format, 3);
21969
21970 ret_val = xmlSaveFormatFileTo(buf, cur, encoding, format);
21971 buf = NULL;
21972 desret_int(ret_val);
21973 call_tests++;
21974 des_xmlOutputBufferPtr(n_buf, buf, 0);
21975 des_xmlDocPtr(n_cur, cur, 1);
21976 des_const_char_ptr(n_encoding, encoding, 2);
21977 des_int(n_format, format, 3);
21978 xmlResetLastError();
21979 if (mem_base != xmlMemBlocks()) {
21980 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
21981 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021982 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021983 printf(" %d", n_buf);
21984 printf(" %d", n_cur);
21985 printf(" %d", n_encoding);
21986 printf(" %d", n_format);
21987 printf("\n");
21988 }
21989 }
21990 }
21991 }
21992 }
21993#endif
21994
21995 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000021996 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021997}
21998
21999
22000static int
22001test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022002 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022003
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022004 int mem_base;
22005 xmlNsPtr ret_val;
22006 xmlDocPtr doc; /* the document */
22007 int n_doc;
22008 xmlNodePtr node; /* the current node */
22009 int n_node;
22010 xmlChar * nameSpace; /* the namespace prefix */
22011 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022012
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022013 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22014 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22015 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22016 mem_base = xmlMemBlocks();
22017 doc = gen_xmlDocPtr(n_doc, 0);
22018 node = gen_xmlNodePtr(n_node, 1);
22019 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22020
22021 ret_val = xmlSearchNs(doc, node, nameSpace);
22022 desret_xmlNsPtr(ret_val);
22023 call_tests++;
22024 des_xmlDocPtr(n_doc, doc, 0);
22025 des_xmlNodePtr(n_node, node, 1);
22026 des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
22027 xmlResetLastError();
22028 if (mem_base != xmlMemBlocks()) {
22029 printf("Leak of %d blocks found in xmlSearchNs",
22030 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022031 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022032 printf(" %d", n_doc);
22033 printf(" %d", n_node);
22034 printf(" %d", n_nameSpace);
22035 printf("\n");
22036 }
22037 }
22038 }
22039 }
22040
22041 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022043}
22044
22045
22046static int
22047test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022049
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022050 int mem_base;
22051 xmlNsPtr ret_val;
22052 xmlDocPtr doc; /* the document */
22053 int n_doc;
22054 xmlNodePtr node; /* the current node */
22055 int n_node;
22056 xmlChar * href; /* the namespace value */
22057 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022058
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022059 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22060 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22061 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22062 mem_base = xmlMemBlocks();
22063 doc = gen_xmlDocPtr(n_doc, 0);
22064 node = gen_xmlNodePtr(n_node, 1);
22065 href = gen_const_xmlChar_ptr(n_href, 2);
22066
22067 ret_val = xmlSearchNsByHref(doc, node, href);
22068 desret_xmlNsPtr(ret_val);
22069 call_tests++;
22070 des_xmlDocPtr(n_doc, doc, 0);
22071 des_xmlNodePtr(n_node, node, 1);
22072 des_const_xmlChar_ptr(n_href, href, 2);
22073 xmlResetLastError();
22074 if (mem_base != xmlMemBlocks()) {
22075 printf("Leak of %d blocks found in xmlSearchNsByHref",
22076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022077 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022078 printf(" %d", n_doc);
22079 printf(" %d", n_node);
22080 printf(" %d", n_href);
22081 printf("\n");
22082 }
22083 }
22084 }
22085 }
22086
22087 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022088 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022089}
22090
22091
22092static int
22093test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022094 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022095
Daniel Veillard57b25162004-11-06 14:50:18 +000022096 int mem_base;
22097 xmlBufferAllocationScheme scheme; /* allocation method to use */
22098 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022099
Daniel Veillard57b25162004-11-06 14:50:18 +000022100 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22101 mem_base = xmlMemBlocks();
22102 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22103
22104 xmlSetBufferAllocationScheme(scheme);
22105 call_tests++;
22106 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22107 xmlResetLastError();
22108 if (mem_base != xmlMemBlocks()) {
22109 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022111 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022112 printf(" %d", n_scheme);
22113 printf("\n");
22114 }
22115 }
22116
22117 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022118 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022119}
22120
22121
22122static int
22123test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022124 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022125
22126 int mem_base;
22127 int mode; /* the compression ratio */
22128 int n_mode;
22129
22130 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022132 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022133
22134 xmlSetCompressMode(mode);
22135 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022136 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022137 xmlResetLastError();
22138 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022139 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022141 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022142 printf(" %d", n_mode);
22143 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022144 }
22145 }
22146
Daniel Veillard3d97e662004-11-04 10:49:00 +000022147 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022148 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022149}
22150
22151
22152static int
22153test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022155
22156 int mem_base;
22157 xmlDocPtr doc; /* the document */
22158 int n_doc;
22159 int mode; /* the compression ratio */
22160 int n_mode;
22161
22162 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22163 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22164 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022165 doc = gen_xmlDocPtr(n_doc, 0);
22166 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022167
22168 xmlSetDocCompressMode(doc, mode);
22169 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022170 des_xmlDocPtr(n_doc, doc, 0);
22171 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022172 xmlResetLastError();
22173 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022174 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022176 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022177 printf(" %d", n_doc);
22178 printf(" %d", n_mode);
22179 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022180 }
22181 }
22182 }
22183
Daniel Veillard3d97e662004-11-04 10:49:00 +000022184 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022185 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022186}
22187
22188
22189static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022190test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022192
Daniel Veillard27f20102004-11-05 11:50:11 +000022193 int mem_base;
22194 xmlNodePtr node; /* a node in the document */
22195 int n_node;
22196 xmlNsPtr ns; /* a namespace pointer */
22197 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022198
Daniel Veillard27f20102004-11-05 11:50:11 +000022199 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22200 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22201 mem_base = xmlMemBlocks();
22202 node = gen_xmlNodePtr(n_node, 0);
22203 ns = gen_xmlNsPtr(n_ns, 1);
22204
22205 xmlSetNs(node, ns);
22206 call_tests++;
22207 des_xmlNodePtr(n_node, node, 0);
22208 des_xmlNsPtr(n_ns, ns, 1);
22209 xmlResetLastError();
22210 if (mem_base != xmlMemBlocks()) {
22211 printf("Leak of %d blocks found in xmlSetNs",
22212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022213 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022214 printf(" %d", n_node);
22215 printf(" %d", n_ns);
22216 printf("\n");
22217 }
22218 }
22219 }
22220
22221 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022223}
22224
22225
22226static int
22227test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022229
Daniel Veillard57b25162004-11-06 14:50:18 +000022230#ifdef LIBXML_TREE_ENABLED
22231 int mem_base;
22232 xmlAttrPtr ret_val;
22233 xmlNodePtr node; /* the node */
22234 int n_node;
22235 xmlNsPtr ns; /* the namespace definition */
22236 int n_ns;
22237 xmlChar * name; /* the attribute name */
22238 int n_name;
22239 xmlChar * value; /* the attribute value */
22240 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022241
Daniel Veillard57b25162004-11-06 14:50:18 +000022242 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22243 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22244 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22245 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22246 mem_base = xmlMemBlocks();
22247 node = gen_xmlNodePtr(n_node, 0);
22248 ns = gen_xmlNsPtr(n_ns, 1);
22249 name = gen_const_xmlChar_ptr(n_name, 2);
22250 value = gen_const_xmlChar_ptr(n_value, 3);
22251
22252 ret_val = xmlSetNsProp(node, ns, name, value);
22253 desret_xmlAttrPtr(ret_val);
22254 call_tests++;
22255 des_xmlNodePtr(n_node, node, 0);
22256 des_xmlNsPtr(n_ns, ns, 1);
22257 des_const_xmlChar_ptr(n_name, name, 2);
22258 des_const_xmlChar_ptr(n_value, value, 3);
22259 xmlResetLastError();
22260 if (mem_base != xmlMemBlocks()) {
22261 printf("Leak of %d blocks found in xmlSetNsProp",
22262 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022263 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022264 printf(" %d", n_node);
22265 printf(" %d", n_ns);
22266 printf(" %d", n_name);
22267 printf(" %d", n_value);
22268 printf("\n");
22269 }
22270 }
22271 }
22272 }
22273 }
22274#endif
22275
22276 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022278}
22279
22280
22281static int
22282test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022284
Daniel Veillard57b25162004-11-06 14:50:18 +000022285#ifdef LIBXML_TREE_ENABLED
22286 int mem_base;
22287 xmlAttrPtr ret_val;
22288 xmlNodePtr node; /* the node */
22289 int n_node;
22290 xmlChar * name; /* the attribute name */
22291 int n_name;
22292 xmlChar * value; /* the attribute value */
22293 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022294
Daniel Veillard57b25162004-11-06 14:50:18 +000022295 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22296 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22297 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22298 mem_base = xmlMemBlocks();
22299 node = gen_xmlNodePtr(n_node, 0);
22300 name = gen_const_xmlChar_ptr(n_name, 1);
22301 value = gen_const_xmlChar_ptr(n_value, 2);
22302
22303 ret_val = xmlSetProp(node, name, value);
22304 desret_xmlAttrPtr(ret_val);
22305 call_tests++;
22306 des_xmlNodePtr(n_node, node, 0);
22307 des_const_xmlChar_ptr(n_name, name, 1);
22308 des_const_xmlChar_ptr(n_value, value, 2);
22309 xmlResetLastError();
22310 if (mem_base != xmlMemBlocks()) {
22311 printf("Leak of %d blocks found in xmlSetProp",
22312 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022313 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022314 printf(" %d", n_node);
22315 printf(" %d", n_name);
22316 printf(" %d", n_value);
22317 printf("\n");
22318 }
22319 }
22320 }
22321 }
22322#endif
22323
22324 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022325 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022326}
22327
22328
22329static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022330test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022331 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022332
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022333 int mem_base;
22334 xmlChar * ret_val;
22335 xmlChar * name; /* the full QName */
22336 int n_name;
22337 xmlChar ** prefix; /* a xmlChar ** */
22338 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022339
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022340 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22341 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22342 mem_base = xmlMemBlocks();
22343 name = gen_const_xmlChar_ptr(n_name, 0);
22344 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22345
22346 ret_val = xmlSplitQName2(name, prefix);
22347 desret_xmlChar_ptr(ret_val);
22348 call_tests++;
22349 des_const_xmlChar_ptr(n_name, name, 0);
22350 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22351 xmlResetLastError();
22352 if (mem_base != xmlMemBlocks()) {
22353 printf("Leak of %d blocks found in xmlSplitQName2",
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_name);
22357 printf(" %d", n_prefix);
22358 printf("\n");
22359 }
22360 }
22361 }
22362
22363 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022364 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022365}
22366
22367
22368static int
22369test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022370 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022371
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022372 int mem_base;
22373 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022374 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022375 int n_name;
22376 int * len; /* an int * */
22377 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022378
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022379 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22380 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22381 mem_base = xmlMemBlocks();
22382 name = gen_const_xmlChar_ptr(n_name, 0);
22383 len = gen_int_ptr(n_len, 1);
22384
22385 ret_val = xmlSplitQName3(name, len);
22386 desret_const_xmlChar_ptr(ret_val);
22387 call_tests++;
22388 des_const_xmlChar_ptr(n_name, name, 0);
22389 des_int_ptr(n_len, len, 1);
22390 xmlResetLastError();
22391 if (mem_base != xmlMemBlocks()) {
22392 printf("Leak of %d blocks found in xmlSplitQName3",
22393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022394 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022395 printf(" %d", n_name);
22396 printf(" %d", n_len);
22397 printf("\n");
22398 }
22399 }
22400 }
22401
22402 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022403 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022404}
22405
22406
22407static int
22408test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022409 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022410
22411 int mem_base;
22412 xmlNodePtr ret_val;
22413 xmlDocPtr doc; /* the document */
22414 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022415 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022416 int n_value;
22417
22418 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22419 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22420 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022421 doc = gen_xmlDocPtr(n_doc, 0);
22422 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022423
22424 ret_val = xmlStringGetNodeList(doc, value);
22425 desret_xmlNodePtr(ret_val);
22426 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022427 des_xmlDocPtr(n_doc, doc, 0);
22428 des_const_xmlChar_ptr(n_value, value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022429 xmlResetLastError();
22430 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022431 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022433 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022434 printf(" %d", n_doc);
22435 printf(" %d", n_value);
22436 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022437 }
22438 }
22439 }
22440
Daniel Veillard3d97e662004-11-04 10:49:00 +000022441 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022442 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022443}
22444
22445
22446static int
22447test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022449
22450 int mem_base;
22451 xmlNodePtr ret_val;
22452 xmlDocPtr doc; /* the document */
22453 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022454 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022455 int n_value;
22456 int len; /* the length of the string value */
22457 int n_len;
22458
22459 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22460 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22461 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22462 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022463 doc = gen_xmlDocPtr(n_doc, 0);
22464 value = gen_const_xmlChar_ptr(n_value, 1);
22465 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022466
22467 ret_val = xmlStringLenGetNodeList(doc, value, len);
22468 desret_xmlNodePtr(ret_val);
22469 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022470 des_xmlDocPtr(n_doc, doc, 0);
22471 des_const_xmlChar_ptr(n_value, value, 1);
22472 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022473 xmlResetLastError();
22474 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022475 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022477 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022478 printf(" %d", n_doc);
22479 printf(" %d", n_value);
22480 printf(" %d", n_len);
22481 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022482 }
22483 }
22484 }
22485 }
22486
Daniel Veillard3d97e662004-11-04 10:49:00 +000022487 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022489}
22490
22491
22492static int
22493test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022495
22496 int mem_base;
22497 int ret_val;
22498 xmlNodePtr node; /* the node */
22499 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022500 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022501 int n_content;
22502 int len; /* @content length */
22503 int n_len;
22504
22505 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22506 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22507 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22508 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022509 node = gen_xmlNodePtr(n_node, 0);
22510 content = gen_const_xmlChar_ptr(n_content, 1);
22511 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022512
22513 ret_val = xmlTextConcat(node, content, len);
22514 desret_int(ret_val);
22515 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022516 des_xmlNodePtr(n_node, node, 0);
22517 des_const_xmlChar_ptr(n_content, content, 1);
22518 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022519 xmlResetLastError();
22520 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022521 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022522 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022523 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022524 printf(" %d", n_node);
22525 printf(" %d", n_content);
22526 printf(" %d", n_len);
22527 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022528 }
22529 }
22530 }
22531 }
22532
Daniel Veillard3d97e662004-11-04 10:49:00 +000022533 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022534 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022535}
22536
22537
22538static int
22539test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022540 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022541
22542 int mem_base;
22543 xmlNodePtr ret_val;
22544 xmlNodePtr first; /* the first text node */
22545 int n_first;
22546 xmlNodePtr second; /* the second text node being merged */
22547 int n_second;
22548
Daniel Veillarda03e3652004-11-02 18:45:30 +000022549 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22550 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022551 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022552 first = gen_xmlNodePtr_in(n_first, 0);
22553 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022554
22555 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022556 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022557 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022558 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022559 desret_xmlNodePtr(ret_val);
22560 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022561 des_xmlNodePtr_in(n_first, first, 0);
22562 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022563 xmlResetLastError();
22564 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022565 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022567 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022568 printf(" %d", n_first);
22569 printf(" %d", n_second);
22570 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022571 }
22572 }
22573 }
22574
Daniel Veillard3d97e662004-11-04 10:49:00 +000022575 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022576 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022577}
22578
22579
22580static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022581test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022583
Daniel Veillard27f20102004-11-05 11:50:11 +000022584#ifdef LIBXML_TREE_ENABLED
22585 int mem_base;
22586 int ret_val;
22587 xmlNodePtr node; /* the node */
22588 int n_node;
22589 xmlNsPtr ns; /* the namespace definition */
22590 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022591 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022592 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022593
Daniel Veillard27f20102004-11-05 11:50:11 +000022594 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22595 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22596 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22597 mem_base = xmlMemBlocks();
22598 node = gen_xmlNodePtr(n_node, 0);
22599 ns = gen_xmlNsPtr(n_ns, 1);
22600 name = gen_const_xmlChar_ptr(n_name, 2);
22601
22602 ret_val = xmlUnsetNsProp(node, ns, name);
22603 desret_int(ret_val);
22604 call_tests++;
22605 des_xmlNodePtr(n_node, node, 0);
22606 des_xmlNsPtr(n_ns, ns, 1);
22607 des_const_xmlChar_ptr(n_name, name, 2);
22608 xmlResetLastError();
22609 if (mem_base != xmlMemBlocks()) {
22610 printf("Leak of %d blocks found in xmlUnsetNsProp",
22611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022612 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022613 printf(" %d", n_node);
22614 printf(" %d", n_ns);
22615 printf(" %d", n_name);
22616 printf("\n");
22617 }
22618 }
22619 }
22620 }
22621#endif
22622
22623 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022625}
22626
22627
22628static int
22629test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022631
22632#ifdef LIBXML_TREE_ENABLED
22633 int mem_base;
22634 int ret_val;
22635 xmlNodePtr node; /* the node */
22636 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022637 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022638 int n_name;
22639
22640 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22641 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22642 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022643 node = gen_xmlNodePtr(n_node, 0);
22644 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022645
22646 ret_val = xmlUnsetProp(node, name);
22647 desret_int(ret_val);
22648 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022649 des_xmlNodePtr(n_node, node, 0);
22650 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022651 xmlResetLastError();
22652 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022653 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022655 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022656 printf(" %d", n_node);
22657 printf(" %d", n_name);
22658 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022659 }
22660 }
22661 }
22662#endif
22663
Daniel Veillard3d97e662004-11-04 10:49:00 +000022664 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022666}
22667
22668
22669static int
22670test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022672
22673 int mem_base;
22674 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022675 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022676 int n_value;
22677 int space; /* allow spaces in front and end of the string */
22678 int n_space;
22679
22680 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22681 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22682 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022683 value = gen_const_xmlChar_ptr(n_value, 0);
22684 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022685
22686 ret_val = xmlValidateNCName(value, space);
22687 desret_int(ret_val);
22688 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022689 des_const_xmlChar_ptr(n_value, value, 0);
22690 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022691 xmlResetLastError();
22692 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022693 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022695 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022696 printf(" %d", n_value);
22697 printf(" %d", n_space);
22698 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022699 }
22700 }
22701 }
22702
Daniel Veillard3d97e662004-11-04 10:49:00 +000022703 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022704 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022705}
22706
22707
22708static int
22709test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022710 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022711
22712 int mem_base;
22713 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022714 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022715 int n_value;
22716 int space; /* allow spaces in front and end of the string */
22717 int n_space;
22718
22719 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22720 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22721 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022722 value = gen_const_xmlChar_ptr(n_value, 0);
22723 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022724
22725 ret_val = xmlValidateNMToken(value, space);
22726 desret_int(ret_val);
22727 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022728 des_const_xmlChar_ptr(n_value, value, 0);
22729 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022730 xmlResetLastError();
22731 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022732 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022733 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022734 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022735 printf(" %d", n_value);
22736 printf(" %d", n_space);
22737 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022738 }
22739 }
22740 }
22741
Daniel Veillard3d97e662004-11-04 10:49:00 +000022742 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022744}
22745
22746
22747static int
22748test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022750
22751 int mem_base;
22752 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022753 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022754 int n_value;
22755 int space; /* allow spaces in front and end of the string */
22756 int n_space;
22757
22758 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22759 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22760 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022761 value = gen_const_xmlChar_ptr(n_value, 0);
22762 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022763
22764 ret_val = xmlValidateName(value, space);
22765 desret_int(ret_val);
22766 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022767 des_const_xmlChar_ptr(n_value, value, 0);
22768 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022769 xmlResetLastError();
22770 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022771 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022772 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022773 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022774 printf(" %d", n_value);
22775 printf(" %d", n_space);
22776 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022777 }
22778 }
22779 }
22780
Daniel Veillard3d97e662004-11-04 10:49:00 +000022781 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022783}
22784
22785
22786static int
22787test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022789
22790 int mem_base;
22791 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022792 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022793 int n_value;
22794 int space; /* allow spaces in front and end of the string */
22795 int n_space;
22796
22797 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22798 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22799 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022800 value = gen_const_xmlChar_ptr(n_value, 0);
22801 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022802
22803 ret_val = xmlValidateQName(value, space);
22804 desret_int(ret_val);
22805 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022806 des_const_xmlChar_ptr(n_value, value, 0);
22807 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022808 xmlResetLastError();
22809 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022810 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022811 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022812 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022813 printf(" %d", n_value);
22814 printf(" %d", n_space);
22815 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022816 }
22817 }
22818 }
22819
Daniel Veillard3d97e662004-11-04 10:49:00 +000022820 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000022821 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022822}
22823
22824static int
22825test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022827
Daniel Veillard3d95c732004-11-06 22:25:14 +000022828 printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000022829 test_ret += test_xmlAddChild();
22830 test_ret += test_xmlAddChildList();
22831 test_ret += test_xmlAddNextSibling();
22832 test_ret += test_xmlAddPrevSibling();
22833 test_ret += test_xmlAddSibling();
22834 test_ret += test_xmlAttrSerializeTxtContent();
22835 test_ret += test_xmlBufferAdd();
22836 test_ret += test_xmlBufferAddHead();
22837 test_ret += test_xmlBufferCCat();
22838 test_ret += test_xmlBufferCat();
22839 test_ret += test_xmlBufferContent();
22840 test_ret += test_xmlBufferCreate();
22841 test_ret += test_xmlBufferCreateSize();
22842 test_ret += test_xmlBufferCreateStatic();
22843 test_ret += test_xmlBufferEmpty();
22844 test_ret += test_xmlBufferGrow();
22845 test_ret += test_xmlBufferLength();
22846 test_ret += test_xmlBufferResize();
22847 test_ret += test_xmlBufferSetAllocationScheme();
22848 test_ret += test_xmlBufferShrink();
22849 test_ret += test_xmlBufferWriteCHAR();
22850 test_ret += test_xmlBufferWriteChar();
22851 test_ret += test_xmlBufferWriteQuotedString();
22852 test_ret += test_xmlBuildQName();
22853 test_ret += test_xmlCopyDoc();
22854 test_ret += test_xmlCopyDtd();
22855 test_ret += test_xmlCopyNamespace();
22856 test_ret += test_xmlCopyNamespaceList();
22857 test_ret += test_xmlCopyNode();
22858 test_ret += test_xmlCopyNodeList();
22859 test_ret += test_xmlCopyProp();
22860 test_ret += test_xmlCopyPropList();
22861 test_ret += test_xmlCreateIntSubset();
22862 test_ret += test_xmlDocCopyNode();
22863 test_ret += test_xmlDocCopyNodeList();
22864 test_ret += test_xmlDocDump();
22865 test_ret += test_xmlDocDumpFormatMemory();
22866 test_ret += test_xmlDocDumpFormatMemoryEnc();
22867 test_ret += test_xmlDocDumpMemory();
22868 test_ret += test_xmlDocDumpMemoryEnc();
22869 test_ret += test_xmlDocFormatDump();
22870 test_ret += test_xmlDocGetRootElement();
22871 test_ret += test_xmlDocSetRootElement();
22872 test_ret += test_xmlElemDump();
22873 test_ret += test_xmlGetBufferAllocationScheme();
22874 test_ret += test_xmlGetCompressMode();
22875 test_ret += test_xmlGetDocCompressMode();
22876 test_ret += test_xmlGetIntSubset();
22877 test_ret += test_xmlGetLastChild();
22878 test_ret += test_xmlGetLineNo();
22879 test_ret += test_xmlGetNoNsProp();
22880 test_ret += test_xmlGetNodePath();
22881 test_ret += test_xmlGetNsList();
22882 test_ret += test_xmlGetNsProp();
22883 test_ret += test_xmlGetProp();
22884 test_ret += test_xmlHasNsProp();
22885 test_ret += test_xmlHasProp();
22886 test_ret += test_xmlIsBlankNode();
22887 test_ret += test_xmlIsXHTML();
22888 test_ret += test_xmlNewCDataBlock();
22889 test_ret += test_xmlNewCharRef();
22890 test_ret += test_xmlNewChild();
22891 test_ret += test_xmlNewComment();
22892 test_ret += test_xmlNewDoc();
22893 test_ret += test_xmlNewDocComment();
22894 test_ret += test_xmlNewDocFragment();
22895 test_ret += test_xmlNewDocNode();
22896 test_ret += test_xmlNewDocNodeEatName();
22897 test_ret += test_xmlNewDocPI();
22898 test_ret += test_xmlNewDocProp();
22899 test_ret += test_xmlNewDocRawNode();
22900 test_ret += test_xmlNewDocText();
22901 test_ret += test_xmlNewDocTextLen();
22902 test_ret += test_xmlNewDtd();
22903 test_ret += test_xmlNewNode();
22904 test_ret += test_xmlNewNodeEatName();
22905 test_ret += test_xmlNewNs();
22906 test_ret += test_xmlNewNsProp();
22907 test_ret += test_xmlNewNsPropEatName();
22908 test_ret += test_xmlNewPI();
22909 test_ret += test_xmlNewProp();
22910 test_ret += test_xmlNewReference();
22911 test_ret += test_xmlNewText();
22912 test_ret += test_xmlNewTextChild();
22913 test_ret += test_xmlNewTextLen();
22914 test_ret += test_xmlNodeAddContent();
22915 test_ret += test_xmlNodeAddContentLen();
22916 test_ret += test_xmlNodeBufGetContent();
22917 test_ret += test_xmlNodeDump();
22918 test_ret += test_xmlNodeDumpOutput();
22919 test_ret += test_xmlNodeGetBase();
22920 test_ret += test_xmlNodeGetContent();
22921 test_ret += test_xmlNodeGetLang();
22922 test_ret += test_xmlNodeGetSpacePreserve();
22923 test_ret += test_xmlNodeIsText();
22924 test_ret += test_xmlNodeListGetRawString();
22925 test_ret += test_xmlNodeListGetString();
22926 test_ret += test_xmlNodeSetBase();
22927 test_ret += test_xmlNodeSetContent();
22928 test_ret += test_xmlNodeSetContentLen();
22929 test_ret += test_xmlNodeSetLang();
22930 test_ret += test_xmlNodeSetName();
22931 test_ret += test_xmlNodeSetSpacePreserve();
22932 test_ret += test_xmlReconciliateNs();
22933 test_ret += test_xmlRemoveProp();
22934 test_ret += test_xmlReplaceNode();
22935 test_ret += test_xmlSaveFile();
22936 test_ret += test_xmlSaveFileEnc();
22937 test_ret += test_xmlSaveFileTo();
22938 test_ret += test_xmlSaveFormatFile();
22939 test_ret += test_xmlSaveFormatFileEnc();
22940 test_ret += test_xmlSaveFormatFileTo();
22941 test_ret += test_xmlSearchNs();
22942 test_ret += test_xmlSearchNsByHref();
22943 test_ret += test_xmlSetBufferAllocationScheme();
22944 test_ret += test_xmlSetCompressMode();
22945 test_ret += test_xmlSetDocCompressMode();
22946 test_ret += test_xmlSetNs();
22947 test_ret += test_xmlSetNsProp();
22948 test_ret += test_xmlSetProp();
22949 test_ret += test_xmlSplitQName2();
22950 test_ret += test_xmlSplitQName3();
22951 test_ret += test_xmlStringGetNodeList();
22952 test_ret += test_xmlStringLenGetNodeList();
22953 test_ret += test_xmlTextConcat();
22954 test_ret += test_xmlTextMerge();
22955 test_ret += test_xmlUnsetNsProp();
22956 test_ret += test_xmlUnsetProp();
22957 test_ret += test_xmlValidateNCName();
22958 test_ret += test_xmlValidateNMToken();
22959 test_ret += test_xmlValidateName();
22960 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000022961
Daniel Veillard42595322004-11-08 10:52:06 +000022962 if (test_ret != 0)
22963 printf("Module tree: %d errors\n", test_ret);
22964 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022965}
22966
22967static int
22968test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022970
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022971 int mem_base;
22972 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022973 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022974 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022975 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022976 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022977
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022978 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
22979 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
22980 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022981 URI = gen_const_xmlChar_ptr(n_URI, 0);
22982 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022983
22984 ret_val = xmlBuildRelativeURI(URI, base);
22985 desret_xmlChar_ptr(ret_val);
22986 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022987 des_const_xmlChar_ptr(n_URI, URI, 0);
22988 des_const_xmlChar_ptr(n_base, base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022989 xmlResetLastError();
22990 if (mem_base != xmlMemBlocks()) {
22991 printf("Leak of %d blocks found in xmlBuildRelativeURI",
22992 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022993 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022994 printf(" %d", n_URI);
22995 printf(" %d", n_base);
22996 printf("\n");
22997 }
22998 }
22999 }
23000
Daniel Veillard3d97e662004-11-04 10:49:00 +000023001 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023002 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023003}
23004
23005
23006static int
23007test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023008 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023009
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023010 int mem_base;
23011 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023012 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023013 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023014 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023015 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023016
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023017 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23018 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23019 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023020 URI = gen_const_xmlChar_ptr(n_URI, 0);
23021 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023022
23023 ret_val = xmlBuildURI(URI, base);
23024 desret_xmlChar_ptr(ret_val);
23025 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023026 des_const_xmlChar_ptr(n_URI, URI, 0);
23027 des_const_xmlChar_ptr(n_base, base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023028 xmlResetLastError();
23029 if (mem_base != xmlMemBlocks()) {
23030 printf("Leak of %d blocks found in xmlBuildURI",
23031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023032 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023033 printf(" %d", n_URI);
23034 printf(" %d", n_base);
23035 printf("\n");
23036 }
23037 }
23038 }
23039
Daniel Veillard3d97e662004-11-04 10:49:00 +000023040 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023041 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023042}
23043
23044
23045static int
23046test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023047 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023048
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023049 int mem_base;
23050 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023051 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023052 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023053
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023054 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23055 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023056 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023057
23058 ret_val = xmlCanonicPath(path);
23059 desret_xmlChar_ptr(ret_val);
23060 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023061 des_const_xmlChar_ptr(n_path, path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023062 xmlResetLastError();
23063 if (mem_base != xmlMemBlocks()) {
23064 printf("Leak of %d blocks found in xmlCanonicPath",
23065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023066 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023067 printf(" %d", n_path);
23068 printf("\n");
23069 }
23070 }
23071
Daniel Veillard3d97e662004-11-04 10:49:00 +000023072 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023073 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023074}
23075
23076
23077static int
23078test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023079 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023080
23081
23082 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023084}
23085
23086
23087static int
23088test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023090
Daniel Veillardce682bc2004-11-05 17:22:25 +000023091 int mem_base;
23092 int ret_val;
23093 char * path; /* pointer to the path string */
23094 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023095
Daniel Veillardce682bc2004-11-05 17:22:25 +000023096 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23097 mem_base = xmlMemBlocks();
23098 path = gen_char_ptr(n_path, 0);
23099
23100 ret_val = xmlNormalizeURIPath(path);
23101 desret_int(ret_val);
23102 call_tests++;
23103 des_char_ptr(n_path, path, 0);
23104 xmlResetLastError();
23105 if (mem_base != xmlMemBlocks()) {
23106 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023108 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023109 printf(" %d", n_path);
23110 printf("\n");
23111 }
23112 }
23113
23114 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023116}
23117
23118
23119static int
23120test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023122
23123
23124 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023125 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023126}
23127
23128
Daniel Veillardce682bc2004-11-05 17:22:25 +000023129#define gen_nb_xmlURIPtr 1
23130static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23131 return(NULL);
23132}
23133static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23134}
23135
Daniel Veillardd93f6252004-11-02 15:53:51 +000023136static int
23137test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023139
Daniel Veillardce682bc2004-11-05 17:22:25 +000023140 int mem_base;
23141 int ret_val;
23142 xmlURIPtr uri; /* pointer to an URI structure */
23143 int n_uri;
23144 char * str; /* the string to analyze */
23145 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023146
Daniel Veillardce682bc2004-11-05 17:22:25 +000023147 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23148 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23149 mem_base = xmlMemBlocks();
23150 uri = gen_xmlURIPtr(n_uri, 0);
23151 str = gen_const_char_ptr(n_str, 1);
23152
23153 ret_val = xmlParseURIReference(uri, str);
23154 desret_int(ret_val);
23155 call_tests++;
23156 des_xmlURIPtr(n_uri, uri, 0);
23157 des_const_char_ptr(n_str, str, 1);
23158 xmlResetLastError();
23159 if (mem_base != xmlMemBlocks()) {
23160 printf("Leak of %d blocks found in xmlParseURIReference",
23161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023162 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023163 printf(" %d", n_uri);
23164 printf(" %d", n_str);
23165 printf("\n");
23166 }
23167 }
23168 }
23169
23170 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023171 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023172}
23173
23174
23175static int
23176test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023177 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023178
Daniel Veillardce682bc2004-11-05 17:22:25 +000023179 int mem_base;
23180 FILE * stream; /* a FILE* for the output */
23181 int n_stream;
23182 xmlURIPtr uri; /* pointer to an xmlURI */
23183 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023184
Daniel Veillardce682bc2004-11-05 17:22:25 +000023185 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23186 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23187 mem_base = xmlMemBlocks();
23188 stream = gen_FILE_ptr(n_stream, 0);
23189 uri = gen_xmlURIPtr(n_uri, 1);
23190
23191 xmlPrintURI(stream, uri);
23192 call_tests++;
23193 des_FILE_ptr(n_stream, stream, 0);
23194 des_xmlURIPtr(n_uri, uri, 1);
23195 xmlResetLastError();
23196 if (mem_base != xmlMemBlocks()) {
23197 printf("Leak of %d blocks found in xmlPrintURI",
23198 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023199 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023200 printf(" %d", n_stream);
23201 printf(" %d", n_uri);
23202 printf("\n");
23203 }
23204 }
23205 }
23206
23207 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023209}
23210
23211
23212static int
23213test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023215
Daniel Veillardce682bc2004-11-05 17:22:25 +000023216 int mem_base;
23217 xmlChar * ret_val;
23218 xmlURIPtr uri; /* pointer to an xmlURI */
23219 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023220
Daniel Veillardce682bc2004-11-05 17:22:25 +000023221 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23222 mem_base = xmlMemBlocks();
23223 uri = gen_xmlURIPtr(n_uri, 0);
23224
23225 ret_val = xmlSaveUri(uri);
23226 desret_xmlChar_ptr(ret_val);
23227 call_tests++;
23228 des_xmlURIPtr(n_uri, uri, 0);
23229 xmlResetLastError();
23230 if (mem_base != xmlMemBlocks()) {
23231 printf("Leak of %d blocks found in xmlSaveUri",
23232 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023233 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023234 printf(" %d", n_uri);
23235 printf("\n");
23236 }
23237 }
23238
23239 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023241}
23242
23243
23244static int
23245test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023247
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023248 int mem_base;
23249 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023250 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023251 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023252
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023253 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23254 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023255 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023256
23257 ret_val = xmlURIEscape(str);
23258 desret_xmlChar_ptr(ret_val);
23259 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023260 des_const_xmlChar_ptr(n_str, str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023261 xmlResetLastError();
23262 if (mem_base != xmlMemBlocks()) {
23263 printf("Leak of %d blocks found in xmlURIEscape",
23264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023265 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023266 printf(" %d", n_str);
23267 printf("\n");
23268 }
23269 }
23270
Daniel Veillard3d97e662004-11-04 10:49:00 +000023271 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023272 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023273}
23274
23275
23276static int
23277test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023278 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023279
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023280 int mem_base;
23281 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023282 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023283 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023284 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023285 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023286
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023287 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23288 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23289 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023290 str = gen_const_xmlChar_ptr(n_str, 0);
23291 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023292
23293 ret_val = xmlURIEscapeStr(str, list);
23294 desret_xmlChar_ptr(ret_val);
23295 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000023296 des_const_xmlChar_ptr(n_str, str, 0);
23297 des_const_xmlChar_ptr(n_list, list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023298 xmlResetLastError();
23299 if (mem_base != xmlMemBlocks()) {
23300 printf("Leak of %d blocks found in xmlURIEscapeStr",
23301 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023302 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023303 printf(" %d", n_str);
23304 printf(" %d", n_list);
23305 printf("\n");
23306 }
23307 }
23308 }
23309
Daniel Veillard3d97e662004-11-04 10:49:00 +000023310 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023312}
23313
23314
23315static int
23316test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023318
23319
23320 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023321 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023322}
23323
23324static int
23325test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023326 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023327
Daniel Veillardce682bc2004-11-05 17:22:25 +000023328 printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023329 test_ret += test_xmlBuildRelativeURI();
23330 test_ret += test_xmlBuildURI();
23331 test_ret += test_xmlCanonicPath();
23332 test_ret += test_xmlCreateURI();
23333 test_ret += test_xmlNormalizeURIPath();
23334 test_ret += test_xmlParseURI();
23335 test_ret += test_xmlParseURIReference();
23336 test_ret += test_xmlPrintURI();
23337 test_ret += test_xmlSaveUri();
23338 test_ret += test_xmlURIEscape();
23339 test_ret += test_xmlURIEscapeStr();
23340 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023341
Daniel Veillard42595322004-11-08 10:52:06 +000023342 if (test_ret != 0)
23343 printf("Module uri: %d errors\n", test_ret);
23344 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023345}
23346
23347static int
23348test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023350
Daniel Veillard42595322004-11-08 10:52:06 +000023351 int mem_base;
23352 xmlAttributePtr ret_val;
23353 xmlValidCtxtPtr ctxt; /* the validation context */
23354 int n_ctxt;
23355 xmlDtdPtr dtd; /* pointer to the DTD */
23356 int n_dtd;
23357 xmlChar * elem; /* the element name */
23358 int n_elem;
23359 xmlChar * name; /* the attribute name */
23360 int n_name;
23361 xmlChar * ns; /* the attribute namespace prefix */
23362 int n_ns;
23363 xmlAttributeType type; /* the attribute type */
23364 int n_type;
23365 xmlAttributeDefault def; /* the attribute default type */
23366 int n_def;
23367 xmlChar * defaultValue; /* the attribute default value */
23368 int n_defaultValue;
23369 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23370 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023371
Daniel Veillard42595322004-11-08 10:52:06 +000023372 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23373 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23374 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23375 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23376 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23377 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23378 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23379 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23380 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23381 mem_base = xmlMemBlocks();
23382 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23383 dtd = gen_xmlDtdPtr(n_dtd, 1);
23384 elem = gen_const_xmlChar_ptr(n_elem, 2);
23385 name = gen_const_xmlChar_ptr(n_name, 3);
23386 ns = gen_const_xmlChar_ptr(n_ns, 4);
23387 type = gen_xmlAttributeType(n_type, 5);
23388 def = gen_xmlAttributeDefault(n_def, 6);
23389 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23390 tree = gen_xmlEnumerationPtr(n_tree, 8);
23391
23392 ret_val = xmlAddAttributeDecl(ctxt, dtd, elem, name, ns, type, def, defaultValue, tree);
23393 desret_xmlAttributePtr(ret_val);
23394 call_tests++;
23395 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23396 des_xmlDtdPtr(n_dtd, dtd, 1);
23397 des_const_xmlChar_ptr(n_elem, elem, 2);
23398 des_const_xmlChar_ptr(n_name, name, 3);
23399 des_const_xmlChar_ptr(n_ns, ns, 4);
23400 des_xmlAttributeType(n_type, type, 5);
23401 des_xmlAttributeDefault(n_def, def, 6);
23402 des_const_xmlChar_ptr(n_defaultValue, defaultValue, 7);
23403 des_xmlEnumerationPtr(n_tree, tree, 8);
23404 xmlResetLastError();
23405 if (mem_base != xmlMemBlocks()) {
23406 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23407 xmlMemBlocks() - mem_base);
23408 test_ret++;
23409 printf(" %d", n_ctxt);
23410 printf(" %d", n_dtd);
23411 printf(" %d", n_elem);
23412 printf(" %d", n_name);
23413 printf(" %d", n_ns);
23414 printf(" %d", n_type);
23415 printf(" %d", n_def);
23416 printf(" %d", n_defaultValue);
23417 printf(" %d", n_tree);
23418 printf("\n");
23419 }
23420 }
23421 }
23422 }
23423 }
23424 }
23425 }
23426 }
23427 }
23428 }
23429
23430 function_tests++;
23431 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023432}
23433
23434
23435static int
23436test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023437 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023438
Daniel Veillard42595322004-11-08 10:52:06 +000023439 int mem_base;
23440 xmlElementPtr ret_val;
23441 xmlValidCtxtPtr ctxt; /* the validation context */
23442 int n_ctxt;
23443 xmlDtdPtr dtd; /* pointer to the DTD */
23444 int n_dtd;
23445 xmlChar * name; /* the entity name */
23446 int n_name;
23447 xmlElementTypeVal type; /* the element type */
23448 int n_type;
23449 xmlElementContentPtr content; /* the element content tree or NULL */
23450 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023451
Daniel Veillard42595322004-11-08 10:52:06 +000023452 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23453 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23454 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23455 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23456 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23457 mem_base = xmlMemBlocks();
23458 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23459 dtd = gen_xmlDtdPtr(n_dtd, 1);
23460 name = gen_const_xmlChar_ptr(n_name, 2);
23461 type = gen_xmlElementTypeVal(n_type, 3);
23462 content = gen_xmlElementContentPtr(n_content, 4);
23463
23464 ret_val = xmlAddElementDecl(ctxt, dtd, name, type, content);
23465 desret_xmlElementPtr(ret_val);
23466 call_tests++;
23467 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23468 des_xmlDtdPtr(n_dtd, dtd, 1);
23469 des_const_xmlChar_ptr(n_name, name, 2);
23470 des_xmlElementTypeVal(n_type, type, 3);
23471 des_xmlElementContentPtr(n_content, content, 4);
23472 xmlResetLastError();
23473 if (mem_base != xmlMemBlocks()) {
23474 printf("Leak of %d blocks found in xmlAddElementDecl",
23475 xmlMemBlocks() - mem_base);
23476 test_ret++;
23477 printf(" %d", n_ctxt);
23478 printf(" %d", n_dtd);
23479 printf(" %d", n_name);
23480 printf(" %d", n_type);
23481 printf(" %d", n_content);
23482 printf("\n");
23483 }
23484 }
23485 }
23486 }
23487 }
23488 }
23489
23490 function_tests++;
23491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023492}
23493
23494
23495static int
23496test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023498
23499
23500 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023502}
23503
23504
23505static int
23506test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023507 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023508
23509
23510 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023511 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023512}
23513
23514
23515static int
23516test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023517 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023518
23519
23520 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023521 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023522}
23523
23524
Daniel Veillardce682bc2004-11-05 17:22:25 +000023525#define gen_nb_xmlAttributeTablePtr 1
23526static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23527 return(NULL);
23528}
23529static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23530}
23531
Daniel Veillardd93f6252004-11-02 15:53:51 +000023532static int
23533test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023535
23536
23537 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023539}
23540
23541
23542static int
23543test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023545
23546
23547 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023549}
23550
23551
Daniel Veillardce682bc2004-11-05 17:22:25 +000023552#define gen_nb_xmlElementTablePtr 1
23553static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23554 return(NULL);
23555}
23556static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23557}
23558
Daniel Veillardd93f6252004-11-02 15:53:51 +000023559static int
23560test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023561 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023562
23563
23564 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023565 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023566}
23567
23568
23569static int
23570test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023571 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023572
23573
23574 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023576}
23577
23578
Daniel Veillardce682bc2004-11-05 17:22:25 +000023579#define gen_nb_xmlNotationTablePtr 1
23580static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23581 return(NULL);
23582}
23583static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23584}
23585
Daniel Veillardd93f6252004-11-02 15:53:51 +000023586static int
23587test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023589
23590
23591 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023593}
23594
23595
23596static int
23597test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023598 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023599
23600
23601 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023603}
23604
23605
Daniel Veillardce682bc2004-11-05 17:22:25 +000023606#define gen_nb_xmlAttributePtr 1
23607static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23608 return(NULL);
23609}
23610static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23611}
23612
Daniel Veillardd93f6252004-11-02 15:53:51 +000023613static int
23614test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023616
Daniel Veillardce682bc2004-11-05 17:22:25 +000023617#ifdef LIBXML_OUTPUT_ENABLED
23618 int mem_base;
23619 xmlBufferPtr buf; /* the XML buffer output */
23620 int n_buf;
23621 xmlAttributePtr attr; /* An attribute declaration */
23622 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023623
Daniel Veillardce682bc2004-11-05 17:22:25 +000023624 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23625 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23626 mem_base = xmlMemBlocks();
23627 buf = gen_xmlBufferPtr(n_buf, 0);
23628 attr = gen_xmlAttributePtr(n_attr, 1);
23629
23630 xmlDumpAttributeDecl(buf, attr);
23631 call_tests++;
23632 des_xmlBufferPtr(n_buf, buf, 0);
23633 des_xmlAttributePtr(n_attr, attr, 1);
23634 xmlResetLastError();
23635 if (mem_base != xmlMemBlocks()) {
23636 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23637 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023638 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023639 printf(" %d", n_buf);
23640 printf(" %d", n_attr);
23641 printf("\n");
23642 }
23643 }
23644 }
23645#endif
23646
23647 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023649}
23650
23651
23652static int
23653test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023655
Daniel Veillardce682bc2004-11-05 17:22:25 +000023656#ifdef LIBXML_OUTPUT_ENABLED
23657 int mem_base;
23658 xmlBufferPtr buf; /* the XML buffer output */
23659 int n_buf;
23660 xmlAttributeTablePtr table; /* An attribute table */
23661 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023662
Daniel Veillardce682bc2004-11-05 17:22:25 +000023663 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23664 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23665 mem_base = xmlMemBlocks();
23666 buf = gen_xmlBufferPtr(n_buf, 0);
23667 table = gen_xmlAttributeTablePtr(n_table, 1);
23668
23669 xmlDumpAttributeTable(buf, table);
23670 call_tests++;
23671 des_xmlBufferPtr(n_buf, buf, 0);
23672 des_xmlAttributeTablePtr(n_table, table, 1);
23673 xmlResetLastError();
23674 if (mem_base != xmlMemBlocks()) {
23675 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23676 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023677 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023678 printf(" %d", n_buf);
23679 printf(" %d", n_table);
23680 printf("\n");
23681 }
23682 }
23683 }
23684#endif
23685
23686 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023687 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023688}
23689
23690
Daniel Veillardce682bc2004-11-05 17:22:25 +000023691#define gen_nb_xmlElementPtr 1
23692static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23693 return(NULL);
23694}
23695static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23696}
23697
Daniel Veillardd93f6252004-11-02 15:53:51 +000023698static int
23699test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023700 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023701
Daniel Veillardce682bc2004-11-05 17:22:25 +000023702#ifdef LIBXML_OUTPUT_ENABLED
23703 int mem_base;
23704 xmlBufferPtr buf; /* the XML buffer output */
23705 int n_buf;
23706 xmlElementPtr elem; /* An element table */
23707 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023708
Daniel Veillardce682bc2004-11-05 17:22:25 +000023709 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23710 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
23711 mem_base = xmlMemBlocks();
23712 buf = gen_xmlBufferPtr(n_buf, 0);
23713 elem = gen_xmlElementPtr(n_elem, 1);
23714
23715 xmlDumpElementDecl(buf, elem);
23716 call_tests++;
23717 des_xmlBufferPtr(n_buf, buf, 0);
23718 des_xmlElementPtr(n_elem, elem, 1);
23719 xmlResetLastError();
23720 if (mem_base != xmlMemBlocks()) {
23721 printf("Leak of %d blocks found in xmlDumpElementDecl",
23722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023723 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023724 printf(" %d", n_buf);
23725 printf(" %d", n_elem);
23726 printf("\n");
23727 }
23728 }
23729 }
23730#endif
23731
23732 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023734}
23735
23736
23737static int
23738test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023740
Daniel Veillardce682bc2004-11-05 17:22:25 +000023741#ifdef LIBXML_OUTPUT_ENABLED
23742 int mem_base;
23743 xmlBufferPtr buf; /* the XML buffer output */
23744 int n_buf;
23745 xmlElementTablePtr table; /* An element table */
23746 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023747
Daniel Veillardce682bc2004-11-05 17:22:25 +000023748 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23749 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
23750 mem_base = xmlMemBlocks();
23751 buf = gen_xmlBufferPtr(n_buf, 0);
23752 table = gen_xmlElementTablePtr(n_table, 1);
23753
23754 xmlDumpElementTable(buf, table);
23755 call_tests++;
23756 des_xmlBufferPtr(n_buf, buf, 0);
23757 des_xmlElementTablePtr(n_table, table, 1);
23758 xmlResetLastError();
23759 if (mem_base != xmlMemBlocks()) {
23760 printf("Leak of %d blocks found in xmlDumpElementTable",
23761 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023762 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023763 printf(" %d", n_buf);
23764 printf(" %d", n_table);
23765 printf("\n");
23766 }
23767 }
23768 }
23769#endif
23770
23771 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023772 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023773}
23774
23775
Daniel Veillardce682bc2004-11-05 17:22:25 +000023776#define gen_nb_xmlNotationPtr 1
23777static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23778 return(NULL);
23779}
23780static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23781}
23782
Daniel Veillardd93f6252004-11-02 15:53:51 +000023783static int
23784test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023786
Daniel Veillardce682bc2004-11-05 17:22:25 +000023787#ifdef LIBXML_OUTPUT_ENABLED
23788 int mem_base;
23789 xmlBufferPtr buf; /* the XML buffer output */
23790 int n_buf;
23791 xmlNotationPtr nota; /* A notation declaration */
23792 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023793
Daniel Veillardce682bc2004-11-05 17:22:25 +000023794 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23795 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
23796 mem_base = xmlMemBlocks();
23797 buf = gen_xmlBufferPtr(n_buf, 0);
23798 nota = gen_xmlNotationPtr(n_nota, 1);
23799
23800 xmlDumpNotationDecl(buf, nota);
23801 call_tests++;
23802 des_xmlBufferPtr(n_buf, buf, 0);
23803 des_xmlNotationPtr(n_nota, nota, 1);
23804 xmlResetLastError();
23805 if (mem_base != xmlMemBlocks()) {
23806 printf("Leak of %d blocks found in xmlDumpNotationDecl",
23807 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023808 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023809 printf(" %d", n_buf);
23810 printf(" %d", n_nota);
23811 printf("\n");
23812 }
23813 }
23814 }
23815#endif
23816
23817 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023819}
23820
23821
23822static int
23823test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023825
Daniel Veillardce682bc2004-11-05 17:22:25 +000023826#ifdef LIBXML_OUTPUT_ENABLED
23827 int mem_base;
23828 xmlBufferPtr buf; /* the XML buffer output */
23829 int n_buf;
23830 xmlNotationTablePtr table; /* A notation table */
23831 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023832
Daniel Veillardce682bc2004-11-05 17:22:25 +000023833 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23834 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
23835 mem_base = xmlMemBlocks();
23836 buf = gen_xmlBufferPtr(n_buf, 0);
23837 table = gen_xmlNotationTablePtr(n_table, 1);
23838
23839 xmlDumpNotationTable(buf, table);
23840 call_tests++;
23841 des_xmlBufferPtr(n_buf, buf, 0);
23842 des_xmlNotationTablePtr(n_table, table, 1);
23843 xmlResetLastError();
23844 if (mem_base != xmlMemBlocks()) {
23845 printf("Leak of %d blocks found in xmlDumpNotationTable",
23846 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023847 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023848 printf(" %d", n_buf);
23849 printf(" %d", n_table);
23850 printf("\n");
23851 }
23852 }
23853 }
23854#endif
23855
23856 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000023857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023858}
23859
23860
23861static int
23862test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023864
Daniel Veillard42595322004-11-08 10:52:06 +000023865 int mem_base;
23866 xmlAttributePtr ret_val;
23867 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23868 int n_dtd;
23869 xmlChar * elem; /* the element name */
23870 int n_elem;
23871 xmlChar * name; /* the attribute name */
23872 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023873
Daniel Veillard42595322004-11-08 10:52:06 +000023874 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23875 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23876 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23877 mem_base = xmlMemBlocks();
23878 dtd = gen_xmlDtdPtr(n_dtd, 0);
23879 elem = gen_const_xmlChar_ptr(n_elem, 1);
23880 name = gen_const_xmlChar_ptr(n_name, 2);
23881
23882 ret_val = xmlGetDtdAttrDesc(dtd, elem, name);
23883 desret_xmlAttributePtr(ret_val);
23884 call_tests++;
23885 des_xmlDtdPtr(n_dtd, dtd, 0);
23886 des_const_xmlChar_ptr(n_elem, elem, 1);
23887 des_const_xmlChar_ptr(n_name, name, 2);
23888 xmlResetLastError();
23889 if (mem_base != xmlMemBlocks()) {
23890 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
23891 xmlMemBlocks() - mem_base);
23892 test_ret++;
23893 printf(" %d", n_dtd);
23894 printf(" %d", n_elem);
23895 printf(" %d", n_name);
23896 printf("\n");
23897 }
23898 }
23899 }
23900 }
23901
23902 function_tests++;
23903 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023904}
23905
23906
23907static int
23908test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023909 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023910
Daniel Veillard42595322004-11-08 10:52:06 +000023911 int mem_base;
23912 xmlElementPtr ret_val;
23913 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23914 int n_dtd;
23915 xmlChar * name; /* the element name */
23916 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023917
Daniel Veillard42595322004-11-08 10:52:06 +000023918 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23919 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23920 mem_base = xmlMemBlocks();
23921 dtd = gen_xmlDtdPtr(n_dtd, 0);
23922 name = gen_const_xmlChar_ptr(n_name, 1);
23923
23924 ret_val = xmlGetDtdElementDesc(dtd, name);
23925 desret_xmlElementPtr(ret_val);
23926 call_tests++;
23927 des_xmlDtdPtr(n_dtd, dtd, 0);
23928 des_const_xmlChar_ptr(n_name, name, 1);
23929 xmlResetLastError();
23930 if (mem_base != xmlMemBlocks()) {
23931 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
23932 xmlMemBlocks() - mem_base);
23933 test_ret++;
23934 printf(" %d", n_dtd);
23935 printf(" %d", n_name);
23936 printf("\n");
23937 }
23938 }
23939 }
23940
23941 function_tests++;
23942 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023943}
23944
23945
23946static int
23947test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023948 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023949
23950
23951 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023952 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023953}
23954
23955
23956static int
23957test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023958 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023959
Daniel Veillard42595322004-11-08 10:52:06 +000023960 int mem_base;
23961 xmlAttributePtr ret_val;
23962 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23963 int n_dtd;
23964 xmlChar * elem; /* the element name */
23965 int n_elem;
23966 xmlChar * name; /* the attribute name */
23967 int n_name;
23968 xmlChar * prefix; /* the attribute namespace prefix */
23969 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023970
Daniel Veillard42595322004-11-08 10:52:06 +000023971 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23972 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23973 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23974 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
23975 mem_base = xmlMemBlocks();
23976 dtd = gen_xmlDtdPtr(n_dtd, 0);
23977 elem = gen_const_xmlChar_ptr(n_elem, 1);
23978 name = gen_const_xmlChar_ptr(n_name, 2);
23979 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
23980
23981 ret_val = xmlGetDtdQAttrDesc(dtd, elem, name, prefix);
23982 desret_xmlAttributePtr(ret_val);
23983 call_tests++;
23984 des_xmlDtdPtr(n_dtd, dtd, 0);
23985 des_const_xmlChar_ptr(n_elem, elem, 1);
23986 des_const_xmlChar_ptr(n_name, name, 2);
23987 des_const_xmlChar_ptr(n_prefix, prefix, 3);
23988 xmlResetLastError();
23989 if (mem_base != xmlMemBlocks()) {
23990 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
23991 xmlMemBlocks() - mem_base);
23992 test_ret++;
23993 printf(" %d", n_dtd);
23994 printf(" %d", n_elem);
23995 printf(" %d", n_name);
23996 printf(" %d", n_prefix);
23997 printf("\n");
23998 }
23999 }
24000 }
24001 }
24002 }
24003
24004 function_tests++;
24005 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024006}
24007
24008
24009static int
24010test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024011 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024012
Daniel Veillard42595322004-11-08 10:52:06 +000024013 int mem_base;
24014 xmlElementPtr ret_val;
24015 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24016 int n_dtd;
24017 xmlChar * name; /* the element name */
24018 int n_name;
24019 xmlChar * prefix; /* the element namespace prefix */
24020 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024021
Daniel Veillard42595322004-11-08 10:52:06 +000024022 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24023 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24024 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24025 mem_base = xmlMemBlocks();
24026 dtd = gen_xmlDtdPtr(n_dtd, 0);
24027 name = gen_const_xmlChar_ptr(n_name, 1);
24028 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24029
24030 ret_val = xmlGetDtdQElementDesc(dtd, name, prefix);
24031 desret_xmlElementPtr(ret_val);
24032 call_tests++;
24033 des_xmlDtdPtr(n_dtd, dtd, 0);
24034 des_const_xmlChar_ptr(n_name, name, 1);
24035 des_const_xmlChar_ptr(n_prefix, prefix, 2);
24036 xmlResetLastError();
24037 if (mem_base != xmlMemBlocks()) {
24038 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24039 xmlMemBlocks() - mem_base);
24040 test_ret++;
24041 printf(" %d", n_dtd);
24042 printf(" %d", n_name);
24043 printf(" %d", n_prefix);
24044 printf("\n");
24045 }
24046 }
24047 }
24048 }
24049
24050 function_tests++;
24051 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024052}
24053
24054
24055static int
24056test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024057 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024058
Daniel Veillard57b25162004-11-06 14:50:18 +000024059 int mem_base;
24060 xmlAttrPtr ret_val;
24061 xmlDocPtr doc; /* pointer to the document */
24062 int n_doc;
24063 xmlChar * ID; /* the ID value */
24064 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024065
Daniel Veillard57b25162004-11-06 14:50:18 +000024066 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24067 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24068 mem_base = xmlMemBlocks();
24069 doc = gen_xmlDocPtr(n_doc, 0);
24070 ID = gen_const_xmlChar_ptr(n_ID, 1);
24071
24072 ret_val = xmlGetID(doc, ID);
24073 desret_xmlAttrPtr(ret_val);
24074 call_tests++;
24075 des_xmlDocPtr(n_doc, doc, 0);
24076 des_const_xmlChar_ptr(n_ID, ID, 1);
24077 xmlResetLastError();
24078 if (mem_base != xmlMemBlocks()) {
24079 printf("Leak of %d blocks found in xmlGetID",
24080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024081 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024082 printf(" %d", n_doc);
24083 printf(" %d", n_ID);
24084 printf("\n");
24085 }
24086 }
24087 }
24088
24089 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024090 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024091}
24092
24093
24094static int
24095test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024096 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024097
24098
24099 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024100 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024101}
24102
24103
24104static int
24105test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024106 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024107
Daniel Veillardce244ad2004-11-05 10:03:46 +000024108 int mem_base;
24109 int ret_val;
24110 xmlDocPtr doc; /* the document */
24111 int n_doc;
24112 xmlNodePtr elem; /* the element carrying the attribute */
24113 int n_elem;
24114 xmlAttrPtr attr; /* the attribute */
24115 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024116
Daniel Veillardce244ad2004-11-05 10:03:46 +000024117 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24118 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24119 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24120 mem_base = xmlMemBlocks();
24121 doc = gen_xmlDocPtr(n_doc, 0);
24122 elem = gen_xmlNodePtr(n_elem, 1);
24123 attr = gen_xmlAttrPtr(n_attr, 2);
24124
24125 ret_val = xmlIsID(doc, elem, attr);
24126 desret_int(ret_val);
24127 call_tests++;
24128 des_xmlDocPtr(n_doc, doc, 0);
24129 des_xmlNodePtr(n_elem, elem, 1);
24130 des_xmlAttrPtr(n_attr, attr, 2);
24131 xmlResetLastError();
24132 if (mem_base != xmlMemBlocks()) {
24133 printf("Leak of %d blocks found in xmlIsID",
24134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024135 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024136 printf(" %d", n_doc);
24137 printf(" %d", n_elem);
24138 printf(" %d", n_attr);
24139 printf("\n");
24140 }
24141 }
24142 }
24143 }
24144
24145 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024146 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024147}
24148
24149
24150static int
24151test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024152 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024153
24154 int mem_base;
24155 int ret_val;
24156 xmlDocPtr doc; /* the document */
24157 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024158 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024159 int n_name;
24160
24161 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24162 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24163 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024164 doc = gen_xmlDocPtr(n_doc, 0);
24165 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024166
24167 ret_val = xmlIsMixedElement(doc, name);
24168 desret_int(ret_val);
24169 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024170 des_xmlDocPtr(n_doc, doc, 0);
24171 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024172 xmlResetLastError();
24173 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024174 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024176 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024177 printf(" %d", n_doc);
24178 printf(" %d", n_name);
24179 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024180 }
24181 }
24182 }
24183
Daniel Veillard3d97e662004-11-04 10:49:00 +000024184 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024185 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024186}
24187
24188
24189static int
24190test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024192
Daniel Veillardce244ad2004-11-05 10:03:46 +000024193 int mem_base;
24194 int ret_val;
24195 xmlDocPtr doc; /* the document */
24196 int n_doc;
24197 xmlNodePtr elem; /* the element carrying the attribute */
24198 int n_elem;
24199 xmlAttrPtr attr; /* the attribute */
24200 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024201
Daniel Veillardce244ad2004-11-05 10:03:46 +000024202 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24203 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24204 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24205 mem_base = xmlMemBlocks();
24206 doc = gen_xmlDocPtr(n_doc, 0);
24207 elem = gen_xmlNodePtr(n_elem, 1);
24208 attr = gen_xmlAttrPtr(n_attr, 2);
24209
24210 ret_val = xmlIsRef(doc, elem, attr);
24211 desret_int(ret_val);
24212 call_tests++;
24213 des_xmlDocPtr(n_doc, doc, 0);
24214 des_xmlNodePtr(n_elem, elem, 1);
24215 des_xmlAttrPtr(n_attr, attr, 2);
24216 xmlResetLastError();
24217 if (mem_base != xmlMemBlocks()) {
24218 printf("Leak of %d blocks found in xmlIsRef",
24219 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024220 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024221 printf(" %d", n_doc);
24222 printf(" %d", n_elem);
24223 printf(" %d", n_attr);
24224 printf("\n");
24225 }
24226 }
24227 }
24228 }
24229
24230 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024232}
24233
24234
24235static int
24236test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024238
24239
24240 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024241 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024242}
24243
24244
24245static int
24246test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024247 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024248
24249
24250 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024252}
24253
24254
24255static int
24256test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024258
Daniel Veillardce244ad2004-11-05 10:03:46 +000024259 int mem_base;
24260 int ret_val;
24261 xmlDocPtr doc; /* the document */
24262 int n_doc;
24263 xmlAttrPtr attr; /* the attribute */
24264 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024265
Daniel Veillardce244ad2004-11-05 10:03:46 +000024266 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24267 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24268 mem_base = xmlMemBlocks();
24269 doc = gen_xmlDocPtr(n_doc, 0);
24270 attr = gen_xmlAttrPtr(n_attr, 1);
24271
24272 ret_val = xmlRemoveID(doc, attr);
24273 desret_int(ret_val);
24274 call_tests++;
24275 des_xmlDocPtr(n_doc, doc, 0);
24276 des_xmlAttrPtr(n_attr, attr, 1);
24277 xmlResetLastError();
24278 if (mem_base != xmlMemBlocks()) {
24279 printf("Leak of %d blocks found in xmlRemoveID",
24280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024281 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024282 printf(" %d", n_doc);
24283 printf(" %d", n_attr);
24284 printf("\n");
24285 }
24286 }
24287 }
24288
24289 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024291}
24292
24293
24294static int
24295test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024296 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024297
Daniel Veillardce244ad2004-11-05 10:03:46 +000024298 int mem_base;
24299 int ret_val;
24300 xmlDocPtr doc; /* the document */
24301 int n_doc;
24302 xmlAttrPtr attr; /* the attribute */
24303 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024304
Daniel Veillardce244ad2004-11-05 10:03:46 +000024305 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24306 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24307 mem_base = xmlMemBlocks();
24308 doc = gen_xmlDocPtr(n_doc, 0);
24309 attr = gen_xmlAttrPtr(n_attr, 1);
24310
24311 ret_val = xmlRemoveRef(doc, attr);
24312 desret_int(ret_val);
24313 call_tests++;
24314 des_xmlDocPtr(n_doc, doc, 0);
24315 des_xmlAttrPtr(n_attr, attr, 1);
24316 xmlResetLastError();
24317 if (mem_base != xmlMemBlocks()) {
24318 printf("Leak of %d blocks found in xmlRemoveRef",
24319 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024320 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024321 printf(" %d", n_doc);
24322 printf(" %d", n_attr);
24323 printf("\n");
24324 }
24325 }
24326 }
24327
24328 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024330}
24331
24332
24333static int
24334test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024336
Daniel Veillardce682bc2004-11-05 17:22:25 +000024337 int mem_base;
24338 char * buf; /* an output buffer */
24339 int n_buf;
24340 int size; /* the buffer size */
24341 int n_size;
24342 xmlElementContentPtr content; /* An element table */
24343 int n_content;
24344 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24345 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024346
Daniel Veillardce682bc2004-11-05 17:22:25 +000024347 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24348 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24349 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24350 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24351 mem_base = xmlMemBlocks();
24352 buf = gen_char_ptr(n_buf, 0);
24353 size = gen_int(n_size, 1);
24354 content = gen_xmlElementContentPtr(n_content, 2);
24355 glob = gen_int(n_glob, 3);
24356
24357 xmlSnprintfElementContent(buf, size, content, glob);
24358 call_tests++;
24359 des_char_ptr(n_buf, buf, 0);
24360 des_int(n_size, size, 1);
24361 des_xmlElementContentPtr(n_content, content, 2);
24362 des_int(n_glob, glob, 3);
24363 xmlResetLastError();
24364 if (mem_base != xmlMemBlocks()) {
24365 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24366 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024367 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024368 printf(" %d", n_buf);
24369 printf(" %d", n_size);
24370 printf(" %d", n_content);
24371 printf(" %d", n_glob);
24372 printf("\n");
24373 }
24374 }
24375 }
24376 }
24377 }
24378
24379 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024380 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024381}
24382
24383
24384static int
24385test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024386 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024387
Daniel Veillardce682bc2004-11-05 17:22:25 +000024388 int mem_base;
24389 char * buf; /* an output buffer */
24390 int n_buf;
24391 xmlElementContentPtr content; /* An element table */
24392 int n_content;
24393 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24394 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024395
Daniel Veillardce682bc2004-11-05 17:22:25 +000024396 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24397 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24398 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24399 mem_base = xmlMemBlocks();
24400 buf = gen_char_ptr(n_buf, 0);
24401 content = gen_xmlElementContentPtr(n_content, 1);
24402 glob = gen_int(n_glob, 2);
24403
24404 xmlSprintfElementContent(buf, content, glob);
24405 call_tests++;
24406 des_char_ptr(n_buf, buf, 0);
24407 des_xmlElementContentPtr(n_content, content, 1);
24408 des_int(n_glob, glob, 2);
24409 xmlResetLastError();
24410 if (mem_base != xmlMemBlocks()) {
24411 printf("Leak of %d blocks found in xmlSprintfElementContent",
24412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024413 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024414 printf(" %d", n_buf);
24415 printf(" %d", n_content);
24416 printf(" %d", n_glob);
24417 printf("\n");
24418 }
24419 }
24420 }
24421 }
24422
24423 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024424 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024425}
24426
24427
24428static int
24429test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024430 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024431
Daniel Veillardce682bc2004-11-05 17:22:25 +000024432#ifdef LIBXML_REGEXP_ENABLED
24433 int mem_base;
24434 int ret_val;
24435 xmlValidCtxtPtr ctxt; /* a validation context */
24436 int n_ctxt;
24437 xmlElementPtr elem; /* an element declaration node */
24438 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024439
Daniel Veillardce682bc2004-11-05 17:22:25 +000024440 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24441 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24442 mem_base = xmlMemBlocks();
24443 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24444 elem = gen_xmlElementPtr(n_elem, 1);
24445
24446 ret_val = xmlValidBuildContentModel(ctxt, elem);
24447 desret_int(ret_val);
24448 call_tests++;
24449 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24450 des_xmlElementPtr(n_elem, elem, 1);
24451 xmlResetLastError();
24452 if (mem_base != xmlMemBlocks()) {
24453 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024455 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024456 printf(" %d", n_ctxt);
24457 printf(" %d", n_elem);
24458 printf("\n");
24459 }
24460 }
24461 }
24462#endif
24463
24464 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024465 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024466}
24467
24468
24469static int
24470test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024471 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024472
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024473#ifdef LIBXML_VALID_ENABLED
24474 int mem_base;
24475 xmlChar * ret_val;
24476 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24477 int n_ctxt;
24478 xmlDocPtr doc; /* the document */
24479 int n_doc;
24480 xmlNodePtr elem; /* the parent */
24481 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024482 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024483 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024484 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024485 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024486
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024487 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24488 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_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24491 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24492 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024493 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24494 doc = gen_xmlDocPtr(n_doc, 1);
24495 elem = gen_xmlNodePtr(n_elem, 2);
24496 name = gen_const_xmlChar_ptr(n_name, 3);
24497 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024498
24499 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, name, value);
24500 desret_xmlChar_ptr(ret_val);
24501 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024502 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24503 des_xmlDocPtr(n_doc, doc, 1);
24504 des_xmlNodePtr(n_elem, elem, 2);
24505 des_const_xmlChar_ptr(n_name, name, 3);
24506 des_const_xmlChar_ptr(n_value, value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024507 xmlResetLastError();
24508 if (mem_base != xmlMemBlocks()) {
24509 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24510 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024511 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024512 printf(" %d", n_ctxt);
24513 printf(" %d", n_doc);
24514 printf(" %d", n_elem);
24515 printf(" %d", n_name);
24516 printf(" %d", n_value);
24517 printf("\n");
24518 }
24519 }
24520 }
24521 }
24522 }
24523 }
24524#endif
24525
Daniel Veillard3d97e662004-11-04 10:49:00 +000024526 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024528}
24529
24530
Daniel Veillardce682bc2004-11-05 17:22:25 +000024531#define gen_nb_xmlElementContent_ptr 1
24532static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24533 return(NULL);
24534}
24535static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24536}
24537
Daniel Veillardd93f6252004-11-02 15:53:51 +000024538static int
24539test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024540 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024541
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024542 int mem_base;
24543 int ret_val;
24544 xmlElementContent * ctree; /* an element content tree */
24545 int n_ctree;
24546 xmlChar ** list; /* an array to store the list of child names */
24547 int n_list;
24548 int * len; /* a pointer to the number of element in the list */
24549 int n_len;
24550 int max; /* the size of the array */
24551 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024552
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024553 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24554 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24555 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24556 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24557 mem_base = xmlMemBlocks();
24558 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24559 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24560 len = gen_int_ptr(n_len, 2);
24561 max = gen_int(n_max, 3);
24562
24563 ret_val = xmlValidGetPotentialChildren(ctree, list, len, max);
24564 desret_int(ret_val);
24565 call_tests++;
24566 des_xmlElementContent_ptr(n_ctree, ctree, 0);
24567 des_const_xmlChar_ptr_ptr(n_list, list, 1);
24568 des_int_ptr(n_len, len, 2);
24569 des_int(n_max, max, 3);
24570 xmlResetLastError();
24571 if (mem_base != xmlMemBlocks()) {
24572 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24573 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024574 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024575 printf(" %d", n_ctree);
24576 printf(" %d", n_list);
24577 printf(" %d", n_len);
24578 printf(" %d", n_max);
24579 printf("\n");
24580 }
24581 }
24582 }
24583 }
24584 }
24585
24586 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024588}
24589
24590
24591static int
24592test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024594
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024595 int mem_base;
24596 int ret_val;
24597 xmlNode * prev; /* an element to insert after */
24598 int n_prev;
24599 xmlNode * next; /* an element to insert next */
24600 int n_next;
24601 xmlChar ** names; /* an array to store the list of child names */
24602 int n_names;
24603 int max; /* the size of the array */
24604 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024605
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024606 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24607 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
24608 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
24609 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24610 mem_base = xmlMemBlocks();
24611 prev = gen_xmlNodePtr(n_prev, 0);
24612 next = gen_xmlNodePtr(n_next, 1);
24613 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
24614 max = gen_int(n_max, 3);
24615
24616 ret_val = xmlValidGetValidElements(prev, next, names, max);
24617 desret_int(ret_val);
24618 call_tests++;
24619 des_xmlNodePtr(n_prev, prev, 0);
24620 des_xmlNodePtr(n_next, next, 1);
24621 des_const_xmlChar_ptr_ptr(n_names, names, 2);
24622 des_int(n_max, max, 3);
24623 xmlResetLastError();
24624 if (mem_base != xmlMemBlocks()) {
24625 printf("Leak of %d blocks found in xmlValidGetValidElements",
24626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024627 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024628 printf(" %d", n_prev);
24629 printf(" %d", n_next);
24630 printf(" %d", n_names);
24631 printf(" %d", n_max);
24632 printf("\n");
24633 }
24634 }
24635 }
24636 }
24637 }
24638
24639 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024640 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024641}
24642
24643
24644static int
24645test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024647
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024648#ifdef LIBXML_VALID_ENABLED
24649 int mem_base;
24650 xmlChar * ret_val;
24651 xmlDocPtr doc; /* the document */
24652 int n_doc;
24653 xmlNodePtr elem; /* the parent */
24654 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024655 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024656 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024657 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024658 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024659
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024660 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24661 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24662 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24663 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24664 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024665 doc = gen_xmlDocPtr(n_doc, 0);
24666 elem = gen_xmlNodePtr(n_elem, 1);
24667 name = gen_const_xmlChar_ptr(n_name, 2);
24668 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024669
24670 ret_val = xmlValidNormalizeAttributeValue(doc, elem, name, value);
24671 desret_xmlChar_ptr(ret_val);
24672 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024673 des_xmlDocPtr(n_doc, doc, 0);
24674 des_xmlNodePtr(n_elem, elem, 1);
24675 des_const_xmlChar_ptr(n_name, name, 2);
24676 des_const_xmlChar_ptr(n_value, value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024677 xmlResetLastError();
24678 if (mem_base != xmlMemBlocks()) {
24679 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
24680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024681 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024682 printf(" %d", n_doc);
24683 printf(" %d", n_elem);
24684 printf(" %d", n_name);
24685 printf(" %d", n_value);
24686 printf("\n");
24687 }
24688 }
24689 }
24690 }
24691 }
24692#endif
24693
Daniel Veillard3d97e662004-11-04 10:49:00 +000024694 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024696}
24697
24698
24699static int
24700test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024701 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024702
Daniel Veillardce682bc2004-11-05 17:22:25 +000024703#ifdef LIBXML_VALID_ENABLED
24704 int mem_base;
24705 int ret_val;
24706 xmlValidCtxtPtr ctxt; /* the validation context */
24707 int n_ctxt;
24708 xmlDocPtr doc; /* a document instance */
24709 int n_doc;
24710 xmlAttributePtr attr; /* an attribute definition */
24711 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024712
Daniel Veillardce682bc2004-11-05 17:22:25 +000024713 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24714 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24715 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
24716 mem_base = xmlMemBlocks();
24717 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24718 doc = gen_xmlDocPtr(n_doc, 1);
24719 attr = gen_xmlAttributePtr(n_attr, 2);
24720
24721 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
24722 desret_int(ret_val);
24723 call_tests++;
24724 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24725 des_xmlDocPtr(n_doc, doc, 1);
24726 des_xmlAttributePtr(n_attr, attr, 2);
24727 xmlResetLastError();
24728 if (mem_base != xmlMemBlocks()) {
24729 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
24730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024731 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024732 printf(" %d", n_ctxt);
24733 printf(" %d", n_doc);
24734 printf(" %d", n_attr);
24735 printf("\n");
24736 }
24737 }
24738 }
24739 }
24740#endif
24741
24742 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024744}
24745
24746
24747static int
24748test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024750
Daniel Veillard57b25162004-11-06 14:50:18 +000024751#ifdef LIBXML_VALID_ENABLED
24752 int mem_base;
24753 int ret_val;
24754 xmlAttributeType type; /* an attribute type */
24755 int n_type;
24756 xmlChar * value; /* an attribute value */
24757 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024758
Daniel Veillard57b25162004-11-06 14:50:18 +000024759 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
24760 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24761 mem_base = xmlMemBlocks();
24762 type = gen_xmlAttributeType(n_type, 0);
24763 value = gen_const_xmlChar_ptr(n_value, 1);
24764
24765 ret_val = xmlValidateAttributeValue(type, value);
24766 desret_int(ret_val);
24767 call_tests++;
24768 des_xmlAttributeType(n_type, type, 0);
24769 des_const_xmlChar_ptr(n_value, value, 1);
24770 xmlResetLastError();
24771 if (mem_base != xmlMemBlocks()) {
24772 printf("Leak of %d blocks found in xmlValidateAttributeValue",
24773 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024774 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024775 printf(" %d", n_type);
24776 printf(" %d", n_value);
24777 printf("\n");
24778 }
24779 }
24780 }
24781#endif
24782
24783 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024784 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024785}
24786
24787
24788static int
24789test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024790 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024791
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024792#ifdef LIBXML_VALID_ENABLED
24793 int mem_base;
24794 int ret_val;
24795 xmlValidCtxtPtr ctxt; /* the validation context */
24796 int n_ctxt;
24797 xmlDocPtr doc; /* a document instance */
24798 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024799
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024800 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24801 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24802 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024803 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24804 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024805
24806 ret_val = xmlValidateDocument(ctxt, doc);
24807 desret_int(ret_val);
24808 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024809 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24810 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024811 xmlResetLastError();
24812 if (mem_base != xmlMemBlocks()) {
24813 printf("Leak of %d blocks found in xmlValidateDocument",
24814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024815 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024816 printf(" %d", n_ctxt);
24817 printf(" %d", n_doc);
24818 printf("\n");
24819 }
24820 }
24821 }
24822#endif
24823
Daniel Veillard3d97e662004-11-04 10:49:00 +000024824 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024825 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024826}
24827
24828
24829static int
24830test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024831 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024832
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024833#ifdef LIBXML_VALID_ENABLED
24834 int mem_base;
24835 int ret_val;
24836 xmlValidCtxtPtr ctxt; /* the validation context */
24837 int n_ctxt;
24838 xmlDocPtr doc; /* a document instance */
24839 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024840
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024841 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24842 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24843 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024844 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24845 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024846
24847 ret_val = xmlValidateDocumentFinal(ctxt, doc);
24848 desret_int(ret_val);
24849 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024850 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24851 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024852 xmlResetLastError();
24853 if (mem_base != xmlMemBlocks()) {
24854 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
24855 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024856 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024857 printf(" %d", n_ctxt);
24858 printf(" %d", n_doc);
24859 printf("\n");
24860 }
24861 }
24862 }
24863#endif
24864
Daniel Veillard3d97e662004-11-04 10:49:00 +000024865 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024867}
24868
24869
24870static int
24871test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024872 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024873
Daniel Veillard27f20102004-11-05 11:50:11 +000024874#ifdef LIBXML_VALID_ENABLED
24875 int mem_base;
24876 int ret_val;
24877 xmlValidCtxtPtr ctxt; /* the validation context */
24878 int n_ctxt;
24879 xmlDocPtr doc; /* a document instance */
24880 int n_doc;
24881 xmlDtdPtr dtd; /* a dtd instance */
24882 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024883
Daniel Veillard27f20102004-11-05 11:50:11 +000024884 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24885 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24886 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24887 mem_base = xmlMemBlocks();
24888 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24889 doc = gen_xmlDocPtr(n_doc, 1);
24890 dtd = gen_xmlDtdPtr(n_dtd, 2);
24891
24892 ret_val = xmlValidateDtd(ctxt, doc, dtd);
24893 desret_int(ret_val);
24894 call_tests++;
24895 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24896 des_xmlDocPtr(n_doc, doc, 1);
24897 des_xmlDtdPtr(n_dtd, dtd, 2);
24898 xmlResetLastError();
24899 if (mem_base != xmlMemBlocks()) {
24900 printf("Leak of %d blocks found in xmlValidateDtd",
24901 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024902 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000024903 printf(" %d", n_ctxt);
24904 printf(" %d", n_doc);
24905 printf(" %d", n_dtd);
24906 printf("\n");
24907 }
24908 }
24909 }
24910 }
24911#endif
24912
24913 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024914 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024915}
24916
24917
24918static int
24919test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024920 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024921
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024922#ifdef LIBXML_VALID_ENABLED
24923 int mem_base;
24924 int ret_val;
24925 xmlValidCtxtPtr ctxt; /* the validation context */
24926 int n_ctxt;
24927 xmlDocPtr doc; /* a document instance */
24928 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024929
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024930 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24931 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24932 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024933 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24934 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024935
24936 ret_val = xmlValidateDtdFinal(ctxt, doc);
24937 desret_int(ret_val);
24938 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024939 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24940 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024941 xmlResetLastError();
24942 if (mem_base != xmlMemBlocks()) {
24943 printf("Leak of %d blocks found in xmlValidateDtdFinal",
24944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024945 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024946 printf(" %d", n_ctxt);
24947 printf(" %d", n_doc);
24948 printf("\n");
24949 }
24950 }
24951 }
24952#endif
24953
Daniel Veillard3d97e662004-11-04 10:49:00 +000024954 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000024955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024956}
24957
24958
24959static int
24960test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024961 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024962
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024963#ifdef LIBXML_VALID_ENABLED
24964 int mem_base;
24965 int ret_val;
24966 xmlValidCtxtPtr ctxt; /* the validation context */
24967 int n_ctxt;
24968 xmlDocPtr doc; /* a document instance */
24969 int n_doc;
24970 xmlNodePtr elem; /* an element instance */
24971 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024972
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024973 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24974 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24975 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24976 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024977 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24978 doc = gen_xmlDocPtr(n_doc, 1);
24979 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024980
24981 ret_val = xmlValidateElement(ctxt, doc, elem);
24982 desret_int(ret_val);
24983 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024984 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24985 des_xmlDocPtr(n_doc, doc, 1);
24986 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024987 xmlResetLastError();
24988 if (mem_base != xmlMemBlocks()) {
24989 printf("Leak of %d blocks found in xmlValidateElement",
24990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024991 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024992 printf(" %d", n_ctxt);
24993 printf(" %d", n_doc);
24994 printf(" %d", n_elem);
24995 printf("\n");
24996 }
24997 }
24998 }
24999 }
25000#endif
25001
Daniel Veillard3d97e662004-11-04 10:49:00 +000025002 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025003 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025004}
25005
25006
25007static int
25008test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025009 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025010
Daniel Veillardce682bc2004-11-05 17:22:25 +000025011#ifdef LIBXML_VALID_ENABLED
25012 int mem_base;
25013 int ret_val;
25014 xmlValidCtxtPtr ctxt; /* the validation context */
25015 int n_ctxt;
25016 xmlDocPtr doc; /* a document instance */
25017 int n_doc;
25018 xmlElementPtr elem; /* an element definition */
25019 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025020
Daniel Veillardce682bc2004-11-05 17:22:25 +000025021 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25022 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25023 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25024 mem_base = xmlMemBlocks();
25025 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25026 doc = gen_xmlDocPtr(n_doc, 1);
25027 elem = gen_xmlElementPtr(n_elem, 2);
25028
25029 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25030 desret_int(ret_val);
25031 call_tests++;
25032 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25033 des_xmlDocPtr(n_doc, doc, 1);
25034 des_xmlElementPtr(n_elem, elem, 2);
25035 xmlResetLastError();
25036 if (mem_base != xmlMemBlocks()) {
25037 printf("Leak of %d blocks found in xmlValidateElementDecl",
25038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025039 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025040 printf(" %d", n_ctxt);
25041 printf(" %d", n_doc);
25042 printf(" %d", n_elem);
25043 printf("\n");
25044 }
25045 }
25046 }
25047 }
25048#endif
25049
25050 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025051 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025052}
25053
25054
25055static int
25056test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025057 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025058
25059#ifdef LIBXML_VALID_ENABLED
25060 int mem_base;
25061 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025062 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025063 int n_value;
25064
25065 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25066 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025067 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025068
25069 ret_val = xmlValidateNameValue(value);
25070 desret_int(ret_val);
25071 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025072 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025073 xmlResetLastError();
25074 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025075 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025077 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025078 printf(" %d", n_value);
25079 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025080 }
25081 }
25082#endif
25083
Daniel Veillard3d97e662004-11-04 10:49:00 +000025084 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025086}
25087
25088
25089static int
25090test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025092
25093#ifdef LIBXML_VALID_ENABLED
25094 int mem_base;
25095 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025096 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025097 int n_value;
25098
25099 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25100 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025101 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025102
25103 ret_val = xmlValidateNamesValue(value);
25104 desret_int(ret_val);
25105 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025106 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025107 xmlResetLastError();
25108 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025109 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025111 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025112 printf(" %d", n_value);
25113 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025114 }
25115 }
25116#endif
25117
Daniel Veillard3d97e662004-11-04 10:49:00 +000025118 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025119 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025120}
25121
25122
25123static int
25124test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025126
25127#ifdef LIBXML_VALID_ENABLED
25128 int mem_base;
25129 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025130 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025131 int n_value;
25132
25133 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25134 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025135 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025136
25137 ret_val = xmlValidateNmtokenValue(value);
25138 desret_int(ret_val);
25139 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025140 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025141 xmlResetLastError();
25142 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025143 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025145 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025146 printf(" %d", n_value);
25147 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025148 }
25149 }
25150#endif
25151
Daniel Veillard3d97e662004-11-04 10:49:00 +000025152 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025153 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025154}
25155
25156
25157static int
25158test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025159 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025160
25161#ifdef LIBXML_VALID_ENABLED
25162 int mem_base;
25163 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025164 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025165 int n_value;
25166
25167 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25168 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025169 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025170
25171 ret_val = xmlValidateNmtokensValue(value);
25172 desret_int(ret_val);
25173 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025174 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025175 xmlResetLastError();
25176 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025177 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025178 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025179 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025180 printf(" %d", n_value);
25181 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025182 }
25183 }
25184#endif
25185
Daniel Veillard3d97e662004-11-04 10:49:00 +000025186 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025187 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025188}
25189
25190
25191static int
25192test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025193 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025194
Daniel Veillardce682bc2004-11-05 17:22:25 +000025195#ifdef LIBXML_VALID_ENABLED
25196 int mem_base;
25197 int ret_val;
25198 xmlValidCtxtPtr ctxt; /* the validation context */
25199 int n_ctxt;
25200 xmlDocPtr doc; /* a document instance */
25201 int n_doc;
25202 xmlNotationPtr nota; /* a notation definition */
25203 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025204
Daniel Veillardce682bc2004-11-05 17:22:25 +000025205 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25206 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25207 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25208 mem_base = xmlMemBlocks();
25209 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25210 doc = gen_xmlDocPtr(n_doc, 1);
25211 nota = gen_xmlNotationPtr(n_nota, 2);
25212
25213 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25214 desret_int(ret_val);
25215 call_tests++;
25216 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25217 des_xmlDocPtr(n_doc, doc, 1);
25218 des_xmlNotationPtr(n_nota, nota, 2);
25219 xmlResetLastError();
25220 if (mem_base != xmlMemBlocks()) {
25221 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25222 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025223 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025224 printf(" %d", n_ctxt);
25225 printf(" %d", n_doc);
25226 printf(" %d", n_nota);
25227 printf("\n");
25228 }
25229 }
25230 }
25231 }
25232#endif
25233
25234 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025236}
25237
25238
25239static int
25240test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025242
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025243#ifdef LIBXML_VALID_ENABLED
25244 int mem_base;
25245 int ret_val;
25246 xmlValidCtxtPtr ctxt; /* the validation context */
25247 int n_ctxt;
25248 xmlDocPtr doc; /* the document */
25249 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025250 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025251 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025252
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025253 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25254 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25255 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25256 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025257 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25258 doc = gen_xmlDocPtr(n_doc, 1);
25259 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025260
25261 ret_val = xmlValidateNotationUse(ctxt, doc, notationName);
25262 desret_int(ret_val);
25263 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025264 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25265 des_xmlDocPtr(n_doc, doc, 1);
25266 des_const_xmlChar_ptr(n_notationName, notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025267 xmlResetLastError();
25268 if (mem_base != xmlMemBlocks()) {
25269 printf("Leak of %d blocks found in xmlValidateNotationUse",
25270 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025271 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025272 printf(" %d", n_ctxt);
25273 printf(" %d", n_doc);
25274 printf(" %d", n_notationName);
25275 printf("\n");
25276 }
25277 }
25278 }
25279 }
25280#endif
25281
Daniel Veillard3d97e662004-11-04 10:49:00 +000025282 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025283 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025284}
25285
25286
25287static int
25288test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025289 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025290
Daniel Veillardce244ad2004-11-05 10:03:46 +000025291#ifdef LIBXML_VALID_ENABLED
25292 int mem_base;
25293 int ret_val;
25294 xmlValidCtxtPtr ctxt; /* the validation context */
25295 int n_ctxt;
25296 xmlDocPtr doc; /* a document instance */
25297 int n_doc;
25298 xmlNodePtr elem; /* an element instance */
25299 int n_elem;
25300 xmlAttrPtr attr; /* an attribute instance */
25301 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025302 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025303 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025304
Daniel Veillardce244ad2004-11-05 10:03:46 +000025305 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25306 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25307 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25308 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25309 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25310 mem_base = xmlMemBlocks();
25311 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25312 doc = gen_xmlDocPtr(n_doc, 1);
25313 elem = gen_xmlNodePtr(n_elem, 2);
25314 attr = gen_xmlAttrPtr(n_attr, 3);
25315 value = gen_const_xmlChar_ptr(n_value, 4);
25316
25317 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
25318 desret_int(ret_val);
25319 call_tests++;
25320 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25321 des_xmlDocPtr(n_doc, doc, 1);
25322 des_xmlNodePtr(n_elem, elem, 2);
25323 des_xmlAttrPtr(n_attr, attr, 3);
25324 des_const_xmlChar_ptr(n_value, value, 4);
25325 xmlResetLastError();
25326 if (mem_base != xmlMemBlocks()) {
25327 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25328 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025329 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025330 printf(" %d", n_ctxt);
25331 printf(" %d", n_doc);
25332 printf(" %d", n_elem);
25333 printf(" %d", n_attr);
25334 printf(" %d", n_value);
25335 printf("\n");
25336 }
25337 }
25338 }
25339 }
25340 }
25341 }
25342#endif
25343
25344 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025346}
25347
25348
25349static int
25350test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025351 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025352
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025353#ifdef LIBXML_VALID_ENABLED
25354 int mem_base;
25355 int ret_val;
25356 xmlValidCtxtPtr ctxt; /* the validation context */
25357 int n_ctxt;
25358 xmlDocPtr doc; /* a document instance */
25359 int n_doc;
25360 xmlNodePtr elem; /* an element instance */
25361 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025362
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025363 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25364 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25365 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25366 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025367 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25368 doc = gen_xmlDocPtr(n_doc, 1);
25369 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025370
25371 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25372 desret_int(ret_val);
25373 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025374 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25375 des_xmlDocPtr(n_doc, doc, 1);
25376 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025377 xmlResetLastError();
25378 if (mem_base != xmlMemBlocks()) {
25379 printf("Leak of %d blocks found in xmlValidateOneElement",
25380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025381 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025382 printf(" %d", n_ctxt);
25383 printf(" %d", n_doc);
25384 printf(" %d", n_elem);
25385 printf("\n");
25386 }
25387 }
25388 }
25389 }
25390#endif
25391
Daniel Veillard3d97e662004-11-04 10:49:00 +000025392 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025394}
25395
25396
25397static int
25398test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025399 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025400
Daniel Veillard27f20102004-11-05 11:50:11 +000025401#ifdef LIBXML_VALID_ENABLED
25402 int mem_base;
25403 int ret_val;
25404 xmlValidCtxtPtr ctxt; /* the validation context */
25405 int n_ctxt;
25406 xmlDocPtr doc; /* a document instance */
25407 int n_doc;
25408 xmlNodePtr elem; /* an element instance */
25409 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025410 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025411 int n_prefix;
25412 xmlNsPtr ns; /* an namespace declaration instance */
25413 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025414 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025415 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025416
Daniel Veillard27f20102004-11-05 11:50:11 +000025417 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25418 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25419 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25420 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25421 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25422 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25423 mem_base = xmlMemBlocks();
25424 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25425 doc = gen_xmlDocPtr(n_doc, 1);
25426 elem = gen_xmlNodePtr(n_elem, 2);
25427 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25428 ns = gen_xmlNsPtr(n_ns, 4);
25429 value = gen_const_xmlChar_ptr(n_value, 5);
25430
25431 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, prefix, ns, value);
25432 desret_int(ret_val);
25433 call_tests++;
25434 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25435 des_xmlDocPtr(n_doc, doc, 1);
25436 des_xmlNodePtr(n_elem, elem, 2);
25437 des_const_xmlChar_ptr(n_prefix, prefix, 3);
25438 des_xmlNsPtr(n_ns, ns, 4);
25439 des_const_xmlChar_ptr(n_value, value, 5);
25440 xmlResetLastError();
25441 if (mem_base != xmlMemBlocks()) {
25442 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25443 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025444 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025445 printf(" %d", n_ctxt);
25446 printf(" %d", n_doc);
25447 printf(" %d", n_elem);
25448 printf(" %d", n_prefix);
25449 printf(" %d", n_ns);
25450 printf(" %d", n_value);
25451 printf("\n");
25452 }
25453 }
25454 }
25455 }
25456 }
25457 }
25458 }
25459#endif
25460
25461 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025463}
25464
25465
25466static int
25467test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025469
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025470#ifdef LIBXML_REGEXP_ENABLED
25471 int mem_base;
25472 int ret_val;
25473 xmlValidCtxtPtr ctxt; /* the validation context */
25474 int n_ctxt;
25475 xmlDocPtr doc; /* a document instance */
25476 int n_doc;
25477 xmlNodePtr elem; /* an element instance */
25478 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025479 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025480 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025481
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025482 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25483 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25484 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25485 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25486 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025487 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25488 doc = gen_xmlDocPtr(n_doc, 1);
25489 elem = gen_xmlNodePtr(n_elem, 2);
25490 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025491
25492 ret_val = xmlValidatePopElement(ctxt, doc, elem, qname);
25493 desret_int(ret_val);
25494 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025495 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25496 des_xmlDocPtr(n_doc, doc, 1);
25497 des_xmlNodePtr(n_elem, elem, 2);
25498 des_const_xmlChar_ptr(n_qname, qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025499 xmlResetLastError();
25500 if (mem_base != xmlMemBlocks()) {
25501 printf("Leak of %d blocks found in xmlValidatePopElement",
25502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025503 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025504 printf(" %d", n_ctxt);
25505 printf(" %d", n_doc);
25506 printf(" %d", n_elem);
25507 printf(" %d", n_qname);
25508 printf("\n");
25509 }
25510 }
25511 }
25512 }
25513 }
25514#endif
25515
Daniel Veillard3d97e662004-11-04 10:49:00 +000025516 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025517 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025518}
25519
25520
25521static int
25522test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025523 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025524
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025525#ifdef LIBXML_REGEXP_ENABLED
25526 int mem_base;
25527 int ret_val;
25528 xmlValidCtxtPtr ctxt; /* the validation context */
25529 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025530 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025531 int n_data;
25532 int len; /* the lenght of the data */
25533 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025534
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025535 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25536 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25537 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25538 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025539 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25540 data = gen_const_xmlChar_ptr(n_data, 1);
25541 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025542
25543 ret_val = xmlValidatePushCData(ctxt, data, len);
25544 desret_int(ret_val);
25545 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025546 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25547 des_const_xmlChar_ptr(n_data, data, 1);
25548 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025549 xmlResetLastError();
25550 if (mem_base != xmlMemBlocks()) {
25551 printf("Leak of %d blocks found in xmlValidatePushCData",
25552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025553 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025554 printf(" %d", n_ctxt);
25555 printf(" %d", n_data);
25556 printf(" %d", n_len);
25557 printf("\n");
25558 }
25559 }
25560 }
25561 }
25562#endif
25563
Daniel Veillard3d97e662004-11-04 10:49:00 +000025564 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025565 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025566}
25567
25568
25569static int
25570test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025571 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025572
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025573#ifdef LIBXML_REGEXP_ENABLED
25574 int mem_base;
25575 int ret_val;
25576 xmlValidCtxtPtr ctxt; /* the validation context */
25577 int n_ctxt;
25578 xmlDocPtr doc; /* a document instance */
25579 int n_doc;
25580 xmlNodePtr elem; /* an element instance */
25581 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025582 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025583 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025584
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025585 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25586 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25587 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25588 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25589 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025590 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25591 doc = gen_xmlDocPtr(n_doc, 1);
25592 elem = gen_xmlNodePtr(n_elem, 2);
25593 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025594
25595 ret_val = xmlValidatePushElement(ctxt, doc, elem, qname);
25596 desret_int(ret_val);
25597 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025598 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25599 des_xmlDocPtr(n_doc, doc, 1);
25600 des_xmlNodePtr(n_elem, elem, 2);
25601 des_const_xmlChar_ptr(n_qname, qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025602 xmlResetLastError();
25603 if (mem_base != xmlMemBlocks()) {
25604 printf("Leak of %d blocks found in xmlValidatePushElement",
25605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025606 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025607 printf(" %d", n_ctxt);
25608 printf(" %d", n_doc);
25609 printf(" %d", n_elem);
25610 printf(" %d", n_qname);
25611 printf("\n");
25612 }
25613 }
25614 }
25615 }
25616 }
25617#endif
25618
Daniel Veillard3d97e662004-11-04 10:49:00 +000025619 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025620 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025621}
25622
25623
25624static int
25625test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025626 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025627
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025628#ifdef LIBXML_VALID_ENABLED
25629 int mem_base;
25630 int ret_val;
25631 xmlValidCtxtPtr ctxt; /* the validation context */
25632 int n_ctxt;
25633 xmlDocPtr doc; /* a document instance */
25634 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025635
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025636 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25637 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25638 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025639 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25640 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025641
25642 ret_val = xmlValidateRoot(ctxt, doc);
25643 desret_int(ret_val);
25644 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025645 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25646 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025647 xmlResetLastError();
25648 if (mem_base != xmlMemBlocks()) {
25649 printf("Leak of %d blocks found in xmlValidateRoot",
25650 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025651 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025652 printf(" %d", n_ctxt);
25653 printf(" %d", n_doc);
25654 printf("\n");
25655 }
25656 }
25657 }
25658#endif
25659
Daniel Veillard3d97e662004-11-04 10:49:00 +000025660 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025661 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025662}
25663
25664static int
25665test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025667
Daniel Veillard42595322004-11-08 10:52:06 +000025668 printf("Testing valid : 46 of 67 functions ...\n");
25669 test_ret += test_xmlAddAttributeDecl();
25670 test_ret += test_xmlAddElementDecl();
25671 test_ret += test_xmlAddID();
25672 test_ret += test_xmlAddNotationDecl();
25673 test_ret += test_xmlAddRef();
25674 test_ret += test_xmlCopyAttributeTable();
25675 test_ret += test_xmlCopyElementContent();
25676 test_ret += test_xmlCopyElementTable();
25677 test_ret += test_xmlCopyEnumeration();
25678 test_ret += test_xmlCopyNotationTable();
25679 test_ret += test_xmlCreateEnumeration();
25680 test_ret += test_xmlDumpAttributeDecl();
25681 test_ret += test_xmlDumpAttributeTable();
25682 test_ret += test_xmlDumpElementDecl();
25683 test_ret += test_xmlDumpElementTable();
25684 test_ret += test_xmlDumpNotationDecl();
25685 test_ret += test_xmlDumpNotationTable();
25686 test_ret += test_xmlGetDtdAttrDesc();
25687 test_ret += test_xmlGetDtdElementDesc();
25688 test_ret += test_xmlGetDtdNotationDesc();
25689 test_ret += test_xmlGetDtdQAttrDesc();
25690 test_ret += test_xmlGetDtdQElementDesc();
25691 test_ret += test_xmlGetID();
25692 test_ret += test_xmlGetRefs();
25693 test_ret += test_xmlIsID();
25694 test_ret += test_xmlIsMixedElement();
25695 test_ret += test_xmlIsRef();
25696 test_ret += test_xmlNewElementContent();
25697 test_ret += test_xmlNewValidCtxt();
25698 test_ret += test_xmlRemoveID();
25699 test_ret += test_xmlRemoveRef();
25700 test_ret += test_xmlSnprintfElementContent();
25701 test_ret += test_xmlSprintfElementContent();
25702 test_ret += test_xmlValidBuildContentModel();
25703 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
25704 test_ret += test_xmlValidGetPotentialChildren();
25705 test_ret += test_xmlValidGetValidElements();
25706 test_ret += test_xmlValidNormalizeAttributeValue();
25707 test_ret += test_xmlValidateAttributeDecl();
25708 test_ret += test_xmlValidateAttributeValue();
25709 test_ret += test_xmlValidateDocument();
25710 test_ret += test_xmlValidateDocumentFinal();
25711 test_ret += test_xmlValidateDtd();
25712 test_ret += test_xmlValidateDtdFinal();
25713 test_ret += test_xmlValidateElement();
25714 test_ret += test_xmlValidateElementDecl();
25715 test_ret += test_xmlValidateNameValue();
25716 test_ret += test_xmlValidateNamesValue();
25717 test_ret += test_xmlValidateNmtokenValue();
25718 test_ret += test_xmlValidateNmtokensValue();
25719 test_ret += test_xmlValidateNotationDecl();
25720 test_ret += test_xmlValidateNotationUse();
25721 test_ret += test_xmlValidateOneAttribute();
25722 test_ret += test_xmlValidateOneElement();
25723 test_ret += test_xmlValidateOneNamespace();
25724 test_ret += test_xmlValidatePopElement();
25725 test_ret += test_xmlValidatePushCData();
25726 test_ret += test_xmlValidatePushElement();
25727 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000025728
Daniel Veillard42595322004-11-08 10:52:06 +000025729 if (test_ret != 0)
25730 printf("Module valid: %d errors\n", test_ret);
25731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025732}
25733
25734static int
25735test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025736 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025737
25738
25739 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000025740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025741}
25742
25743
25744static int
25745test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025747
25748#ifdef LIBXML_XINCLUDE_ENABLED
25749 int mem_base;
25750 int ret_val;
25751 xmlDocPtr doc; /* an XML document */
25752 int n_doc;
25753
25754 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25755 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025756 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025757
25758 ret_val = xmlXIncludeProcess(doc);
25759 desret_int(ret_val);
25760 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025761 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025762 xmlResetLastError();
25763 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025764 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025765 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025766 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025767 printf(" %d", n_doc);
25768 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025769 }
25770 }
25771#endif
25772
Daniel Veillard3d97e662004-11-04 10:49:00 +000025773 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025774 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025775}
25776
25777
25778static int
25779test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025781
25782#ifdef LIBXML_XINCLUDE_ENABLED
25783 int mem_base;
25784 int ret_val;
25785 xmlDocPtr doc; /* an XML document */
25786 int n_doc;
25787 int flags; /* a set of xmlParserOption used for parsing XML includes */
25788 int n_flags;
25789
25790 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25791 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
25792 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025793 doc = gen_xmlDocPtr(n_doc, 0);
25794 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025795
25796 ret_val = xmlXIncludeProcessFlags(doc, flags);
25797 desret_int(ret_val);
25798 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025799 des_xmlDocPtr(n_doc, doc, 0);
25800 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025801 xmlResetLastError();
25802 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025803 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025805 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025806 printf(" %d", n_doc);
25807 printf(" %d", n_flags);
25808 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025809 }
25810 }
25811 }
25812#endif
25813
Daniel Veillard3d97e662004-11-04 10:49:00 +000025814 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025815 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025816}
25817
25818
Daniel Veillardce682bc2004-11-05 17:22:25 +000025819#define gen_nb_xmlXIncludeCtxtPtr 1
25820static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
25821 return(NULL);
25822}
25823static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
25824}
25825
Daniel Veillardd93f6252004-11-02 15:53:51 +000025826static int
25827test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025829
Daniel Veillardce682bc2004-11-05 17:22:25 +000025830#ifdef LIBXML_XINCLUDE_ENABLED
25831 int mem_base;
25832 int ret_val;
25833 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
25834 int n_ctxt;
25835 xmlNodePtr node; /* a node in an XML document */
25836 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025837
Daniel Veillardce682bc2004-11-05 17:22:25 +000025838 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
25839 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
25840 mem_base = xmlMemBlocks();
25841 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
25842 node = gen_xmlNodePtr(n_node, 1);
25843
25844 ret_val = xmlXIncludeProcessNode(ctxt, node);
25845 desret_int(ret_val);
25846 call_tests++;
25847 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
25848 des_xmlNodePtr(n_node, node, 1);
25849 xmlResetLastError();
25850 if (mem_base != xmlMemBlocks()) {
25851 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
25852 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025853 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025854 printf(" %d", n_ctxt);
25855 printf(" %d", n_node);
25856 printf("\n");
25857 }
25858 }
25859 }
25860#endif
25861
25862 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025863 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025864}
25865
25866
25867static int
25868test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025869 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025870
25871#ifdef LIBXML_XINCLUDE_ENABLED
25872 int mem_base;
25873 int ret_val;
25874 xmlNodePtr tree; /* a node in an XML document */
25875 int n_tree;
25876
25877 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
25878 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025879 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025880
25881 ret_val = xmlXIncludeProcessTree(tree);
25882 desret_int(ret_val);
25883 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025884 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025885 xmlResetLastError();
25886 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025887 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025888 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025889 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025890 printf(" %d", n_tree);
25891 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025892 }
25893 }
25894#endif
25895
Daniel Veillard3d97e662004-11-04 10:49:00 +000025896 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025897 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025898}
25899
25900
25901static int
25902test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025904
25905#ifdef LIBXML_XINCLUDE_ENABLED
25906 int mem_base;
25907 int ret_val;
25908 xmlNodePtr tree; /* a node in an XML document */
25909 int n_tree;
25910 int flags; /* a set of xmlParserOption used for parsing XML includes */
25911 int n_flags;
25912
25913 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
25914 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
25915 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025916 tree = gen_xmlNodePtr(n_tree, 0);
25917 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025918
25919 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
25920 desret_int(ret_val);
25921 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025922 des_xmlNodePtr(n_tree, tree, 0);
25923 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025924 xmlResetLastError();
25925 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025926 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025927 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025928 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025929 printf(" %d", n_tree);
25930 printf(" %d", n_flags);
25931 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025932 }
25933 }
25934 }
25935#endif
25936
Daniel Veillard3d97e662004-11-04 10:49:00 +000025937 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025938 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025939}
25940
25941
25942static int
25943test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025945
Daniel Veillardce682bc2004-11-05 17:22:25 +000025946#ifdef LIBXML_XINCLUDE_ENABLED
25947 int mem_base;
25948 int ret_val;
25949 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
25950 int n_ctxt;
25951 int flags; /* a set of xmlParserOption used for parsing XML includes */
25952 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025953
Daniel Veillardce682bc2004-11-05 17:22:25 +000025954 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
25955 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
25956 mem_base = xmlMemBlocks();
25957 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
25958 flags = gen_int(n_flags, 1);
25959
25960 ret_val = xmlXIncludeSetFlags(ctxt, flags);
25961 desret_int(ret_val);
25962 call_tests++;
25963 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
25964 des_int(n_flags, flags, 1);
25965 xmlResetLastError();
25966 if (mem_base != xmlMemBlocks()) {
25967 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
25968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025969 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025970 printf(" %d", n_ctxt);
25971 printf(" %d", n_flags);
25972 printf("\n");
25973 }
25974 }
25975 }
25976#endif
25977
25978 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000025979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025980}
25981
25982static int
25983test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025985
Daniel Veillardce682bc2004-11-05 17:22:25 +000025986 printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000025987 test_ret += test_xmlXIncludeNewContext();
25988 test_ret += test_xmlXIncludeProcess();
25989 test_ret += test_xmlXIncludeProcessFlags();
25990 test_ret += test_xmlXIncludeProcessNode();
25991 test_ret += test_xmlXIncludeProcessTree();
25992 test_ret += test_xmlXIncludeProcessTreeFlags();
25993 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000025994
Daniel Veillard42595322004-11-08 10:52:06 +000025995 if (test_ret != 0)
25996 printf("Module xinclude: %d errors\n", test_ret);
25997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025998}
25999
26000static int
26001test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026002 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026003
Daniel Veillard3d95c732004-11-06 22:25:14 +000026004#ifdef LIBXML_OUTPUT_ENABLED
26005 int mem_base;
26006 xmlOutputBufferPtr ret_val;
26007 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26008 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026009
Daniel Veillard3d95c732004-11-06 22:25:14 +000026010 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26011 mem_base = xmlMemBlocks();
26012 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26013
26014 ret_val = xmlAllocOutputBuffer(encoder);
26015 desret_xmlOutputBufferPtr(ret_val);
26016 call_tests++;
26017 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26018 xmlResetLastError();
26019 if (mem_base != xmlMemBlocks()) {
26020 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026022 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026023 printf(" %d", n_encoder);
26024 printf("\n");
26025 }
26026 }
26027#endif
26028
26029 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026031}
26032
26033
26034static int
26035test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026037
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026038 int mem_base;
26039 xmlParserInputBufferPtr ret_val;
26040 xmlCharEncoding enc; /* the charset encoding if known */
26041 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026042
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026043 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26044 mem_base = xmlMemBlocks();
26045 enc = gen_xmlCharEncoding(n_enc, 0);
26046
26047 ret_val = xmlAllocParserInputBuffer(enc);
26048 desret_xmlParserInputBufferPtr(ret_val);
26049 call_tests++;
26050 des_xmlCharEncoding(n_enc, enc, 0);
26051 xmlResetLastError();
26052 if (mem_base != xmlMemBlocks()) {
26053 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026055 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026056 printf(" %d", n_enc);
26057 printf("\n");
26058 }
26059 }
26060
26061 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026063}
26064
26065
26066static int
26067test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026069
26070 int mem_base;
26071 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026072 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026073 int n_path;
26074
26075 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26076 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026077 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026078
26079 ret_val = xmlCheckFilename(path);
26080 desret_int(ret_val);
26081 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026082 des_const_char_ptr(n_path, path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026083 xmlResetLastError();
26084 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026085 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026087 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026088 printf(" %d", n_path);
26089 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026090 }
26091 }
26092
Daniel Veillard3d97e662004-11-04 10:49:00 +000026093 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026095}
26096
26097
26098static int
26099test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026101
Daniel Veillard42595322004-11-08 10:52:06 +000026102 int mem_base;
26103 xmlParserInputPtr ret_val;
26104 xmlParserCtxtPtr ctxt; /* an XML parser context */
26105 int n_ctxt;
26106 xmlParserInputPtr ret; /* an XML parser input */
26107 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026108
Daniel Veillard42595322004-11-08 10:52:06 +000026109 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26110 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26111 mem_base = xmlMemBlocks();
26112 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26113 ret = gen_xmlParserInputPtr(n_ret, 1);
26114
26115 ret_val = xmlCheckHTTPInput(ctxt, ret);
26116 desret_xmlParserInputPtr(ret_val);
26117 call_tests++;
26118 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26119 des_xmlParserInputPtr(n_ret, ret, 1);
26120 xmlResetLastError();
26121 if (mem_base != xmlMemBlocks()) {
26122 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26123 xmlMemBlocks() - mem_base);
26124 test_ret++;
26125 printf(" %d", n_ctxt);
26126 printf(" %d", n_ret);
26127 printf("\n");
26128 }
26129 }
26130 }
26131
26132 function_tests++;
26133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026134}
26135
26136
26137static int
26138test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026140
26141 int mem_base;
26142
26143 mem_base = xmlMemBlocks();
26144
26145 xmlCleanupInputCallbacks();
26146 call_tests++;
26147 xmlResetLastError();
26148 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026149 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026151 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026152 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026153 }
26154
Daniel Veillard3d97e662004-11-04 10:49:00 +000026155 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026156 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026157}
26158
26159
26160static int
26161test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026162 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026163
26164#ifdef LIBXML_OUTPUT_ENABLED
26165 int mem_base;
26166
26167 mem_base = xmlMemBlocks();
26168
26169 xmlCleanupOutputCallbacks();
26170 call_tests++;
26171 xmlResetLastError();
26172 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026173 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026174 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026175 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026176 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026177 }
26178#endif
26179
Daniel Veillard3d97e662004-11-04 10:49:00 +000026180 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026182}
26183
26184
26185static int
26186test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026188
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026189 int mem_base;
26190 int ret_val;
26191 void * context; /* the I/O context */
26192 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026193
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026194 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26195 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026196 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026197
26198 ret_val = xmlFileClose(context);
26199 desret_int(ret_val);
26200 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026201 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026202 xmlResetLastError();
26203 if (mem_base != xmlMemBlocks()) {
26204 printf("Leak of %d blocks found in xmlFileClose",
26205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026206 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026207 printf(" %d", n_context);
26208 printf("\n");
26209 }
26210 }
26211
Daniel Veillard3d97e662004-11-04 10:49:00 +000026212 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026213 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026214}
26215
26216
26217static int
26218test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026220
26221 int mem_base;
26222 int ret_val;
26223 const char * filename; /* the URI for matching */
26224 int n_filename;
26225
26226 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26227 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026228 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026229
26230 ret_val = xmlFileMatch(filename);
26231 desret_int(ret_val);
26232 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026233 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026234 xmlResetLastError();
26235 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026236 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026237 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026238 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026239 printf(" %d", n_filename);
26240 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026241 }
26242 }
26243
Daniel Veillard3d97e662004-11-04 10:49:00 +000026244 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026246}
26247
26248
26249static int
26250test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026252
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026253 int mem_base;
26254 void * ret_val;
26255 const char * filename; /* the URI for matching */
26256 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026257
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026258 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26259 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026260 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026261
26262 ret_val = xmlFileOpen(filename);
26263 desret_void_ptr(ret_val);
26264 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026265 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026266 xmlResetLastError();
26267 if (mem_base != xmlMemBlocks()) {
26268 printf("Leak of %d blocks found in xmlFileOpen",
26269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026270 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026271 printf(" %d", n_filename);
26272 printf("\n");
26273 }
26274 }
26275
Daniel Veillard3d97e662004-11-04 10:49:00 +000026276 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026278}
26279
26280
26281static int
26282test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026284
Daniel Veillardce682bc2004-11-05 17:22:25 +000026285 int mem_base;
26286 int ret_val;
26287 void * context; /* the I/O context */
26288 int n_context;
26289 char * buffer; /* where to drop data */
26290 int n_buffer;
26291 int len; /* number of bytes to write */
26292 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026293
Daniel Veillardce682bc2004-11-05 17:22:25 +000026294 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26295 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26296 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26297 mem_base = xmlMemBlocks();
26298 context = gen_void_ptr(n_context, 0);
26299 buffer = gen_char_ptr(n_buffer, 1);
26300 len = gen_int(n_len, 2);
26301
26302 ret_val = xmlFileRead(context, buffer, len);
26303 desret_int(ret_val);
26304 call_tests++;
26305 des_void_ptr(n_context, context, 0);
26306 des_char_ptr(n_buffer, buffer, 1);
26307 des_int(n_len, len, 2);
26308 xmlResetLastError();
26309 if (mem_base != xmlMemBlocks()) {
26310 printf("Leak of %d blocks found in xmlFileRead",
26311 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026312 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026313 printf(" %d", n_context);
26314 printf(" %d", n_buffer);
26315 printf(" %d", n_len);
26316 printf("\n");
26317 }
26318 }
26319 }
26320 }
26321
26322 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026324}
26325
26326
26327static int
26328test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026330
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026331#ifdef LIBXML_FTP_ENABLED
26332 int mem_base;
26333 int ret_val;
26334 void * context; /* the I/O context */
26335 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026336
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026337 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26338 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026339 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026340
26341 ret_val = xmlIOFTPClose(context);
26342 desret_int(ret_val);
26343 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026344 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026345 xmlResetLastError();
26346 if (mem_base != xmlMemBlocks()) {
26347 printf("Leak of %d blocks found in xmlIOFTPClose",
26348 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026349 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026350 printf(" %d", n_context);
26351 printf("\n");
26352 }
26353 }
26354#endif
26355
Daniel Veillard3d97e662004-11-04 10:49:00 +000026356 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026358}
26359
26360
26361static int
26362test_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026364
26365#ifdef LIBXML_FTP_ENABLED
26366 int mem_base;
26367 int ret_val;
26368 const char * filename; /* the URI for matching */
26369 int n_filename;
26370
26371 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26372 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026373 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026374
26375 ret_val = xmlIOFTPMatch(filename);
26376 desret_int(ret_val);
26377 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026378 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026379 xmlResetLastError();
26380 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026381 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026383 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026384 printf(" %d", n_filename);
26385 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026386 }
26387 }
26388#endif
26389
Daniel Veillard3d97e662004-11-04 10:49:00 +000026390 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026392}
26393
26394
26395static int
26396test_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026397 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026398
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026399#ifdef LIBXML_FTP_ENABLED
26400 int mem_base;
26401 void * ret_val;
26402 const char * filename; /* the URI for matching */
26403 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026404
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026405 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26406 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026407 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026408
26409 ret_val = xmlIOFTPOpen(filename);
26410 desret_void_ptr(ret_val);
26411 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026412 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026413 xmlResetLastError();
26414 if (mem_base != xmlMemBlocks()) {
26415 printf("Leak of %d blocks found in xmlIOFTPOpen",
26416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026417 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026418 printf(" %d", n_filename);
26419 printf("\n");
26420 }
26421 }
26422#endif
26423
Daniel Veillard3d97e662004-11-04 10:49:00 +000026424 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026426}
26427
26428
26429static int
26430test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026432
Daniel Veillardce682bc2004-11-05 17:22:25 +000026433#ifdef LIBXML_FTP_ENABLED
26434 int mem_base;
26435 int ret_val;
26436 void * context; /* the I/O context */
26437 int n_context;
26438 char * buffer; /* where to drop data */
26439 int n_buffer;
26440 int len; /* number of bytes to write */
26441 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026442
Daniel Veillardce682bc2004-11-05 17:22:25 +000026443 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26444 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26445 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26446 mem_base = xmlMemBlocks();
26447 context = gen_void_ptr(n_context, 0);
26448 buffer = gen_char_ptr(n_buffer, 1);
26449 len = gen_int(n_len, 2);
26450
26451 ret_val = xmlIOFTPRead(context, buffer, len);
26452 desret_int(ret_val);
26453 call_tests++;
26454 des_void_ptr(n_context, context, 0);
26455 des_char_ptr(n_buffer, buffer, 1);
26456 des_int(n_len, len, 2);
26457 xmlResetLastError();
26458 if (mem_base != xmlMemBlocks()) {
26459 printf("Leak of %d blocks found in xmlIOFTPRead",
26460 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026461 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026462 printf(" %d", n_context);
26463 printf(" %d", n_buffer);
26464 printf(" %d", n_len);
26465 printf("\n");
26466 }
26467 }
26468 }
26469 }
26470#endif
26471
26472 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026473 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026474}
26475
26476
26477static int
26478test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026479 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026480
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026481#ifdef LIBXML_HTTP_ENABLED
26482 int mem_base;
26483 int ret_val;
26484 void * context; /* the I/O context */
26485 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026486
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026487 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26488 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026489 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026490
26491 ret_val = xmlIOHTTPClose(context);
26492 desret_int(ret_val);
26493 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026494 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026495 xmlResetLastError();
26496 if (mem_base != xmlMemBlocks()) {
26497 printf("Leak of %d blocks found in xmlIOHTTPClose",
26498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026499 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026500 printf(" %d", n_context);
26501 printf("\n");
26502 }
26503 }
26504#endif
26505
Daniel Veillard3d97e662004-11-04 10:49:00 +000026506 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026508}
26509
26510
26511static int
26512test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026514
26515#ifdef LIBXML_HTTP_ENABLED
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 = xmlIOHTTPMatch(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 xmlIOHTTPMatch",
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 }
26538#endif
26539
Daniel Veillard3d97e662004-11-04 10:49:00 +000026540 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026542}
26543
26544
26545static int
26546test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026548
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026549#ifdef LIBXML_HTTP_ENABLED
26550 int mem_base;
26551 void * ret_val;
26552 const char * filename; /* the URI for matching */
26553 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026554
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026555 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26556 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026557 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026558
26559 ret_val = xmlIOHTTPOpen(filename);
26560 desret_void_ptr(ret_val);
26561 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026562 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026563 xmlResetLastError();
26564 if (mem_base != xmlMemBlocks()) {
26565 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026567 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026568 printf(" %d", n_filename);
26569 printf("\n");
26570 }
26571 }
26572#endif
26573
Daniel Veillard3d97e662004-11-04 10:49:00 +000026574 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026576}
26577
26578
26579static int
26580test_xmlIOHTTPOpenW(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026582
26583
26584 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026586}
26587
26588
26589static int
26590test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026592
Daniel Veillardce682bc2004-11-05 17:22:25 +000026593#ifdef LIBXML_HTTP_ENABLED
26594 int mem_base;
26595 int ret_val;
26596 void * context; /* the I/O context */
26597 int n_context;
26598 char * buffer; /* where to drop data */
26599 int n_buffer;
26600 int len; /* number of bytes to write */
26601 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026602
Daniel Veillardce682bc2004-11-05 17:22:25 +000026603 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26604 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26605 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26606 mem_base = xmlMemBlocks();
26607 context = gen_void_ptr(n_context, 0);
26608 buffer = gen_char_ptr(n_buffer, 1);
26609 len = gen_int(n_len, 2);
26610
26611 ret_val = xmlIOHTTPRead(context, buffer, len);
26612 desret_int(ret_val);
26613 call_tests++;
26614 des_void_ptr(n_context, context, 0);
26615 des_char_ptr(n_buffer, buffer, 1);
26616 des_int(n_len, len, 2);
26617 xmlResetLastError();
26618 if (mem_base != xmlMemBlocks()) {
26619 printf("Leak of %d blocks found in xmlIOHTTPRead",
26620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026621 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026622 printf(" %d", n_context);
26623 printf(" %d", n_buffer);
26624 printf(" %d", n_len);
26625 printf("\n");
26626 }
26627 }
26628 }
26629 }
26630#endif
26631
26632 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026633 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026634}
26635
26636
26637static int
26638test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026639 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026640
Daniel Veillard42595322004-11-08 10:52:06 +000026641 int mem_base;
26642 xmlParserInputPtr ret_val;
26643 const char * URL; /* the URL for the entity to load */
26644 int n_URL;
26645 char * ID; /* the System ID for the entity to load */
26646 int n_ID;
26647 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
26648 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026649
Daniel Veillard42595322004-11-08 10:52:06 +000026650 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
26651 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
26652 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26653 mem_base = xmlMemBlocks();
26654 URL = gen_filepath(n_URL, 0);
26655 ID = gen_const_char_ptr(n_ID, 1);
26656 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
26657
26658 ret_val = xmlNoNetExternalEntityLoader(URL, ID, ctxt);
26659 desret_xmlParserInputPtr(ret_val);
26660 call_tests++;
26661 des_filepath(n_URL, URL, 0);
26662 des_const_char_ptr(n_ID, ID, 1);
26663 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
26664 xmlResetLastError();
26665 if (mem_base != xmlMemBlocks()) {
26666 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
26667 xmlMemBlocks() - mem_base);
26668 test_ret++;
26669 printf(" %d", n_URL);
26670 printf(" %d", n_ID);
26671 printf(" %d", n_ctxt);
26672 printf("\n");
26673 }
26674 }
26675 }
26676 }
26677
26678 function_tests++;
26679 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026680}
26681
26682
26683static int
26684test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026685 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026686
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026687 int mem_base;
26688 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026689 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026690 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026691
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026692 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
26693 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026694 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026695
26696 ret_val = xmlNormalizeWindowsPath(path);
26697 desret_xmlChar_ptr(ret_val);
26698 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026699 des_const_xmlChar_ptr(n_path, path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026700 xmlResetLastError();
26701 if (mem_base != xmlMemBlocks()) {
26702 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
26703 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026704 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026705 printf(" %d", n_path);
26706 printf("\n");
26707 }
26708 }
26709
Daniel Veillard3d97e662004-11-04 10:49:00 +000026710 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026711 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026712}
26713
26714
26715static int
26716test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026717 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026718
Daniel Veillard3d95c732004-11-06 22:25:14 +000026719#ifdef LIBXML_OUTPUT_ENABLED
26720 int mem_base;
26721 xmlOutputBufferPtr ret_val;
26722 int fd; /* a file descriptor number */
26723 int n_fd;
26724 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26725 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026726
Daniel Veillard3d95c732004-11-06 22:25:14 +000026727 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
26728 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26729 mem_base = xmlMemBlocks();
26730 fd = gen_int(n_fd, 0);
26731 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26732
26733 ret_val = xmlOutputBufferCreateFd(fd, encoder);
26734 desret_xmlOutputBufferPtr(ret_val);
26735 call_tests++;
26736 des_int(n_fd, fd, 0);
26737 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26738 xmlResetLastError();
26739 if (mem_base != xmlMemBlocks()) {
26740 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
26741 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026742 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026743 printf(" %d", n_fd);
26744 printf(" %d", n_encoder);
26745 printf("\n");
26746 }
26747 }
26748 }
26749#endif
26750
26751 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026752 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026753}
26754
26755
26756static int
26757test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026759
Daniel Veillard3d95c732004-11-06 22:25:14 +000026760#ifdef LIBXML_OUTPUT_ENABLED
26761 int mem_base;
26762 xmlOutputBufferPtr ret_val;
26763 FILE * file; /* a FILE* */
26764 int n_file;
26765 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26766 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026767
Daniel Veillard3d95c732004-11-06 22:25:14 +000026768 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
26769 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26770 mem_base = xmlMemBlocks();
26771 file = gen_FILE_ptr(n_file, 0);
26772 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26773
26774 ret_val = xmlOutputBufferCreateFile(file, encoder);
26775 desret_xmlOutputBufferPtr(ret_val);
26776 call_tests++;
26777 des_FILE_ptr(n_file, file, 0);
26778 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26779 xmlResetLastError();
26780 if (mem_base != xmlMemBlocks()) {
26781 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
26782 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026783 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026784 printf(" %d", n_file);
26785 printf(" %d", n_encoder);
26786 printf("\n");
26787 }
26788 }
26789 }
26790#endif
26791
26792 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026793 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026794}
26795
26796
26797static int
26798test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026799 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026800
Daniel Veillard3d95c732004-11-06 22:25:14 +000026801#ifdef LIBXML_OUTPUT_ENABLED
26802 int mem_base;
26803 xmlOutputBufferPtr ret_val;
26804 const char * URI; /* a C string containing the URI or filename */
26805 int n_URI;
26806 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26807 int n_encoder;
26808 int compression; /* the compression ration (0 none, 9 max). */
26809 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026810
Daniel Veillard42595322004-11-08 10:52:06 +000026811 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000026812 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26813 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
26814 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000026815 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000026816 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26817 compression = gen_int(n_compression, 2);
26818
26819 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
26820 desret_xmlOutputBufferPtr(ret_val);
26821 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026822 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000026823 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26824 des_int(n_compression, compression, 2);
26825 xmlResetLastError();
26826 if (mem_base != xmlMemBlocks()) {
26827 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
26828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026829 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026830 printf(" %d", n_URI);
26831 printf(" %d", n_encoder);
26832 printf(" %d", n_compression);
26833 printf("\n");
26834 }
26835 }
26836 }
26837 }
26838#endif
26839
26840 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026841 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026842}
26843
26844
26845static int
26846test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026847 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026848
Daniel Veillard3d97e662004-11-04 10:49:00 +000026849#ifdef LIBXML_OUTPUT_ENABLED
26850 int mem_base;
26851 int ret_val;
26852 xmlOutputBufferPtr out; /* a buffered output */
26853 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026854
Daniel Veillard3d97e662004-11-04 10:49:00 +000026855 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
26856 mem_base = xmlMemBlocks();
26857 out = gen_xmlOutputBufferPtr(n_out, 0);
26858
26859 ret_val = xmlOutputBufferFlush(out);
26860 desret_int(ret_val);
26861 call_tests++;
26862 des_xmlOutputBufferPtr(n_out, out, 0);
26863 xmlResetLastError();
26864 if (mem_base != xmlMemBlocks()) {
26865 printf("Leak of %d blocks found in xmlOutputBufferFlush",
26866 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026867 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026868 printf(" %d", n_out);
26869 printf("\n");
26870 }
26871 }
26872#endif
26873
26874 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026875 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026876}
26877
26878
26879static int
26880test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026881 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026882
Daniel Veillard3d97e662004-11-04 10:49:00 +000026883#ifdef LIBXML_OUTPUT_ENABLED
26884 int mem_base;
26885 int ret_val;
26886 xmlOutputBufferPtr out; /* a buffered parser output */
26887 int n_out;
26888 int len; /* the size in bytes of the array. */
26889 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026890 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000026891 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026892
Daniel Veillard3d97e662004-11-04 10:49:00 +000026893 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
26894 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26895 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
26896 mem_base = xmlMemBlocks();
26897 out = gen_xmlOutputBufferPtr(n_out, 0);
26898 len = gen_int(n_len, 1);
26899 buf = gen_const_char_ptr(n_buf, 2);
26900
26901 ret_val = xmlOutputBufferWrite(out, len, buf);
26902 desret_int(ret_val);
26903 call_tests++;
26904 des_xmlOutputBufferPtr(n_out, out, 0);
26905 des_int(n_len, len, 1);
26906 des_const_char_ptr(n_buf, buf, 2);
26907 xmlResetLastError();
26908 if (mem_base != xmlMemBlocks()) {
26909 printf("Leak of %d blocks found in xmlOutputBufferWrite",
26910 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026911 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026912 printf(" %d", n_out);
26913 printf(" %d", n_len);
26914 printf(" %d", n_buf);
26915 printf("\n");
26916 }
26917 }
26918 }
26919 }
26920#endif
26921
26922 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026923 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026924}
26925
26926
26927static int
26928test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026929 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026930
26931
26932 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026934}
26935
26936
26937static int
26938test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026940
Daniel Veillard3d97e662004-11-04 10:49:00 +000026941#ifdef LIBXML_OUTPUT_ENABLED
26942 int mem_base;
26943 int ret_val;
26944 xmlOutputBufferPtr out; /* a buffered parser output */
26945 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026946 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000026947 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026948
Daniel Veillard3d97e662004-11-04 10:49:00 +000026949 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
26950 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
26951 mem_base = xmlMemBlocks();
26952 out = gen_xmlOutputBufferPtr(n_out, 0);
26953 str = gen_const_char_ptr(n_str, 1);
26954
26955 ret_val = xmlOutputBufferWriteString(out, str);
26956 desret_int(ret_val);
26957 call_tests++;
26958 des_xmlOutputBufferPtr(n_out, out, 0);
26959 des_const_char_ptr(n_str, str, 1);
26960 xmlResetLastError();
26961 if (mem_base != xmlMemBlocks()) {
26962 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
26963 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026964 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026965 printf(" %d", n_out);
26966 printf(" %d", n_str);
26967 printf("\n");
26968 }
26969 }
26970 }
26971#endif
26972
26973 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026975}
26976
26977
26978static int
26979test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026981
26982
26983 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026985}
26986
26987
26988static int
26989test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026991
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026992 int mem_base;
26993 xmlParserInputBufferPtr ret_val;
26994 int fd; /* a file descriptor number */
26995 int n_fd;
26996 xmlCharEncoding enc; /* the charset encoding if known */
26997 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026998
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026999 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27000 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27001 mem_base = xmlMemBlocks();
27002 fd = gen_int(n_fd, 0);
27003 enc = gen_xmlCharEncoding(n_enc, 1);
27004 if (fd >= 0) fd = -1;
27005
27006 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27007 desret_xmlParserInputBufferPtr(ret_val);
27008 call_tests++;
27009 des_int(n_fd, fd, 0);
27010 des_xmlCharEncoding(n_enc, enc, 1);
27011 xmlResetLastError();
27012 if (mem_base != xmlMemBlocks()) {
27013 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027015 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027016 printf(" %d", n_fd);
27017 printf(" %d", n_enc);
27018 printf("\n");
27019 }
27020 }
27021 }
27022
27023 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027025}
27026
27027
27028static int
27029test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027031
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027032 int mem_base;
27033 xmlParserInputBufferPtr ret_val;
27034 FILE * file; /* a FILE* */
27035 int n_file;
27036 xmlCharEncoding enc; /* the charset encoding if known */
27037 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027038
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027039 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27040 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27041 mem_base = xmlMemBlocks();
27042 file = gen_FILE_ptr(n_file, 0);
27043 enc = gen_xmlCharEncoding(n_enc, 1);
27044
27045 ret_val = xmlParserInputBufferCreateFile(file, enc);
27046 desret_xmlParserInputBufferPtr(ret_val);
27047 call_tests++;
27048 des_FILE_ptr(n_file, file, 0);
27049 des_xmlCharEncoding(n_enc, enc, 1);
27050 xmlResetLastError();
27051 if (mem_base != xmlMemBlocks()) {
27052 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027054 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027055 printf(" %d", n_file);
27056 printf(" %d", n_enc);
27057 printf("\n");
27058 }
27059 }
27060 }
27061
27062 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027064}
27065
27066
27067static int
27068test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027070
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027071 int mem_base;
27072 xmlParserInputBufferPtr ret_val;
27073 const char * URI; /* a C string containing the URI or filename */
27074 int n_URI;
27075 xmlCharEncoding enc; /* the charset encoding if known */
27076 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027077
Daniel Veillard42595322004-11-08 10:52:06 +000027078 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027079 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27080 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027081 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027082 enc = gen_xmlCharEncoding(n_enc, 1);
27083
27084 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27085 desret_xmlParserInputBufferPtr(ret_val);
27086 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027087 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027088 des_xmlCharEncoding(n_enc, enc, 1);
27089 xmlResetLastError();
27090 if (mem_base != xmlMemBlocks()) {
27091 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27092 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027093 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027094 printf(" %d", n_URI);
27095 printf(" %d", n_enc);
27096 printf("\n");
27097 }
27098 }
27099 }
27100
27101 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027103}
27104
27105
27106static int
27107test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027109
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027110 int mem_base;
27111 xmlParserInputBufferPtr ret_val;
27112 char * mem; /* the memory input */
27113 int n_mem;
27114 int size; /* the length of the memory block */
27115 int n_size;
27116 xmlCharEncoding enc; /* the charset encoding if known */
27117 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027118
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027119 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27120 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27121 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27122 mem_base = xmlMemBlocks();
27123 mem = gen_const_char_ptr(n_mem, 0);
27124 size = gen_int(n_size, 1);
27125 enc = gen_xmlCharEncoding(n_enc, 2);
27126
27127 ret_val = xmlParserInputBufferCreateMem(mem, size, enc);
27128 desret_xmlParserInputBufferPtr(ret_val);
27129 call_tests++;
27130 des_const_char_ptr(n_mem, mem, 0);
27131 des_int(n_size, size, 1);
27132 des_xmlCharEncoding(n_enc, enc, 2);
27133 xmlResetLastError();
27134 if (mem_base != xmlMemBlocks()) {
27135 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027137 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027138 printf(" %d", n_mem);
27139 printf(" %d", n_size);
27140 printf(" %d", n_enc);
27141 printf("\n");
27142 }
27143 }
27144 }
27145 }
27146
27147 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027148 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027149}
27150
27151
27152static int
27153test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027155
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027156 int mem_base;
27157 xmlParserInputBufferPtr ret_val;
27158 char * mem; /* the memory input */
27159 int n_mem;
27160 int size; /* the length of the memory block */
27161 int n_size;
27162 xmlCharEncoding enc; /* the charset encoding if known */
27163 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027164
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027165 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27166 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27167 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27168 mem_base = xmlMemBlocks();
27169 mem = gen_const_char_ptr(n_mem, 0);
27170 size = gen_int(n_size, 1);
27171 enc = gen_xmlCharEncoding(n_enc, 2);
27172
27173 ret_val = xmlParserInputBufferCreateStatic(mem, size, enc);
27174 desret_xmlParserInputBufferPtr(ret_val);
27175 call_tests++;
27176 des_const_char_ptr(n_mem, mem, 0);
27177 des_int(n_size, size, 1);
27178 des_xmlCharEncoding(n_enc, enc, 2);
27179 xmlResetLastError();
27180 if (mem_base != xmlMemBlocks()) {
27181 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27182 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027183 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027184 printf(" %d", n_mem);
27185 printf(" %d", n_size);
27186 printf(" %d", n_enc);
27187 printf("\n");
27188 }
27189 }
27190 }
27191 }
27192
27193 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027195}
27196
27197
27198static int
27199test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027200 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027201
Daniel Veillard34099b42004-11-04 17:34:35 +000027202 int mem_base;
27203 int ret_val;
27204 xmlParserInputBufferPtr in; /* a buffered parser input */
27205 int n_in;
27206 int len; /* indicative value of the amount of chars to read */
27207 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027208
Daniel Veillard34099b42004-11-04 17:34:35 +000027209 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27210 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27211 mem_base = xmlMemBlocks();
27212 in = gen_xmlParserInputBufferPtr(n_in, 0);
27213 len = gen_int(n_len, 1);
27214
27215 ret_val = xmlParserInputBufferGrow(in, len);
27216 desret_int(ret_val);
27217 call_tests++;
27218 des_xmlParserInputBufferPtr(n_in, in, 0);
27219 des_int(n_len, len, 1);
27220 xmlResetLastError();
27221 if (mem_base != xmlMemBlocks()) {
27222 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027224 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027225 printf(" %d", n_in);
27226 printf(" %d", n_len);
27227 printf("\n");
27228 }
27229 }
27230 }
27231
27232 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027234}
27235
27236
27237static int
27238test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027240
Daniel Veillard34099b42004-11-04 17:34:35 +000027241 int mem_base;
27242 int ret_val;
27243 xmlParserInputBufferPtr in; /* a buffered parser input */
27244 int n_in;
27245 int len; /* the size in bytes of the array. */
27246 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027247 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027248 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027249
Daniel Veillard34099b42004-11-04 17:34:35 +000027250 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27251 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27252 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27253 mem_base = xmlMemBlocks();
27254 in = gen_xmlParserInputBufferPtr(n_in, 0);
27255 len = gen_int(n_len, 1);
27256 buf = gen_const_char_ptr(n_buf, 2);
27257
27258 ret_val = xmlParserInputBufferPush(in, len, buf);
27259 desret_int(ret_val);
27260 call_tests++;
27261 des_xmlParserInputBufferPtr(n_in, in, 0);
27262 des_int(n_len, len, 1);
27263 des_const_char_ptr(n_buf, buf, 2);
27264 xmlResetLastError();
27265 if (mem_base != xmlMemBlocks()) {
27266 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27267 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027268 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027269 printf(" %d", n_in);
27270 printf(" %d", n_len);
27271 printf(" %d", n_buf);
27272 printf("\n");
27273 }
27274 }
27275 }
27276 }
27277
27278 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027279 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027280}
27281
27282
27283static int
27284test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027285 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027286
Daniel Veillard34099b42004-11-04 17:34:35 +000027287 int mem_base;
27288 int ret_val;
27289 xmlParserInputBufferPtr in; /* a buffered parser input */
27290 int n_in;
27291 int len; /* indicative value of the amount of chars to read */
27292 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027293
Daniel Veillard34099b42004-11-04 17:34:35 +000027294 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27295 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27296 mem_base = xmlMemBlocks();
27297 in = gen_xmlParserInputBufferPtr(n_in, 0);
27298 len = gen_int(n_len, 1);
27299
27300 ret_val = xmlParserInputBufferRead(in, len);
27301 desret_int(ret_val);
27302 call_tests++;
27303 des_xmlParserInputBufferPtr(n_in, in, 0);
27304 des_int(n_len, len, 1);
27305 xmlResetLastError();
27306 if (mem_base != xmlMemBlocks()) {
27307 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027309 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027310 printf(" %d", n_in);
27311 printf(" %d", n_len);
27312 printf("\n");
27313 }
27314 }
27315 }
27316
27317 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027319}
27320
27321
27322static int
27323test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027325
27326 int mem_base;
27327 int ret_val;
27328
27329 mem_base = xmlMemBlocks();
27330
27331 ret_val = xmlPopInputCallbacks();
27332 desret_int(ret_val);
27333 call_tests++;
27334 xmlResetLastError();
27335 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027336 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027338 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027339 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027340 }
27341
Daniel Veillard3d97e662004-11-04 10:49:00 +000027342 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027344}
27345
27346
27347static int
27348test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027350
27351 int mem_base;
27352
27353 mem_base = xmlMemBlocks();
27354
27355 xmlRegisterDefaultInputCallbacks();
27356 call_tests++;
27357 xmlResetLastError();
27358 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027359 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027360 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027361 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027362 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027363 }
27364
Daniel Veillard3d97e662004-11-04 10:49:00 +000027365 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027366 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027367}
27368
27369
27370static int
27371test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027373
27374#ifdef LIBXML_OUTPUT_ENABLED
27375 int mem_base;
27376
27377 mem_base = xmlMemBlocks();
27378
27379 xmlRegisterDefaultOutputCallbacks();
27380 call_tests++;
27381 xmlResetLastError();
27382 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027383 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027385 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027386 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027387 }
27388#endif
27389
Daniel Veillard3d97e662004-11-04 10:49:00 +000027390 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027392}
27393
27394
27395static int
27396test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027397 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027398
27399#ifdef LIBXML_HTTP_ENABLED
27400 int mem_base;
27401
27402 mem_base = xmlMemBlocks();
27403
27404 xmlRegisterHTTPPostCallbacks();
27405 call_tests++;
27406 xmlResetLastError();
27407 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027408 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027410 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027411 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027412 }
27413#endif
27414
Daniel Veillard3d97e662004-11-04 10:49:00 +000027415 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027416 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027417}
27418
27419static int
27420test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027421 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027422
Daniel Veillard42595322004-11-08 10:52:06 +000027423 printf("Testing xmlIO : 38 of 47 functions ...\n");
27424 test_ret += test_xmlAllocOutputBuffer();
27425 test_ret += test_xmlAllocParserInputBuffer();
27426 test_ret += test_xmlCheckFilename();
27427 test_ret += test_xmlCheckHTTPInput();
27428 test_ret += test_xmlCleanupInputCallbacks();
27429 test_ret += test_xmlCleanupOutputCallbacks();
27430 test_ret += test_xmlFileClose();
27431 test_ret += test_xmlFileMatch();
27432 test_ret += test_xmlFileOpen();
27433 test_ret += test_xmlFileRead();
27434 test_ret += test_xmlIOFTPClose();
27435 test_ret += test_xmlIOFTPMatch();
27436 test_ret += test_xmlIOFTPOpen();
27437 test_ret += test_xmlIOFTPRead();
27438 test_ret += test_xmlIOHTTPClose();
27439 test_ret += test_xmlIOHTTPMatch();
27440 test_ret += test_xmlIOHTTPOpen();
27441 test_ret += test_xmlIOHTTPOpenW();
27442 test_ret += test_xmlIOHTTPRead();
27443 test_ret += test_xmlNoNetExternalEntityLoader();
27444 test_ret += test_xmlNormalizeWindowsPath();
27445 test_ret += test_xmlOutputBufferCreateFd();
27446 test_ret += test_xmlOutputBufferCreateFile();
27447 test_ret += test_xmlOutputBufferCreateFilename();
27448 test_ret += test_xmlOutputBufferFlush();
27449 test_ret += test_xmlOutputBufferWrite();
27450 test_ret += test_xmlOutputBufferWriteEscape();
27451 test_ret += test_xmlOutputBufferWriteString();
27452 test_ret += test_xmlParserGetDirectory();
27453 test_ret += test_xmlParserInputBufferCreateFd();
27454 test_ret += test_xmlParserInputBufferCreateFile();
27455 test_ret += test_xmlParserInputBufferCreateFilename();
27456 test_ret += test_xmlParserInputBufferCreateMem();
27457 test_ret += test_xmlParserInputBufferCreateStatic();
27458 test_ret += test_xmlParserInputBufferGrow();
27459 test_ret += test_xmlParserInputBufferPush();
27460 test_ret += test_xmlParserInputBufferRead();
27461 test_ret += test_xmlPopInputCallbacks();
27462 test_ret += test_xmlRegisterDefaultInputCallbacks();
27463 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27464 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027465
Daniel Veillard42595322004-11-08 10:52:06 +000027466 if (test_ret != 0)
27467 printf("Module xmlIO: %d errors\n", test_ret);
27468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027469}
27470
Daniel Veillarda82b1822004-11-08 16:24:57 +000027471#define gen_nb_xmlAutomataPtr 1
27472static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27473 return(NULL);
27474}
27475static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27476}
27477
27478static int
27479test_xmlAutomataCompile(void) {
27480 int test_ret = 0;
27481
27482
27483 /* missing type support */
27484 return(test_ret);
27485}
27486
27487
27488static int
27489test_xmlAutomataGetInitState(void) {
27490 int test_ret = 0;
27491
27492
27493 /* missing type support */
27494 return(test_ret);
27495}
27496
27497
27498static int
27499test_xmlAutomataIsDeterminist(void) {
27500 int test_ret = 0;
27501
27502#ifdef LIBXML_AUTOMATA_ENABLED
27503 int mem_base;
27504 int ret_val;
27505 xmlAutomataPtr am; /* an automata */
27506 int n_am;
27507
27508 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27509 mem_base = xmlMemBlocks();
27510 am = gen_xmlAutomataPtr(n_am, 0);
27511
27512 ret_val = xmlAutomataIsDeterminist(am);
27513 desret_int(ret_val);
27514 call_tests++;
27515 des_xmlAutomataPtr(n_am, am, 0);
27516 xmlResetLastError();
27517 if (mem_base != xmlMemBlocks()) {
27518 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27519 xmlMemBlocks() - mem_base);
27520 test_ret++;
27521 printf(" %d", n_am);
27522 printf("\n");
27523 }
27524 }
27525#endif
27526
27527 function_tests++;
27528 return(test_ret);
27529}
27530
27531
27532#define gen_nb_xmlAutomataStatePtr 1
27533static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27534 return(NULL);
27535}
27536static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27537}
27538
27539static int
27540test_xmlAutomataNewAllTrans(void) {
27541 int test_ret = 0;
27542
27543
27544 /* missing type support */
27545 return(test_ret);
27546}
27547
27548
27549static int
27550test_xmlAutomataNewCountTrans(void) {
27551 int test_ret = 0;
27552
27553
27554 /* missing type support */
27555 return(test_ret);
27556}
27557
27558
27559static int
27560test_xmlAutomataNewCountTrans2(void) {
27561 int test_ret = 0;
27562
27563
27564 /* missing type support */
27565 return(test_ret);
27566}
27567
27568
27569static int
27570test_xmlAutomataNewCountedTrans(void) {
27571 int test_ret = 0;
27572
27573
27574 /* missing type support */
27575 return(test_ret);
27576}
27577
27578
27579static int
27580test_xmlAutomataNewCounter(void) {
27581 int test_ret = 0;
27582
27583#ifdef LIBXML_AUTOMATA_ENABLED
27584 int mem_base;
27585 int ret_val;
27586 xmlAutomataPtr am; /* an automata */
27587 int n_am;
27588 int min; /* the minimal value on the counter */
27589 int n_min;
27590 int max; /* the maximal value on the counter */
27591 int n_max;
27592
27593 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27594 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27595 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27596 mem_base = xmlMemBlocks();
27597 am = gen_xmlAutomataPtr(n_am, 0);
27598 min = gen_int(n_min, 1);
27599 max = gen_int(n_max, 2);
27600
27601 ret_val = xmlAutomataNewCounter(am, min, max);
27602 desret_int(ret_val);
27603 call_tests++;
27604 des_xmlAutomataPtr(n_am, am, 0);
27605 des_int(n_min, min, 1);
27606 des_int(n_max, max, 2);
27607 xmlResetLastError();
27608 if (mem_base != xmlMemBlocks()) {
27609 printf("Leak of %d blocks found in xmlAutomataNewCounter",
27610 xmlMemBlocks() - mem_base);
27611 test_ret++;
27612 printf(" %d", n_am);
27613 printf(" %d", n_min);
27614 printf(" %d", n_max);
27615 printf("\n");
27616 }
27617 }
27618 }
27619 }
27620#endif
27621
27622 function_tests++;
27623 return(test_ret);
27624}
27625
27626
27627static int
27628test_xmlAutomataNewCounterTrans(void) {
27629 int test_ret = 0;
27630
27631
27632 /* missing type support */
27633 return(test_ret);
27634}
27635
27636
27637static int
27638test_xmlAutomataNewEpsilon(void) {
27639 int test_ret = 0;
27640
27641
27642 /* missing type support */
27643 return(test_ret);
27644}
27645
27646
27647static int
27648test_xmlAutomataNewOnceTrans(void) {
27649 int test_ret = 0;
27650
27651
27652 /* missing type support */
27653 return(test_ret);
27654}
27655
27656
27657static int
27658test_xmlAutomataNewOnceTrans2(void) {
27659 int test_ret = 0;
27660
27661
27662 /* missing type support */
27663 return(test_ret);
27664}
27665
27666
27667static int
27668test_xmlAutomataNewState(void) {
27669 int test_ret = 0;
27670
27671
27672 /* missing type support */
27673 return(test_ret);
27674}
27675
27676
27677static int
27678test_xmlAutomataNewTransition(void) {
27679 int test_ret = 0;
27680
27681
27682 /* missing type support */
27683 return(test_ret);
27684}
27685
27686
27687static int
27688test_xmlAutomataNewTransition2(void) {
27689 int test_ret = 0;
27690
27691
27692 /* missing type support */
27693 return(test_ret);
27694}
27695
27696
27697static int
27698test_xmlAutomataSetFinalState(void) {
27699 int test_ret = 0;
27700
27701#ifdef LIBXML_AUTOMATA_ENABLED
27702 int mem_base;
27703 int ret_val;
27704 xmlAutomataPtr am; /* an automata */
27705 int n_am;
27706 xmlAutomataStatePtr state; /* a state in this automata */
27707 int n_state;
27708
27709 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27710 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
27711 mem_base = xmlMemBlocks();
27712 am = gen_xmlAutomataPtr(n_am, 0);
27713 state = gen_xmlAutomataStatePtr(n_state, 1);
27714
27715 ret_val = xmlAutomataSetFinalState(am, state);
27716 desret_int(ret_val);
27717 call_tests++;
27718 des_xmlAutomataPtr(n_am, am, 0);
27719 des_xmlAutomataStatePtr(n_state, state, 1);
27720 xmlResetLastError();
27721 if (mem_base != xmlMemBlocks()) {
27722 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
27723 xmlMemBlocks() - mem_base);
27724 test_ret++;
27725 printf(" %d", n_am);
27726 printf(" %d", n_state);
27727 printf("\n");
27728 }
27729 }
27730 }
27731#endif
27732
27733 function_tests++;
27734 return(test_ret);
27735}
27736
27737
27738static int
27739test_xmlNewAutomata(void) {
27740 int test_ret = 0;
27741
27742
27743 /* missing type support */
27744 return(test_ret);
27745}
27746
27747static int
27748test_xmlautomata(void) {
27749 int test_ret = 0;
27750
27751 printf("Testing xmlautomata : 3 of 18 functions ...\n");
27752 test_ret += test_xmlAutomataCompile();
27753 test_ret += test_xmlAutomataGetInitState();
27754 test_ret += test_xmlAutomataIsDeterminist();
27755 test_ret += test_xmlAutomataNewAllTrans();
27756 test_ret += test_xmlAutomataNewCountTrans();
27757 test_ret += test_xmlAutomataNewCountTrans2();
27758 test_ret += test_xmlAutomataNewCountedTrans();
27759 test_ret += test_xmlAutomataNewCounter();
27760 test_ret += test_xmlAutomataNewCounterTrans();
27761 test_ret += test_xmlAutomataNewEpsilon();
27762 test_ret += test_xmlAutomataNewOnceTrans();
27763 test_ret += test_xmlAutomataNewOnceTrans2();
27764 test_ret += test_xmlAutomataNewState();
27765 test_ret += test_xmlAutomataNewTransition();
27766 test_ret += test_xmlAutomataNewTransition2();
27767 test_ret += test_xmlAutomataSetFinalState();
27768 test_ret += test_xmlNewAutomata();
27769
27770 if (test_ret != 0)
27771 printf("Module xmlautomata: %d errors\n", test_ret);
27772 return(test_ret);
27773}
27774
Daniel Veillardce682bc2004-11-05 17:22:25 +000027775#define gen_nb_xmlGenericErrorFunc_ptr 1
27776static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27777 return(NULL);
27778}
27779static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27780}
27781
Daniel Veillardd93f6252004-11-02 15:53:51 +000027782static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000027783test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027784 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027785
Daniel Veillardce682bc2004-11-05 17:22:25 +000027786 int mem_base;
27787 xmlGenericErrorFunc * handler; /* the handler */
27788 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027789
Daniel Veillardce682bc2004-11-05 17:22:25 +000027790 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
27791 mem_base = xmlMemBlocks();
27792 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
27793
27794 initGenericErrorDefaultFunc(handler);
27795 call_tests++;
27796 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
27797 xmlResetLastError();
27798 if (mem_base != xmlMemBlocks()) {
27799 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
27800 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027801 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027802 printf(" %d", n_handler);
27803 printf("\n");
27804 }
27805 }
27806
27807 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027808 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027809}
27810
27811
Daniel Veillardce682bc2004-11-05 17:22:25 +000027812#define gen_nb_xmlErrorPtr 1
27813static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27814 return(NULL);
27815}
27816static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27817}
27818
Daniel Veillardd93f6252004-11-02 15:53:51 +000027819static int
27820test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027821 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027822
Daniel Veillardce682bc2004-11-05 17:22:25 +000027823 int mem_base;
27824 int ret_val;
27825 xmlErrorPtr from; /* a source error */
27826 int n_from;
27827 xmlErrorPtr to; /* a target error */
27828 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027829
Daniel Veillardce682bc2004-11-05 17:22:25 +000027830 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
27831 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
27832 mem_base = xmlMemBlocks();
27833 from = gen_xmlErrorPtr(n_from, 0);
27834 to = gen_xmlErrorPtr(n_to, 1);
27835
27836 ret_val = xmlCopyError(from, to);
27837 desret_int(ret_val);
27838 call_tests++;
27839 des_xmlErrorPtr(n_from, from, 0);
27840 des_xmlErrorPtr(n_to, to, 1);
27841 xmlResetLastError();
27842 if (mem_base != xmlMemBlocks()) {
27843 printf("Leak of %d blocks found in xmlCopyError",
27844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027845 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027846 printf(" %d", n_from);
27847 printf(" %d", n_to);
27848 printf("\n");
27849 }
27850 }
27851 }
27852
27853 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027854 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027855}
27856
27857
27858static int
27859test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027860 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027861
27862
27863 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027864 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027865}
27866
27867
27868static int
27869test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027870 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027871
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027872 int mem_base;
27873 void * ctx; /* an XML parser context */
27874 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027875
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027876 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
27877 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027878 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027879
27880 xmlCtxtResetLastError(ctx);
27881 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027882 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027883 xmlResetLastError();
27884 if (mem_base != xmlMemBlocks()) {
27885 printf("Leak of %d blocks found in xmlCtxtResetLastError",
27886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027887 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027888 printf(" %d", n_ctx);
27889 printf("\n");
27890 }
27891 }
27892
Daniel Veillard3d97e662004-11-04 10:49:00 +000027893 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027894 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027895}
27896
27897
27898static int
27899test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027900 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027901
27902
27903 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027904 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027905}
27906
27907
27908static int
27909test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027910 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027911
27912
27913 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027914 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027915}
27916
27917
27918static int
27919test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027920 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027921
Daniel Veillardce682bc2004-11-05 17:22:25 +000027922 int mem_base;
27923 xmlParserInputPtr input; /* an xmlParserInputPtr input */
27924 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027925
Daniel Veillardce682bc2004-11-05 17:22:25 +000027926 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
27927 mem_base = xmlMemBlocks();
27928 input = gen_xmlParserInputPtr(n_input, 0);
27929
27930 xmlParserPrintFileContext(input);
27931 call_tests++;
27932 des_xmlParserInputPtr(n_input, input, 0);
27933 xmlResetLastError();
27934 if (mem_base != xmlMemBlocks()) {
27935 printf("Leak of %d blocks found in xmlParserPrintFileContext",
27936 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027937 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027938 printf(" %d", n_input);
27939 printf("\n");
27940 }
27941 }
27942
27943 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027944 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027945}
27946
27947
27948static int
27949test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027950 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027951
Daniel Veillardce682bc2004-11-05 17:22:25 +000027952 int mem_base;
27953 xmlParserInputPtr input; /* an xmlParserInputPtr input */
27954 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027955
Daniel Veillardce682bc2004-11-05 17:22:25 +000027956 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
27957 mem_base = xmlMemBlocks();
27958 input = gen_xmlParserInputPtr(n_input, 0);
27959
27960 xmlParserPrintFileInfo(input);
27961 call_tests++;
27962 des_xmlParserInputPtr(n_input, input, 0);
27963 xmlResetLastError();
27964 if (mem_base != xmlMemBlocks()) {
27965 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
27966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027967 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027968 printf(" %d", n_input);
27969 printf("\n");
27970 }
27971 }
27972
27973 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027975}
27976
27977
27978static int
27979test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027981
27982
27983 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027985}
27986
27987
27988static int
27989test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027991
27992
27993 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027995}
27996
27997
27998static int
27999test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028000 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028001
28002
28003 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028005}
28006
28007
28008static int
28009test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028011
Daniel Veillardce682bc2004-11-05 17:22:25 +000028012 int mem_base;
28013 xmlErrorPtr err; /* pointer to the error. */
28014 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028015
Daniel Veillardce682bc2004-11-05 17:22:25 +000028016 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28017 mem_base = xmlMemBlocks();
28018 err = gen_xmlErrorPtr(n_err, 0);
28019
28020 xmlResetError(err);
28021 call_tests++;
28022 des_xmlErrorPtr(n_err, err, 0);
28023 xmlResetLastError();
28024 if (mem_base != xmlMemBlocks()) {
28025 printf("Leak of %d blocks found in xmlResetError",
28026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028027 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028028 printf(" %d", n_err);
28029 printf("\n");
28030 }
28031 }
28032
28033 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028035}
28036
28037
28038static int
28039test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028041
28042
28043
28044 xmlResetLastError();
28045 call_tests++;
28046 xmlResetLastError();
28047
Daniel Veillard3d97e662004-11-04 10:49:00 +000028048 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028050}
28051
28052
28053static int
28054test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028056
28057
28058 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028059 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028060}
28061
28062
28063static int
28064test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028065 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028066
28067
28068 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028069 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028070}
28071
28072static int
28073test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028075
Daniel Veillardce682bc2004-11-05 17:22:25 +000028076 printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028077 test_ret += test_initGenericErrorDefaultFunc();
28078 test_ret += test_xmlCopyError();
28079 test_ret += test_xmlCtxtGetLastError();
28080 test_ret += test_xmlCtxtResetLastError();
28081 test_ret += test_xmlGetLastError();
28082 test_ret += test_xmlParserError();
28083 test_ret += test_xmlParserPrintFileContext();
28084 test_ret += test_xmlParserPrintFileInfo();
28085 test_ret += test_xmlParserValidityError();
28086 test_ret += test_xmlParserValidityWarning();
28087 test_ret += test_xmlParserWarning();
28088 test_ret += test_xmlResetError();
28089 test_ret += test_xmlResetLastError();
28090 test_ret += test_xmlSetGenericErrorFunc();
28091 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028092
Daniel Veillard42595322004-11-08 10:52:06 +000028093 if (test_ret != 0)
28094 printf("Module xmlerror: %d errors\n", test_ret);
28095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028096}
Daniel Veillardd93f6252004-11-02 15:53:51 +000028097
28098static int
28099test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028101
Daniel Veillard34099b42004-11-04 17:34:35 +000028102#ifdef LIBXML_READER_ENABLED
28103 int mem_base;
28104 xmlTextReaderPtr ret_val;
28105 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28106 int n_input;
28107 const char * URI; /* the URI information for the source if available */
28108 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028109
Daniel Veillard34099b42004-11-04 17:34:35 +000028110 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28111 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28112 mem_base = xmlMemBlocks();
28113 input = gen_xmlParserInputBufferPtr(n_input, 0);
28114 URI = gen_filepath(n_URI, 1);
28115
28116 ret_val = xmlNewTextReader(input, URI);
28117 desret_xmlTextReaderPtr(ret_val);
28118 call_tests++;
28119 des_xmlParserInputBufferPtr(n_input, input, 0);
28120 des_filepath(n_URI, URI, 1);
28121 xmlResetLastError();
28122 if (mem_base != xmlMemBlocks()) {
28123 printf("Leak of %d blocks found in xmlNewTextReader",
28124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028125 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028126 printf(" %d", n_input);
28127 printf(" %d", n_URI);
28128 printf("\n");
28129 }
28130 }
28131 }
28132#endif
28133
28134 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028135 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028136}
28137
28138
28139static int
28140test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028141 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028142
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028143#ifdef LIBXML_READER_ENABLED
28144 int mem_base;
28145 xmlTextReaderPtr ret_val;
28146 const char * URI; /* the URI of the resource to process */
28147 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028148
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028149 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28150 mem_base = xmlMemBlocks();
28151 URI = gen_filepath(n_URI, 0);
28152
28153 ret_val = xmlNewTextReaderFilename(URI);
28154 desret_xmlTextReaderPtr(ret_val);
28155 call_tests++;
28156 des_filepath(n_URI, URI, 0);
28157 xmlResetLastError();
28158 if (mem_base != xmlMemBlocks()) {
28159 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028161 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028162 printf(" %d", n_URI);
28163 printf("\n");
28164 }
28165 }
28166#endif
28167
28168 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028170}
28171
28172
28173static int
28174test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028176
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028177#ifdef LIBXML_READER_ENABLED
28178 int mem_base;
28179 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028180 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028181 int n_cur;
28182 const char * URL; /* the base URL to use for the document */
28183 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028184 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028185 int n_encoding;
28186 int options; /* a combination of xmlParserOption */
28187 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028188
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028189 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28190 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28191 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028192 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028193 mem_base = xmlMemBlocks();
28194 cur = gen_const_xmlChar_ptr(n_cur, 0);
28195 URL = gen_filepath(n_URL, 1);
28196 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028197 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028198
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028199 ret_val = xmlReaderForDoc(cur, URL, encoding, options);
28200 desret_xmlTextReaderPtr(ret_val);
28201 call_tests++;
28202 des_const_xmlChar_ptr(n_cur, cur, 0);
28203 des_filepath(n_URL, URL, 1);
28204 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028205 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028206 xmlResetLastError();
28207 if (mem_base != xmlMemBlocks()) {
28208 printf("Leak of %d blocks found in xmlReaderForDoc",
28209 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028210 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028211 printf(" %d", n_cur);
28212 printf(" %d", n_URL);
28213 printf(" %d", n_encoding);
28214 printf(" %d", n_options);
28215 printf("\n");
28216 }
28217 }
28218 }
28219 }
28220 }
28221#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028222
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028223 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028225}
28226
28227
28228static int
28229test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028231
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028232#ifdef LIBXML_READER_ENABLED
28233 int mem_base;
28234 xmlTextReaderPtr ret_val;
28235 const char * filename; /* a file or URL */
28236 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028237 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028238 int n_encoding;
28239 int options; /* a combination of xmlParserOption */
28240 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028241
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028242 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28243 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028244 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028245 mem_base = xmlMemBlocks();
28246 filename = gen_filepath(n_filename, 0);
28247 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028248 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028249
28250 ret_val = xmlReaderForFile(filename, encoding, options);
28251 desret_xmlTextReaderPtr(ret_val);
28252 call_tests++;
28253 des_filepath(n_filename, filename, 0);
28254 des_const_char_ptr(n_encoding, encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028255 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028256 xmlResetLastError();
28257 if (mem_base != xmlMemBlocks()) {
28258 printf("Leak of %d blocks found in xmlReaderForFile",
28259 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028260 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028261 printf(" %d", n_filename);
28262 printf(" %d", n_encoding);
28263 printf(" %d", n_options);
28264 printf("\n");
28265 }
28266 }
28267 }
28268 }
28269#endif
28270
28271 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028272 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028273}
28274
28275
28276static int
28277test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028278 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028279
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028280#ifdef LIBXML_READER_ENABLED
28281 int mem_base;
28282 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028283 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028284 int n_buffer;
28285 int size; /* the size of the array */
28286 int n_size;
28287 const char * URL; /* the base URL to use for the document */
28288 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028289 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028290 int n_encoding;
28291 int options; /* a combination of xmlParserOption */
28292 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028293
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028294 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28295 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28296 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28297 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028298 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028299 mem_base = xmlMemBlocks();
28300 buffer = gen_const_char_ptr(n_buffer, 0);
28301 size = gen_int(n_size, 1);
28302 URL = gen_filepath(n_URL, 2);
28303 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028304 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028305
28306 ret_val = xmlReaderForMemory(buffer, size, URL, encoding, options);
28307 desret_xmlTextReaderPtr(ret_val);
28308 call_tests++;
28309 des_const_char_ptr(n_buffer, buffer, 0);
28310 des_int(n_size, size, 1);
28311 des_filepath(n_URL, URL, 2);
28312 des_const_char_ptr(n_encoding, encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028313 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028314 xmlResetLastError();
28315 if (mem_base != xmlMemBlocks()) {
28316 printf("Leak of %d blocks found in xmlReaderForMemory",
28317 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028318 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028319 printf(" %d", n_buffer);
28320 printf(" %d", n_size);
28321 printf(" %d", n_URL);
28322 printf(" %d", n_encoding);
28323 printf(" %d", n_options);
28324 printf("\n");
28325 }
28326 }
28327 }
28328 }
28329 }
28330 }
28331#endif
28332
28333 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028335}
28336
28337
28338static int
28339test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028341
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028342#ifdef LIBXML_READER_ENABLED
28343 int mem_base;
28344 int ret_val;
28345 xmlTextReaderPtr reader; /* an XML reader */
28346 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028347 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028348 int n_cur;
28349 const char * URL; /* the base URL to use for the document */
28350 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028351 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028352 int n_encoding;
28353 int options; /* a combination of xmlParserOption */
28354 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028355
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028356 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28357 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28358 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28359 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028360 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028361 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028362 reader = gen_xmlTextReaderPtr(n_reader, 0);
28363 cur = gen_const_xmlChar_ptr(n_cur, 1);
28364 URL = gen_filepath(n_URL, 2);
28365 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028366 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028367
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028368 ret_val = xmlReaderNewDoc(reader, cur, URL, encoding, options);
28369 desret_int(ret_val);
28370 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028371 des_xmlTextReaderPtr(n_reader, reader, 0);
28372 des_const_xmlChar_ptr(n_cur, cur, 1);
28373 des_filepath(n_URL, URL, 2);
28374 des_const_char_ptr(n_encoding, encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028375 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028376 xmlResetLastError();
28377 if (mem_base != xmlMemBlocks()) {
28378 printf("Leak of %d blocks found in xmlReaderNewDoc",
28379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028380 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028381 printf(" %d", n_reader);
28382 printf(" %d", n_cur);
28383 printf(" %d", n_URL);
28384 printf(" %d", n_encoding);
28385 printf(" %d", n_options);
28386 printf("\n");
28387 }
28388 }
28389 }
28390 }
28391 }
28392 }
28393#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028394
Daniel Veillard3d97e662004-11-04 10:49:00 +000028395 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028397}
28398
28399
28400static int
28401test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028403
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028404#ifdef LIBXML_READER_ENABLED
28405 int mem_base;
28406 int ret_val;
28407 xmlTextReaderPtr reader; /* an XML reader */
28408 int n_reader;
28409 const char * filename; /* a file or URL */
28410 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028411 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028412 int n_encoding;
28413 int options; /* a combination of xmlParserOption */
28414 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028415
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028416 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28417 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28418 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028419 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028420 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028421 reader = gen_xmlTextReaderPtr(n_reader, 0);
28422 filename = gen_filepath(n_filename, 1);
28423 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028424 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028425
28426 ret_val = xmlReaderNewFile(reader, filename, encoding, options);
28427 desret_int(ret_val);
28428 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028429 des_xmlTextReaderPtr(n_reader, reader, 0);
28430 des_filepath(n_filename, filename, 1);
28431 des_const_char_ptr(n_encoding, encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028432 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028433 xmlResetLastError();
28434 if (mem_base != xmlMemBlocks()) {
28435 printf("Leak of %d blocks found in xmlReaderNewFile",
28436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028437 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028438 printf(" %d", n_reader);
28439 printf(" %d", n_filename);
28440 printf(" %d", n_encoding);
28441 printf(" %d", n_options);
28442 printf("\n");
28443 }
28444 }
28445 }
28446 }
28447 }
28448#endif
28449
Daniel Veillard3d97e662004-11-04 10:49:00 +000028450 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028452}
28453
28454
28455static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028456test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028458
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028459#ifdef LIBXML_READER_ENABLED
28460 int mem_base;
28461 int ret_val;
28462 xmlTextReaderPtr reader; /* an XML reader */
28463 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028464 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028465 int n_buffer;
28466 int size; /* the size of the array */
28467 int n_size;
28468 const char * URL; /* the base URL to use for the document */
28469 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028470 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028471 int n_encoding;
28472 int options; /* a combination of xmlParserOption */
28473 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028474
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028475 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28476 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28477 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28478 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28479 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028480 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028481 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028482 reader = gen_xmlTextReaderPtr(n_reader, 0);
28483 buffer = gen_const_char_ptr(n_buffer, 1);
28484 size = gen_int(n_size, 2);
28485 URL = gen_filepath(n_URL, 3);
28486 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028487 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028488
28489 ret_val = xmlReaderNewMemory(reader, buffer, size, URL, encoding, options);
28490 desret_int(ret_val);
28491 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028492 des_xmlTextReaderPtr(n_reader, reader, 0);
28493 des_const_char_ptr(n_buffer, buffer, 1);
28494 des_int(n_size, size, 2);
28495 des_filepath(n_URL, URL, 3);
28496 des_const_char_ptr(n_encoding, encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028497 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028498 xmlResetLastError();
28499 if (mem_base != xmlMemBlocks()) {
28500 printf("Leak of %d blocks found in xmlReaderNewMemory",
28501 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028502 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028503 printf(" %d", n_reader);
28504 printf(" %d", n_buffer);
28505 printf(" %d", n_size);
28506 printf(" %d", n_URL);
28507 printf(" %d", n_encoding);
28508 printf(" %d", n_options);
28509 printf("\n");
28510 }
28511 }
28512 }
28513 }
28514 }
28515 }
28516 }
28517#endif
28518
Daniel Veillard3d97e662004-11-04 10:49:00 +000028519 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028520 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028521}
28522
28523
28524static int
28525test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028526 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028527
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028528#ifdef LIBXML_READER_ENABLED
28529 int mem_base;
28530 int ret_val;
28531 xmlTextReaderPtr reader; /* an XML reader */
28532 int n_reader;
28533 xmlDocPtr doc; /* a preparsed document */
28534 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028535
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028536 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28537 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28538 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028539 reader = gen_xmlTextReaderPtr(n_reader, 0);
28540 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028541
28542 ret_val = xmlReaderNewWalker(reader, doc);
28543 desret_int(ret_val);
28544 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028545 des_xmlTextReaderPtr(n_reader, reader, 0);
28546 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028547 xmlResetLastError();
28548 if (mem_base != xmlMemBlocks()) {
28549 printf("Leak of %d blocks found in xmlReaderNewWalker",
28550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028551 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028552 printf(" %d", n_reader);
28553 printf(" %d", n_doc);
28554 printf("\n");
28555 }
28556 }
28557 }
28558#endif
28559
Daniel Veillard3d97e662004-11-04 10:49:00 +000028560 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028562}
28563
28564
28565static int
28566test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028568
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028569#ifdef LIBXML_READER_ENABLED
28570 int mem_base;
28571 xmlTextReaderPtr ret_val;
28572 xmlDocPtr doc; /* a preparsed document */
28573 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028574
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028575 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28576 mem_base = xmlMemBlocks();
28577 doc = gen_xmlDocPtr(n_doc, 0);
28578
28579 ret_val = xmlReaderWalker(doc);
28580 desret_xmlTextReaderPtr(ret_val);
28581 call_tests++;
28582 des_xmlDocPtr(n_doc, doc, 0);
28583 xmlResetLastError();
28584 if (mem_base != xmlMemBlocks()) {
28585 printf("Leak of %d blocks found in xmlReaderWalker",
28586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028587 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028588 printf(" %d", n_doc);
28589 printf("\n");
28590 }
28591 }
28592#endif
28593
28594 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028596}
28597
28598
28599static int
28600test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028602
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028603#ifdef LIBXML_READER_ENABLED
28604 int mem_base;
28605 int ret_val;
28606 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28607 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028608
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028609 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28610 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028611 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028612
28613 ret_val = xmlTextReaderAttributeCount(reader);
28614 desret_int(ret_val);
28615 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028616 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028617 xmlResetLastError();
28618 if (mem_base != xmlMemBlocks()) {
28619 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
28620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028621 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028622 printf(" %d", n_reader);
28623 printf("\n");
28624 }
28625 }
28626#endif
28627
Daniel Veillard3d97e662004-11-04 10:49:00 +000028628 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028630}
28631
28632
28633static int
28634test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028636
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028637#ifdef LIBXML_READER_ENABLED
28638 int mem_base;
28639 xmlChar * ret_val;
28640 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28641 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028642
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028643 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28644 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028645 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028646
28647 ret_val = xmlTextReaderBaseUri(reader);
28648 desret_xmlChar_ptr(ret_val);
28649 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028650 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028651 xmlResetLastError();
28652 if (mem_base != xmlMemBlocks()) {
28653 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
28654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028655 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028656 printf(" %d", n_reader);
28657 printf("\n");
28658 }
28659 }
28660#endif
28661
Daniel Veillard3d97e662004-11-04 10:49:00 +000028662 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028664}
28665
28666
28667static int
28668test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028670
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028671#ifdef LIBXML_READER_ENABLED
28672 int mem_base;
28673 int ret_val;
28674 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28675 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028676
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028677 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28678 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028679 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028680
28681 ret_val = xmlTextReaderClose(reader);
28682 desret_int(ret_val);
28683 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028684 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028685 xmlResetLastError();
28686 if (mem_base != xmlMemBlocks()) {
28687 printf("Leak of %d blocks found in xmlTextReaderClose",
28688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028689 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028690 printf(" %d", n_reader);
28691 printf("\n");
28692 }
28693 }
28694#endif
28695
Daniel Veillard3d97e662004-11-04 10:49:00 +000028696 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028698}
28699
28700
28701static int
28702test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028704
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028705#ifdef LIBXML_READER_ENABLED
28706 int mem_base;
28707 const xmlChar * ret_val;
28708 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28709 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028710
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028711 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28712 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028713 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028714
28715 ret_val = xmlTextReaderConstBaseUri(reader);
28716 desret_const_xmlChar_ptr(ret_val);
28717 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028718 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028719 xmlResetLastError();
28720 if (mem_base != xmlMemBlocks()) {
28721 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
28722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028723 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028724 printf(" %d", n_reader);
28725 printf("\n");
28726 }
28727 }
28728#endif
28729
Daniel Veillard3d97e662004-11-04 10:49:00 +000028730 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028732}
28733
28734
28735static int
28736test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028738
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028739#ifdef LIBXML_READER_ENABLED
28740 int mem_base;
28741 const xmlChar * ret_val;
28742 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28743 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028744
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028745 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28746 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028747 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028748
28749 ret_val = xmlTextReaderConstEncoding(reader);
28750 desret_const_xmlChar_ptr(ret_val);
28751 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028752 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028753 xmlResetLastError();
28754 if (mem_base != xmlMemBlocks()) {
28755 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
28756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028757 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028758 printf(" %d", n_reader);
28759 printf("\n");
28760 }
28761 }
28762#endif
28763
Daniel Veillard3d97e662004-11-04 10:49:00 +000028764 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028766}
28767
28768
28769static int
28770test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028772
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028773#ifdef LIBXML_READER_ENABLED
28774 int mem_base;
28775 const xmlChar * ret_val;
28776 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28777 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028778
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028779 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28780 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028781 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028782
28783 ret_val = xmlTextReaderConstLocalName(reader);
28784 desret_const_xmlChar_ptr(ret_val);
28785 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028786 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028787 xmlResetLastError();
28788 if (mem_base != xmlMemBlocks()) {
28789 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
28790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028791 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028792 printf(" %d", n_reader);
28793 printf("\n");
28794 }
28795 }
28796#endif
28797
Daniel Veillard3d97e662004-11-04 10:49:00 +000028798 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028800}
28801
28802
28803static int
28804test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028806
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028807#ifdef LIBXML_READER_ENABLED
28808 int mem_base;
28809 const xmlChar * ret_val;
28810 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28811 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028812
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028813 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28814 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028815 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028816
28817 ret_val = xmlTextReaderConstName(reader);
28818 desret_const_xmlChar_ptr(ret_val);
28819 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028820 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028821 xmlResetLastError();
28822 if (mem_base != xmlMemBlocks()) {
28823 printf("Leak of %d blocks found in xmlTextReaderConstName",
28824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028825 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028826 printf(" %d", n_reader);
28827 printf("\n");
28828 }
28829 }
28830#endif
28831
Daniel Veillard3d97e662004-11-04 10:49:00 +000028832 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028834}
28835
28836
28837static int
28838test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028840
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028841#ifdef LIBXML_READER_ENABLED
28842 int mem_base;
28843 const xmlChar * ret_val;
28844 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28845 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028846
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028847 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28848 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028849 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028850
28851 ret_val = xmlTextReaderConstNamespaceUri(reader);
28852 desret_const_xmlChar_ptr(ret_val);
28853 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028854 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028855 xmlResetLastError();
28856 if (mem_base != xmlMemBlocks()) {
28857 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
28858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028859 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028860 printf(" %d", n_reader);
28861 printf("\n");
28862 }
28863 }
28864#endif
28865
Daniel Veillard3d97e662004-11-04 10:49:00 +000028866 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028867 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028868}
28869
28870
28871static int
28872test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028873 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028874
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028875#ifdef LIBXML_READER_ENABLED
28876 int mem_base;
28877 const xmlChar * ret_val;
28878 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28879 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028880
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028881 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28882 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028883 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028884
28885 ret_val = xmlTextReaderConstPrefix(reader);
28886 desret_const_xmlChar_ptr(ret_val);
28887 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028888 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028889 xmlResetLastError();
28890 if (mem_base != xmlMemBlocks()) {
28891 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
28892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028893 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028894 printf(" %d", n_reader);
28895 printf("\n");
28896 }
28897 }
28898#endif
28899
Daniel Veillard3d97e662004-11-04 10:49:00 +000028900 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028902}
28903
28904
28905static int
28906test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028908
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028909#ifdef LIBXML_READER_ENABLED
28910 int mem_base;
28911 const xmlChar * ret_val;
28912 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28913 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028914 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028915 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028916
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028917 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28918 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
28919 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028920 reader = gen_xmlTextReaderPtr(n_reader, 0);
28921 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028922
28923 ret_val = xmlTextReaderConstString(reader, str);
28924 desret_const_xmlChar_ptr(ret_val);
28925 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028926 des_xmlTextReaderPtr(n_reader, reader, 0);
28927 des_const_xmlChar_ptr(n_str, str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028928 xmlResetLastError();
28929 if (mem_base != xmlMemBlocks()) {
28930 printf("Leak of %d blocks found in xmlTextReaderConstString",
28931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028932 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028933 printf(" %d", n_reader);
28934 printf(" %d", n_str);
28935 printf("\n");
28936 }
28937 }
28938 }
28939#endif
28940
Daniel Veillard3d97e662004-11-04 10:49:00 +000028941 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028942 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028943}
28944
28945
28946static int
28947test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028948 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028949
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028950#ifdef LIBXML_READER_ENABLED
28951 int mem_base;
28952 const xmlChar * ret_val;
28953 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28954 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028955
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028956 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28957 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028958 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028959
28960 ret_val = xmlTextReaderConstValue(reader);
28961 desret_const_xmlChar_ptr(ret_val);
28962 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028963 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028964 xmlResetLastError();
28965 if (mem_base != xmlMemBlocks()) {
28966 printf("Leak of %d blocks found in xmlTextReaderConstValue",
28967 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028968 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028969 printf(" %d", n_reader);
28970 printf("\n");
28971 }
28972 }
28973#endif
28974
Daniel Veillard3d97e662004-11-04 10:49:00 +000028975 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000028976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028977}
28978
28979
28980static int
28981test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028983
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028984#ifdef LIBXML_READER_ENABLED
28985 int mem_base;
28986 const xmlChar * ret_val;
28987 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28988 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028989
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028990 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28991 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028992 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028993
28994 ret_val = xmlTextReaderConstXmlLang(reader);
28995 desret_const_xmlChar_ptr(ret_val);
28996 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028997 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028998 xmlResetLastError();
28999 if (mem_base != xmlMemBlocks()) {
29000 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29001 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029002 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029003 printf(" %d", n_reader);
29004 printf("\n");
29005 }
29006 }
29007#endif
29008
Daniel Veillard3d97e662004-11-04 10:49:00 +000029009 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029011}
29012
29013
29014static int
29015test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029016 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029017
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029018#ifdef LIBXML_READER_ENABLED
29019 int mem_base;
29020 const xmlChar * ret_val;
29021 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29022 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029023
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029024 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29025 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029026 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029027
29028 ret_val = xmlTextReaderConstXmlVersion(reader);
29029 desret_const_xmlChar_ptr(ret_val);
29030 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029031 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029032 xmlResetLastError();
29033 if (mem_base != xmlMemBlocks()) {
29034 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029036 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029037 printf(" %d", n_reader);
29038 printf("\n");
29039 }
29040 }
29041#endif
29042
Daniel Veillard3d97e662004-11-04 10:49:00 +000029043 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029044 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029045}
29046
29047
29048static int
29049test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029050 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029051
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029052#ifdef LIBXML_READER_ENABLED
29053 int mem_base;
29054 xmlDocPtr ret_val;
29055 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29056 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029057
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029058 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29059 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029060 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029061
29062 ret_val = xmlTextReaderCurrentDoc(reader);
29063 desret_xmlDocPtr(ret_val);
29064 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029065 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029066 xmlResetLastError();
29067 if (mem_base != xmlMemBlocks()) {
29068 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029070 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029071 printf(" %d", n_reader);
29072 printf("\n");
29073 }
29074 }
29075#endif
29076
Daniel Veillard3d97e662004-11-04 10:49:00 +000029077 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029079}
29080
29081
29082static int
29083test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029085
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029086#ifdef LIBXML_READER_ENABLED
29087 int mem_base;
29088 xmlNodePtr ret_val;
29089 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29090 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029091
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029092 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29093 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029094 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029095
29096 ret_val = xmlTextReaderCurrentNode(reader);
29097 desret_xmlNodePtr(ret_val);
29098 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029099 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029100 xmlResetLastError();
29101 if (mem_base != xmlMemBlocks()) {
29102 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29103 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029104 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029105 printf(" %d", n_reader);
29106 printf("\n");
29107 }
29108 }
29109#endif
29110
Daniel Veillard3d97e662004-11-04 10:49:00 +000029111 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029113}
29114
29115
29116static int
29117test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029119
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029120#ifdef LIBXML_READER_ENABLED
29121 int mem_base;
29122 int ret_val;
29123 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29124 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029125
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029126 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29127 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029128 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029129
29130 ret_val = xmlTextReaderDepth(reader);
29131 desret_int(ret_val);
29132 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029133 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029134 xmlResetLastError();
29135 if (mem_base != xmlMemBlocks()) {
29136 printf("Leak of %d blocks found in xmlTextReaderDepth",
29137 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029138 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029139 printf(" %d", n_reader);
29140 printf("\n");
29141 }
29142 }
29143#endif
29144
Daniel Veillard3d97e662004-11-04 10:49:00 +000029145 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029146 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029147}
29148
29149
29150static int
29151test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029152 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029153
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029154#ifdef LIBXML_READER_ENABLED
29155 int mem_base;
29156 xmlNodePtr ret_val;
29157 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29158 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029159
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029160 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29161 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029162 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029163
29164 ret_val = xmlTextReaderExpand(reader);
29165 desret_xmlNodePtr(ret_val);
29166 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029167 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029168 xmlResetLastError();
29169 if (mem_base != xmlMemBlocks()) {
29170 printf("Leak of %d blocks found in xmlTextReaderExpand",
29171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029172 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029173 printf(" %d", n_reader);
29174 printf("\n");
29175 }
29176 }
29177#endif
29178
Daniel Veillard3d97e662004-11-04 10:49:00 +000029179 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029181}
29182
29183
29184static int
29185test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029187
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029188#ifdef LIBXML_READER_ENABLED
29189 int mem_base;
29190 xmlChar * ret_val;
29191 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29192 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029193 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029194 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029195
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029196 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29197 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29198 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029199 reader = gen_xmlTextReaderPtr(n_reader, 0);
29200 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029201
29202 ret_val = xmlTextReaderGetAttribute(reader, name);
29203 desret_xmlChar_ptr(ret_val);
29204 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029205 des_xmlTextReaderPtr(n_reader, reader, 0);
29206 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029207 xmlResetLastError();
29208 if (mem_base != xmlMemBlocks()) {
29209 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029211 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029212 printf(" %d", n_reader);
29213 printf(" %d", n_name);
29214 printf("\n");
29215 }
29216 }
29217 }
29218#endif
29219
Daniel Veillard3d97e662004-11-04 10:49:00 +000029220 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029221 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029222}
29223
29224
29225static int
29226test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029227 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029228
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029229#ifdef LIBXML_READER_ENABLED
29230 int mem_base;
29231 xmlChar * ret_val;
29232 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29233 int n_reader;
29234 int no; /* the zero-based index of the attribute relative to the containing element */
29235 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029236
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029237 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29238 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29239 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029240 reader = gen_xmlTextReaderPtr(n_reader, 0);
29241 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029242
29243 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29244 desret_xmlChar_ptr(ret_val);
29245 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029246 des_xmlTextReaderPtr(n_reader, reader, 0);
29247 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029248 xmlResetLastError();
29249 if (mem_base != xmlMemBlocks()) {
29250 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29251 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029252 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029253 printf(" %d", n_reader);
29254 printf(" %d", n_no);
29255 printf("\n");
29256 }
29257 }
29258 }
29259#endif
29260
Daniel Veillard3d97e662004-11-04 10:49:00 +000029261 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029263}
29264
29265
29266static int
29267test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029269
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029270#ifdef LIBXML_READER_ENABLED
29271 int mem_base;
29272 xmlChar * ret_val;
29273 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29274 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029275 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029276 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029277 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029278 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029279
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029280 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29281 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29282 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29283 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029284 reader = gen_xmlTextReaderPtr(n_reader, 0);
29285 localName = gen_const_xmlChar_ptr(n_localName, 1);
29286 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029287
29288 ret_val = xmlTextReaderGetAttributeNs(reader, localName, namespaceURI);
29289 desret_xmlChar_ptr(ret_val);
29290 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029291 des_xmlTextReaderPtr(n_reader, reader, 0);
29292 des_const_xmlChar_ptr(n_localName, localName, 1);
29293 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029294 xmlResetLastError();
29295 if (mem_base != xmlMemBlocks()) {
29296 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29297 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029298 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029299 printf(" %d", n_reader);
29300 printf(" %d", n_localName);
29301 printf(" %d", n_namespaceURI);
29302 printf("\n");
29303 }
29304 }
29305 }
29306 }
29307#endif
29308
Daniel Veillard3d97e662004-11-04 10:49:00 +000029309 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029310 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029311}
29312
29313
Daniel Veillardce682bc2004-11-05 17:22:25 +000029314#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29315static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29316 return(NULL);
29317}
29318static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29319}
29320
Daniel Veillardd93f6252004-11-02 15:53:51 +000029321static int
29322test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029324
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029325#ifdef LIBXML_READER_ENABLED
29326 int mem_base;
29327 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29328 int n_reader;
29329 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29330 int n_f;
29331 void ** arg; /* a user argument */
29332 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029333
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029334 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29335 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29336 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29337 mem_base = xmlMemBlocks();
29338 reader = gen_xmlTextReaderPtr(n_reader, 0);
29339 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29340 arg = gen_void_ptr_ptr(n_arg, 2);
29341
29342 xmlTextReaderGetErrorHandler(reader, f, arg);
29343 call_tests++;
29344 des_xmlTextReaderPtr(n_reader, reader, 0);
29345 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29346 des_void_ptr_ptr(n_arg, arg, 2);
29347 xmlResetLastError();
29348 if (mem_base != xmlMemBlocks()) {
29349 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29350 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029351 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029352 printf(" %d", n_reader);
29353 printf(" %d", n_f);
29354 printf(" %d", n_arg);
29355 printf("\n");
29356 }
29357 }
29358 }
29359 }
29360#endif
29361
29362 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029364}
29365
29366
29367static int
29368test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029370
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029371#ifdef LIBXML_READER_ENABLED
29372 int mem_base;
29373 int ret_val;
29374 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29375 int n_reader;
29376 int prop; /* the xmlParserProperties to get */
29377 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029378
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029379 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29380 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29381 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029382 reader = gen_xmlTextReaderPtr(n_reader, 0);
29383 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029384
29385 ret_val = xmlTextReaderGetParserProp(reader, prop);
29386 desret_int(ret_val);
29387 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029388 des_xmlTextReaderPtr(n_reader, reader, 0);
29389 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029390 xmlResetLastError();
29391 if (mem_base != xmlMemBlocks()) {
29392 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
29393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029394 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029395 printf(" %d", n_reader);
29396 printf(" %d", n_prop);
29397 printf("\n");
29398 }
29399 }
29400 }
29401#endif
29402
Daniel Veillard3d97e662004-11-04 10:49:00 +000029403 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029405}
29406
29407
29408static int
29409test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029411
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029412#ifdef LIBXML_READER_ENABLED
29413 int mem_base;
29414 xmlParserInputBufferPtr ret_val;
29415 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29416 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029417
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029418 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29419 mem_base = xmlMemBlocks();
29420 reader = gen_xmlTextReaderPtr(n_reader, 0);
29421
29422 ret_val = xmlTextReaderGetRemainder(reader);
29423 desret_xmlParserInputBufferPtr(ret_val);
29424 call_tests++;
29425 des_xmlTextReaderPtr(n_reader, reader, 0);
29426 xmlResetLastError();
29427 if (mem_base != xmlMemBlocks()) {
29428 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
29429 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029430 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029431 printf(" %d", n_reader);
29432 printf("\n");
29433 }
29434 }
29435#endif
29436
29437 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029438 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029439}
29440
29441
29442static int
29443test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029444 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029445
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029446#ifdef LIBXML_READER_ENABLED
29447 int mem_base;
29448 int ret_val;
29449 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29450 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029451
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029452 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29453 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029454 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029455
29456 ret_val = xmlTextReaderHasAttributes(reader);
29457 desret_int(ret_val);
29458 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029459 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029460 xmlResetLastError();
29461 if (mem_base != xmlMemBlocks()) {
29462 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
29463 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029464 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029465 printf(" %d", n_reader);
29466 printf("\n");
29467 }
29468 }
29469#endif
29470
Daniel Veillard3d97e662004-11-04 10:49:00 +000029471 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029472 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029473}
29474
29475
29476static int
29477test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029478 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029479
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029480#ifdef LIBXML_READER_ENABLED
29481 int mem_base;
29482 int ret_val;
29483 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29484 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029485
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029486 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29487 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029488 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029489
29490 ret_val = xmlTextReaderHasValue(reader);
29491 desret_int(ret_val);
29492 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029493 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029494 xmlResetLastError();
29495 if (mem_base != xmlMemBlocks()) {
29496 printf("Leak of %d blocks found in xmlTextReaderHasValue",
29497 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029498 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029499 printf(" %d", n_reader);
29500 printf("\n");
29501 }
29502 }
29503#endif
29504
Daniel Veillard3d97e662004-11-04 10:49:00 +000029505 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029507}
29508
29509
29510static int
29511test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029513
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029514#ifdef LIBXML_READER_ENABLED
29515 int mem_base;
29516 int ret_val;
29517 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29518 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029519
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029520 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29521 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029522 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029523
29524 ret_val = xmlTextReaderIsDefault(reader);
29525 desret_int(ret_val);
29526 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029527 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029528 xmlResetLastError();
29529 if (mem_base != xmlMemBlocks()) {
29530 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
29531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029532 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029533 printf(" %d", n_reader);
29534 printf("\n");
29535 }
29536 }
29537#endif
29538
Daniel Veillard3d97e662004-11-04 10:49:00 +000029539 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029541}
29542
29543
29544static int
29545test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029547
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029548#ifdef LIBXML_READER_ENABLED
29549 int mem_base;
29550 int ret_val;
29551 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29552 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029553
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029554 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29555 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029556 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029557
29558 ret_val = xmlTextReaderIsEmptyElement(reader);
29559 desret_int(ret_val);
29560 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029561 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029562 xmlResetLastError();
29563 if (mem_base != xmlMemBlocks()) {
29564 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
29565 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029566 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029567 printf(" %d", n_reader);
29568 printf("\n");
29569 }
29570 }
29571#endif
29572
Daniel Veillard3d97e662004-11-04 10:49:00 +000029573 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029575}
29576
29577
29578static int
29579test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029580 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029581
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029582#ifdef LIBXML_READER_ENABLED
29583 int mem_base;
29584 int ret_val;
29585 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29586 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029587
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029588 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29589 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029590 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029591
29592 ret_val = xmlTextReaderIsNamespaceDecl(reader);
29593 desret_int(ret_val);
29594 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029595 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029596 xmlResetLastError();
29597 if (mem_base != xmlMemBlocks()) {
29598 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
29599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029600 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029601 printf(" %d", n_reader);
29602 printf("\n");
29603 }
29604 }
29605#endif
29606
Daniel Veillard3d97e662004-11-04 10:49:00 +000029607 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029609}
29610
29611
29612static int
29613test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029614 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029615
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029616#ifdef LIBXML_READER_ENABLED
29617 int mem_base;
29618 int ret_val;
29619 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29620 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029621
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029622 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29623 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029624 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029625
29626 ret_val = xmlTextReaderIsValid(reader);
29627 desret_int(ret_val);
29628 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029629 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029630 xmlResetLastError();
29631 if (mem_base != xmlMemBlocks()) {
29632 printf("Leak of %d blocks found in xmlTextReaderIsValid",
29633 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029634 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029635 printf(" %d", n_reader);
29636 printf("\n");
29637 }
29638 }
29639#endif
29640
Daniel Veillard3d97e662004-11-04 10:49:00 +000029641 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029643}
29644
29645
29646static int
29647test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029649
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029650#ifdef LIBXML_READER_ENABLED
29651 int mem_base;
29652 xmlChar * ret_val;
29653 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29654 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029655
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029656 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29657 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029658 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029659
29660 ret_val = xmlTextReaderLocalName(reader);
29661 desret_xmlChar_ptr(ret_val);
29662 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029663 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029664 xmlResetLastError();
29665 if (mem_base != xmlMemBlocks()) {
29666 printf("Leak of %d blocks found in xmlTextReaderLocalName",
29667 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029668 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029669 printf(" %d", n_reader);
29670 printf("\n");
29671 }
29672 }
29673#endif
29674
Daniel Veillard3d97e662004-11-04 10:49:00 +000029675 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029677}
29678
29679
Daniel Veillardce682bc2004-11-05 17:22:25 +000029680#define gen_nb_xmlTextReaderLocatorPtr 1
29681static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29682 return(NULL);
29683}
29684static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29685}
29686
Daniel Veillardd93f6252004-11-02 15:53:51 +000029687static int
29688test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029689 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029690
Daniel Veillardce682bc2004-11-05 17:22:25 +000029691#ifdef LIBXML_READER_ENABLED
29692 int mem_base;
29693 xmlChar * ret_val;
29694 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
29695 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029696
Daniel Veillardce682bc2004-11-05 17:22:25 +000029697 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
29698 mem_base = xmlMemBlocks();
29699 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
29700
29701 ret_val = xmlTextReaderLocatorBaseURI(locator);
29702 desret_xmlChar_ptr(ret_val);
29703 call_tests++;
29704 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
29705 xmlResetLastError();
29706 if (mem_base != xmlMemBlocks()) {
29707 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
29708 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029709 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029710 printf(" %d", n_locator);
29711 printf("\n");
29712 }
29713 }
29714#endif
29715
29716 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029717 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029718}
29719
29720
29721static int
29722test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029723 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029724
Daniel Veillardce682bc2004-11-05 17:22:25 +000029725#ifdef LIBXML_READER_ENABLED
29726 int mem_base;
29727 int ret_val;
29728 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
29729 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029730
Daniel Veillardce682bc2004-11-05 17:22:25 +000029731 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
29732 mem_base = xmlMemBlocks();
29733 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
29734
29735 ret_val = xmlTextReaderLocatorLineNumber(locator);
29736 desret_int(ret_val);
29737 call_tests++;
29738 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
29739 xmlResetLastError();
29740 if (mem_base != xmlMemBlocks()) {
29741 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
29742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029743 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029744 printf(" %d", n_locator);
29745 printf("\n");
29746 }
29747 }
29748#endif
29749
29750 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029751 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029752}
29753
29754
29755static int
29756test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029757 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029758
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029759#ifdef LIBXML_READER_ENABLED
29760 int mem_base;
29761 xmlChar * ret_val;
29762 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29763 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029764 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 +000029765 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029766
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029767 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29768 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
29769 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029770 reader = gen_xmlTextReaderPtr(n_reader, 0);
29771 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029772
29773 ret_val = xmlTextReaderLookupNamespace(reader, prefix);
29774 desret_xmlChar_ptr(ret_val);
29775 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029776 des_xmlTextReaderPtr(n_reader, reader, 0);
29777 des_const_xmlChar_ptr(n_prefix, prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029778 xmlResetLastError();
29779 if (mem_base != xmlMemBlocks()) {
29780 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
29781 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029782 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029783 printf(" %d", n_reader);
29784 printf(" %d", n_prefix);
29785 printf("\n");
29786 }
29787 }
29788 }
29789#endif
29790
Daniel Veillard3d97e662004-11-04 10:49:00 +000029791 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029792 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029793}
29794
29795
29796static int
29797test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029798 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029799
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029800#ifdef LIBXML_READER_ENABLED
29801 int mem_base;
29802 int ret_val;
29803 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29804 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029805 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029806 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029807
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029808 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29809 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29810 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029811 reader = gen_xmlTextReaderPtr(n_reader, 0);
29812 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029813
29814 ret_val = xmlTextReaderMoveToAttribute(reader, name);
29815 desret_int(ret_val);
29816 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029817 des_xmlTextReaderPtr(n_reader, reader, 0);
29818 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029819 xmlResetLastError();
29820 if (mem_base != xmlMemBlocks()) {
29821 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
29822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029823 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029824 printf(" %d", n_reader);
29825 printf(" %d", n_name);
29826 printf("\n");
29827 }
29828 }
29829 }
29830#endif
29831
Daniel Veillard3d97e662004-11-04 10:49:00 +000029832 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029834}
29835
29836
29837static int
29838test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029840
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029841#ifdef LIBXML_READER_ENABLED
29842 int mem_base;
29843 int ret_val;
29844 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29845 int n_reader;
29846 int no; /* the zero-based index of the attribute relative to the containing element. */
29847 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029848
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029849 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29850 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29851 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029852 reader = gen_xmlTextReaderPtr(n_reader, 0);
29853 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029854
29855 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
29856 desret_int(ret_val);
29857 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029858 des_xmlTextReaderPtr(n_reader, reader, 0);
29859 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029860 xmlResetLastError();
29861 if (mem_base != xmlMemBlocks()) {
29862 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
29863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029864 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029865 printf(" %d", n_reader);
29866 printf(" %d", n_no);
29867 printf("\n");
29868 }
29869 }
29870 }
29871#endif
29872
Daniel Veillard3d97e662004-11-04 10:49:00 +000029873 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029874 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029875}
29876
29877
29878static int
29879test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029880 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029881
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029882#ifdef LIBXML_READER_ENABLED
29883 int mem_base;
29884 int ret_val;
29885 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29886 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029887 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029888 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029889 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029890 int n_namespaceURI;
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 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29894 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29895 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029896 reader = gen_xmlTextReaderPtr(n_reader, 0);
29897 localName = gen_const_xmlChar_ptr(n_localName, 1);
29898 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029899
29900 ret_val = xmlTextReaderMoveToAttributeNs(reader, localName, namespaceURI);
29901 desret_int(ret_val);
29902 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029903 des_xmlTextReaderPtr(n_reader, reader, 0);
29904 des_const_xmlChar_ptr(n_localName, localName, 1);
29905 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029906 xmlResetLastError();
29907 if (mem_base != xmlMemBlocks()) {
29908 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
29909 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029910 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029911 printf(" %d", n_reader);
29912 printf(" %d", n_localName);
29913 printf(" %d", n_namespaceURI);
29914 printf("\n");
29915 }
29916 }
29917 }
29918 }
29919#endif
29920
Daniel Veillard3d97e662004-11-04 10:49:00 +000029921 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029922 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029923}
29924
29925
29926static int
29927test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029928 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029929
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029930#ifdef LIBXML_READER_ENABLED
29931 int mem_base;
29932 int ret_val;
29933 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29934 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029935
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029936 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29937 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029938 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029939
29940 ret_val = xmlTextReaderMoveToElement(reader);
29941 desret_int(ret_val);
29942 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029943 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029944 xmlResetLastError();
29945 if (mem_base != xmlMemBlocks()) {
29946 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
29947 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029948 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029949 printf(" %d", n_reader);
29950 printf("\n");
29951 }
29952 }
29953#endif
29954
Daniel Veillard3d97e662004-11-04 10:49:00 +000029955 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029956 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029957}
29958
29959
29960static int
29961test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029962 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029963
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029964#ifdef LIBXML_READER_ENABLED
29965 int mem_base;
29966 int ret_val;
29967 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29968 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029969
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029970 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29971 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029972 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029973
29974 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
29975 desret_int(ret_val);
29976 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029977 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029978 xmlResetLastError();
29979 if (mem_base != xmlMemBlocks()) {
29980 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
29981 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029982 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029983 printf(" %d", n_reader);
29984 printf("\n");
29985 }
29986 }
29987#endif
29988
Daniel Veillard3d97e662004-11-04 10:49:00 +000029989 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000029990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029991}
29992
29993
29994static int
29995test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029997
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029998#ifdef LIBXML_READER_ENABLED
29999 int mem_base;
30000 int ret_val;
30001 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30002 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030003
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030004 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30005 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030006 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030007
30008 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30009 desret_int(ret_val);
30010 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030011 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030012 xmlResetLastError();
30013 if (mem_base != xmlMemBlocks()) {
30014 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030016 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030017 printf(" %d", n_reader);
30018 printf("\n");
30019 }
30020 }
30021#endif
30022
Daniel Veillard3d97e662004-11-04 10:49:00 +000030023 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030025}
30026
30027
30028static int
30029test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030031
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030032#ifdef LIBXML_READER_ENABLED
30033 int mem_base;
30034 xmlChar * ret_val;
30035 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30036 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030037
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030038 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30039 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030040 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030041
30042 ret_val = xmlTextReaderName(reader);
30043 desret_xmlChar_ptr(ret_val);
30044 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030045 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030046 xmlResetLastError();
30047 if (mem_base != xmlMemBlocks()) {
30048 printf("Leak of %d blocks found in xmlTextReaderName",
30049 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030050 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030051 printf(" %d", n_reader);
30052 printf("\n");
30053 }
30054 }
30055#endif
30056
Daniel Veillard3d97e662004-11-04 10:49:00 +000030057 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030058 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030059}
30060
30061
30062static int
30063test_xmlTextReaderNamespaceUri(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 Veillardd93f6252004-11-02 15:53:51 +000030071
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030072 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30073 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030074 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030075
30076 ret_val = xmlTextReaderNamespaceUri(reader);
30077 desret_xmlChar_ptr(ret_val);
30078 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030079 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030080 xmlResetLastError();
30081 if (mem_base != xmlMemBlocks()) {
30082 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30083 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030084 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030085 printf(" %d", n_reader);
30086 printf("\n");
30087 }
30088 }
30089#endif
30090
Daniel Veillard3d97e662004-11-04 10:49:00 +000030091 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030093}
30094
30095
30096static int
30097test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030099
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030100#ifdef LIBXML_READER_ENABLED
30101 int mem_base;
30102 int ret_val;
30103 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30104 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030105
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030106 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30107 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030108 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030109
30110 ret_val = xmlTextReaderNext(reader);
30111 desret_int(ret_val);
30112 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030113 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030114 xmlResetLastError();
30115 if (mem_base != xmlMemBlocks()) {
30116 printf("Leak of %d blocks found in xmlTextReaderNext",
30117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030118 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030119 printf(" %d", n_reader);
30120 printf("\n");
30121 }
30122 }
30123#endif
30124
Daniel Veillard3d97e662004-11-04 10:49:00 +000030125 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030127}
30128
30129
30130static int
30131test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030133
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030134#ifdef LIBXML_READER_ENABLED
30135 int mem_base;
30136 int ret_val;
30137 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30138 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030139
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030140 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30141 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030142 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030143
30144 ret_val = xmlTextReaderNextSibling(reader);
30145 desret_int(ret_val);
30146 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030147 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030148 xmlResetLastError();
30149 if (mem_base != xmlMemBlocks()) {
30150 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30151 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030152 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030153 printf(" %d", n_reader);
30154 printf("\n");
30155 }
30156 }
30157#endif
30158
Daniel Veillard3d97e662004-11-04 10:49:00 +000030159 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030160 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030161}
30162
30163
30164static int
30165test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030166 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030167
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030168#ifdef LIBXML_READER_ENABLED
30169 int mem_base;
30170 int ret_val;
30171 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30172 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030173
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030174 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30175 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030176 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030177
30178 ret_val = xmlTextReaderNodeType(reader);
30179 desret_int(ret_val);
30180 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030181 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030182 xmlResetLastError();
30183 if (mem_base != xmlMemBlocks()) {
30184 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30185 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030186 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030187 printf(" %d", n_reader);
30188 printf("\n");
30189 }
30190 }
30191#endif
30192
Daniel Veillard3d97e662004-11-04 10:49:00 +000030193 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030195}
30196
30197
30198static int
30199test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030200 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030201
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030202#ifdef LIBXML_READER_ENABLED
30203 int mem_base;
30204 int ret_val;
30205 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30206 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030207
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030208 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30209 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030210 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030211
30212 ret_val = xmlTextReaderNormalization(reader);
30213 desret_int(ret_val);
30214 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030215 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030216 xmlResetLastError();
30217 if (mem_base != xmlMemBlocks()) {
30218 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30219 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030220 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030221 printf(" %d", n_reader);
30222 printf("\n");
30223 }
30224 }
30225#endif
30226
Daniel Veillard3d97e662004-11-04 10:49:00 +000030227 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030228 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030229}
30230
30231
30232static int
30233test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030235
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030236#ifdef LIBXML_READER_ENABLED
30237 int mem_base;
30238 xmlChar * ret_val;
30239 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30240 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030241
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030242 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30243 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030244 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030245
30246 ret_val = xmlTextReaderPrefix(reader);
30247 desret_xmlChar_ptr(ret_val);
30248 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030249 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030250 xmlResetLastError();
30251 if (mem_base != xmlMemBlocks()) {
30252 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30253 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030254 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030255 printf(" %d", n_reader);
30256 printf("\n");
30257 }
30258 }
30259#endif
30260
Daniel Veillard3d97e662004-11-04 10:49:00 +000030261 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030263}
30264
30265
30266static int
30267test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030269
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030270#ifdef LIBXML_READER_ENABLED
30271 int mem_base;
30272 xmlNodePtr ret_val;
30273 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30274 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030275
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030276 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30277 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030278 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030279
30280 ret_val = xmlTextReaderPreserve(reader);
30281 desret_xmlNodePtr(ret_val);
30282 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030283 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030284 xmlResetLastError();
30285 if (mem_base != xmlMemBlocks()) {
30286 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30287 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030288 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030289 printf(" %d", n_reader);
30290 printf("\n");
30291 }
30292 }
30293#endif
30294
Daniel Veillard3d97e662004-11-04 10:49:00 +000030295 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030296 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030297}
30298
30299
30300static int
30301test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030302 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030303
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030304#ifdef LIBXML_READER_ENABLED
30305 int mem_base;
30306 int ret_val;
30307 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30308 int n_reader;
30309 xmlChar * pattern; /* an XPath subset pattern */
30310 int n_pattern;
30311 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30312 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030313
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030314 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30315 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30316 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30317 mem_base = xmlMemBlocks();
30318 reader = gen_xmlTextReaderPtr(n_reader, 0);
30319 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30320 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30321
30322 ret_val = xmlTextReaderPreservePattern(reader, pattern, namespaces);
30323 desret_int(ret_val);
30324 call_tests++;
30325 des_xmlTextReaderPtr(n_reader, reader, 0);
30326 des_const_xmlChar_ptr(n_pattern, pattern, 1);
30327 des_const_xmlChar_ptr_ptr(n_namespaces, namespaces, 2);
30328 xmlResetLastError();
30329 if (mem_base != xmlMemBlocks()) {
30330 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30331 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030332 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030333 printf(" %d", n_reader);
30334 printf(" %d", n_pattern);
30335 printf(" %d", n_namespaces);
30336 printf("\n");
30337 }
30338 }
30339 }
30340 }
30341#endif
30342
30343 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030344 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030345}
30346
30347
30348static int
30349test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030350 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030351
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030352#ifdef LIBXML_READER_ENABLED
30353 int mem_base;
30354 int ret_val;
30355 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30356 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030357
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030358 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30359 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030360 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030361
30362 ret_val = xmlTextReaderQuoteChar(reader);
30363 desret_int(ret_val);
30364 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030365 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030366 xmlResetLastError();
30367 if (mem_base != xmlMemBlocks()) {
30368 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30369 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030370 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030371 printf(" %d", n_reader);
30372 printf("\n");
30373 }
30374 }
30375#endif
30376
Daniel Veillard3d97e662004-11-04 10:49:00 +000030377 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030378 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030379}
30380
30381
30382static int
30383test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030384 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030385
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030386#ifdef LIBXML_READER_ENABLED
30387 int mem_base;
30388 int ret_val;
30389 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30390 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030391
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030392 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30393 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030394 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030395
30396 ret_val = xmlTextReaderRead(reader);
30397 desret_int(ret_val);
30398 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030399 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030400 xmlResetLastError();
30401 if (mem_base != xmlMemBlocks()) {
30402 printf("Leak of %d blocks found in xmlTextReaderRead",
30403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030404 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030405 printf(" %d", n_reader);
30406 printf("\n");
30407 }
30408 }
30409#endif
30410
Daniel Veillard3d97e662004-11-04 10:49:00 +000030411 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030413}
30414
30415
30416static int
30417test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030419
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030420#ifdef LIBXML_READER_ENABLED
30421 int mem_base;
30422 int ret_val;
30423 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30424 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030425
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030426 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30427 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030428 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030429
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030430 ret_val = xmlTextReaderReadAttributeValue(reader);
30431 desret_int(ret_val);
30432 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030433 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030434 xmlResetLastError();
30435 if (mem_base != xmlMemBlocks()) {
30436 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
30437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030438 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030439 printf(" %d", n_reader);
30440 printf("\n");
30441 }
30442 }
30443#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030444
Daniel Veillard3d97e662004-11-04 10:49:00 +000030445 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030447}
30448
30449
30450static int
30451test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030453
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030454#ifdef LIBXML_READER_ENABLED
30455 int mem_base;
30456 int ret_val;
30457 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30458 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030459
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030460 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30461 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030462 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030463
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030464 ret_val = xmlTextReaderReadState(reader);
30465 desret_int(ret_val);
30466 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030467 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030468 xmlResetLastError();
30469 if (mem_base != xmlMemBlocks()) {
30470 printf("Leak of %d blocks found in xmlTextReaderReadState",
30471 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030472 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030473 printf(" %d", n_reader);
30474 printf("\n");
30475 }
30476 }
30477#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030478
Daniel Veillard3d97e662004-11-04 10:49:00 +000030479 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030481}
30482
30483
30484static int
30485test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030487
Daniel Veillardce682bc2004-11-05 17:22:25 +000030488#ifdef LIBXML_READER_ENABLED
30489#ifdef LIBXML_SCHEMAS_ENABLED
30490 int mem_base;
30491 int ret_val;
30492 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30493 int n_reader;
30494 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
30495 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030496
Daniel Veillardce682bc2004-11-05 17:22:25 +000030497 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30498 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
30499 mem_base = xmlMemBlocks();
30500 reader = gen_xmlTextReaderPtr(n_reader, 0);
30501 schema = gen_xmlRelaxNGPtr(n_schema, 1);
30502
30503 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
30504 desret_int(ret_val);
30505 call_tests++;
30506 des_xmlTextReaderPtr(n_reader, reader, 0);
30507 des_xmlRelaxNGPtr(n_schema, schema, 1);
30508 xmlResetLastError();
30509 if (mem_base != xmlMemBlocks()) {
30510 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
30511 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030512 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030513 printf(" %d", n_reader);
30514 printf(" %d", n_schema);
30515 printf("\n");
30516 }
30517 }
30518 }
30519#endif
30520#endif
30521
30522 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030524}
30525
30526
30527static int
30528test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030530
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030531#ifdef LIBXML_READER_ENABLED
30532#ifdef LIBXML_SCHEMAS_ENABLED
30533 int mem_base;
30534 int ret_val;
30535 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30536 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030537 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030538 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030539
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030540 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30541 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
30542 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030543 reader = gen_xmlTextReaderPtr(n_reader, 0);
30544 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030545
30546 ret_val = xmlTextReaderRelaxNGValidate(reader, rng);
30547 desret_int(ret_val);
30548 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030549 des_xmlTextReaderPtr(n_reader, reader, 0);
30550 des_const_char_ptr(n_rng, rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030551 xmlResetLastError();
30552 if (mem_base != xmlMemBlocks()) {
30553 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
30554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030555 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030556 printf(" %d", n_reader);
30557 printf(" %d", n_rng);
30558 printf("\n");
30559 }
30560 }
30561 }
30562#endif
30563#endif
30564
Daniel Veillard3d97e662004-11-04 10:49:00 +000030565 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030567}
30568
30569
30570static int
30571test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030573
30574
30575 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030576 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030577}
30578
30579
30580static int
30581test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030583
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030584#ifdef LIBXML_READER_ENABLED
30585 int mem_base;
30586 int ret_val;
30587 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30588 int n_reader;
30589 int prop; /* the xmlParserProperties to set */
30590 int n_prop;
30591 int value; /* usually 0 or 1 to (de)activate it */
30592 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030593
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030594 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30595 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
30596 for (n_value = 0;n_value < gen_nb_int;n_value++) {
30597 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030598 reader = gen_xmlTextReaderPtr(n_reader, 0);
30599 prop = gen_int(n_prop, 1);
30600 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030601
30602 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
30603 desret_int(ret_val);
30604 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030605 des_xmlTextReaderPtr(n_reader, reader, 0);
30606 des_int(n_prop, prop, 1);
30607 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030608 xmlResetLastError();
30609 if (mem_base != xmlMemBlocks()) {
30610 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
30611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030612 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030613 printf(" %d", n_reader);
30614 printf(" %d", n_prop);
30615 printf(" %d", n_value);
30616 printf("\n");
30617 }
30618 }
30619 }
30620 }
30621#endif
30622
Daniel Veillard3d97e662004-11-04 10:49:00 +000030623 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030625}
30626
30627
30628static int
30629test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030631
30632
30633 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030635}
30636
30637
30638static int
30639test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030641
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030642#ifdef LIBXML_READER_ENABLED
30643 int mem_base;
30644 int ret_val;
30645 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30646 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030647
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030648 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30649 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030650 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030651
30652 ret_val = xmlTextReaderStandalone(reader);
30653 desret_int(ret_val);
30654 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030655 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030656 xmlResetLastError();
30657 if (mem_base != xmlMemBlocks()) {
30658 printf("Leak of %d blocks found in xmlTextReaderStandalone",
30659 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030660 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030661 printf(" %d", n_reader);
30662 printf("\n");
30663 }
30664 }
30665#endif
30666
Daniel Veillard3d97e662004-11-04 10:49:00 +000030667 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030668 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030669}
30670
30671
30672static int
30673test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030674 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030675
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030676#ifdef LIBXML_READER_ENABLED
30677 int mem_base;
30678 xmlChar * ret_val;
30679 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30680 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030681
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030682 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30683 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030684 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030685
30686 ret_val = xmlTextReaderValue(reader);
30687 desret_xmlChar_ptr(ret_val);
30688 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030689 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030690 xmlResetLastError();
30691 if (mem_base != xmlMemBlocks()) {
30692 printf("Leak of %d blocks found in xmlTextReaderValue",
30693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030694 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030695 printf(" %d", n_reader);
30696 printf("\n");
30697 }
30698 }
30699#endif
30700
Daniel Veillard3d97e662004-11-04 10:49:00 +000030701 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030703}
30704
30705
30706static int
30707test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030709
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030710#ifdef LIBXML_READER_ENABLED
30711 int mem_base;
30712 xmlChar * ret_val;
30713 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30714 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030715
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030716 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30717 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030718 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030719
30720 ret_val = xmlTextReaderXmlLang(reader);
30721 desret_xmlChar_ptr(ret_val);
30722 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030723 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030724 xmlResetLastError();
30725 if (mem_base != xmlMemBlocks()) {
30726 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
30727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030728 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030729 printf(" %d", n_reader);
30730 printf("\n");
30731 }
30732 }
30733#endif
30734
Daniel Veillard3d97e662004-11-04 10:49:00 +000030735 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000030736 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030737}
30738
30739static int
30740test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030742
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030743 printf("Testing xmlreader : 68 of 78 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000030744 test_ret += test_xmlNewTextReader();
30745 test_ret += test_xmlNewTextReaderFilename();
30746 test_ret += test_xmlReaderForDoc();
30747 test_ret += test_xmlReaderForFile();
30748 test_ret += test_xmlReaderForMemory();
30749 test_ret += test_xmlReaderNewDoc();
30750 test_ret += test_xmlReaderNewFile();
30751 test_ret += test_xmlReaderNewMemory();
30752 test_ret += test_xmlReaderNewWalker();
30753 test_ret += test_xmlReaderWalker();
30754 test_ret += test_xmlTextReaderAttributeCount();
30755 test_ret += test_xmlTextReaderBaseUri();
30756 test_ret += test_xmlTextReaderClose();
30757 test_ret += test_xmlTextReaderConstBaseUri();
30758 test_ret += test_xmlTextReaderConstEncoding();
30759 test_ret += test_xmlTextReaderConstLocalName();
30760 test_ret += test_xmlTextReaderConstName();
30761 test_ret += test_xmlTextReaderConstNamespaceUri();
30762 test_ret += test_xmlTextReaderConstPrefix();
30763 test_ret += test_xmlTextReaderConstString();
30764 test_ret += test_xmlTextReaderConstValue();
30765 test_ret += test_xmlTextReaderConstXmlLang();
30766 test_ret += test_xmlTextReaderConstXmlVersion();
30767 test_ret += test_xmlTextReaderCurrentDoc();
30768 test_ret += test_xmlTextReaderCurrentNode();
30769 test_ret += test_xmlTextReaderDepth();
30770 test_ret += test_xmlTextReaderExpand();
30771 test_ret += test_xmlTextReaderGetAttribute();
30772 test_ret += test_xmlTextReaderGetAttributeNo();
30773 test_ret += test_xmlTextReaderGetAttributeNs();
30774 test_ret += test_xmlTextReaderGetErrorHandler();
30775 test_ret += test_xmlTextReaderGetParserProp();
30776 test_ret += test_xmlTextReaderGetRemainder();
30777 test_ret += test_xmlTextReaderHasAttributes();
30778 test_ret += test_xmlTextReaderHasValue();
30779 test_ret += test_xmlTextReaderIsDefault();
30780 test_ret += test_xmlTextReaderIsEmptyElement();
30781 test_ret += test_xmlTextReaderIsNamespaceDecl();
30782 test_ret += test_xmlTextReaderIsValid();
30783 test_ret += test_xmlTextReaderLocalName();
30784 test_ret += test_xmlTextReaderLocatorBaseURI();
30785 test_ret += test_xmlTextReaderLocatorLineNumber();
30786 test_ret += test_xmlTextReaderLookupNamespace();
30787 test_ret += test_xmlTextReaderMoveToAttribute();
30788 test_ret += test_xmlTextReaderMoveToAttributeNo();
30789 test_ret += test_xmlTextReaderMoveToAttributeNs();
30790 test_ret += test_xmlTextReaderMoveToElement();
30791 test_ret += test_xmlTextReaderMoveToFirstAttribute();
30792 test_ret += test_xmlTextReaderMoveToNextAttribute();
30793 test_ret += test_xmlTextReaderName();
30794 test_ret += test_xmlTextReaderNamespaceUri();
30795 test_ret += test_xmlTextReaderNext();
30796 test_ret += test_xmlTextReaderNextSibling();
30797 test_ret += test_xmlTextReaderNodeType();
30798 test_ret += test_xmlTextReaderNormalization();
30799 test_ret += test_xmlTextReaderPrefix();
30800 test_ret += test_xmlTextReaderPreserve();
30801 test_ret += test_xmlTextReaderPreservePattern();
30802 test_ret += test_xmlTextReaderQuoteChar();
30803 test_ret += test_xmlTextReaderRead();
30804 test_ret += test_xmlTextReaderReadAttributeValue();
30805 test_ret += test_xmlTextReaderReadState();
30806 test_ret += test_xmlTextReaderRelaxNGSetSchema();
30807 test_ret += test_xmlTextReaderRelaxNGValidate();
30808 test_ret += test_xmlTextReaderSetErrorHandler();
30809 test_ret += test_xmlTextReaderSetParserProp();
30810 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
30811 test_ret += test_xmlTextReaderStandalone();
30812 test_ret += test_xmlTextReaderValue();
30813 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000030814
Daniel Veillard42595322004-11-08 10:52:06 +000030815 if (test_ret != 0)
30816 printf("Module xmlreader: %d errors\n", test_ret);
30817 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030818}
30819
Daniel Veillarda82b1822004-11-08 16:24:57 +000030820#define gen_nb_xmlRegExecCtxtPtr 1
30821static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30822 return(NULL);
30823}
30824static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30825}
30826
30827static int
30828test_xmlRegExecPushString(void) {
30829 int test_ret = 0;
30830
30831#ifdef LIBXML_REGEXP_ENABLED
30832 int mem_base;
30833 int ret_val;
30834 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
30835 int n_exec;
30836 xmlChar * value; /* a string token input */
30837 int n_value;
30838 void * data; /* data associated to the token to reuse in callbacks */
30839 int n_data;
30840
30841 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
30842 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
30843 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
30844 mem_base = xmlMemBlocks();
30845 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
30846 value = gen_const_xmlChar_ptr(n_value, 1);
30847 data = gen_userdata(n_data, 2);
30848
30849 ret_val = xmlRegExecPushString(exec, value, data);
30850 desret_int(ret_val);
30851 call_tests++;
30852 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
30853 des_const_xmlChar_ptr(n_value, value, 1);
30854 des_userdata(n_data, data, 2);
30855 xmlResetLastError();
30856 if (mem_base != xmlMemBlocks()) {
30857 printf("Leak of %d blocks found in xmlRegExecPushString",
30858 xmlMemBlocks() - mem_base);
30859 test_ret++;
30860 printf(" %d", n_exec);
30861 printf(" %d", n_value);
30862 printf(" %d", n_data);
30863 printf("\n");
30864 }
30865 }
30866 }
30867 }
30868#endif
30869
30870 function_tests++;
30871 return(test_ret);
30872}
30873
30874
30875static int
30876test_xmlRegExecPushString2(void) {
30877 int test_ret = 0;
30878
30879#ifdef LIBXML_REGEXP_ENABLED
30880 int mem_base;
30881 int ret_val;
30882 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
30883 int n_exec;
30884 xmlChar * value; /* the first string token input */
30885 int n_value;
30886 xmlChar * value2; /* the second string token input */
30887 int n_value2;
30888 void * data; /* data associated to the token to reuse in callbacks */
30889 int n_data;
30890
30891 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
30892 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
30893 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
30894 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
30895 mem_base = xmlMemBlocks();
30896 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
30897 value = gen_const_xmlChar_ptr(n_value, 1);
30898 value2 = gen_const_xmlChar_ptr(n_value2, 2);
30899 data = gen_userdata(n_data, 3);
30900
30901 ret_val = xmlRegExecPushString2(exec, value, value2, data);
30902 desret_int(ret_val);
30903 call_tests++;
30904 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
30905 des_const_xmlChar_ptr(n_value, value, 1);
30906 des_const_xmlChar_ptr(n_value2, value2, 2);
30907 des_userdata(n_data, data, 3);
30908 xmlResetLastError();
30909 if (mem_base != xmlMemBlocks()) {
30910 printf("Leak of %d blocks found in xmlRegExecPushString2",
30911 xmlMemBlocks() - mem_base);
30912 test_ret++;
30913 printf(" %d", n_exec);
30914 printf(" %d", n_value);
30915 printf(" %d", n_value2);
30916 printf(" %d", n_data);
30917 printf("\n");
30918 }
30919 }
30920 }
30921 }
30922 }
30923#endif
30924
30925 function_tests++;
30926 return(test_ret);
30927}
30928
30929
30930#define gen_nb_xmlRegexpPtr 1
30931static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30932 return(NULL);
30933}
30934static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30935}
30936
30937static int
30938test_xmlRegNewExecCtxt(void) {
30939 int test_ret = 0;
30940
30941
30942 /* missing type support */
30943 return(test_ret);
30944}
30945
30946
30947static int
30948test_xmlRegexpCompile(void) {
30949 int test_ret = 0;
30950
30951
30952 /* missing type support */
30953 return(test_ret);
30954}
30955
30956
30957static int
30958test_xmlRegexpExec(void) {
30959 int test_ret = 0;
30960
30961#ifdef LIBXML_REGEXP_ENABLED
30962 int mem_base;
30963 int ret_val;
30964 xmlRegexpPtr comp; /* the compiled regular expression */
30965 int n_comp;
30966 xmlChar * content; /* the value to check against the regular expression */
30967 int n_content;
30968
30969 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
30970 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
30971 mem_base = xmlMemBlocks();
30972 comp = gen_xmlRegexpPtr(n_comp, 0);
30973 content = gen_const_xmlChar_ptr(n_content, 1);
30974
30975 ret_val = xmlRegexpExec(comp, content);
30976 desret_int(ret_val);
30977 call_tests++;
30978 des_xmlRegexpPtr(n_comp, comp, 0);
30979 des_const_xmlChar_ptr(n_content, content, 1);
30980 xmlResetLastError();
30981 if (mem_base != xmlMemBlocks()) {
30982 printf("Leak of %d blocks found in xmlRegexpExec",
30983 xmlMemBlocks() - mem_base);
30984 test_ret++;
30985 printf(" %d", n_comp);
30986 printf(" %d", n_content);
30987 printf("\n");
30988 }
30989 }
30990 }
30991#endif
30992
30993 function_tests++;
30994 return(test_ret);
30995}
30996
30997
30998static int
30999test_xmlRegexpIsDeterminist(void) {
31000 int test_ret = 0;
31001
31002#ifdef LIBXML_REGEXP_ENABLED
31003 int mem_base;
31004 int ret_val;
31005 xmlRegexpPtr comp; /* the compiled regular expression */
31006 int n_comp;
31007
31008 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31009 mem_base = xmlMemBlocks();
31010 comp = gen_xmlRegexpPtr(n_comp, 0);
31011
31012 ret_val = xmlRegexpIsDeterminist(comp);
31013 desret_int(ret_val);
31014 call_tests++;
31015 des_xmlRegexpPtr(n_comp, comp, 0);
31016 xmlResetLastError();
31017 if (mem_base != xmlMemBlocks()) {
31018 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31019 xmlMemBlocks() - mem_base);
31020 test_ret++;
31021 printf(" %d", n_comp);
31022 printf("\n");
31023 }
31024 }
31025#endif
31026
31027 function_tests++;
31028 return(test_ret);
31029}
31030
31031
31032static int
31033test_xmlRegexpPrint(void) {
31034 int test_ret = 0;
31035
31036#ifdef LIBXML_REGEXP_ENABLED
31037 int mem_base;
31038 FILE * output; /* the file for the output debug */
31039 int n_output;
31040 xmlRegexpPtr regexp; /* the compiled regexp */
31041 int n_regexp;
31042
31043 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31044 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31045 mem_base = xmlMemBlocks();
31046 output = gen_FILE_ptr(n_output, 0);
31047 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31048
31049 xmlRegexpPrint(output, regexp);
31050 call_tests++;
31051 des_FILE_ptr(n_output, output, 0);
31052 des_xmlRegexpPtr(n_regexp, regexp, 1);
31053 xmlResetLastError();
31054 if (mem_base != xmlMemBlocks()) {
31055 printf("Leak of %d blocks found in xmlRegexpPrint",
31056 xmlMemBlocks() - mem_base);
31057 test_ret++;
31058 printf(" %d", n_output);
31059 printf(" %d", n_regexp);
31060 printf("\n");
31061 }
31062 }
31063 }
31064#endif
31065
31066 function_tests++;
31067 return(test_ret);
31068}
31069
31070static int
31071test_xmlregexp(void) {
31072 int test_ret = 0;
31073
31074 printf("Testing xmlregexp : 5 of 9 functions ...\n");
31075 test_ret += test_xmlRegExecPushString();
31076 test_ret += test_xmlRegExecPushString2();
31077 test_ret += test_xmlRegNewExecCtxt();
31078 test_ret += test_xmlRegexpCompile();
31079 test_ret += test_xmlRegexpExec();
31080 test_ret += test_xmlRegexpIsDeterminist();
31081 test_ret += test_xmlRegexpPrint();
31082
31083 if (test_ret != 0)
31084 printf("Module xmlregexp: %d errors\n", test_ret);
31085 return(test_ret);
31086}
31087
Daniel Veillardce682bc2004-11-05 17:22:25 +000031088#define gen_nb_xmlSaveCtxtPtr 1
31089static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31090 return(NULL);
31091}
31092static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31093}
31094
Daniel Veillardd93f6252004-11-02 15:53:51 +000031095static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031096test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031098
Daniel Veillardce682bc2004-11-05 17:22:25 +000031099#ifdef LIBXML_OUTPUT_ENABLED
31100 int mem_base;
31101 int ret_val;
31102 xmlSaveCtxtPtr ctxt; /* a document saving context */
31103 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031104
Daniel Veillardce682bc2004-11-05 17:22:25 +000031105 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31106 mem_base = xmlMemBlocks();
31107 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31108
31109 ret_val = xmlSaveClose(ctxt);
31110 desret_int(ret_val);
31111 call_tests++;
31112 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31113 xmlResetLastError();
31114 if (mem_base != xmlMemBlocks()) {
31115 printf("Leak of %d blocks found in xmlSaveClose",
31116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031117 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031118 printf(" %d", n_ctxt);
31119 printf("\n");
31120 }
31121 }
31122#endif
31123
31124 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031125 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031126}
31127
31128
31129static int
31130test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031131 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031132
Daniel Veillardce682bc2004-11-05 17:22:25 +000031133#ifdef LIBXML_OUTPUT_ENABLED
31134 int mem_base;
31135 long ret_val;
31136 xmlSaveCtxtPtr ctxt; /* a document saving context */
31137 int n_ctxt;
31138 xmlDocPtr doc; /* a document */
31139 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031140
Daniel Veillardce682bc2004-11-05 17:22:25 +000031141 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31142 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31143 mem_base = xmlMemBlocks();
31144 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31145 doc = gen_xmlDocPtr(n_doc, 1);
31146
31147 ret_val = xmlSaveDoc(ctxt, doc);
31148 desret_long(ret_val);
31149 call_tests++;
31150 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31151 des_xmlDocPtr(n_doc, doc, 1);
31152 xmlResetLastError();
31153 if (mem_base != xmlMemBlocks()) {
31154 printf("Leak of %d blocks found in xmlSaveDoc",
31155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031156 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031157 printf(" %d", n_ctxt);
31158 printf(" %d", n_doc);
31159 printf("\n");
31160 }
31161 }
31162 }
31163#endif
31164
31165 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031167}
31168
31169
31170static int
31171test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031173
Daniel Veillardce682bc2004-11-05 17:22:25 +000031174#ifdef LIBXML_OUTPUT_ENABLED
31175 int mem_base;
31176 int ret_val;
31177 xmlSaveCtxtPtr ctxt; /* a document saving context */
31178 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031179
Daniel Veillardce682bc2004-11-05 17:22:25 +000031180 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31181 mem_base = xmlMemBlocks();
31182 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31183
31184 ret_val = xmlSaveFlush(ctxt);
31185 desret_int(ret_val);
31186 call_tests++;
31187 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31188 xmlResetLastError();
31189 if (mem_base != xmlMemBlocks()) {
31190 printf("Leak of %d blocks found in xmlSaveFlush",
31191 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031192 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031193 printf(" %d", n_ctxt);
31194 printf("\n");
31195 }
31196 }
31197#endif
31198
31199 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031200 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031201}
31202
31203
31204static int
31205test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031206 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031207
31208
31209 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031210 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031211}
31212
31213
31214static int
31215test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031216 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031217
31218
31219 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031221}
31222
31223
31224static int
31225test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031227
31228
31229 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031231}
31232
31233
31234static int
31235test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031237
31238
31239 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031241}
31242
31243
31244static int
31245test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031247
Daniel Veillardce682bc2004-11-05 17:22:25 +000031248#ifdef LIBXML_OUTPUT_ENABLED
31249 int mem_base;
31250 long ret_val;
31251 xmlSaveCtxtPtr ctxt; /* a document saving context */
31252 int n_ctxt;
31253 xmlNodePtr node; /* a document */
31254 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031255
Daniel Veillardce682bc2004-11-05 17:22:25 +000031256 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31257 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31258 mem_base = xmlMemBlocks();
31259 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31260 node = gen_xmlNodePtr(n_node, 1);
31261
31262 ret_val = xmlSaveTree(ctxt, node);
31263 desret_long(ret_val);
31264 call_tests++;
31265 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31266 des_xmlNodePtr(n_node, node, 1);
31267 xmlResetLastError();
31268 if (mem_base != xmlMemBlocks()) {
31269 printf("Leak of %d blocks found in xmlSaveTree",
31270 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031271 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031272 printf(" %d", n_ctxt);
31273 printf(" %d", n_node);
31274 printf("\n");
31275 }
31276 }
31277 }
31278#endif
31279
31280 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031282}
31283
31284static int
31285test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031287
Daniel Veillardce682bc2004-11-05 17:22:25 +000031288 printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031289 test_ret += test_xmlSaveClose();
31290 test_ret += test_xmlSaveDoc();
31291 test_ret += test_xmlSaveFlush();
31292 test_ret += test_xmlSaveSetAttrEscape();
31293 test_ret += test_xmlSaveSetEscape();
31294 test_ret += test_xmlSaveToFd();
31295 test_ret += test_xmlSaveToFilename();
31296 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031297
Daniel Veillard42595322004-11-08 10:52:06 +000031298 if (test_ret != 0)
31299 printf("Module xmlsave: %d errors\n", test_ret);
31300 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031301}
31302
Daniel Veillardce682bc2004-11-05 17:22:25 +000031303#define gen_nb_xmlSchemaPtr 1
31304static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31305 return(NULL);
31306}
31307static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31308}
31309
Daniel Veillardd93f6252004-11-02 15:53:51 +000031310static int
31311test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031312 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031313
Daniel Veillardce682bc2004-11-05 17:22:25 +000031314#ifdef LIBXML_SCHEMAS_ENABLED
31315#ifdef LIBXML_OUTPUT_ENABLED
31316 int mem_base;
31317 FILE * output; /* the file output */
31318 int n_output;
31319 xmlSchemaPtr schema; /* a schema structure */
31320 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031321
Daniel Veillardce682bc2004-11-05 17:22:25 +000031322 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31323 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
31324 mem_base = xmlMemBlocks();
31325 output = gen_FILE_ptr(n_output, 0);
31326 schema = gen_xmlSchemaPtr(n_schema, 1);
31327
31328 xmlSchemaDump(output, schema);
31329 call_tests++;
31330 des_FILE_ptr(n_output, output, 0);
31331 des_xmlSchemaPtr(n_schema, schema, 1);
31332 xmlResetLastError();
31333 if (mem_base != xmlMemBlocks()) {
31334 printf("Leak of %d blocks found in xmlSchemaDump",
31335 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031336 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031337 printf(" %d", n_output);
31338 printf(" %d", n_schema);
31339 printf("\n");
31340 }
31341 }
31342 }
31343#endif
31344#endif
31345
31346 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031348}
31349
31350
Daniel Veillardce682bc2004-11-05 17:22:25 +000031351#define gen_nb_xmlSchemaParserCtxtPtr 1
31352static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31353 return(NULL);
31354}
31355static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31356}
31357
31358#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
31359static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31360 return(NULL);
31361}
31362static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31363}
31364
31365#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
31366static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31367 return(NULL);
31368}
31369static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31370}
31371
Daniel Veillardd93f6252004-11-02 15:53:51 +000031372static int
31373test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031374 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031375
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031376#ifdef LIBXML_SCHEMAS_ENABLED
31377 int mem_base;
31378 int ret_val;
31379 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
31380 int n_ctxt;
31381 xmlSchemaValidityErrorFunc * err; /* the error callback result */
31382 int n_err;
31383 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
31384 int n_warn;
31385 void ** ctx; /* contextual data for the callbacks result */
31386 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031387
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031388 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
31389 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31390 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31391 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31392 mem_base = xmlMemBlocks();
31393 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
31394 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31395 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31396 ctx = gen_void_ptr_ptr(n_ctx, 3);
31397
31398 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
31399 desret_int(ret_val);
31400 call_tests++;
31401 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
31402 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31403 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31404 des_void_ptr_ptr(n_ctx, ctx, 3);
31405 xmlResetLastError();
31406 if (mem_base != xmlMemBlocks()) {
31407 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
31408 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031409 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031410 printf(" %d", n_ctxt);
31411 printf(" %d", n_err);
31412 printf(" %d", n_warn);
31413 printf(" %d", n_ctx);
31414 printf("\n");
31415 }
31416 }
31417 }
31418 }
31419 }
31420#endif
31421
31422 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031423 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031424}
31425
31426
Daniel Veillardce682bc2004-11-05 17:22:25 +000031427#define gen_nb_xmlSchemaValidCtxtPtr 1
31428static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31429 return(NULL);
31430}
31431static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31432}
31433
Daniel Veillardd93f6252004-11-02 15:53:51 +000031434static int
31435test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031436 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031437
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031438#ifdef LIBXML_SCHEMAS_ENABLED
31439 int mem_base;
31440 int ret_val;
31441 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
31442 int n_ctxt;
31443 xmlSchemaValidityErrorFunc * err; /* the error function result */
31444 int n_err;
31445 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
31446 int n_warn;
31447 void ** ctx; /* the functions context result */
31448 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031449
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031450 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31451 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31452 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31453 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31454 mem_base = xmlMemBlocks();
31455 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31456 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31457 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31458 ctx = gen_void_ptr_ptr(n_ctx, 3);
31459
31460 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
31461 desret_int(ret_val);
31462 call_tests++;
31463 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31464 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31465 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31466 des_void_ptr_ptr(n_ctx, ctx, 3);
31467 xmlResetLastError();
31468 if (mem_base != xmlMemBlocks()) {
31469 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
31470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031471 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031472 printf(" %d", n_ctxt);
31473 printf(" %d", n_err);
31474 printf(" %d", n_warn);
31475 printf(" %d", n_ctx);
31476 printf("\n");
31477 }
31478 }
31479 }
31480 }
31481 }
31482#endif
31483
31484 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031486}
31487
31488
31489static int
31490test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031491 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031492
Daniel Veillard42595322004-11-08 10:52:06 +000031493#ifdef LIBXML_SCHEMAS_ENABLED
31494 int mem_base;
31495 xmlSchemaParserCtxtPtr ret_val;
31496 xmlDocPtr doc; /* a preparsed document tree */
31497 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031498
Daniel Veillard42595322004-11-08 10:52:06 +000031499 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31500 mem_base = xmlMemBlocks();
31501 doc = gen_xmlDocPtr(n_doc, 0);
31502
31503 ret_val = xmlSchemaNewDocParserCtxt(doc);
31504 desret_xmlSchemaParserCtxtPtr(ret_val);
31505 call_tests++;
31506 des_xmlDocPtr(n_doc, doc, 0);
31507 xmlResetLastError();
31508 if (mem_base != xmlMemBlocks()) {
31509 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
31510 xmlMemBlocks() - mem_base);
31511 test_ret++;
31512 printf(" %d", n_doc);
31513 printf("\n");
31514 }
31515 }
31516#endif
31517
31518 function_tests++;
31519 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031520}
31521
31522
31523static int
31524test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031525 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031526
Daniel Veillard42595322004-11-08 10:52:06 +000031527#ifdef LIBXML_SCHEMAS_ENABLED
31528 int mem_base;
31529 xmlSchemaParserCtxtPtr ret_val;
31530 char * buffer; /* a pointer to a char array containing the schemas */
31531 int n_buffer;
31532 int size; /* the size of the array */
31533 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031534
Daniel Veillard42595322004-11-08 10:52:06 +000031535 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
31536 for (n_size = 0;n_size < gen_nb_int;n_size++) {
31537 mem_base = xmlMemBlocks();
31538 buffer = gen_const_char_ptr(n_buffer, 0);
31539 size = gen_int(n_size, 1);
31540
31541 ret_val = xmlSchemaNewMemParserCtxt(buffer, size);
31542 desret_xmlSchemaParserCtxtPtr(ret_val);
31543 call_tests++;
31544 des_const_char_ptr(n_buffer, buffer, 0);
31545 des_int(n_size, size, 1);
31546 xmlResetLastError();
31547 if (mem_base != xmlMemBlocks()) {
31548 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
31549 xmlMemBlocks() - mem_base);
31550 test_ret++;
31551 printf(" %d", n_buffer);
31552 printf(" %d", n_size);
31553 printf("\n");
31554 }
31555 }
31556 }
31557#endif
31558
31559 function_tests++;
31560 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031561}
31562
31563
31564static int
31565test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031566 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031567
Daniel Veillard42595322004-11-08 10:52:06 +000031568#ifdef LIBXML_SCHEMAS_ENABLED
31569 int mem_base;
31570 xmlSchemaParserCtxtPtr ret_val;
31571 char * URL; /* the location of the schema */
31572 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031573
Daniel Veillard42595322004-11-08 10:52:06 +000031574 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
31575 mem_base = xmlMemBlocks();
31576 URL = gen_const_char_ptr(n_URL, 0);
31577
31578 ret_val = xmlSchemaNewParserCtxt(URL);
31579 desret_xmlSchemaParserCtxtPtr(ret_val);
31580 call_tests++;
31581 des_const_char_ptr(n_URL, URL, 0);
31582 xmlResetLastError();
31583 if (mem_base != xmlMemBlocks()) {
31584 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
31585 xmlMemBlocks() - mem_base);
31586 test_ret++;
31587 printf(" %d", n_URL);
31588 printf("\n");
31589 }
31590 }
31591#endif
31592
31593 function_tests++;
31594 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031595}
31596
31597
31598static int
31599test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031600 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031601
31602
31603 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031604 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031605}
31606
31607
31608static int
31609test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031610 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031611
31612
31613 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031614 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031615}
31616
31617
31618static int
31619test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031621
31622
31623 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031625}
31626
31627
31628static int
31629test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031631
31632
31633 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031635}
31636
31637
31638static int
31639test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031641
Daniel Veillardce682bc2004-11-05 17:22:25 +000031642#ifdef LIBXML_SCHEMAS_ENABLED
31643 int mem_base;
31644 int ret_val;
31645 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31646 int n_ctxt;
31647 int options; /* a combination of xmlSchemaValidOption */
31648 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031649
Daniel Veillardce682bc2004-11-05 17:22:25 +000031650 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31651 for (n_options = 0;n_options < gen_nb_int;n_options++) {
31652 mem_base = xmlMemBlocks();
31653 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31654 options = gen_int(n_options, 1);
31655
31656 ret_val = xmlSchemaSetValidOptions(ctxt, options);
31657 desret_int(ret_val);
31658 call_tests++;
31659 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31660 des_int(n_options, options, 1);
31661 xmlResetLastError();
31662 if (mem_base != xmlMemBlocks()) {
31663 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
31664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031665 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031666 printf(" %d", n_ctxt);
31667 printf(" %d", n_options);
31668 printf("\n");
31669 }
31670 }
31671 }
31672#endif
31673
31674 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031676}
31677
31678
31679static int
31680test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031682
Daniel Veillardce682bc2004-11-05 17:22:25 +000031683#ifdef LIBXML_SCHEMAS_ENABLED
31684 int mem_base;
31685 int ret_val;
31686 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31687 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031688
Daniel Veillardce682bc2004-11-05 17:22:25 +000031689 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31690 mem_base = xmlMemBlocks();
31691 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31692
31693 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
31694 desret_int(ret_val);
31695 call_tests++;
31696 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31697 xmlResetLastError();
31698 if (mem_base != xmlMemBlocks()) {
31699 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
31700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031701 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031702 printf(" %d", n_ctxt);
31703 printf("\n");
31704 }
31705 }
31706#endif
31707
31708 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031710}
31711
31712
31713static int
31714test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031715 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031716
Daniel Veillardce682bc2004-11-05 17:22:25 +000031717#ifdef LIBXML_SCHEMAS_ENABLED
31718 int mem_base;
31719 int ret_val;
31720 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31721 int n_ctxt;
31722 xmlDocPtr doc; /* a parsed document tree */
31723 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031724
Daniel Veillardce682bc2004-11-05 17:22:25 +000031725 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31726 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31727 mem_base = xmlMemBlocks();
31728 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31729 doc = gen_xmlDocPtr(n_doc, 1);
31730
31731 ret_val = xmlSchemaValidateDoc(ctxt, doc);
31732 desret_int(ret_val);
31733 call_tests++;
31734 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31735 des_xmlDocPtr(n_doc, doc, 1);
31736 xmlResetLastError();
31737 if (mem_base != xmlMemBlocks()) {
31738 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
31739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031740 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031741 printf(" %d", n_ctxt);
31742 printf(" %d", n_doc);
31743 printf("\n");
31744 }
31745 }
31746 }
31747#endif
31748
31749 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031751}
31752
31753
31754static int
31755test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031757
Daniel Veillardce682bc2004-11-05 17:22:25 +000031758#ifdef LIBXML_SCHEMAS_ENABLED
31759 int mem_base;
31760 int ret_val;
31761 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31762 int n_ctxt;
31763 xmlNodePtr elem; /* an element node */
31764 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031765
Daniel Veillardce682bc2004-11-05 17:22:25 +000031766 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31767 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
31768 mem_base = xmlMemBlocks();
31769 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31770 elem = gen_xmlNodePtr(n_elem, 1);
31771
31772 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
31773 desret_int(ret_val);
31774 call_tests++;
31775 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31776 des_xmlNodePtr(n_elem, elem, 1);
31777 xmlResetLastError();
31778 if (mem_base != xmlMemBlocks()) {
31779 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
31780 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031781 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031782 printf(" %d", n_ctxt);
31783 printf(" %d", n_elem);
31784 printf("\n");
31785 }
31786 }
31787 }
31788#endif
31789
31790 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031791 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031792}
31793
31794
31795static int
31796test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031797 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031798
Daniel Veillardce682bc2004-11-05 17:22:25 +000031799#ifdef LIBXML_SCHEMAS_ENABLED
31800 int mem_base;
31801 int ret_val;
31802 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31803 int n_ctxt;
31804 xmlParserInputBufferPtr input; /* the input to use for reading the data */
31805 int n_input;
31806 xmlCharEncoding enc; /* an optional encoding information */
31807 int n_enc;
31808 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
31809 int n_sax;
31810 void * user_data; /* the context to provide to the SAX handler. */
31811 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031812
Daniel Veillardce682bc2004-11-05 17:22:25 +000031813 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31814 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
31815 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
31816 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
31817 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
31818 mem_base = xmlMemBlocks();
31819 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31820 input = gen_xmlParserInputBufferPtr(n_input, 1);
31821 enc = gen_xmlCharEncoding(n_enc, 2);
31822 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
31823 user_data = gen_userdata(n_user_data, 4);
31824
31825 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
31826 desret_int(ret_val);
31827 call_tests++;
31828 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31829 des_xmlParserInputBufferPtr(n_input, input, 1);
31830 des_xmlCharEncoding(n_enc, enc, 2);
31831 des_xmlSAXHandlerPtr(n_sax, sax, 3);
31832 des_userdata(n_user_data, user_data, 4);
31833 xmlResetLastError();
31834 if (mem_base != xmlMemBlocks()) {
31835 printf("Leak of %d blocks found in xmlSchemaValidateStream",
31836 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031837 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031838 printf(" %d", n_ctxt);
31839 printf(" %d", n_input);
31840 printf(" %d", n_enc);
31841 printf(" %d", n_sax);
31842 printf(" %d", n_user_data);
31843 printf("\n");
31844 }
31845 }
31846 }
31847 }
31848 }
31849 }
31850#endif
31851
31852 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031853 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031854}
31855
31856static int
31857test_xmlschemas(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 printf("Testing xmlschemas : 11 of 18 functions ...\n");
31861 test_ret += test_xmlSchemaDump();
31862 test_ret += test_xmlSchemaGetParserErrors();
31863 test_ret += test_xmlSchemaGetValidErrors();
31864 test_ret += test_xmlSchemaNewDocParserCtxt();
31865 test_ret += test_xmlSchemaNewMemParserCtxt();
31866 test_ret += test_xmlSchemaNewParserCtxt();
31867 test_ret += test_xmlSchemaNewValidCtxt();
31868 test_ret += test_xmlSchemaParse();
31869 test_ret += test_xmlSchemaSetParserErrors();
31870 test_ret += test_xmlSchemaSetValidErrors();
31871 test_ret += test_xmlSchemaSetValidOptions();
31872 test_ret += test_xmlSchemaValidCtxtGetOptions();
31873 test_ret += test_xmlSchemaValidateDoc();
31874 test_ret += test_xmlSchemaValidateOneElement();
31875 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031876
Daniel Veillard42595322004-11-08 10:52:06 +000031877 if (test_ret != 0)
31878 printf("Module xmlschemas: %d errors\n", test_ret);
31879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031880}
31881
Daniel Veillardce682bc2004-11-05 17:22:25 +000031882#define gen_nb_xmlSchemaFacetPtr 1
31883static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31884 return(NULL);
31885}
31886static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31887}
31888
31889#define gen_nb_xmlSchemaTypePtr 1
31890static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31891 return(NULL);
31892}
31893static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31894}
31895
Daniel Veillardd93f6252004-11-02 15:53:51 +000031896static int
31897test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031898 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031899
Daniel Veillardce682bc2004-11-05 17:22:25 +000031900#ifdef LIBXML_SCHEMAS_ENABLED
31901 int mem_base;
31902 int ret_val;
31903 xmlSchemaFacetPtr facet; /* the facet */
31904 int n_facet;
31905 xmlSchemaTypePtr typeDecl; /* the schema type definition */
31906 int n_typeDecl;
31907 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
31908 int n_ctxt;
31909 xmlChar * name; /* name of the type */
31910 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031911
Daniel Veillardce682bc2004-11-05 17:22:25 +000031912 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
31913 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
31914 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
31915 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
31916 mem_base = xmlMemBlocks();
31917 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
31918 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
31919 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
31920 name = gen_const_xmlChar_ptr(n_name, 3);
31921
31922 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, name);
31923 desret_int(ret_val);
31924 call_tests++;
31925 des_xmlSchemaFacetPtr(n_facet, facet, 0);
31926 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
31927 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
31928 des_const_xmlChar_ptr(n_name, name, 3);
31929 xmlResetLastError();
31930 if (mem_base != xmlMemBlocks()) {
31931 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
31932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031933 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031934 printf(" %d", n_facet);
31935 printf(" %d", n_typeDecl);
31936 printf(" %d", n_ctxt);
31937 printf(" %d", n_name);
31938 printf("\n");
31939 }
31940 }
31941 }
31942 }
31943 }
31944#endif
31945
31946 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031948}
31949
31950
31951static int
31952test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031954
31955#ifdef LIBXML_SCHEMAS_ENABLED
31956 int mem_base;
31957
31958 mem_base = xmlMemBlocks();
31959
31960 xmlSchemaCleanupTypes();
31961 call_tests++;
31962 xmlResetLastError();
31963 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000031964 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000031965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031966 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000031967 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000031968 }
31969#endif
31970
Daniel Veillard3d97e662004-11-04 10:49:00 +000031971 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031973}
31974
31975
31976static int
31977test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031978 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031979
Daniel Veillard8a32fe42004-11-02 22:10:16 +000031980#ifdef LIBXML_SCHEMAS_ENABLED
31981 int mem_base;
31982 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031983 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000031984 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031985
Daniel Veillard8a32fe42004-11-02 22:10:16 +000031986 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31987 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031988 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000031989
31990 ret_val = xmlSchemaCollapseString(value);
31991 desret_xmlChar_ptr(ret_val);
31992 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031993 des_const_xmlChar_ptr(n_value, value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000031994 xmlResetLastError();
31995 if (mem_base != xmlMemBlocks()) {
31996 printf("Leak of %d blocks found in xmlSchemaCollapseString",
31997 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031998 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000031999 printf(" %d", n_value);
32000 printf("\n");
32001 }
32002 }
32003#endif
32004
Daniel Veillard3d97e662004-11-04 10:49:00 +000032005 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032006 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032007}
32008
32009
Daniel Veillardce682bc2004-11-05 17:22:25 +000032010#define gen_nb_xmlSchemaValPtr 1
32011static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32012 return(NULL);
32013}
32014static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32015}
32016
Daniel Veillardd93f6252004-11-02 15:53:51 +000032017static int
32018test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032020
Daniel Veillardce682bc2004-11-05 17:22:25 +000032021#ifdef LIBXML_SCHEMAS_ENABLED
32022 int mem_base;
32023 int ret_val;
32024 xmlSchemaValPtr x; /* a first value */
32025 int n_x;
32026 xmlSchemaValPtr y; /* a second value */
32027 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032028
Daniel Veillardce682bc2004-11-05 17:22:25 +000032029 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32030 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32031 mem_base = xmlMemBlocks();
32032 x = gen_xmlSchemaValPtr(n_x, 0);
32033 y = gen_xmlSchemaValPtr(n_y, 1);
32034
32035 ret_val = xmlSchemaCompareValues(x, y);
32036 desret_int(ret_val);
32037 call_tests++;
32038 des_xmlSchemaValPtr(n_x, x, 0);
32039 des_xmlSchemaValPtr(n_y, y, 1);
32040 xmlResetLastError();
32041 if (mem_base != xmlMemBlocks()) {
32042 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32043 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032044 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032045 printf(" %d", n_x);
32046 printf(" %d", n_y);
32047 printf("\n");
32048 }
32049 }
32050 }
32051#endif
32052
32053 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032054 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032055}
32056
32057
32058static int
32059test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032060 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032061
Daniel Veillard42595322004-11-08 10:52:06 +000032062#ifdef LIBXML_SCHEMAS_ENABLED
32063 int mem_base;
32064 xmlSchemaTypePtr ret_val;
32065 xmlSchemaTypePtr type; /* the built-in simple type. */
32066 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032067
Daniel Veillard42595322004-11-08 10:52:06 +000032068 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32069 mem_base = xmlMemBlocks();
32070 type = gen_xmlSchemaTypePtr(n_type, 0);
32071
32072 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32073 desret_xmlSchemaTypePtr(ret_val);
32074 call_tests++;
32075 des_xmlSchemaTypePtr(n_type, type, 0);
32076 xmlResetLastError();
32077 if (mem_base != xmlMemBlocks()) {
32078 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32079 xmlMemBlocks() - mem_base);
32080 test_ret++;
32081 printf(" %d", n_type);
32082 printf("\n");
32083 }
32084 }
32085#endif
32086
32087 function_tests++;
32088 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032089}
32090
32091
32092static int
32093test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032094 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032095
Daniel Veillard42595322004-11-08 10:52:06 +000032096#ifdef LIBXML_SCHEMAS_ENABLED
32097 xmlSchemaTypePtr ret_val;
32098 xmlSchemaValType type; /* the type of the built in type */
32099 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032100
Daniel Veillard42595322004-11-08 10:52:06 +000032101 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32102 type = gen_xmlSchemaValType(n_type, 0);
32103
32104 ret_val = xmlSchemaGetBuiltInType(type);
32105 desret_xmlSchemaTypePtr(ret_val);
32106 call_tests++;
32107 des_xmlSchemaValType(n_type, type, 0);
32108 xmlResetLastError();
32109 }
32110#endif
32111
32112 function_tests++;
32113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032114}
32115
32116
32117static int
32118test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032120
32121
32122 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032124}
32125
32126
32127static int
32128test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032130
Daniel Veillard42595322004-11-08 10:52:06 +000032131#ifdef LIBXML_SCHEMAS_ENABLED
32132 int mem_base;
32133 xmlSchemaTypePtr ret_val;
32134 xmlChar * name; /* the type name */
32135 int n_name;
32136 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
32137 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032138
Daniel Veillard42595322004-11-08 10:52:06 +000032139 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32140 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
32141 mem_base = xmlMemBlocks();
32142 name = gen_const_xmlChar_ptr(n_name, 0);
32143 ns = gen_const_xmlChar_ptr(n_ns, 1);
32144
32145 ret_val = xmlSchemaGetPredefinedType(name, ns);
32146 desret_xmlSchemaTypePtr(ret_val);
32147 call_tests++;
32148 des_const_xmlChar_ptr(n_name, name, 0);
32149 des_const_xmlChar_ptr(n_ns, ns, 1);
32150 xmlResetLastError();
32151 if (mem_base != xmlMemBlocks()) {
32152 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
32153 xmlMemBlocks() - mem_base);
32154 test_ret++;
32155 printf(" %d", n_name);
32156 printf(" %d", n_ns);
32157 printf("\n");
32158 }
32159 }
32160 }
32161#endif
32162
32163 function_tests++;
32164 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032165}
32166
32167
32168static int
32169test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032171
32172#ifdef LIBXML_SCHEMAS_ENABLED
32173
32174
32175 xmlSchemaInitTypes();
32176 call_tests++;
32177 xmlResetLastError();
32178#endif
32179
Daniel Veillard3d97e662004-11-04 10:49:00 +000032180 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032182}
32183
32184
32185static int
32186test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032188
Daniel Veillardce682bc2004-11-05 17:22:25 +000032189#ifdef LIBXML_SCHEMAS_ENABLED
32190 int mem_base;
32191 int ret_val;
32192 xmlSchemaTypePtr type; /* the built-in type */
32193 int n_type;
32194 int facetType; /* the facet type */
32195 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032196
Daniel Veillardce682bc2004-11-05 17:22:25 +000032197 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32198 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
32199 mem_base = xmlMemBlocks();
32200 type = gen_xmlSchemaTypePtr(n_type, 0);
32201 facetType = gen_int(n_facetType, 1);
32202
32203 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
32204 desret_int(ret_val);
32205 call_tests++;
32206 des_xmlSchemaTypePtr(n_type, type, 0);
32207 des_int(n_facetType, facetType, 1);
32208 xmlResetLastError();
32209 if (mem_base != xmlMemBlocks()) {
32210 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
32211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032212 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032213 printf(" %d", n_type);
32214 printf(" %d", n_facetType);
32215 printf("\n");
32216 }
32217 }
32218 }
32219#endif
32220
32221 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032223}
32224
32225
32226static int
32227test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032229
32230
32231 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032233}
32234
32235
Daniel Veillardce682bc2004-11-05 17:22:25 +000032236#define gen_nb_xmlSchemaValPtr_ptr 1
32237static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32238 return(NULL);
32239}
32240static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32241}
32242
Daniel Veillardd93f6252004-11-02 15:53:51 +000032243static int
32244test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032245 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032246
Daniel Veillardce682bc2004-11-05 17:22:25 +000032247#ifdef LIBXML_SCHEMAS_ENABLED
32248 int mem_base;
32249 int ret_val;
32250 xmlSchemaTypePtr type; /* the predefined type */
32251 int n_type;
32252 xmlChar * value; /* the value to check */
32253 int n_value;
32254 xmlSchemaValPtr * val; /* the return computed value */
32255 int n_val;
32256 xmlNodePtr node; /* the node containing the value */
32257 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032258
Daniel Veillardce682bc2004-11-05 17:22:25 +000032259 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32260 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32261 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32262 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32263 mem_base = xmlMemBlocks();
32264 type = gen_xmlSchemaTypePtr(n_type, 0);
32265 value = gen_const_xmlChar_ptr(n_value, 1);
32266 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32267 node = gen_xmlNodePtr(n_node, 3);
32268
32269 ret_val = xmlSchemaValPredefTypeNode(type, value, val, node);
32270 desret_int(ret_val);
32271 call_tests++;
32272 des_xmlSchemaTypePtr(n_type, type, 0);
32273 des_const_xmlChar_ptr(n_value, value, 1);
32274 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32275 des_xmlNodePtr(n_node, node, 3);
32276 xmlResetLastError();
32277 if (mem_base != xmlMemBlocks()) {
32278 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
32279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032280 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032281 printf(" %d", n_type);
32282 printf(" %d", n_value);
32283 printf(" %d", n_val);
32284 printf(" %d", n_node);
32285 printf("\n");
32286 }
32287 }
32288 }
32289 }
32290 }
32291#endif
32292
32293 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032294 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032295}
32296
32297
32298static int
32299test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032300 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032301
Daniel Veillardce682bc2004-11-05 17:22:25 +000032302#ifdef LIBXML_SCHEMAS_ENABLED
32303 int mem_base;
32304 int ret_val;
32305 xmlSchemaTypePtr type; /* the predefined type */
32306 int n_type;
32307 xmlChar * value; /* the value to check */
32308 int n_value;
32309 xmlSchemaValPtr * val; /* the return computed value */
32310 int n_val;
32311 xmlNodePtr node; /* the node containing the value */
32312 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032313
Daniel Veillardce682bc2004-11-05 17:22:25 +000032314 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32315 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32316 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32317 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32318 mem_base = xmlMemBlocks();
32319 type = gen_xmlSchemaTypePtr(n_type, 0);
32320 value = gen_const_xmlChar_ptr(n_value, 1);
32321 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32322 node = gen_xmlNodePtr(n_node, 3);
32323
32324 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, value, val, node);
32325 desret_int(ret_val);
32326 call_tests++;
32327 des_xmlSchemaTypePtr(n_type, type, 0);
32328 des_const_xmlChar_ptr(n_value, value, 1);
32329 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32330 des_xmlNodePtr(n_node, node, 3);
32331 xmlResetLastError();
32332 if (mem_base != xmlMemBlocks()) {
32333 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
32334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032335 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032336 printf(" %d", n_type);
32337 printf(" %d", n_value);
32338 printf(" %d", n_val);
32339 printf(" %d", n_node);
32340 printf("\n");
32341 }
32342 }
32343 }
32344 }
32345 }
32346#endif
32347
32348 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032350}
32351
32352
32353static int
32354test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032356
Daniel Veillardce682bc2004-11-05 17:22:25 +000032357#ifdef LIBXML_SCHEMAS_ENABLED
32358 int mem_base;
32359 int ret_val;
32360 xmlSchemaTypePtr base; /* the base type */
32361 int n_base;
32362 xmlSchemaFacetPtr facet; /* the facet to check */
32363 int n_facet;
32364 xmlChar * value; /* the lexical repr of the value to validate */
32365 int n_value;
32366 xmlSchemaValPtr val; /* the precomputed value */
32367 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032368
Daniel Veillardce682bc2004-11-05 17:22:25 +000032369 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
32370 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32371 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32372 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32373 mem_base = xmlMemBlocks();
32374 base = gen_xmlSchemaTypePtr(n_base, 0);
32375 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32376 value = gen_const_xmlChar_ptr(n_value, 2);
32377 val = gen_xmlSchemaValPtr(n_val, 3);
32378
32379 ret_val = xmlSchemaValidateFacet(base, facet, value, val);
32380 desret_int(ret_val);
32381 call_tests++;
32382 des_xmlSchemaTypePtr(n_base, base, 0);
32383 des_xmlSchemaFacetPtr(n_facet, facet, 1);
32384 des_const_xmlChar_ptr(n_value, value, 2);
32385 des_xmlSchemaValPtr(n_val, val, 3);
32386 xmlResetLastError();
32387 if (mem_base != xmlMemBlocks()) {
32388 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
32389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032390 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032391 printf(" %d", n_base);
32392 printf(" %d", n_facet);
32393 printf(" %d", n_value);
32394 printf(" %d", n_val);
32395 printf("\n");
32396 }
32397 }
32398 }
32399 }
32400 }
32401#endif
32402
32403 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032405}
32406
32407
32408static int
32409test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032411
Daniel Veillardce682bc2004-11-05 17:22:25 +000032412#ifdef LIBXML_SCHEMAS_ENABLED
32413 int mem_base;
32414 int ret_val;
32415 xmlSchemaTypePtr type; /* the built-in type */
32416 int n_type;
32417 xmlSchemaFacetPtr facet; /* the facet to check */
32418 int n_facet;
32419 xmlChar * value; /* the lexical repr. of the value to be validated */
32420 int n_value;
32421 xmlSchemaValPtr val; /* the precomputed value */
32422 int n_val;
32423 unsigned long * length; /* the actual length of the value */
32424 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032425
Daniel Veillardce682bc2004-11-05 17:22:25 +000032426 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32427 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32428 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32429 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32430 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
32431 mem_base = xmlMemBlocks();
32432 type = gen_xmlSchemaTypePtr(n_type, 0);
32433 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32434 value = gen_const_xmlChar_ptr(n_value, 2);
32435 val = gen_xmlSchemaValPtr(n_val, 3);
32436 length = gen_unsigned_long_ptr(n_length, 4);
32437
32438 ret_val = xmlSchemaValidateLengthFacet(type, facet, value, val, length);
32439 desret_int(ret_val);
32440 call_tests++;
32441 des_xmlSchemaTypePtr(n_type, type, 0);
32442 des_xmlSchemaFacetPtr(n_facet, facet, 1);
32443 des_const_xmlChar_ptr(n_value, value, 2);
32444 des_xmlSchemaValPtr(n_val, val, 3);
32445 des_unsigned_long_ptr(n_length, length, 4);
32446 xmlResetLastError();
32447 if (mem_base != xmlMemBlocks()) {
32448 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
32449 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032450 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032451 printf(" %d", n_type);
32452 printf(" %d", n_facet);
32453 printf(" %d", n_value);
32454 printf(" %d", n_val);
32455 printf(" %d", n_length);
32456 printf("\n");
32457 }
32458 }
32459 }
32460 }
32461 }
32462 }
32463#endif
32464
32465 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032466 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032467}
32468
32469
32470static int
32471test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032472 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032473
Daniel Veillardce682bc2004-11-05 17:22:25 +000032474#ifdef LIBXML_SCHEMAS_ENABLED
32475 int mem_base;
32476 int ret_val;
32477 xmlSchemaFacetPtr facet; /* the facet to check */
32478 int n_facet;
32479 xmlChar * value; /* the lexical repr of the value to validate */
32480 int n_value;
32481 unsigned long actualLen; /* the number of list items */
32482 int n_actualLen;
32483 unsigned long * expectedLen; /* the resulting expected number of list items */
32484 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032485
Daniel Veillardce682bc2004-11-05 17:22:25 +000032486 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32487 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32488 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
32489 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
32490 mem_base = xmlMemBlocks();
32491 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32492 value = gen_const_xmlChar_ptr(n_value, 1);
32493 actualLen = gen_unsigned_long(n_actualLen, 2);
32494 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
32495
32496 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, value, actualLen, expectedLen);
32497 desret_int(ret_val);
32498 call_tests++;
32499 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32500 des_const_xmlChar_ptr(n_value, value, 1);
32501 des_unsigned_long(n_actualLen, actualLen, 2);
32502 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
32503 xmlResetLastError();
32504 if (mem_base != xmlMemBlocks()) {
32505 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
32506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032507 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032508 printf(" %d", n_facet);
32509 printf(" %d", n_value);
32510 printf(" %d", n_actualLen);
32511 printf(" %d", n_expectedLen);
32512 printf("\n");
32513 }
32514 }
32515 }
32516 }
32517 }
32518#endif
32519
32520 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032521 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032522}
32523
32524
32525static int
32526test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032527 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032528
Daniel Veillardce682bc2004-11-05 17:22:25 +000032529#ifdef LIBXML_SCHEMAS_ENABLED
32530 int mem_base;
32531 int ret_val;
32532 xmlSchemaTypePtr type; /* the predefined type */
32533 int n_type;
32534 xmlChar * value; /* the value to check */
32535 int n_value;
32536 xmlSchemaValPtr * val; /* the return computed value */
32537 int n_val;
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_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32541 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32542 mem_base = xmlMemBlocks();
32543 type = gen_xmlSchemaTypePtr(n_type, 0);
32544 value = gen_const_xmlChar_ptr(n_value, 1);
32545 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32546
32547 ret_val = xmlSchemaValidatePredefinedType(type, value, val);
32548 desret_int(ret_val);
32549 call_tests++;
32550 des_xmlSchemaTypePtr(n_type, type, 0);
32551 des_const_xmlChar_ptr(n_value, value, 1);
32552 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32553 xmlResetLastError();
32554 if (mem_base != xmlMemBlocks()) {
32555 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
32556 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032557 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032558 printf(" %d", n_type);
32559 printf(" %d", n_value);
32560 printf(" %d", n_val);
32561 printf("\n");
32562 }
32563 }
32564 }
32565 }
32566#endif
32567
32568 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032570}
32571
32572static int
32573test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032575
Daniel Veillard42595322004-11-08 10:52:06 +000032576 printf("Testing xmlschemastypes : 15 of 19 functions ...\n");
32577 test_ret += test_xmlSchemaCheckFacet();
32578 test_ret += test_xmlSchemaCleanupTypes();
32579 test_ret += test_xmlSchemaCollapseString();
32580 test_ret += test_xmlSchemaCompareValues();
32581 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
32582 test_ret += test_xmlSchemaGetBuiltInType();
32583 test_ret += test_xmlSchemaGetFacetValueAsULong();
32584 test_ret += test_xmlSchemaGetPredefinedType();
32585 test_ret += test_xmlSchemaInitTypes();
32586 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
32587 test_ret += test_xmlSchemaNewFacet();
32588 test_ret += test_xmlSchemaValPredefTypeNode();
32589 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
32590 test_ret += test_xmlSchemaValidateFacet();
32591 test_ret += test_xmlSchemaValidateLengthFacet();
32592 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
32593 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032594
Daniel Veillard42595322004-11-08 10:52:06 +000032595 if (test_ret != 0)
32596 printf("Module xmlschemastypes: %d errors\n", test_ret);
32597 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032598}
32599
32600static int
32601test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032602 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032603
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032604 int mem_base;
32605 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032606 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032607 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032608
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032609 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
32610 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032611 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032612
32613 ret_val = xmlCharStrdup(cur);
32614 desret_xmlChar_ptr(ret_val);
32615 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032616 des_const_char_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032617 xmlResetLastError();
32618 if (mem_base != xmlMemBlocks()) {
32619 printf("Leak of %d blocks found in xmlCharStrdup",
32620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032621 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032622 printf(" %d", n_cur);
32623 printf("\n");
32624 }
32625 }
32626
Daniel Veillard3d97e662004-11-04 10:49:00 +000032627 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032628 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032629}
32630
32631
32632static int
32633test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032634 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032635
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032636 int mem_base;
32637 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032638 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032639 int n_cur;
32640 int len; /* the len of @cur */
32641 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032642
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032643 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
32644 for (n_len = 0;n_len < gen_nb_int;n_len++) {
32645 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032646 cur = gen_const_char_ptr(n_cur, 0);
32647 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032648
32649 ret_val = xmlCharStrndup(cur, len);
32650 desret_xmlChar_ptr(ret_val);
32651 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032652 des_const_char_ptr(n_cur, cur, 0);
32653 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032654 xmlResetLastError();
32655 if (mem_base != xmlMemBlocks()) {
32656 printf("Leak of %d blocks found in xmlCharStrndup",
32657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032658 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032659 printf(" %d", n_cur);
32660 printf(" %d", n_len);
32661 printf("\n");
32662 }
32663 }
32664 }
32665
Daniel Veillard3d97e662004-11-04 10:49:00 +000032666 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032667 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032668}
32669
32670
32671static int
32672test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032673 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032674
Daniel Veillardce682bc2004-11-05 17:22:25 +000032675 int mem_base;
32676 int ret_val;
32677 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
32678 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032679
Daniel Veillardce682bc2004-11-05 17:22:25 +000032680 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
32681 mem_base = xmlMemBlocks();
32682 utf = gen_const_unsigned_char_ptr(n_utf, 0);
32683
32684 ret_val = xmlCheckUTF8(utf);
32685 desret_int(ret_val);
32686 call_tests++;
32687 des_const_unsigned_char_ptr(n_utf, utf, 0);
32688 xmlResetLastError();
32689 if (mem_base != xmlMemBlocks()) {
32690 printf("Leak of %d blocks found in xmlCheckUTF8",
32691 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032692 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032693 printf(" %d", n_utf);
32694 printf("\n");
32695 }
32696 }
32697
32698 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032700}
32701
32702
32703static int
32704test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032706
Daniel Veillardce682bc2004-11-05 17:22:25 +000032707 int mem_base;
32708 int ret_val;
32709 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
32710 int n_utf;
32711 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. */
32712 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032713
Daniel Veillardce682bc2004-11-05 17:22:25 +000032714 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
32715 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
32716 mem_base = xmlMemBlocks();
32717 utf = gen_const_unsigned_char_ptr(n_utf, 0);
32718 len = gen_int_ptr(n_len, 1);
32719
32720 ret_val = xmlGetUTF8Char(utf, len);
32721 desret_int(ret_val);
32722 call_tests++;
32723 des_const_unsigned_char_ptr(n_utf, utf, 0);
32724 des_int_ptr(n_len, len, 1);
32725 xmlResetLastError();
32726 if (mem_base != xmlMemBlocks()) {
32727 printf("Leak of %d blocks found in xmlGetUTF8Char",
32728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032729 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032730 printf(" %d", n_utf);
32731 printf(" %d", n_len);
32732 printf("\n");
32733 }
32734 }
32735 }
32736
32737 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032739}
32740
32741
32742static int
32743test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032745
32746 int mem_base;
32747 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032748 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032749 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032750 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032751 int n_str2;
32752
32753 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
32754 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
32755 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032756 str1 = gen_const_xmlChar_ptr(n_str1, 0);
32757 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032758
32759 ret_val = xmlStrEqual(str1, str2);
32760 desret_int(ret_val);
32761 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032762 des_const_xmlChar_ptr(n_str1, str1, 0);
32763 des_const_xmlChar_ptr(n_str2, str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032764 xmlResetLastError();
32765 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032766 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032768 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032769 printf(" %d", n_str1);
32770 printf(" %d", n_str2);
32771 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032772 }
32773 }
32774 }
32775
Daniel Veillard3d97e662004-11-04 10:49:00 +000032776 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032778}
32779
32780
32781static int
32782test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032784
32785
32786 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032788}
32789
32790
32791static int
32792test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032794
32795 int mem_base;
32796 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032797 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032798 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032799 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032800 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032801 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032802 int n_str;
32803
32804 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
32805 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32806 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
32807 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032808 pref = gen_const_xmlChar_ptr(n_pref, 0);
32809 name = gen_const_xmlChar_ptr(n_name, 1);
32810 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032811
32812 ret_val = xmlStrQEqual(pref, name, str);
32813 desret_int(ret_val);
32814 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032815 des_const_xmlChar_ptr(n_pref, pref, 0);
32816 des_const_xmlChar_ptr(n_name, name, 1);
32817 des_const_xmlChar_ptr(n_str, str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032818 xmlResetLastError();
32819 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032820 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032821 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032822 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032823 printf(" %d", n_pref);
32824 printf(" %d", n_name);
32825 printf(" %d", n_str);
32826 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032827 }
32828 }
32829 }
32830 }
32831
Daniel Veillard3d97e662004-11-04 10:49:00 +000032832 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032834}
32835
32836
32837static int
32838test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032840
32841
32842 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032844}
32845
32846
32847static int
32848test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032850
32851 int mem_base;
32852 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032853 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032854 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032855 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032856 int n_str2;
32857
32858 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
32859 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
32860 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032861 str1 = gen_const_xmlChar_ptr(n_str1, 0);
32862 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032863
32864 ret_val = xmlStrcasecmp(str1, str2);
32865 desret_int(ret_val);
32866 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032867 des_const_xmlChar_ptr(n_str1, str1, 0);
32868 des_const_xmlChar_ptr(n_str2, str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032869 xmlResetLastError();
32870 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032871 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032873 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032874 printf(" %d", n_str1);
32875 printf(" %d", n_str2);
32876 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032877 }
32878 }
32879 }
32880
Daniel Veillard3d97e662004-11-04 10:49:00 +000032881 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032883}
32884
32885
32886static int
32887test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032889
Daniel Veillardd005b9e2004-11-03 17:07:05 +000032890 int mem_base;
32891 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032892 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000032893 int n_str;
32894 xmlChar * val; /* the xmlChar to search (needle) */
32895 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032896
Daniel Veillardd005b9e2004-11-03 17:07:05 +000032897 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
32898 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
32899 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032900 str = gen_const_xmlChar_ptr(n_str, 0);
32901 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000032902
32903 ret_val = xmlStrcasestr(str, val);
32904 desret_const_xmlChar_ptr(ret_val);
32905 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032906 des_const_xmlChar_ptr(n_str, str, 0);
32907 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000032908 xmlResetLastError();
32909 if (mem_base != xmlMemBlocks()) {
32910 printf("Leak of %d blocks found in xmlStrcasestr",
32911 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032912 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000032913 printf(" %d", n_str);
32914 printf(" %d", n_val);
32915 printf("\n");
32916 }
32917 }
32918 }
32919
Daniel Veillard3d97e662004-11-04 10:49:00 +000032920 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032921 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032922}
32923
32924
32925static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000032926test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032927 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032928
Daniel Veillardf2a36f92004-11-08 17:55:01 +000032929 int mem_base;
32930 const xmlChar * ret_val;
32931 xmlChar * str; /* the xmlChar * array */
32932 int n_str;
32933 xmlChar val; /* the xmlChar to search */
32934 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032935
Daniel Veillardf2a36f92004-11-08 17:55:01 +000032936 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
32937 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
32938 mem_base = xmlMemBlocks();
32939 str = gen_const_xmlChar_ptr(n_str, 0);
32940 val = gen_xmlChar(n_val, 1);
32941
32942 ret_val = xmlStrchr(str, val);
32943 desret_const_xmlChar_ptr(ret_val);
32944 call_tests++;
32945 des_const_xmlChar_ptr(n_str, str, 0);
32946 des_xmlChar(n_val, val, 1);
32947 xmlResetLastError();
32948 if (mem_base != xmlMemBlocks()) {
32949 printf("Leak of %d blocks found in xmlStrchr",
32950 xmlMemBlocks() - mem_base);
32951 test_ret++;
32952 printf(" %d", n_str);
32953 printf(" %d", n_val);
32954 printf("\n");
32955 }
32956 }
32957 }
32958
32959 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032961}
32962
32963
32964static int
32965test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032967
32968 int mem_base;
32969 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032970 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032971 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032972 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032973 int n_str2;
32974
32975 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
32976 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
32977 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032978 str1 = gen_const_xmlChar_ptr(n_str1, 0);
32979 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032980
32981 ret_val = xmlStrcmp(str1, str2);
32982 desret_int(ret_val);
32983 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000032984 des_const_xmlChar_ptr(n_str1, str1, 0);
32985 des_const_xmlChar_ptr(n_str2, str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032986 xmlResetLastError();
32987 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032988 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032989 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032990 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032991 printf(" %d", n_str1);
32992 printf(" %d", n_str2);
32993 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032994 }
32995 }
32996 }
32997
Daniel Veillard3d97e662004-11-04 10:49:00 +000032998 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033000}
33001
33002
33003static int
33004test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033006
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033007 int mem_base;
33008 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033009 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033010 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033011
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033012 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33013 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033014 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033015
33016 ret_val = xmlStrdup(cur);
33017 desret_xmlChar_ptr(ret_val);
33018 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033019 des_const_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033020 xmlResetLastError();
33021 if (mem_base != xmlMemBlocks()) {
33022 printf("Leak of %d blocks found in xmlStrdup",
33023 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033024 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033025 printf(" %d", n_cur);
33026 printf("\n");
33027 }
33028 }
33029
Daniel Veillard3d97e662004-11-04 10:49:00 +000033030 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033031 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033032}
33033
33034
33035static int
33036test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033037 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033038
33039 int mem_base;
33040 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033041 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033042 int n_str;
33043
33044 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33045 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033046 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033047
33048 ret_val = xmlStrlen(str);
33049 desret_int(ret_val);
33050 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033051 des_const_xmlChar_ptr(n_str, str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033052 xmlResetLastError();
33053 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033054 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033055 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033056 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033057 printf(" %d", n_str);
33058 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033059 }
33060 }
33061
Daniel Veillard3d97e662004-11-04 10:49:00 +000033062 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033064}
33065
33066
33067static int
33068test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033070
33071 int mem_base;
33072 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033073 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033074 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033075 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033076 int n_str2;
33077 int len; /* the max comparison length */
33078 int n_len;
33079
33080 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33081 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33082 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33083 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033084 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33085 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33086 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033087
33088 ret_val = xmlStrncasecmp(str1, str2, len);
33089 desret_int(ret_val);
33090 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033091 des_const_xmlChar_ptr(n_str1, str1, 0);
33092 des_const_xmlChar_ptr(n_str2, str2, 1);
33093 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033094 xmlResetLastError();
33095 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033096 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033098 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033099 printf(" %d", n_str1);
33100 printf(" %d", n_str2);
33101 printf(" %d", n_len);
33102 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033103 }
33104 }
33105 }
33106 }
33107
Daniel Veillard3d97e662004-11-04 10:49:00 +000033108 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033109 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033110}
33111
33112
33113static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033114test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033115 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033116
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033117 int mem_base;
33118 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033119 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033120 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033121 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033122 int n_str2;
33123 int len; /* the len of @str2 */
33124 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033125
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033126 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33127 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33128 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33129 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033130 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33131 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33132 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033133
33134 ret_val = xmlStrncatNew(str1, str2, len);
33135 desret_xmlChar_ptr(ret_val);
33136 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033137 des_const_xmlChar_ptr(n_str1, str1, 0);
33138 des_const_xmlChar_ptr(n_str2, str2, 1);
33139 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033140 xmlResetLastError();
33141 if (mem_base != xmlMemBlocks()) {
33142 printf("Leak of %d blocks found in xmlStrncatNew",
33143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033144 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033145 printf(" %d", n_str1);
33146 printf(" %d", n_str2);
33147 printf(" %d", n_len);
33148 printf("\n");
33149 }
33150 }
33151 }
33152 }
33153
Daniel Veillard3d97e662004-11-04 10:49:00 +000033154 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033156}
33157
33158
33159static int
33160test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033162
33163 int mem_base;
33164 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033165 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033166 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033167 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033168 int n_str2;
33169 int len; /* the max comparison length */
33170 int n_len;
33171
33172 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33173 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33174 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33175 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033176 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33177 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33178 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033179
33180 ret_val = xmlStrncmp(str1, str2, len);
33181 desret_int(ret_val);
33182 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033183 des_const_xmlChar_ptr(n_str1, str1, 0);
33184 des_const_xmlChar_ptr(n_str2, str2, 1);
33185 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033186 xmlResetLastError();
33187 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033188 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033190 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033191 printf(" %d", n_str1);
33192 printf(" %d", n_str2);
33193 printf(" %d", n_len);
33194 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033195 }
33196 }
33197 }
33198 }
33199
Daniel Veillard3d97e662004-11-04 10:49:00 +000033200 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033201 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033202}
33203
33204
33205static int
33206test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033208
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033209 int mem_base;
33210 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033211 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033212 int n_cur;
33213 int len; /* the len of @cur */
33214 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033215
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033216 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33217 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33218 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033219 cur = gen_const_xmlChar_ptr(n_cur, 0);
33220 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033221
33222 ret_val = xmlStrndup(cur, len);
33223 desret_xmlChar_ptr(ret_val);
33224 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033225 des_const_xmlChar_ptr(n_cur, cur, 0);
33226 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033227 xmlResetLastError();
33228 if (mem_base != xmlMemBlocks()) {
33229 printf("Leak of %d blocks found in xmlStrndup",
33230 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033231 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033232 printf(" %d", n_cur);
33233 printf(" %d", n_len);
33234 printf("\n");
33235 }
33236 }
33237 }
33238
Daniel Veillard3d97e662004-11-04 10:49:00 +000033239 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033241}
33242
33243
33244static int
33245test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033247
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033248 int mem_base;
33249 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033250 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033251 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033252 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033253 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033254
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033255 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33256 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
33257 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033258 str = gen_const_xmlChar_ptr(n_str, 0);
33259 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033260
33261 ret_val = xmlStrstr(str, val);
33262 desret_const_xmlChar_ptr(ret_val);
33263 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033264 des_const_xmlChar_ptr(n_str, str, 0);
33265 des_const_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033266 xmlResetLastError();
33267 if (mem_base != xmlMemBlocks()) {
33268 printf("Leak of %d blocks found in xmlStrstr",
33269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033270 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033271 printf(" %d", n_str);
33272 printf(" %d", n_val);
33273 printf("\n");
33274 }
33275 }
33276 }
33277
Daniel Veillard3d97e662004-11-04 10:49:00 +000033278 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033279 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033280}
33281
33282
33283static int
33284test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033285 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033286
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033287 int mem_base;
33288 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033289 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033290 int n_str;
33291 int start; /* the index of the first char (zero based) */
33292 int n_start;
33293 int len; /* the length of the substring */
33294 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033295
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033296 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33297 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33298 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33299 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033300 str = gen_const_xmlChar_ptr(n_str, 0);
33301 start = gen_int(n_start, 1);
33302 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033303
33304 ret_val = xmlStrsub(str, start, len);
33305 desret_xmlChar_ptr(ret_val);
33306 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033307 des_const_xmlChar_ptr(n_str, str, 0);
33308 des_int(n_start, start, 1);
33309 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033310 xmlResetLastError();
33311 if (mem_base != xmlMemBlocks()) {
33312 printf("Leak of %d blocks found in xmlStrsub",
33313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033314 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033315 printf(" %d", n_str);
33316 printf(" %d", n_start);
33317 printf(" %d", n_len);
33318 printf("\n");
33319 }
33320 }
33321 }
33322 }
33323
Daniel Veillard3d97e662004-11-04 10:49:00 +000033324 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033325 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033326}
33327
33328
33329static int
33330test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033331 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033332
33333 int mem_base;
33334 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033335 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033336 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033337 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033338 int n_utf2;
33339
33340 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
33341 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
33342 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033343 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
33344 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033345
33346 ret_val = xmlUTF8Charcmp(utf1, utf2);
33347 desret_int(ret_val);
33348 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033349 des_const_xmlChar_ptr(n_utf1, utf1, 0);
33350 des_const_xmlChar_ptr(n_utf2, utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033351 xmlResetLastError();
33352 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033353 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033355 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033356 printf(" %d", n_utf1);
33357 printf(" %d", n_utf2);
33358 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033359 }
33360 }
33361 }
33362
Daniel Veillard3d97e662004-11-04 10:49:00 +000033363 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033364 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033365}
33366
33367
33368static int
33369test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033370 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033371
33372 int mem_base;
33373 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033374 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033375 int n_utf;
33376
33377 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33378 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033379 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033380
33381 ret_val = xmlUTF8Size(utf);
33382 desret_int(ret_val);
33383 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033384 des_const_xmlChar_ptr(n_utf, utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033385 xmlResetLastError();
33386 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033387 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033389 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033390 printf(" %d", n_utf);
33391 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033392 }
33393 }
33394
Daniel Veillard3d97e662004-11-04 10:49:00 +000033395 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033397}
33398
33399
33400static int
33401test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033403
33404 int mem_base;
33405 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033406 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033407 int n_utf;
33408
33409 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33410 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033411 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033412
33413 ret_val = xmlUTF8Strlen(utf);
33414 desret_int(ret_val);
33415 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033416 des_const_xmlChar_ptr(n_utf, utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033417 xmlResetLastError();
33418 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033419 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033421 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033422 printf(" %d", n_utf);
33423 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033424 }
33425 }
33426
Daniel Veillard3d97e662004-11-04 10:49:00 +000033427 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033429}
33430
33431
33432static int
33433test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033435
33436 int mem_base;
33437 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033438 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033439 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033440 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033441 int n_utfchar;
33442
33443 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33444 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
33445 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033446 utf = gen_const_xmlChar_ptr(n_utf, 0);
33447 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033448
33449 ret_val = xmlUTF8Strloc(utf, utfchar);
33450 desret_int(ret_val);
33451 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033452 des_const_xmlChar_ptr(n_utf, utf, 0);
33453 des_const_xmlChar_ptr(n_utfchar, utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033454 xmlResetLastError();
33455 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033456 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033457 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033458 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033459 printf(" %d", n_utf);
33460 printf(" %d", n_utfchar);
33461 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033462 }
33463 }
33464 }
33465
Daniel Veillard3d97e662004-11-04 10:49:00 +000033466 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033467 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033468}
33469
33470
33471static int
33472test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033473 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033474
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033475 int mem_base;
33476 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033477 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033478 int n_utf;
33479 int len; /* the len of @utf (in chars) */
33480 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033481
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033482 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33483 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33484 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033485 utf = gen_const_xmlChar_ptr(n_utf, 0);
33486 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033487
33488 ret_val = xmlUTF8Strndup(utf, len);
33489 desret_xmlChar_ptr(ret_val);
33490 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033491 des_const_xmlChar_ptr(n_utf, utf, 0);
33492 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033493 xmlResetLastError();
33494 if (mem_base != xmlMemBlocks()) {
33495 printf("Leak of %d blocks found in xmlUTF8Strndup",
33496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033497 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033498 printf(" %d", n_utf);
33499 printf(" %d", n_len);
33500 printf("\n");
33501 }
33502 }
33503 }
33504
Daniel Veillard3d97e662004-11-04 10:49:00 +000033505 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033507}
33508
33509
33510static int
33511test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033513
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033514 int mem_base;
33515 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033516 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033517 int n_utf;
33518 int pos; /* the position of the desired UTF8 char (in chars) */
33519 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033520
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033521 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33522 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
33523 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033524 utf = gen_const_xmlChar_ptr(n_utf, 0);
33525 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033526
33527 ret_val = xmlUTF8Strpos(utf, pos);
33528 desret_const_xmlChar_ptr(ret_val);
33529 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033530 des_const_xmlChar_ptr(n_utf, utf, 0);
33531 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033532 xmlResetLastError();
33533 if (mem_base != xmlMemBlocks()) {
33534 printf("Leak of %d blocks found in xmlUTF8Strpos",
33535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033536 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033537 printf(" %d", n_utf);
33538 printf(" %d", n_pos);
33539 printf("\n");
33540 }
33541 }
33542 }
33543
Daniel Veillard3d97e662004-11-04 10:49:00 +000033544 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033545 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033546}
33547
33548
33549static int
33550test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033551 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033552
33553 int mem_base;
33554 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033555 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033556 int n_utf;
33557 int len; /* the number of characters in the array */
33558 int n_len;
33559
33560 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33561 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33562 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033563 utf = gen_const_xmlChar_ptr(n_utf, 0);
33564 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033565
33566 ret_val = xmlUTF8Strsize(utf, len);
33567 desret_int(ret_val);
33568 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033569 des_const_xmlChar_ptr(n_utf, utf, 0);
33570 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033571 xmlResetLastError();
33572 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033573 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033575 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033576 printf(" %d", n_utf);
33577 printf(" %d", n_len);
33578 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033579 }
33580 }
33581 }
33582
Daniel Veillard3d97e662004-11-04 10:49:00 +000033583 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033584 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033585}
33586
33587
33588static int
33589test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033591
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033592 int mem_base;
33593 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033594 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033595 int n_utf;
33596 int start; /* relative pos of first char */
33597 int n_start;
33598 int len; /* total number to copy */
33599 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033600
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033601 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33602 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33603 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33604 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033605 utf = gen_const_xmlChar_ptr(n_utf, 0);
33606 start = gen_int(n_start, 1);
33607 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033608
33609 ret_val = xmlUTF8Strsub(utf, start, len);
33610 desret_xmlChar_ptr(ret_val);
33611 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000033612 des_const_xmlChar_ptr(n_utf, utf, 0);
33613 des_int(n_start, start, 1);
33614 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033615 xmlResetLastError();
33616 if (mem_base != xmlMemBlocks()) {
33617 printf("Leak of %d blocks found in xmlUTF8Strsub",
33618 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033619 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033620 printf(" %d", n_utf);
33621 printf(" %d", n_start);
33622 printf(" %d", n_len);
33623 printf("\n");
33624 }
33625 }
33626 }
33627 }
33628
Daniel Veillard3d97e662004-11-04 10:49:00 +000033629 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033631}
33632
33633static int
33634test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033636
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033637 printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000033638 test_ret += test_xmlCharStrdup();
33639 test_ret += test_xmlCharStrndup();
33640 test_ret += test_xmlCheckUTF8();
33641 test_ret += test_xmlGetUTF8Char();
33642 test_ret += test_xmlStrEqual();
33643 test_ret += test_xmlStrPrintf();
33644 test_ret += test_xmlStrQEqual();
33645 test_ret += test_xmlStrVPrintf();
33646 test_ret += test_xmlStrcasecmp();
33647 test_ret += test_xmlStrcasestr();
33648 test_ret += test_xmlStrchr();
33649 test_ret += test_xmlStrcmp();
33650 test_ret += test_xmlStrdup();
33651 test_ret += test_xmlStrlen();
33652 test_ret += test_xmlStrncasecmp();
33653 test_ret += test_xmlStrncatNew();
33654 test_ret += test_xmlStrncmp();
33655 test_ret += test_xmlStrndup();
33656 test_ret += test_xmlStrstr();
33657 test_ret += test_xmlStrsub();
33658 test_ret += test_xmlUTF8Charcmp();
33659 test_ret += test_xmlUTF8Size();
33660 test_ret += test_xmlUTF8Strlen();
33661 test_ret += test_xmlUTF8Strloc();
33662 test_ret += test_xmlUTF8Strndup();
33663 test_ret += test_xmlUTF8Strpos();
33664 test_ret += test_xmlUTF8Strsize();
33665 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000033666
Daniel Veillard42595322004-11-08 10:52:06 +000033667 if (test_ret != 0)
33668 printf("Module xmlstring: %d errors\n", test_ret);
33669 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033670}
33671
33672static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033673test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033674 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033675
33676#ifdef LIBXML_UNICODE_ENABLED
33677 int mem_base;
33678 int ret_val;
33679 int code; /* UCS code point */
33680 int n_code;
33681
33682 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33683 mem_base = xmlMemBlocks();
33684 code = gen_int(n_code, 0);
33685
33686 ret_val = xmlUCSIsAegeanNumbers(code);
33687 desret_int(ret_val);
33688 call_tests++;
33689 des_int(n_code, code, 0);
33690 xmlResetLastError();
33691 if (mem_base != xmlMemBlocks()) {
33692 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
33693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033694 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033695 printf(" %d", n_code);
33696 printf("\n");
33697 }
33698 }
33699#endif
33700
33701 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033702 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033703}
33704
33705
33706static int
33707test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033708 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033709
33710#ifdef LIBXML_UNICODE_ENABLED
33711 int mem_base;
33712 int ret_val;
33713 int code; /* UCS code point */
33714 int n_code;
33715
33716 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33717 mem_base = xmlMemBlocks();
33718 code = gen_int(n_code, 0);
33719
33720 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
33721 desret_int(ret_val);
33722 call_tests++;
33723 des_int(n_code, code, 0);
33724 xmlResetLastError();
33725 if (mem_base != xmlMemBlocks()) {
33726 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
33727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033728 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033729 printf(" %d", n_code);
33730 printf("\n");
33731 }
33732 }
33733#endif
33734
33735 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033736 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033737}
33738
33739
33740static int
33741test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033742 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033743
33744#ifdef LIBXML_UNICODE_ENABLED
33745 int mem_base;
33746 int ret_val;
33747 int code; /* UCS code point */
33748 int n_code;
33749
33750 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33751 mem_base = xmlMemBlocks();
33752 code = gen_int(n_code, 0);
33753
33754 ret_val = xmlUCSIsArabic(code);
33755 desret_int(ret_val);
33756 call_tests++;
33757 des_int(n_code, code, 0);
33758 xmlResetLastError();
33759 if (mem_base != xmlMemBlocks()) {
33760 printf("Leak of %d blocks found in xmlUCSIsArabic",
33761 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033762 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033763 printf(" %d", n_code);
33764 printf("\n");
33765 }
33766 }
33767#endif
33768
33769 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033770 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033771}
33772
33773
33774static int
33775test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033776 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033777
33778#ifdef LIBXML_UNICODE_ENABLED
33779 int mem_base;
33780 int ret_val;
33781 int code; /* UCS code point */
33782 int n_code;
33783
33784 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33785 mem_base = xmlMemBlocks();
33786 code = gen_int(n_code, 0);
33787
33788 ret_val = xmlUCSIsArabicPresentationFormsA(code);
33789 desret_int(ret_val);
33790 call_tests++;
33791 des_int(n_code, code, 0);
33792 xmlResetLastError();
33793 if (mem_base != xmlMemBlocks()) {
33794 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
33795 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033796 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033797 printf(" %d", n_code);
33798 printf("\n");
33799 }
33800 }
33801#endif
33802
33803 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033804 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033805}
33806
33807
33808static int
33809test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033810 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033811
33812#ifdef LIBXML_UNICODE_ENABLED
33813 int mem_base;
33814 int ret_val;
33815 int code; /* UCS code point */
33816 int n_code;
33817
33818 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33819 mem_base = xmlMemBlocks();
33820 code = gen_int(n_code, 0);
33821
33822 ret_val = xmlUCSIsArabicPresentationFormsB(code);
33823 desret_int(ret_val);
33824 call_tests++;
33825 des_int(n_code, code, 0);
33826 xmlResetLastError();
33827 if (mem_base != xmlMemBlocks()) {
33828 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
33829 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033830 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033831 printf(" %d", n_code);
33832 printf("\n");
33833 }
33834 }
33835#endif
33836
33837 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033838 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033839}
33840
33841
33842static int
33843test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033844 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033845
33846#ifdef LIBXML_UNICODE_ENABLED
33847 int mem_base;
33848 int ret_val;
33849 int code; /* UCS code point */
33850 int n_code;
33851
33852 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33853 mem_base = xmlMemBlocks();
33854 code = gen_int(n_code, 0);
33855
33856 ret_val = xmlUCSIsArmenian(code);
33857 desret_int(ret_val);
33858 call_tests++;
33859 des_int(n_code, code, 0);
33860 xmlResetLastError();
33861 if (mem_base != xmlMemBlocks()) {
33862 printf("Leak of %d blocks found in xmlUCSIsArmenian",
33863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033864 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033865 printf(" %d", n_code);
33866 printf("\n");
33867 }
33868 }
33869#endif
33870
33871 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033872 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033873}
33874
33875
33876static int
33877test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033878 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033879
33880#ifdef LIBXML_UNICODE_ENABLED
33881 int mem_base;
33882 int ret_val;
33883 int code; /* UCS code point */
33884 int n_code;
33885
33886 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33887 mem_base = xmlMemBlocks();
33888 code = gen_int(n_code, 0);
33889
33890 ret_val = xmlUCSIsArrows(code);
33891 desret_int(ret_val);
33892 call_tests++;
33893 des_int(n_code, code, 0);
33894 xmlResetLastError();
33895 if (mem_base != xmlMemBlocks()) {
33896 printf("Leak of %d blocks found in xmlUCSIsArrows",
33897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033898 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033899 printf(" %d", n_code);
33900 printf("\n");
33901 }
33902 }
33903#endif
33904
33905 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033906 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033907}
33908
33909
33910static int
33911test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033912 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033913
33914#ifdef LIBXML_UNICODE_ENABLED
33915 int mem_base;
33916 int ret_val;
33917 int code; /* UCS code point */
33918 int n_code;
33919
33920 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33921 mem_base = xmlMemBlocks();
33922 code = gen_int(n_code, 0);
33923
33924 ret_val = xmlUCSIsBasicLatin(code);
33925 desret_int(ret_val);
33926 call_tests++;
33927 des_int(n_code, code, 0);
33928 xmlResetLastError();
33929 if (mem_base != xmlMemBlocks()) {
33930 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
33931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033932 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033933 printf(" %d", n_code);
33934 printf("\n");
33935 }
33936 }
33937#endif
33938
33939 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033940 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033941}
33942
33943
33944static int
33945test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033946 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033947
33948#ifdef LIBXML_UNICODE_ENABLED
33949 int mem_base;
33950 int ret_val;
33951 int code; /* UCS code point */
33952 int n_code;
33953
33954 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33955 mem_base = xmlMemBlocks();
33956 code = gen_int(n_code, 0);
33957
33958 ret_val = xmlUCSIsBengali(code);
33959 desret_int(ret_val);
33960 call_tests++;
33961 des_int(n_code, code, 0);
33962 xmlResetLastError();
33963 if (mem_base != xmlMemBlocks()) {
33964 printf("Leak of %d blocks found in xmlUCSIsBengali",
33965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033966 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033967 printf(" %d", n_code);
33968 printf("\n");
33969 }
33970 }
33971#endif
33972
33973 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033974 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033975}
33976
33977
33978static int
33979test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033980 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033981
33982#ifdef LIBXML_UNICODE_ENABLED
33983 int mem_base;
33984 int ret_val;
33985 int code; /* UCS code point */
33986 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033987 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033988 int n_block;
33989
33990 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33991 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
33992 mem_base = xmlMemBlocks();
33993 code = gen_int(n_code, 0);
33994 block = gen_const_char_ptr(n_block, 1);
33995
33996 ret_val = xmlUCSIsBlock(code, block);
33997 desret_int(ret_val);
33998 call_tests++;
33999 des_int(n_code, code, 0);
34000 des_const_char_ptr(n_block, block, 1);
34001 xmlResetLastError();
34002 if (mem_base != xmlMemBlocks()) {
34003 printf("Leak of %d blocks found in xmlUCSIsBlock",
34004 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034005 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034006 printf(" %d", n_code);
34007 printf(" %d", n_block);
34008 printf("\n");
34009 }
34010 }
34011 }
34012#endif
34013
34014 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034015 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034016}
34017
34018
34019static int
34020test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034021 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034022
34023#ifdef LIBXML_UNICODE_ENABLED
34024 int mem_base;
34025 int ret_val;
34026 int code; /* UCS code point */
34027 int n_code;
34028
34029 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34030 mem_base = xmlMemBlocks();
34031 code = gen_int(n_code, 0);
34032
34033 ret_val = xmlUCSIsBlockElements(code);
34034 desret_int(ret_val);
34035 call_tests++;
34036 des_int(n_code, code, 0);
34037 xmlResetLastError();
34038 if (mem_base != xmlMemBlocks()) {
34039 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
34040 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034041 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034042 printf(" %d", n_code);
34043 printf("\n");
34044 }
34045 }
34046#endif
34047
34048 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034049 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034050}
34051
34052
34053static int
34054test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034055 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034056
34057#ifdef LIBXML_UNICODE_ENABLED
34058 int mem_base;
34059 int ret_val;
34060 int code; /* UCS code point */
34061 int n_code;
34062
34063 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34064 mem_base = xmlMemBlocks();
34065 code = gen_int(n_code, 0);
34066
34067 ret_val = xmlUCSIsBopomofo(code);
34068 desret_int(ret_val);
34069 call_tests++;
34070 des_int(n_code, code, 0);
34071 xmlResetLastError();
34072 if (mem_base != xmlMemBlocks()) {
34073 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
34074 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034075 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034076 printf(" %d", n_code);
34077 printf("\n");
34078 }
34079 }
34080#endif
34081
34082 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034083 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034084}
34085
34086
34087static int
34088test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034089 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034090
34091#ifdef LIBXML_UNICODE_ENABLED
34092 int mem_base;
34093 int ret_val;
34094 int code; /* UCS code point */
34095 int n_code;
34096
34097 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34098 mem_base = xmlMemBlocks();
34099 code = gen_int(n_code, 0);
34100
34101 ret_val = xmlUCSIsBopomofoExtended(code);
34102 desret_int(ret_val);
34103 call_tests++;
34104 des_int(n_code, code, 0);
34105 xmlResetLastError();
34106 if (mem_base != xmlMemBlocks()) {
34107 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
34108 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034109 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034110 printf(" %d", n_code);
34111 printf("\n");
34112 }
34113 }
34114#endif
34115
34116 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034117 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034118}
34119
34120
34121static int
34122test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034123 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034124
34125#ifdef LIBXML_UNICODE_ENABLED
34126 int mem_base;
34127 int ret_val;
34128 int code; /* UCS code point */
34129 int n_code;
34130
34131 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34132 mem_base = xmlMemBlocks();
34133 code = gen_int(n_code, 0);
34134
34135 ret_val = xmlUCSIsBoxDrawing(code);
34136 desret_int(ret_val);
34137 call_tests++;
34138 des_int(n_code, code, 0);
34139 xmlResetLastError();
34140 if (mem_base != xmlMemBlocks()) {
34141 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
34142 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034143 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034144 printf(" %d", n_code);
34145 printf("\n");
34146 }
34147 }
34148#endif
34149
34150 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034151 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034152}
34153
34154
34155static int
34156test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034157 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034158
34159#ifdef LIBXML_UNICODE_ENABLED
34160 int mem_base;
34161 int ret_val;
34162 int code; /* UCS code point */
34163 int n_code;
34164
34165 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34166 mem_base = xmlMemBlocks();
34167 code = gen_int(n_code, 0);
34168
34169 ret_val = xmlUCSIsBraillePatterns(code);
34170 desret_int(ret_val);
34171 call_tests++;
34172 des_int(n_code, code, 0);
34173 xmlResetLastError();
34174 if (mem_base != xmlMemBlocks()) {
34175 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
34176 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034177 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034178 printf(" %d", n_code);
34179 printf("\n");
34180 }
34181 }
34182#endif
34183
34184 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034185 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034186}
34187
34188
34189static int
34190test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034191 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034192
34193#ifdef LIBXML_UNICODE_ENABLED
34194 int mem_base;
34195 int ret_val;
34196 int code; /* UCS code point */
34197 int n_code;
34198
34199 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34200 mem_base = xmlMemBlocks();
34201 code = gen_int(n_code, 0);
34202
34203 ret_val = xmlUCSIsBuhid(code);
34204 desret_int(ret_val);
34205 call_tests++;
34206 des_int(n_code, code, 0);
34207 xmlResetLastError();
34208 if (mem_base != xmlMemBlocks()) {
34209 printf("Leak of %d blocks found in xmlUCSIsBuhid",
34210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034211 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034212 printf(" %d", n_code);
34213 printf("\n");
34214 }
34215 }
34216#endif
34217
34218 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034219 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034220}
34221
34222
34223static int
34224test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034225 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034226
34227#ifdef LIBXML_UNICODE_ENABLED
34228 int mem_base;
34229 int ret_val;
34230 int code; /* UCS code point */
34231 int n_code;
34232
34233 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34234 mem_base = xmlMemBlocks();
34235 code = gen_int(n_code, 0);
34236
34237 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
34238 desret_int(ret_val);
34239 call_tests++;
34240 des_int(n_code, code, 0);
34241 xmlResetLastError();
34242 if (mem_base != xmlMemBlocks()) {
34243 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
34244 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034245 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034246 printf(" %d", n_code);
34247 printf("\n");
34248 }
34249 }
34250#endif
34251
34252 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034253 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034254}
34255
34256
34257static int
34258test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034259 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034260
34261#ifdef LIBXML_UNICODE_ENABLED
34262 int mem_base;
34263 int ret_val;
34264 int code; /* UCS code point */
34265 int n_code;
34266
34267 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34268 mem_base = xmlMemBlocks();
34269 code = gen_int(n_code, 0);
34270
34271 ret_val = xmlUCSIsCJKCompatibility(code);
34272 desret_int(ret_val);
34273 call_tests++;
34274 des_int(n_code, code, 0);
34275 xmlResetLastError();
34276 if (mem_base != xmlMemBlocks()) {
34277 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
34278 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034279 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034280 printf(" %d", n_code);
34281 printf("\n");
34282 }
34283 }
34284#endif
34285
34286 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034287 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034288}
34289
34290
34291static int
34292test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034293 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034294
34295#ifdef LIBXML_UNICODE_ENABLED
34296 int mem_base;
34297 int ret_val;
34298 int code; /* UCS code point */
34299 int n_code;
34300
34301 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34302 mem_base = xmlMemBlocks();
34303 code = gen_int(n_code, 0);
34304
34305 ret_val = xmlUCSIsCJKCompatibilityForms(code);
34306 desret_int(ret_val);
34307 call_tests++;
34308 des_int(n_code, code, 0);
34309 xmlResetLastError();
34310 if (mem_base != xmlMemBlocks()) {
34311 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
34312 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034313 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034314 printf(" %d", n_code);
34315 printf("\n");
34316 }
34317 }
34318#endif
34319
34320 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034321 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034322}
34323
34324
34325static int
34326test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034327 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034328
34329#ifdef LIBXML_UNICODE_ENABLED
34330 int mem_base;
34331 int ret_val;
34332 int code; /* UCS code point */
34333 int n_code;
34334
34335 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34336 mem_base = xmlMemBlocks();
34337 code = gen_int(n_code, 0);
34338
34339 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
34340 desret_int(ret_val);
34341 call_tests++;
34342 des_int(n_code, code, 0);
34343 xmlResetLastError();
34344 if (mem_base != xmlMemBlocks()) {
34345 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
34346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034347 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034348 printf(" %d", n_code);
34349 printf("\n");
34350 }
34351 }
34352#endif
34353
34354 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034355 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034356}
34357
34358
34359static int
34360test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034361 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034362
34363#ifdef LIBXML_UNICODE_ENABLED
34364 int mem_base;
34365 int ret_val;
34366 int code; /* UCS code point */
34367 int n_code;
34368
34369 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34370 mem_base = xmlMemBlocks();
34371 code = gen_int(n_code, 0);
34372
34373 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
34374 desret_int(ret_val);
34375 call_tests++;
34376 des_int(n_code, code, 0);
34377 xmlResetLastError();
34378 if (mem_base != xmlMemBlocks()) {
34379 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
34380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034381 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034382 printf(" %d", n_code);
34383 printf("\n");
34384 }
34385 }
34386#endif
34387
34388 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034389 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034390}
34391
34392
34393static int
34394test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034395 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034396
34397#ifdef LIBXML_UNICODE_ENABLED
34398 int mem_base;
34399 int ret_val;
34400 int code; /* UCS code point */
34401 int n_code;
34402
34403 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34404 mem_base = xmlMemBlocks();
34405 code = gen_int(n_code, 0);
34406
34407 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
34408 desret_int(ret_val);
34409 call_tests++;
34410 des_int(n_code, code, 0);
34411 xmlResetLastError();
34412 if (mem_base != xmlMemBlocks()) {
34413 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
34414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034415 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034416 printf(" %d", n_code);
34417 printf("\n");
34418 }
34419 }
34420#endif
34421
34422 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034423 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034424}
34425
34426
34427static int
34428test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034429 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034430
34431#ifdef LIBXML_UNICODE_ENABLED
34432 int mem_base;
34433 int ret_val;
34434 int code; /* UCS code point */
34435 int n_code;
34436
34437 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34438 mem_base = xmlMemBlocks();
34439 code = gen_int(n_code, 0);
34440
34441 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
34442 desret_int(ret_val);
34443 call_tests++;
34444 des_int(n_code, code, 0);
34445 xmlResetLastError();
34446 if (mem_base != xmlMemBlocks()) {
34447 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
34448 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034449 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034450 printf(" %d", n_code);
34451 printf("\n");
34452 }
34453 }
34454#endif
34455
34456 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034457 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034458}
34459
34460
34461static int
34462test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034463 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034464
34465#ifdef LIBXML_UNICODE_ENABLED
34466 int mem_base;
34467 int ret_val;
34468 int code; /* UCS code point */
34469 int n_code;
34470
34471 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34472 mem_base = xmlMemBlocks();
34473 code = gen_int(n_code, 0);
34474
34475 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
34476 desret_int(ret_val);
34477 call_tests++;
34478 des_int(n_code, code, 0);
34479 xmlResetLastError();
34480 if (mem_base != xmlMemBlocks()) {
34481 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
34482 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034483 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034484 printf(" %d", n_code);
34485 printf("\n");
34486 }
34487 }
34488#endif
34489
34490 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034491 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034492}
34493
34494
34495static int
34496test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034497 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034498
34499#ifdef LIBXML_UNICODE_ENABLED
34500 int mem_base;
34501 int ret_val;
34502 int code; /* UCS code point */
34503 int n_code;
34504
34505 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34506 mem_base = xmlMemBlocks();
34507 code = gen_int(n_code, 0);
34508
34509 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
34510 desret_int(ret_val);
34511 call_tests++;
34512 des_int(n_code, code, 0);
34513 xmlResetLastError();
34514 if (mem_base != xmlMemBlocks()) {
34515 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
34516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034517 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034518 printf(" %d", n_code);
34519 printf("\n");
34520 }
34521 }
34522#endif
34523
34524 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034525 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034526}
34527
34528
34529static int
34530test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034531 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034532
34533#ifdef LIBXML_UNICODE_ENABLED
34534 int mem_base;
34535 int ret_val;
34536 int code; /* UCS code point */
34537 int n_code;
34538
34539 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34540 mem_base = xmlMemBlocks();
34541 code = gen_int(n_code, 0);
34542
34543 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
34544 desret_int(ret_val);
34545 call_tests++;
34546 des_int(n_code, code, 0);
34547 xmlResetLastError();
34548 if (mem_base != xmlMemBlocks()) {
34549 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
34550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034551 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034552 printf(" %d", n_code);
34553 printf("\n");
34554 }
34555 }
34556#endif
34557
34558 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034559 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034560}
34561
34562
34563static int
34564test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034565 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034566
34567#ifdef LIBXML_UNICODE_ENABLED
34568 int mem_base;
34569 int ret_val;
34570 int code; /* UCS code point */
34571 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034572 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034573 int n_cat;
34574
34575 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34576 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
34577 mem_base = xmlMemBlocks();
34578 code = gen_int(n_code, 0);
34579 cat = gen_const_char_ptr(n_cat, 1);
34580
34581 ret_val = xmlUCSIsCat(code, cat);
34582 desret_int(ret_val);
34583 call_tests++;
34584 des_int(n_code, code, 0);
34585 des_const_char_ptr(n_cat, cat, 1);
34586 xmlResetLastError();
34587 if (mem_base != xmlMemBlocks()) {
34588 printf("Leak of %d blocks found in xmlUCSIsCat",
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(" %d", n_cat);
34593 printf("\n");
34594 }
34595 }
34596 }
34597#endif
34598
34599 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034600 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034601}
34602
34603
34604static int
34605test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034606 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034607
34608#ifdef LIBXML_UNICODE_ENABLED
34609 int mem_base;
34610 int ret_val;
34611 int code; /* UCS code point */
34612 int n_code;
34613
34614 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34615 mem_base = xmlMemBlocks();
34616 code = gen_int(n_code, 0);
34617
34618 ret_val = xmlUCSIsCatC(code);
34619 desret_int(ret_val);
34620 call_tests++;
34621 des_int(n_code, code, 0);
34622 xmlResetLastError();
34623 if (mem_base != xmlMemBlocks()) {
34624 printf("Leak of %d blocks found in xmlUCSIsCatC",
34625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034626 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034627 printf(" %d", n_code);
34628 printf("\n");
34629 }
34630 }
34631#endif
34632
34633 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034634 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034635}
34636
34637
34638static int
34639test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034640 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034641
34642#ifdef LIBXML_UNICODE_ENABLED
34643 int mem_base;
34644 int ret_val;
34645 int code; /* UCS code point */
34646 int n_code;
34647
34648 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34649 mem_base = xmlMemBlocks();
34650 code = gen_int(n_code, 0);
34651
34652 ret_val = xmlUCSIsCatCc(code);
34653 desret_int(ret_val);
34654 call_tests++;
34655 des_int(n_code, code, 0);
34656 xmlResetLastError();
34657 if (mem_base != xmlMemBlocks()) {
34658 printf("Leak of %d blocks found in xmlUCSIsCatCc",
34659 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034660 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034661 printf(" %d", n_code);
34662 printf("\n");
34663 }
34664 }
34665#endif
34666
34667 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034668 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034669}
34670
34671
34672static int
34673test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034674 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034675
34676#ifdef LIBXML_UNICODE_ENABLED
34677 int mem_base;
34678 int ret_val;
34679 int code; /* UCS code point */
34680 int n_code;
34681
34682 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34683 mem_base = xmlMemBlocks();
34684 code = gen_int(n_code, 0);
34685
34686 ret_val = xmlUCSIsCatCf(code);
34687 desret_int(ret_val);
34688 call_tests++;
34689 des_int(n_code, code, 0);
34690 xmlResetLastError();
34691 if (mem_base != xmlMemBlocks()) {
34692 printf("Leak of %d blocks found in xmlUCSIsCatCf",
34693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034694 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034695 printf(" %d", n_code);
34696 printf("\n");
34697 }
34698 }
34699#endif
34700
34701 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034702 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034703}
34704
34705
34706static int
34707test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034708 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034709
34710#ifdef LIBXML_UNICODE_ENABLED
34711 int mem_base;
34712 int ret_val;
34713 int code; /* UCS code point */
34714 int n_code;
34715
34716 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34717 mem_base = xmlMemBlocks();
34718 code = gen_int(n_code, 0);
34719
34720 ret_val = xmlUCSIsCatCo(code);
34721 desret_int(ret_val);
34722 call_tests++;
34723 des_int(n_code, code, 0);
34724 xmlResetLastError();
34725 if (mem_base != xmlMemBlocks()) {
34726 printf("Leak of %d blocks found in xmlUCSIsCatCo",
34727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034728 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034729 printf(" %d", n_code);
34730 printf("\n");
34731 }
34732 }
34733#endif
34734
34735 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034736 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034737}
34738
34739
34740static int
34741test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034742 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034743
34744#ifdef LIBXML_UNICODE_ENABLED
34745 int mem_base;
34746 int ret_val;
34747 int code; /* UCS code point */
34748 int n_code;
34749
34750 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34751 mem_base = xmlMemBlocks();
34752 code = gen_int(n_code, 0);
34753
34754 ret_val = xmlUCSIsCatCs(code);
34755 desret_int(ret_val);
34756 call_tests++;
34757 des_int(n_code, code, 0);
34758 xmlResetLastError();
34759 if (mem_base != xmlMemBlocks()) {
34760 printf("Leak of %d blocks found in xmlUCSIsCatCs",
34761 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034762 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034763 printf(" %d", n_code);
34764 printf("\n");
34765 }
34766 }
34767#endif
34768
34769 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034770 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034771}
34772
34773
34774static int
34775test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034776 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034777
34778#ifdef LIBXML_UNICODE_ENABLED
34779 int mem_base;
34780 int ret_val;
34781 int code; /* UCS code point */
34782 int n_code;
34783
34784 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34785 mem_base = xmlMemBlocks();
34786 code = gen_int(n_code, 0);
34787
34788 ret_val = xmlUCSIsCatL(code);
34789 desret_int(ret_val);
34790 call_tests++;
34791 des_int(n_code, code, 0);
34792 xmlResetLastError();
34793 if (mem_base != xmlMemBlocks()) {
34794 printf("Leak of %d blocks found in xmlUCSIsCatL",
34795 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034796 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034797 printf(" %d", n_code);
34798 printf("\n");
34799 }
34800 }
34801#endif
34802
34803 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034804 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034805}
34806
34807
34808static int
34809test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034810 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034811
34812#ifdef LIBXML_UNICODE_ENABLED
34813 int mem_base;
34814 int ret_val;
34815 int code; /* UCS code point */
34816 int n_code;
34817
34818 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34819 mem_base = xmlMemBlocks();
34820 code = gen_int(n_code, 0);
34821
34822 ret_val = xmlUCSIsCatLl(code);
34823 desret_int(ret_val);
34824 call_tests++;
34825 des_int(n_code, code, 0);
34826 xmlResetLastError();
34827 if (mem_base != xmlMemBlocks()) {
34828 printf("Leak of %d blocks found in xmlUCSIsCatLl",
34829 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034830 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034831 printf(" %d", n_code);
34832 printf("\n");
34833 }
34834 }
34835#endif
34836
34837 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034838 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034839}
34840
34841
34842static int
34843test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034844 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034845
34846#ifdef LIBXML_UNICODE_ENABLED
34847 int mem_base;
34848 int ret_val;
34849 int code; /* UCS code point */
34850 int n_code;
34851
34852 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34853 mem_base = xmlMemBlocks();
34854 code = gen_int(n_code, 0);
34855
34856 ret_val = xmlUCSIsCatLm(code);
34857 desret_int(ret_val);
34858 call_tests++;
34859 des_int(n_code, code, 0);
34860 xmlResetLastError();
34861 if (mem_base != xmlMemBlocks()) {
34862 printf("Leak of %d blocks found in xmlUCSIsCatLm",
34863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034864 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034865 printf(" %d", n_code);
34866 printf("\n");
34867 }
34868 }
34869#endif
34870
34871 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034872 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034873}
34874
34875
34876static int
34877test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034878 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034879
34880#ifdef LIBXML_UNICODE_ENABLED
34881 int mem_base;
34882 int ret_val;
34883 int code; /* UCS code point */
34884 int n_code;
34885
34886 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34887 mem_base = xmlMemBlocks();
34888 code = gen_int(n_code, 0);
34889
34890 ret_val = xmlUCSIsCatLo(code);
34891 desret_int(ret_val);
34892 call_tests++;
34893 des_int(n_code, code, 0);
34894 xmlResetLastError();
34895 if (mem_base != xmlMemBlocks()) {
34896 printf("Leak of %d blocks found in xmlUCSIsCatLo",
34897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034898 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034899 printf(" %d", n_code);
34900 printf("\n");
34901 }
34902 }
34903#endif
34904
34905 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034906 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034907}
34908
34909
34910static int
34911test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034912 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034913
34914#ifdef LIBXML_UNICODE_ENABLED
34915 int mem_base;
34916 int ret_val;
34917 int code; /* UCS code point */
34918 int n_code;
34919
34920 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34921 mem_base = xmlMemBlocks();
34922 code = gen_int(n_code, 0);
34923
34924 ret_val = xmlUCSIsCatLt(code);
34925 desret_int(ret_val);
34926 call_tests++;
34927 des_int(n_code, code, 0);
34928 xmlResetLastError();
34929 if (mem_base != xmlMemBlocks()) {
34930 printf("Leak of %d blocks found in xmlUCSIsCatLt",
34931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034932 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034933 printf(" %d", n_code);
34934 printf("\n");
34935 }
34936 }
34937#endif
34938
34939 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034940 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034941}
34942
34943
34944static int
34945test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034946 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034947
34948#ifdef LIBXML_UNICODE_ENABLED
34949 int mem_base;
34950 int ret_val;
34951 int code; /* UCS code point */
34952 int n_code;
34953
34954 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34955 mem_base = xmlMemBlocks();
34956 code = gen_int(n_code, 0);
34957
34958 ret_val = xmlUCSIsCatLu(code);
34959 desret_int(ret_val);
34960 call_tests++;
34961 des_int(n_code, code, 0);
34962 xmlResetLastError();
34963 if (mem_base != xmlMemBlocks()) {
34964 printf("Leak of %d blocks found in xmlUCSIsCatLu",
34965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034966 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034967 printf(" %d", n_code);
34968 printf("\n");
34969 }
34970 }
34971#endif
34972
34973 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000034974 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034975}
34976
34977
34978static int
34979test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034980 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034981
34982#ifdef LIBXML_UNICODE_ENABLED
34983 int mem_base;
34984 int ret_val;
34985 int code; /* UCS code point */
34986 int n_code;
34987
34988 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34989 mem_base = xmlMemBlocks();
34990 code = gen_int(n_code, 0);
34991
34992 ret_val = xmlUCSIsCatM(code);
34993 desret_int(ret_val);
34994 call_tests++;
34995 des_int(n_code, code, 0);
34996 xmlResetLastError();
34997 if (mem_base != xmlMemBlocks()) {
34998 printf("Leak of %d blocks found in xmlUCSIsCatM",
34999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035000 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035001 printf(" %d", n_code);
35002 printf("\n");
35003 }
35004 }
35005#endif
35006
35007 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035008 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035009}
35010
35011
35012static int
35013test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035014 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035015
35016#ifdef LIBXML_UNICODE_ENABLED
35017 int mem_base;
35018 int ret_val;
35019 int code; /* UCS code point */
35020 int n_code;
35021
35022 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35023 mem_base = xmlMemBlocks();
35024 code = gen_int(n_code, 0);
35025
35026 ret_val = xmlUCSIsCatMc(code);
35027 desret_int(ret_val);
35028 call_tests++;
35029 des_int(n_code, code, 0);
35030 xmlResetLastError();
35031 if (mem_base != xmlMemBlocks()) {
35032 printf("Leak of %d blocks found in xmlUCSIsCatMc",
35033 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035034 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035035 printf(" %d", n_code);
35036 printf("\n");
35037 }
35038 }
35039#endif
35040
35041 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035042 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035043}
35044
35045
35046static int
35047test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035048 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035049
35050#ifdef LIBXML_UNICODE_ENABLED
35051 int mem_base;
35052 int ret_val;
35053 int code; /* UCS code point */
35054 int n_code;
35055
35056 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35057 mem_base = xmlMemBlocks();
35058 code = gen_int(n_code, 0);
35059
35060 ret_val = xmlUCSIsCatMe(code);
35061 desret_int(ret_val);
35062 call_tests++;
35063 des_int(n_code, code, 0);
35064 xmlResetLastError();
35065 if (mem_base != xmlMemBlocks()) {
35066 printf("Leak of %d blocks found in xmlUCSIsCatMe",
35067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035068 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035069 printf(" %d", n_code);
35070 printf("\n");
35071 }
35072 }
35073#endif
35074
35075 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035076 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035077}
35078
35079
35080static int
35081test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035082 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035083
35084#ifdef LIBXML_UNICODE_ENABLED
35085 int mem_base;
35086 int ret_val;
35087 int code; /* UCS code point */
35088 int n_code;
35089
35090 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35091 mem_base = xmlMemBlocks();
35092 code = gen_int(n_code, 0);
35093
35094 ret_val = xmlUCSIsCatMn(code);
35095 desret_int(ret_val);
35096 call_tests++;
35097 des_int(n_code, code, 0);
35098 xmlResetLastError();
35099 if (mem_base != xmlMemBlocks()) {
35100 printf("Leak of %d blocks found in xmlUCSIsCatMn",
35101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035102 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035103 printf(" %d", n_code);
35104 printf("\n");
35105 }
35106 }
35107#endif
35108
35109 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035110 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035111}
35112
35113
35114static int
35115test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035116 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035117
35118#ifdef LIBXML_UNICODE_ENABLED
35119 int mem_base;
35120 int ret_val;
35121 int code; /* UCS code point */
35122 int n_code;
35123
35124 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35125 mem_base = xmlMemBlocks();
35126 code = gen_int(n_code, 0);
35127
35128 ret_val = xmlUCSIsCatN(code);
35129 desret_int(ret_val);
35130 call_tests++;
35131 des_int(n_code, code, 0);
35132 xmlResetLastError();
35133 if (mem_base != xmlMemBlocks()) {
35134 printf("Leak of %d blocks found in xmlUCSIsCatN",
35135 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035136 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035137 printf(" %d", n_code);
35138 printf("\n");
35139 }
35140 }
35141#endif
35142
35143 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035144 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035145}
35146
35147
35148static int
35149test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035150 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035151
35152#ifdef LIBXML_UNICODE_ENABLED
35153 int mem_base;
35154 int ret_val;
35155 int code; /* UCS code point */
35156 int n_code;
35157
35158 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35159 mem_base = xmlMemBlocks();
35160 code = gen_int(n_code, 0);
35161
35162 ret_val = xmlUCSIsCatNd(code);
35163 desret_int(ret_val);
35164 call_tests++;
35165 des_int(n_code, code, 0);
35166 xmlResetLastError();
35167 if (mem_base != xmlMemBlocks()) {
35168 printf("Leak of %d blocks found in xmlUCSIsCatNd",
35169 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035170 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035171 printf(" %d", n_code);
35172 printf("\n");
35173 }
35174 }
35175#endif
35176
35177 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035178 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035179}
35180
35181
35182static int
35183test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035184 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035185
35186#ifdef LIBXML_UNICODE_ENABLED
35187 int mem_base;
35188 int ret_val;
35189 int code; /* UCS code point */
35190 int n_code;
35191
35192 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35193 mem_base = xmlMemBlocks();
35194 code = gen_int(n_code, 0);
35195
35196 ret_val = xmlUCSIsCatNl(code);
35197 desret_int(ret_val);
35198 call_tests++;
35199 des_int(n_code, code, 0);
35200 xmlResetLastError();
35201 if (mem_base != xmlMemBlocks()) {
35202 printf("Leak of %d blocks found in xmlUCSIsCatNl",
35203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035204 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035205 printf(" %d", n_code);
35206 printf("\n");
35207 }
35208 }
35209#endif
35210
35211 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035212 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035213}
35214
35215
35216static int
35217test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035218 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035219
35220#ifdef LIBXML_UNICODE_ENABLED
35221 int mem_base;
35222 int ret_val;
35223 int code; /* UCS code point */
35224 int n_code;
35225
35226 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35227 mem_base = xmlMemBlocks();
35228 code = gen_int(n_code, 0);
35229
35230 ret_val = xmlUCSIsCatNo(code);
35231 desret_int(ret_val);
35232 call_tests++;
35233 des_int(n_code, code, 0);
35234 xmlResetLastError();
35235 if (mem_base != xmlMemBlocks()) {
35236 printf("Leak of %d blocks found in xmlUCSIsCatNo",
35237 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035238 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035239 printf(" %d", n_code);
35240 printf("\n");
35241 }
35242 }
35243#endif
35244
35245 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035246 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035247}
35248
35249
35250static int
35251test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035252 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035253
35254#ifdef LIBXML_UNICODE_ENABLED
35255 int mem_base;
35256 int ret_val;
35257 int code; /* UCS code point */
35258 int n_code;
35259
35260 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35261 mem_base = xmlMemBlocks();
35262 code = gen_int(n_code, 0);
35263
35264 ret_val = xmlUCSIsCatP(code);
35265 desret_int(ret_val);
35266 call_tests++;
35267 des_int(n_code, code, 0);
35268 xmlResetLastError();
35269 if (mem_base != xmlMemBlocks()) {
35270 printf("Leak of %d blocks found in xmlUCSIsCatP",
35271 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035272 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035273 printf(" %d", n_code);
35274 printf("\n");
35275 }
35276 }
35277#endif
35278
35279 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035280 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035281}
35282
35283
35284static int
35285test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035286 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035287
35288#ifdef LIBXML_UNICODE_ENABLED
35289 int mem_base;
35290 int ret_val;
35291 int code; /* UCS code point */
35292 int n_code;
35293
35294 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35295 mem_base = xmlMemBlocks();
35296 code = gen_int(n_code, 0);
35297
35298 ret_val = xmlUCSIsCatPc(code);
35299 desret_int(ret_val);
35300 call_tests++;
35301 des_int(n_code, code, 0);
35302 xmlResetLastError();
35303 if (mem_base != xmlMemBlocks()) {
35304 printf("Leak of %d blocks found in xmlUCSIsCatPc",
35305 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035306 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035307 printf(" %d", n_code);
35308 printf("\n");
35309 }
35310 }
35311#endif
35312
35313 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035314 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035315}
35316
35317
35318static int
35319test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035320 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035321
35322#ifdef LIBXML_UNICODE_ENABLED
35323 int mem_base;
35324 int ret_val;
35325 int code; /* UCS code point */
35326 int n_code;
35327
35328 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35329 mem_base = xmlMemBlocks();
35330 code = gen_int(n_code, 0);
35331
35332 ret_val = xmlUCSIsCatPd(code);
35333 desret_int(ret_val);
35334 call_tests++;
35335 des_int(n_code, code, 0);
35336 xmlResetLastError();
35337 if (mem_base != xmlMemBlocks()) {
35338 printf("Leak of %d blocks found in xmlUCSIsCatPd",
35339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035340 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035341 printf(" %d", n_code);
35342 printf("\n");
35343 }
35344 }
35345#endif
35346
35347 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035348 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035349}
35350
35351
35352static int
35353test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035354 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035355
35356#ifdef LIBXML_UNICODE_ENABLED
35357 int mem_base;
35358 int ret_val;
35359 int code; /* UCS code point */
35360 int n_code;
35361
35362 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35363 mem_base = xmlMemBlocks();
35364 code = gen_int(n_code, 0);
35365
35366 ret_val = xmlUCSIsCatPe(code);
35367 desret_int(ret_val);
35368 call_tests++;
35369 des_int(n_code, code, 0);
35370 xmlResetLastError();
35371 if (mem_base != xmlMemBlocks()) {
35372 printf("Leak of %d blocks found in xmlUCSIsCatPe",
35373 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035374 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035375 printf(" %d", n_code);
35376 printf("\n");
35377 }
35378 }
35379#endif
35380
35381 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035382 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035383}
35384
35385
35386static int
35387test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035388 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035389
35390#ifdef LIBXML_UNICODE_ENABLED
35391 int mem_base;
35392 int ret_val;
35393 int code; /* UCS code point */
35394 int n_code;
35395
35396 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35397 mem_base = xmlMemBlocks();
35398 code = gen_int(n_code, 0);
35399
35400 ret_val = xmlUCSIsCatPf(code);
35401 desret_int(ret_val);
35402 call_tests++;
35403 des_int(n_code, code, 0);
35404 xmlResetLastError();
35405 if (mem_base != xmlMemBlocks()) {
35406 printf("Leak of %d blocks found in xmlUCSIsCatPf",
35407 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035408 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035409 printf(" %d", n_code);
35410 printf("\n");
35411 }
35412 }
35413#endif
35414
35415 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035416 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035417}
35418
35419
35420static int
35421test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035422 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035423
35424#ifdef LIBXML_UNICODE_ENABLED
35425 int mem_base;
35426 int ret_val;
35427 int code; /* UCS code point */
35428 int n_code;
35429
35430 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35431 mem_base = xmlMemBlocks();
35432 code = gen_int(n_code, 0);
35433
35434 ret_val = xmlUCSIsCatPi(code);
35435 desret_int(ret_val);
35436 call_tests++;
35437 des_int(n_code, code, 0);
35438 xmlResetLastError();
35439 if (mem_base != xmlMemBlocks()) {
35440 printf("Leak of %d blocks found in xmlUCSIsCatPi",
35441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035442 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035443 printf(" %d", n_code);
35444 printf("\n");
35445 }
35446 }
35447#endif
35448
35449 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035450 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035451}
35452
35453
35454static int
35455test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035456 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035457
35458#ifdef LIBXML_UNICODE_ENABLED
35459 int mem_base;
35460 int ret_val;
35461 int code; /* UCS code point */
35462 int n_code;
35463
35464 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35465 mem_base = xmlMemBlocks();
35466 code = gen_int(n_code, 0);
35467
35468 ret_val = xmlUCSIsCatPo(code);
35469 desret_int(ret_val);
35470 call_tests++;
35471 des_int(n_code, code, 0);
35472 xmlResetLastError();
35473 if (mem_base != xmlMemBlocks()) {
35474 printf("Leak of %d blocks found in xmlUCSIsCatPo",
35475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035476 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035477 printf(" %d", n_code);
35478 printf("\n");
35479 }
35480 }
35481#endif
35482
35483 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035484 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035485}
35486
35487
35488static int
35489test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035490 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035491
35492#ifdef LIBXML_UNICODE_ENABLED
35493 int mem_base;
35494 int ret_val;
35495 int code; /* UCS code point */
35496 int n_code;
35497
35498 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35499 mem_base = xmlMemBlocks();
35500 code = gen_int(n_code, 0);
35501
35502 ret_val = xmlUCSIsCatPs(code);
35503 desret_int(ret_val);
35504 call_tests++;
35505 des_int(n_code, code, 0);
35506 xmlResetLastError();
35507 if (mem_base != xmlMemBlocks()) {
35508 printf("Leak of %d blocks found in xmlUCSIsCatPs",
35509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035510 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035511 printf(" %d", n_code);
35512 printf("\n");
35513 }
35514 }
35515#endif
35516
35517 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035518 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035519}
35520
35521
35522static int
35523test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035524 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035525
35526#ifdef LIBXML_UNICODE_ENABLED
35527 int mem_base;
35528 int ret_val;
35529 int code; /* UCS code point */
35530 int n_code;
35531
35532 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35533 mem_base = xmlMemBlocks();
35534 code = gen_int(n_code, 0);
35535
35536 ret_val = xmlUCSIsCatS(code);
35537 desret_int(ret_val);
35538 call_tests++;
35539 des_int(n_code, code, 0);
35540 xmlResetLastError();
35541 if (mem_base != xmlMemBlocks()) {
35542 printf("Leak of %d blocks found in xmlUCSIsCatS",
35543 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035544 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035545 printf(" %d", n_code);
35546 printf("\n");
35547 }
35548 }
35549#endif
35550
35551 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035552 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035553}
35554
35555
35556static int
35557test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035558 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035559
35560#ifdef LIBXML_UNICODE_ENABLED
35561 int mem_base;
35562 int ret_val;
35563 int code; /* UCS code point */
35564 int n_code;
35565
35566 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35567 mem_base = xmlMemBlocks();
35568 code = gen_int(n_code, 0);
35569
35570 ret_val = xmlUCSIsCatSc(code);
35571 desret_int(ret_val);
35572 call_tests++;
35573 des_int(n_code, code, 0);
35574 xmlResetLastError();
35575 if (mem_base != xmlMemBlocks()) {
35576 printf("Leak of %d blocks found in xmlUCSIsCatSc",
35577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035578 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035579 printf(" %d", n_code);
35580 printf("\n");
35581 }
35582 }
35583#endif
35584
35585 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035586 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035587}
35588
35589
35590static int
35591test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035592 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035593
35594#ifdef LIBXML_UNICODE_ENABLED
35595 int mem_base;
35596 int ret_val;
35597 int code; /* UCS code point */
35598 int n_code;
35599
35600 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35601 mem_base = xmlMemBlocks();
35602 code = gen_int(n_code, 0);
35603
35604 ret_val = xmlUCSIsCatSk(code);
35605 desret_int(ret_val);
35606 call_tests++;
35607 des_int(n_code, code, 0);
35608 xmlResetLastError();
35609 if (mem_base != xmlMemBlocks()) {
35610 printf("Leak of %d blocks found in xmlUCSIsCatSk",
35611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035612 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035613 printf(" %d", n_code);
35614 printf("\n");
35615 }
35616 }
35617#endif
35618
35619 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035620 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035621}
35622
35623
35624static int
35625test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035626 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035627
35628#ifdef LIBXML_UNICODE_ENABLED
35629 int mem_base;
35630 int ret_val;
35631 int code; /* UCS code point */
35632 int n_code;
35633
35634 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35635 mem_base = xmlMemBlocks();
35636 code = gen_int(n_code, 0);
35637
35638 ret_val = xmlUCSIsCatSm(code);
35639 desret_int(ret_val);
35640 call_tests++;
35641 des_int(n_code, code, 0);
35642 xmlResetLastError();
35643 if (mem_base != xmlMemBlocks()) {
35644 printf("Leak of %d blocks found in xmlUCSIsCatSm",
35645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035646 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035647 printf(" %d", n_code);
35648 printf("\n");
35649 }
35650 }
35651#endif
35652
35653 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035654 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035655}
35656
35657
35658static int
35659test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035660 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035661
35662#ifdef LIBXML_UNICODE_ENABLED
35663 int mem_base;
35664 int ret_val;
35665 int code; /* UCS code point */
35666 int n_code;
35667
35668 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35669 mem_base = xmlMemBlocks();
35670 code = gen_int(n_code, 0);
35671
35672 ret_val = xmlUCSIsCatSo(code);
35673 desret_int(ret_val);
35674 call_tests++;
35675 des_int(n_code, code, 0);
35676 xmlResetLastError();
35677 if (mem_base != xmlMemBlocks()) {
35678 printf("Leak of %d blocks found in xmlUCSIsCatSo",
35679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035680 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035681 printf(" %d", n_code);
35682 printf("\n");
35683 }
35684 }
35685#endif
35686
35687 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035688 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035689}
35690
35691
35692static int
35693test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035694 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035695
35696#ifdef LIBXML_UNICODE_ENABLED
35697 int mem_base;
35698 int ret_val;
35699 int code; /* UCS code point */
35700 int n_code;
35701
35702 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35703 mem_base = xmlMemBlocks();
35704 code = gen_int(n_code, 0);
35705
35706 ret_val = xmlUCSIsCatZ(code);
35707 desret_int(ret_val);
35708 call_tests++;
35709 des_int(n_code, code, 0);
35710 xmlResetLastError();
35711 if (mem_base != xmlMemBlocks()) {
35712 printf("Leak of %d blocks found in xmlUCSIsCatZ",
35713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035714 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035715 printf(" %d", n_code);
35716 printf("\n");
35717 }
35718 }
35719#endif
35720
35721 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035722 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035723}
35724
35725
35726static int
35727test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035728 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035729
35730#ifdef LIBXML_UNICODE_ENABLED
35731 int mem_base;
35732 int ret_val;
35733 int code; /* UCS code point */
35734 int n_code;
35735
35736 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35737 mem_base = xmlMemBlocks();
35738 code = gen_int(n_code, 0);
35739
35740 ret_val = xmlUCSIsCatZl(code);
35741 desret_int(ret_val);
35742 call_tests++;
35743 des_int(n_code, code, 0);
35744 xmlResetLastError();
35745 if (mem_base != xmlMemBlocks()) {
35746 printf("Leak of %d blocks found in xmlUCSIsCatZl",
35747 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035748 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035749 printf(" %d", n_code);
35750 printf("\n");
35751 }
35752 }
35753#endif
35754
35755 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035756 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035757}
35758
35759
35760static int
35761test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035762 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035763
35764#ifdef LIBXML_UNICODE_ENABLED
35765 int mem_base;
35766 int ret_val;
35767 int code; /* UCS code point */
35768 int n_code;
35769
35770 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35771 mem_base = xmlMemBlocks();
35772 code = gen_int(n_code, 0);
35773
35774 ret_val = xmlUCSIsCatZp(code);
35775 desret_int(ret_val);
35776 call_tests++;
35777 des_int(n_code, code, 0);
35778 xmlResetLastError();
35779 if (mem_base != xmlMemBlocks()) {
35780 printf("Leak of %d blocks found in xmlUCSIsCatZp",
35781 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035782 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035783 printf(" %d", n_code);
35784 printf("\n");
35785 }
35786 }
35787#endif
35788
35789 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035790 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035791}
35792
35793
35794static int
35795test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035796 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035797
35798#ifdef LIBXML_UNICODE_ENABLED
35799 int mem_base;
35800 int ret_val;
35801 int code; /* UCS code point */
35802 int n_code;
35803
35804 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35805 mem_base = xmlMemBlocks();
35806 code = gen_int(n_code, 0);
35807
35808 ret_val = xmlUCSIsCatZs(code);
35809 desret_int(ret_val);
35810 call_tests++;
35811 des_int(n_code, code, 0);
35812 xmlResetLastError();
35813 if (mem_base != xmlMemBlocks()) {
35814 printf("Leak of %d blocks found in xmlUCSIsCatZs",
35815 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035816 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035817 printf(" %d", n_code);
35818 printf("\n");
35819 }
35820 }
35821#endif
35822
35823 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035824 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035825}
35826
35827
35828static int
35829test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035830 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035831
35832#ifdef LIBXML_UNICODE_ENABLED
35833 int mem_base;
35834 int ret_val;
35835 int code; /* UCS code point */
35836 int n_code;
35837
35838 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35839 mem_base = xmlMemBlocks();
35840 code = gen_int(n_code, 0);
35841
35842 ret_val = xmlUCSIsCherokee(code);
35843 desret_int(ret_val);
35844 call_tests++;
35845 des_int(n_code, code, 0);
35846 xmlResetLastError();
35847 if (mem_base != xmlMemBlocks()) {
35848 printf("Leak of %d blocks found in xmlUCSIsCherokee",
35849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035850 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035851 printf(" %d", n_code);
35852 printf("\n");
35853 }
35854 }
35855#endif
35856
35857 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035858 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035859}
35860
35861
35862static int
35863test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035864 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035865
35866#ifdef LIBXML_UNICODE_ENABLED
35867 int mem_base;
35868 int ret_val;
35869 int code; /* UCS code point */
35870 int n_code;
35871
35872 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35873 mem_base = xmlMemBlocks();
35874 code = gen_int(n_code, 0);
35875
35876 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
35877 desret_int(ret_val);
35878 call_tests++;
35879 des_int(n_code, code, 0);
35880 xmlResetLastError();
35881 if (mem_base != xmlMemBlocks()) {
35882 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
35883 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035884 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035885 printf(" %d", n_code);
35886 printf("\n");
35887 }
35888 }
35889#endif
35890
35891 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035892 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035893}
35894
35895
35896static int
35897test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035898 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035899
35900#ifdef LIBXML_UNICODE_ENABLED
35901 int mem_base;
35902 int ret_val;
35903 int code; /* UCS code point */
35904 int n_code;
35905
35906 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35907 mem_base = xmlMemBlocks();
35908 code = gen_int(n_code, 0);
35909
35910 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
35911 desret_int(ret_val);
35912 call_tests++;
35913 des_int(n_code, code, 0);
35914 xmlResetLastError();
35915 if (mem_base != xmlMemBlocks()) {
35916 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
35917 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035918 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035919 printf(" %d", n_code);
35920 printf("\n");
35921 }
35922 }
35923#endif
35924
35925 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035926 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035927}
35928
35929
35930static int
35931test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035932 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035933
35934#ifdef LIBXML_UNICODE_ENABLED
35935 int mem_base;
35936 int ret_val;
35937 int code; /* UCS code point */
35938 int n_code;
35939
35940 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35941 mem_base = xmlMemBlocks();
35942 code = gen_int(n_code, 0);
35943
35944 ret_val = xmlUCSIsCombiningHalfMarks(code);
35945 desret_int(ret_val);
35946 call_tests++;
35947 des_int(n_code, code, 0);
35948 xmlResetLastError();
35949 if (mem_base != xmlMemBlocks()) {
35950 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
35951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035952 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035953 printf(" %d", n_code);
35954 printf("\n");
35955 }
35956 }
35957#endif
35958
35959 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035960 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035961}
35962
35963
35964static int
35965test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035966 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035967
35968#ifdef LIBXML_UNICODE_ENABLED
35969 int mem_base;
35970 int ret_val;
35971 int code; /* UCS code point */
35972 int n_code;
35973
35974 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35975 mem_base = xmlMemBlocks();
35976 code = gen_int(n_code, 0);
35977
35978 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
35979 desret_int(ret_val);
35980 call_tests++;
35981 des_int(n_code, code, 0);
35982 xmlResetLastError();
35983 if (mem_base != xmlMemBlocks()) {
35984 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
35985 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035986 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035987 printf(" %d", n_code);
35988 printf("\n");
35989 }
35990 }
35991#endif
35992
35993 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000035994 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035995}
35996
35997
35998static int
35999test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036000 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036001
36002#ifdef LIBXML_UNICODE_ENABLED
36003 int mem_base;
36004 int ret_val;
36005 int code; /* UCS code point */
36006 int n_code;
36007
36008 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36009 mem_base = xmlMemBlocks();
36010 code = gen_int(n_code, 0);
36011
36012 ret_val = xmlUCSIsControlPictures(code);
36013 desret_int(ret_val);
36014 call_tests++;
36015 des_int(n_code, code, 0);
36016 xmlResetLastError();
36017 if (mem_base != xmlMemBlocks()) {
36018 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
36019 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036020 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036021 printf(" %d", n_code);
36022 printf("\n");
36023 }
36024 }
36025#endif
36026
36027 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036028 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036029}
36030
36031
36032static int
36033test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036034 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036035
36036#ifdef LIBXML_UNICODE_ENABLED
36037 int mem_base;
36038 int ret_val;
36039 int code; /* UCS code point */
36040 int n_code;
36041
36042 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36043 mem_base = xmlMemBlocks();
36044 code = gen_int(n_code, 0);
36045
36046 ret_val = xmlUCSIsCurrencySymbols(code);
36047 desret_int(ret_val);
36048 call_tests++;
36049 des_int(n_code, code, 0);
36050 xmlResetLastError();
36051 if (mem_base != xmlMemBlocks()) {
36052 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
36053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036054 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036055 printf(" %d", n_code);
36056 printf("\n");
36057 }
36058 }
36059#endif
36060
36061 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036062 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036063}
36064
36065
36066static int
36067test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036068 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036069
36070#ifdef LIBXML_UNICODE_ENABLED
36071 int mem_base;
36072 int ret_val;
36073 int code; /* UCS code point */
36074 int n_code;
36075
36076 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36077 mem_base = xmlMemBlocks();
36078 code = gen_int(n_code, 0);
36079
36080 ret_val = xmlUCSIsCypriotSyllabary(code);
36081 desret_int(ret_val);
36082 call_tests++;
36083 des_int(n_code, code, 0);
36084 xmlResetLastError();
36085 if (mem_base != xmlMemBlocks()) {
36086 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
36087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036088 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036089 printf(" %d", n_code);
36090 printf("\n");
36091 }
36092 }
36093#endif
36094
36095 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036096 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036097}
36098
36099
36100static int
36101test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036102 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036103
36104#ifdef LIBXML_UNICODE_ENABLED
36105 int mem_base;
36106 int ret_val;
36107 int code; /* UCS code point */
36108 int n_code;
36109
36110 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36111 mem_base = xmlMemBlocks();
36112 code = gen_int(n_code, 0);
36113
36114 ret_val = xmlUCSIsCyrillic(code);
36115 desret_int(ret_val);
36116 call_tests++;
36117 des_int(n_code, code, 0);
36118 xmlResetLastError();
36119 if (mem_base != xmlMemBlocks()) {
36120 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
36121 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036122 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036123 printf(" %d", n_code);
36124 printf("\n");
36125 }
36126 }
36127#endif
36128
36129 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036130 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036131}
36132
36133
36134static int
36135test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036136 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036137
36138#ifdef LIBXML_UNICODE_ENABLED
36139 int mem_base;
36140 int ret_val;
36141 int code; /* UCS code point */
36142 int n_code;
36143
36144 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36145 mem_base = xmlMemBlocks();
36146 code = gen_int(n_code, 0);
36147
36148 ret_val = xmlUCSIsCyrillicSupplement(code);
36149 desret_int(ret_val);
36150 call_tests++;
36151 des_int(n_code, code, 0);
36152 xmlResetLastError();
36153 if (mem_base != xmlMemBlocks()) {
36154 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
36155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036156 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036157 printf(" %d", n_code);
36158 printf("\n");
36159 }
36160 }
36161#endif
36162
36163 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036164 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036165}
36166
36167
36168static int
36169test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036170 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036171
36172#ifdef LIBXML_UNICODE_ENABLED
36173 int mem_base;
36174 int ret_val;
36175 int code; /* UCS code point */
36176 int n_code;
36177
36178 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36179 mem_base = xmlMemBlocks();
36180 code = gen_int(n_code, 0);
36181
36182 ret_val = xmlUCSIsDeseret(code);
36183 desret_int(ret_val);
36184 call_tests++;
36185 des_int(n_code, code, 0);
36186 xmlResetLastError();
36187 if (mem_base != xmlMemBlocks()) {
36188 printf("Leak of %d blocks found in xmlUCSIsDeseret",
36189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036190 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036191 printf(" %d", n_code);
36192 printf("\n");
36193 }
36194 }
36195#endif
36196
36197 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036198 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036199}
36200
36201
36202static int
36203test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036204 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036205
36206#ifdef LIBXML_UNICODE_ENABLED
36207 int mem_base;
36208 int ret_val;
36209 int code; /* UCS code point */
36210 int n_code;
36211
36212 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36213 mem_base = xmlMemBlocks();
36214 code = gen_int(n_code, 0);
36215
36216 ret_val = xmlUCSIsDevanagari(code);
36217 desret_int(ret_val);
36218 call_tests++;
36219 des_int(n_code, code, 0);
36220 xmlResetLastError();
36221 if (mem_base != xmlMemBlocks()) {
36222 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
36223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036224 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036225 printf(" %d", n_code);
36226 printf("\n");
36227 }
36228 }
36229#endif
36230
36231 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036232 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036233}
36234
36235
36236static int
36237test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036238 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036239
36240#ifdef LIBXML_UNICODE_ENABLED
36241 int mem_base;
36242 int ret_val;
36243 int code; /* UCS code point */
36244 int n_code;
36245
36246 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36247 mem_base = xmlMemBlocks();
36248 code = gen_int(n_code, 0);
36249
36250 ret_val = xmlUCSIsDingbats(code);
36251 desret_int(ret_val);
36252 call_tests++;
36253 des_int(n_code, code, 0);
36254 xmlResetLastError();
36255 if (mem_base != xmlMemBlocks()) {
36256 printf("Leak of %d blocks found in xmlUCSIsDingbats",
36257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036258 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036259 printf(" %d", n_code);
36260 printf("\n");
36261 }
36262 }
36263#endif
36264
36265 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036266 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036267}
36268
36269
36270static int
36271test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036272 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036273
36274#ifdef LIBXML_UNICODE_ENABLED
36275 int mem_base;
36276 int ret_val;
36277 int code; /* UCS code point */
36278 int n_code;
36279
36280 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36281 mem_base = xmlMemBlocks();
36282 code = gen_int(n_code, 0);
36283
36284 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
36285 desret_int(ret_val);
36286 call_tests++;
36287 des_int(n_code, code, 0);
36288 xmlResetLastError();
36289 if (mem_base != xmlMemBlocks()) {
36290 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
36291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036292 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036293 printf(" %d", n_code);
36294 printf("\n");
36295 }
36296 }
36297#endif
36298
36299 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036300 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036301}
36302
36303
36304static int
36305test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036306 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036307
36308#ifdef LIBXML_UNICODE_ENABLED
36309 int mem_base;
36310 int ret_val;
36311 int code; /* UCS code point */
36312 int n_code;
36313
36314 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36315 mem_base = xmlMemBlocks();
36316 code = gen_int(n_code, 0);
36317
36318 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
36319 desret_int(ret_val);
36320 call_tests++;
36321 des_int(n_code, code, 0);
36322 xmlResetLastError();
36323 if (mem_base != xmlMemBlocks()) {
36324 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
36325 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036326 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036327 printf(" %d", n_code);
36328 printf("\n");
36329 }
36330 }
36331#endif
36332
36333 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036334 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036335}
36336
36337
36338static int
36339test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036340 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036341
36342#ifdef LIBXML_UNICODE_ENABLED
36343 int mem_base;
36344 int ret_val;
36345 int code; /* UCS code point */
36346 int n_code;
36347
36348 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36349 mem_base = xmlMemBlocks();
36350 code = gen_int(n_code, 0);
36351
36352 ret_val = xmlUCSIsEthiopic(code);
36353 desret_int(ret_val);
36354 call_tests++;
36355 des_int(n_code, code, 0);
36356 xmlResetLastError();
36357 if (mem_base != xmlMemBlocks()) {
36358 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
36359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036360 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036361 printf(" %d", n_code);
36362 printf("\n");
36363 }
36364 }
36365#endif
36366
36367 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036368 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036369}
36370
36371
36372static int
36373test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036374 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036375
36376#ifdef LIBXML_UNICODE_ENABLED
36377 int mem_base;
36378 int ret_val;
36379 int code; /* UCS code point */
36380 int n_code;
36381
36382 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36383 mem_base = xmlMemBlocks();
36384 code = gen_int(n_code, 0);
36385
36386 ret_val = xmlUCSIsGeneralPunctuation(code);
36387 desret_int(ret_val);
36388 call_tests++;
36389 des_int(n_code, code, 0);
36390 xmlResetLastError();
36391 if (mem_base != xmlMemBlocks()) {
36392 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
36393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036394 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036395 printf(" %d", n_code);
36396 printf("\n");
36397 }
36398 }
36399#endif
36400
36401 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036402 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036403}
36404
36405
36406static int
36407test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036408 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036409
36410#ifdef LIBXML_UNICODE_ENABLED
36411 int mem_base;
36412 int ret_val;
36413 int code; /* UCS code point */
36414 int n_code;
36415
36416 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36417 mem_base = xmlMemBlocks();
36418 code = gen_int(n_code, 0);
36419
36420 ret_val = xmlUCSIsGeometricShapes(code);
36421 desret_int(ret_val);
36422 call_tests++;
36423 des_int(n_code, code, 0);
36424 xmlResetLastError();
36425 if (mem_base != xmlMemBlocks()) {
36426 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
36427 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036428 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036429 printf(" %d", n_code);
36430 printf("\n");
36431 }
36432 }
36433#endif
36434
36435 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036436 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036437}
36438
36439
36440static int
36441test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036442 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036443
36444#ifdef LIBXML_UNICODE_ENABLED
36445 int mem_base;
36446 int ret_val;
36447 int code; /* UCS code point */
36448 int n_code;
36449
36450 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36451 mem_base = xmlMemBlocks();
36452 code = gen_int(n_code, 0);
36453
36454 ret_val = xmlUCSIsGeorgian(code);
36455 desret_int(ret_val);
36456 call_tests++;
36457 des_int(n_code, code, 0);
36458 xmlResetLastError();
36459 if (mem_base != xmlMemBlocks()) {
36460 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
36461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036462 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036463 printf(" %d", n_code);
36464 printf("\n");
36465 }
36466 }
36467#endif
36468
36469 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036470 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036471}
36472
36473
36474static int
36475test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036476 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036477
36478#ifdef LIBXML_UNICODE_ENABLED
36479 int mem_base;
36480 int ret_val;
36481 int code; /* UCS code point */
36482 int n_code;
36483
36484 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36485 mem_base = xmlMemBlocks();
36486 code = gen_int(n_code, 0);
36487
36488 ret_val = xmlUCSIsGothic(code);
36489 desret_int(ret_val);
36490 call_tests++;
36491 des_int(n_code, code, 0);
36492 xmlResetLastError();
36493 if (mem_base != xmlMemBlocks()) {
36494 printf("Leak of %d blocks found in xmlUCSIsGothic",
36495 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036496 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036497 printf(" %d", n_code);
36498 printf("\n");
36499 }
36500 }
36501#endif
36502
36503 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036504 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036505}
36506
36507
36508static int
36509test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036510 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036511
36512#ifdef LIBXML_UNICODE_ENABLED
36513 int mem_base;
36514 int ret_val;
36515 int code; /* UCS code point */
36516 int n_code;
36517
36518 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36519 mem_base = xmlMemBlocks();
36520 code = gen_int(n_code, 0);
36521
36522 ret_val = xmlUCSIsGreek(code);
36523 desret_int(ret_val);
36524 call_tests++;
36525 des_int(n_code, code, 0);
36526 xmlResetLastError();
36527 if (mem_base != xmlMemBlocks()) {
36528 printf("Leak of %d blocks found in xmlUCSIsGreek",
36529 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036530 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036531 printf(" %d", n_code);
36532 printf("\n");
36533 }
36534 }
36535#endif
36536
36537 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036538 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036539}
36540
36541
36542static int
36543test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036544 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036545
36546#ifdef LIBXML_UNICODE_ENABLED
36547 int mem_base;
36548 int ret_val;
36549 int code; /* UCS code point */
36550 int n_code;
36551
36552 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36553 mem_base = xmlMemBlocks();
36554 code = gen_int(n_code, 0);
36555
36556 ret_val = xmlUCSIsGreekExtended(code);
36557 desret_int(ret_val);
36558 call_tests++;
36559 des_int(n_code, code, 0);
36560 xmlResetLastError();
36561 if (mem_base != xmlMemBlocks()) {
36562 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
36563 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036564 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036565 printf(" %d", n_code);
36566 printf("\n");
36567 }
36568 }
36569#endif
36570
36571 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036572 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036573}
36574
36575
36576static int
36577test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036578 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036579
36580#ifdef LIBXML_UNICODE_ENABLED
36581 int mem_base;
36582 int ret_val;
36583 int code; /* UCS code point */
36584 int n_code;
36585
36586 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36587 mem_base = xmlMemBlocks();
36588 code = gen_int(n_code, 0);
36589
36590 ret_val = xmlUCSIsGreekandCoptic(code);
36591 desret_int(ret_val);
36592 call_tests++;
36593 des_int(n_code, code, 0);
36594 xmlResetLastError();
36595 if (mem_base != xmlMemBlocks()) {
36596 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
36597 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036598 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036599 printf(" %d", n_code);
36600 printf("\n");
36601 }
36602 }
36603#endif
36604
36605 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036606 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036607}
36608
36609
36610static int
36611test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036612 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036613
36614#ifdef LIBXML_UNICODE_ENABLED
36615 int mem_base;
36616 int ret_val;
36617 int code; /* UCS code point */
36618 int n_code;
36619
36620 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36621 mem_base = xmlMemBlocks();
36622 code = gen_int(n_code, 0);
36623
36624 ret_val = xmlUCSIsGujarati(code);
36625 desret_int(ret_val);
36626 call_tests++;
36627 des_int(n_code, code, 0);
36628 xmlResetLastError();
36629 if (mem_base != xmlMemBlocks()) {
36630 printf("Leak of %d blocks found in xmlUCSIsGujarati",
36631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036632 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036633 printf(" %d", n_code);
36634 printf("\n");
36635 }
36636 }
36637#endif
36638
36639 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036640 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036641}
36642
36643
36644static int
36645test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036646 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036647
36648#ifdef LIBXML_UNICODE_ENABLED
36649 int mem_base;
36650 int ret_val;
36651 int code; /* UCS code point */
36652 int n_code;
36653
36654 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36655 mem_base = xmlMemBlocks();
36656 code = gen_int(n_code, 0);
36657
36658 ret_val = xmlUCSIsGurmukhi(code);
36659 desret_int(ret_val);
36660 call_tests++;
36661 des_int(n_code, code, 0);
36662 xmlResetLastError();
36663 if (mem_base != xmlMemBlocks()) {
36664 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
36665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036666 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036667 printf(" %d", n_code);
36668 printf("\n");
36669 }
36670 }
36671#endif
36672
36673 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036674 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036675}
36676
36677
36678static int
36679test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036680 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036681
36682#ifdef LIBXML_UNICODE_ENABLED
36683 int mem_base;
36684 int ret_val;
36685 int code; /* UCS code point */
36686 int n_code;
36687
36688 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36689 mem_base = xmlMemBlocks();
36690 code = gen_int(n_code, 0);
36691
36692 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
36693 desret_int(ret_val);
36694 call_tests++;
36695 des_int(n_code, code, 0);
36696 xmlResetLastError();
36697 if (mem_base != xmlMemBlocks()) {
36698 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
36699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036700 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036701 printf(" %d", n_code);
36702 printf("\n");
36703 }
36704 }
36705#endif
36706
36707 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036708 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036709}
36710
36711
36712static int
36713test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036714 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036715
36716#ifdef LIBXML_UNICODE_ENABLED
36717 int mem_base;
36718 int ret_val;
36719 int code; /* UCS code point */
36720 int n_code;
36721
36722 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36723 mem_base = xmlMemBlocks();
36724 code = gen_int(n_code, 0);
36725
36726 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
36727 desret_int(ret_val);
36728 call_tests++;
36729 des_int(n_code, code, 0);
36730 xmlResetLastError();
36731 if (mem_base != xmlMemBlocks()) {
36732 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
36733 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036734 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036735 printf(" %d", n_code);
36736 printf("\n");
36737 }
36738 }
36739#endif
36740
36741 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036742 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036743}
36744
36745
36746static int
36747test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036748 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036749
36750#ifdef LIBXML_UNICODE_ENABLED
36751 int mem_base;
36752 int ret_val;
36753 int code; /* UCS code point */
36754 int n_code;
36755
36756 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36757 mem_base = xmlMemBlocks();
36758 code = gen_int(n_code, 0);
36759
36760 ret_val = xmlUCSIsHangulJamo(code);
36761 desret_int(ret_val);
36762 call_tests++;
36763 des_int(n_code, code, 0);
36764 xmlResetLastError();
36765 if (mem_base != xmlMemBlocks()) {
36766 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
36767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036768 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036769 printf(" %d", n_code);
36770 printf("\n");
36771 }
36772 }
36773#endif
36774
36775 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036776 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036777}
36778
36779
36780static int
36781test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036782 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036783
36784#ifdef LIBXML_UNICODE_ENABLED
36785 int mem_base;
36786 int ret_val;
36787 int code; /* UCS code point */
36788 int n_code;
36789
36790 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36791 mem_base = xmlMemBlocks();
36792 code = gen_int(n_code, 0);
36793
36794 ret_val = xmlUCSIsHangulSyllables(code);
36795 desret_int(ret_val);
36796 call_tests++;
36797 des_int(n_code, code, 0);
36798 xmlResetLastError();
36799 if (mem_base != xmlMemBlocks()) {
36800 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
36801 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036802 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036803 printf(" %d", n_code);
36804 printf("\n");
36805 }
36806 }
36807#endif
36808
36809 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036810 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036811}
36812
36813
36814static int
36815test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036816 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036817
36818#ifdef LIBXML_UNICODE_ENABLED
36819 int mem_base;
36820 int ret_val;
36821 int code; /* UCS code point */
36822 int n_code;
36823
36824 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36825 mem_base = xmlMemBlocks();
36826 code = gen_int(n_code, 0);
36827
36828 ret_val = xmlUCSIsHanunoo(code);
36829 desret_int(ret_val);
36830 call_tests++;
36831 des_int(n_code, code, 0);
36832 xmlResetLastError();
36833 if (mem_base != xmlMemBlocks()) {
36834 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
36835 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036836 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036837 printf(" %d", n_code);
36838 printf("\n");
36839 }
36840 }
36841#endif
36842
36843 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036844 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036845}
36846
36847
36848static int
36849test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036850 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036851
36852#ifdef LIBXML_UNICODE_ENABLED
36853 int mem_base;
36854 int ret_val;
36855 int code; /* UCS code point */
36856 int n_code;
36857
36858 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36859 mem_base = xmlMemBlocks();
36860 code = gen_int(n_code, 0);
36861
36862 ret_val = xmlUCSIsHebrew(code);
36863 desret_int(ret_val);
36864 call_tests++;
36865 des_int(n_code, code, 0);
36866 xmlResetLastError();
36867 if (mem_base != xmlMemBlocks()) {
36868 printf("Leak of %d blocks found in xmlUCSIsHebrew",
36869 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036870 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036871 printf(" %d", n_code);
36872 printf("\n");
36873 }
36874 }
36875#endif
36876
36877 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036878 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036879}
36880
36881
36882static int
36883test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036884 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036885
36886#ifdef LIBXML_UNICODE_ENABLED
36887 int mem_base;
36888 int ret_val;
36889 int code; /* UCS code point */
36890 int n_code;
36891
36892 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36893 mem_base = xmlMemBlocks();
36894 code = gen_int(n_code, 0);
36895
36896 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
36897 desret_int(ret_val);
36898 call_tests++;
36899 des_int(n_code, code, 0);
36900 xmlResetLastError();
36901 if (mem_base != xmlMemBlocks()) {
36902 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
36903 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036904 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036905 printf(" %d", n_code);
36906 printf("\n");
36907 }
36908 }
36909#endif
36910
36911 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036912 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036913}
36914
36915
36916static int
36917test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036918 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036919
36920#ifdef LIBXML_UNICODE_ENABLED
36921 int mem_base;
36922 int ret_val;
36923 int code; /* UCS code point */
36924 int n_code;
36925
36926 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36927 mem_base = xmlMemBlocks();
36928 code = gen_int(n_code, 0);
36929
36930 ret_val = xmlUCSIsHighSurrogates(code);
36931 desret_int(ret_val);
36932 call_tests++;
36933 des_int(n_code, code, 0);
36934 xmlResetLastError();
36935 if (mem_base != xmlMemBlocks()) {
36936 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
36937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036938 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036939 printf(" %d", n_code);
36940 printf("\n");
36941 }
36942 }
36943#endif
36944
36945 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036946 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036947}
36948
36949
36950static int
36951test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036952 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036953
36954#ifdef LIBXML_UNICODE_ENABLED
36955 int mem_base;
36956 int ret_val;
36957 int code; /* UCS code point */
36958 int n_code;
36959
36960 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36961 mem_base = xmlMemBlocks();
36962 code = gen_int(n_code, 0);
36963
36964 ret_val = xmlUCSIsHiragana(code);
36965 desret_int(ret_val);
36966 call_tests++;
36967 des_int(n_code, code, 0);
36968 xmlResetLastError();
36969 if (mem_base != xmlMemBlocks()) {
36970 printf("Leak of %d blocks found in xmlUCSIsHiragana",
36971 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036972 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036973 printf(" %d", n_code);
36974 printf("\n");
36975 }
36976 }
36977#endif
36978
36979 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000036980 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036981}
36982
36983
36984static int
36985test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036986 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036987
36988#ifdef LIBXML_UNICODE_ENABLED
36989 int mem_base;
36990 int ret_val;
36991 int code; /* UCS code point */
36992 int n_code;
36993
36994 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36995 mem_base = xmlMemBlocks();
36996 code = gen_int(n_code, 0);
36997
36998 ret_val = xmlUCSIsIPAExtensions(code);
36999 desret_int(ret_val);
37000 call_tests++;
37001 des_int(n_code, code, 0);
37002 xmlResetLastError();
37003 if (mem_base != xmlMemBlocks()) {
37004 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
37005 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037006 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037007 printf(" %d", n_code);
37008 printf("\n");
37009 }
37010 }
37011#endif
37012
37013 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037014 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037015}
37016
37017
37018static int
37019test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037020 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037021
37022#ifdef LIBXML_UNICODE_ENABLED
37023 int mem_base;
37024 int ret_val;
37025 int code; /* UCS code point */
37026 int n_code;
37027
37028 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37029 mem_base = xmlMemBlocks();
37030 code = gen_int(n_code, 0);
37031
37032 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
37033 desret_int(ret_val);
37034 call_tests++;
37035 des_int(n_code, code, 0);
37036 xmlResetLastError();
37037 if (mem_base != xmlMemBlocks()) {
37038 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
37039 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037040 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037041 printf(" %d", n_code);
37042 printf("\n");
37043 }
37044 }
37045#endif
37046
37047 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037048 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037049}
37050
37051
37052static int
37053test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037054 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037055
37056#ifdef LIBXML_UNICODE_ENABLED
37057 int mem_base;
37058 int ret_val;
37059 int code; /* UCS code point */
37060 int n_code;
37061
37062 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37063 mem_base = xmlMemBlocks();
37064 code = gen_int(n_code, 0);
37065
37066 ret_val = xmlUCSIsKanbun(code);
37067 desret_int(ret_val);
37068 call_tests++;
37069 des_int(n_code, code, 0);
37070 xmlResetLastError();
37071 if (mem_base != xmlMemBlocks()) {
37072 printf("Leak of %d blocks found in xmlUCSIsKanbun",
37073 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037074 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037075 printf(" %d", n_code);
37076 printf("\n");
37077 }
37078 }
37079#endif
37080
37081 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037082 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037083}
37084
37085
37086static int
37087test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037088 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037089
37090#ifdef LIBXML_UNICODE_ENABLED
37091 int mem_base;
37092 int ret_val;
37093 int code; /* UCS code point */
37094 int n_code;
37095
37096 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37097 mem_base = xmlMemBlocks();
37098 code = gen_int(n_code, 0);
37099
37100 ret_val = xmlUCSIsKangxiRadicals(code);
37101 desret_int(ret_val);
37102 call_tests++;
37103 des_int(n_code, code, 0);
37104 xmlResetLastError();
37105 if (mem_base != xmlMemBlocks()) {
37106 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
37107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037108 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037109 printf(" %d", n_code);
37110 printf("\n");
37111 }
37112 }
37113#endif
37114
37115 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037116 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037117}
37118
37119
37120static int
37121test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037122 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037123
37124#ifdef LIBXML_UNICODE_ENABLED
37125 int mem_base;
37126 int ret_val;
37127 int code; /* UCS code point */
37128 int n_code;
37129
37130 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37131 mem_base = xmlMemBlocks();
37132 code = gen_int(n_code, 0);
37133
37134 ret_val = xmlUCSIsKannada(code);
37135 desret_int(ret_val);
37136 call_tests++;
37137 des_int(n_code, code, 0);
37138 xmlResetLastError();
37139 if (mem_base != xmlMemBlocks()) {
37140 printf("Leak of %d blocks found in xmlUCSIsKannada",
37141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037142 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037143 printf(" %d", n_code);
37144 printf("\n");
37145 }
37146 }
37147#endif
37148
37149 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037150 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037151}
37152
37153
37154static int
37155test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037156 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037157
37158#ifdef LIBXML_UNICODE_ENABLED
37159 int mem_base;
37160 int ret_val;
37161 int code; /* UCS code point */
37162 int n_code;
37163
37164 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37165 mem_base = xmlMemBlocks();
37166 code = gen_int(n_code, 0);
37167
37168 ret_val = xmlUCSIsKatakana(code);
37169 desret_int(ret_val);
37170 call_tests++;
37171 des_int(n_code, code, 0);
37172 xmlResetLastError();
37173 if (mem_base != xmlMemBlocks()) {
37174 printf("Leak of %d blocks found in xmlUCSIsKatakana",
37175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037176 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037177 printf(" %d", n_code);
37178 printf("\n");
37179 }
37180 }
37181#endif
37182
37183 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037184 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037185}
37186
37187
37188static int
37189test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037190 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037191
37192#ifdef LIBXML_UNICODE_ENABLED
37193 int mem_base;
37194 int ret_val;
37195 int code; /* UCS code point */
37196 int n_code;
37197
37198 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37199 mem_base = xmlMemBlocks();
37200 code = gen_int(n_code, 0);
37201
37202 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
37203 desret_int(ret_val);
37204 call_tests++;
37205 des_int(n_code, code, 0);
37206 xmlResetLastError();
37207 if (mem_base != xmlMemBlocks()) {
37208 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
37209 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037210 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037211 printf(" %d", n_code);
37212 printf("\n");
37213 }
37214 }
37215#endif
37216
37217 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037218 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037219}
37220
37221
37222static int
37223test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037224 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037225
37226#ifdef LIBXML_UNICODE_ENABLED
37227 int mem_base;
37228 int ret_val;
37229 int code; /* UCS code point */
37230 int n_code;
37231
37232 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37233 mem_base = xmlMemBlocks();
37234 code = gen_int(n_code, 0);
37235
37236 ret_val = xmlUCSIsKhmer(code);
37237 desret_int(ret_val);
37238 call_tests++;
37239 des_int(n_code, code, 0);
37240 xmlResetLastError();
37241 if (mem_base != xmlMemBlocks()) {
37242 printf("Leak of %d blocks found in xmlUCSIsKhmer",
37243 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037244 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037245 printf(" %d", n_code);
37246 printf("\n");
37247 }
37248 }
37249#endif
37250
37251 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037252 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037253}
37254
37255
37256static int
37257test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037258 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037259
37260#ifdef LIBXML_UNICODE_ENABLED
37261 int mem_base;
37262 int ret_val;
37263 int code; /* UCS code point */
37264 int n_code;
37265
37266 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37267 mem_base = xmlMemBlocks();
37268 code = gen_int(n_code, 0);
37269
37270 ret_val = xmlUCSIsKhmerSymbols(code);
37271 desret_int(ret_val);
37272 call_tests++;
37273 des_int(n_code, code, 0);
37274 xmlResetLastError();
37275 if (mem_base != xmlMemBlocks()) {
37276 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
37277 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037278 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037279 printf(" %d", n_code);
37280 printf("\n");
37281 }
37282 }
37283#endif
37284
37285 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037286 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037287}
37288
37289
37290static int
37291test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037292 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037293
37294#ifdef LIBXML_UNICODE_ENABLED
37295 int mem_base;
37296 int ret_val;
37297 int code; /* UCS code point */
37298 int n_code;
37299
37300 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37301 mem_base = xmlMemBlocks();
37302 code = gen_int(n_code, 0);
37303
37304 ret_val = xmlUCSIsLao(code);
37305 desret_int(ret_val);
37306 call_tests++;
37307 des_int(n_code, code, 0);
37308 xmlResetLastError();
37309 if (mem_base != xmlMemBlocks()) {
37310 printf("Leak of %d blocks found in xmlUCSIsLao",
37311 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037312 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037313 printf(" %d", n_code);
37314 printf("\n");
37315 }
37316 }
37317#endif
37318
37319 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037320 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037321}
37322
37323
37324static int
37325test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037326 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037327
37328#ifdef LIBXML_UNICODE_ENABLED
37329 int mem_base;
37330 int ret_val;
37331 int code; /* UCS code point */
37332 int n_code;
37333
37334 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37335 mem_base = xmlMemBlocks();
37336 code = gen_int(n_code, 0);
37337
37338 ret_val = xmlUCSIsLatin1Supplement(code);
37339 desret_int(ret_val);
37340 call_tests++;
37341 des_int(n_code, code, 0);
37342 xmlResetLastError();
37343 if (mem_base != xmlMemBlocks()) {
37344 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
37345 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037346 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037347 printf(" %d", n_code);
37348 printf("\n");
37349 }
37350 }
37351#endif
37352
37353 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037354 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037355}
37356
37357
37358static int
37359test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037360 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037361
37362#ifdef LIBXML_UNICODE_ENABLED
37363 int mem_base;
37364 int ret_val;
37365 int code; /* UCS code point */
37366 int n_code;
37367
37368 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37369 mem_base = xmlMemBlocks();
37370 code = gen_int(n_code, 0);
37371
37372 ret_val = xmlUCSIsLatinExtendedA(code);
37373 desret_int(ret_val);
37374 call_tests++;
37375 des_int(n_code, code, 0);
37376 xmlResetLastError();
37377 if (mem_base != xmlMemBlocks()) {
37378 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
37379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037380 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037381 printf(" %d", n_code);
37382 printf("\n");
37383 }
37384 }
37385#endif
37386
37387 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037388 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037389}
37390
37391
37392static int
37393test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037394 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037395
37396#ifdef LIBXML_UNICODE_ENABLED
37397 int mem_base;
37398 int ret_val;
37399 int code; /* UCS code point */
37400 int n_code;
37401
37402 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37403 mem_base = xmlMemBlocks();
37404 code = gen_int(n_code, 0);
37405
37406 ret_val = xmlUCSIsLatinExtendedAdditional(code);
37407 desret_int(ret_val);
37408 call_tests++;
37409 des_int(n_code, code, 0);
37410 xmlResetLastError();
37411 if (mem_base != xmlMemBlocks()) {
37412 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
37413 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037414 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037415 printf(" %d", n_code);
37416 printf("\n");
37417 }
37418 }
37419#endif
37420
37421 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037422 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037423}
37424
37425
37426static int
37427test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037428 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037429
37430#ifdef LIBXML_UNICODE_ENABLED
37431 int mem_base;
37432 int ret_val;
37433 int code; /* UCS code point */
37434 int n_code;
37435
37436 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37437 mem_base = xmlMemBlocks();
37438 code = gen_int(n_code, 0);
37439
37440 ret_val = xmlUCSIsLatinExtendedB(code);
37441 desret_int(ret_val);
37442 call_tests++;
37443 des_int(n_code, code, 0);
37444 xmlResetLastError();
37445 if (mem_base != xmlMemBlocks()) {
37446 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
37447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037448 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037449 printf(" %d", n_code);
37450 printf("\n");
37451 }
37452 }
37453#endif
37454
37455 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037456 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037457}
37458
37459
37460static int
37461test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037462 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037463
37464#ifdef LIBXML_UNICODE_ENABLED
37465 int mem_base;
37466 int ret_val;
37467 int code; /* UCS code point */
37468 int n_code;
37469
37470 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37471 mem_base = xmlMemBlocks();
37472 code = gen_int(n_code, 0);
37473
37474 ret_val = xmlUCSIsLetterlikeSymbols(code);
37475 desret_int(ret_val);
37476 call_tests++;
37477 des_int(n_code, code, 0);
37478 xmlResetLastError();
37479 if (mem_base != xmlMemBlocks()) {
37480 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
37481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037482 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037483 printf(" %d", n_code);
37484 printf("\n");
37485 }
37486 }
37487#endif
37488
37489 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037490 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037491}
37492
37493
37494static int
37495test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037496 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037497
37498#ifdef LIBXML_UNICODE_ENABLED
37499 int mem_base;
37500 int ret_val;
37501 int code; /* UCS code point */
37502 int n_code;
37503
37504 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37505 mem_base = xmlMemBlocks();
37506 code = gen_int(n_code, 0);
37507
37508 ret_val = xmlUCSIsLimbu(code);
37509 desret_int(ret_val);
37510 call_tests++;
37511 des_int(n_code, code, 0);
37512 xmlResetLastError();
37513 if (mem_base != xmlMemBlocks()) {
37514 printf("Leak of %d blocks found in xmlUCSIsLimbu",
37515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037516 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037517 printf(" %d", n_code);
37518 printf("\n");
37519 }
37520 }
37521#endif
37522
37523 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037524 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037525}
37526
37527
37528static int
37529test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037530 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037531
37532#ifdef LIBXML_UNICODE_ENABLED
37533 int mem_base;
37534 int ret_val;
37535 int code; /* UCS code point */
37536 int n_code;
37537
37538 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37539 mem_base = xmlMemBlocks();
37540 code = gen_int(n_code, 0);
37541
37542 ret_val = xmlUCSIsLinearBIdeograms(code);
37543 desret_int(ret_val);
37544 call_tests++;
37545 des_int(n_code, code, 0);
37546 xmlResetLastError();
37547 if (mem_base != xmlMemBlocks()) {
37548 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
37549 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037550 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037551 printf(" %d", n_code);
37552 printf("\n");
37553 }
37554 }
37555#endif
37556
37557 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037558 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037559}
37560
37561
37562static int
37563test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037564 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037565
37566#ifdef LIBXML_UNICODE_ENABLED
37567 int mem_base;
37568 int ret_val;
37569 int code; /* UCS code point */
37570 int n_code;
37571
37572 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37573 mem_base = xmlMemBlocks();
37574 code = gen_int(n_code, 0);
37575
37576 ret_val = xmlUCSIsLinearBSyllabary(code);
37577 desret_int(ret_val);
37578 call_tests++;
37579 des_int(n_code, code, 0);
37580 xmlResetLastError();
37581 if (mem_base != xmlMemBlocks()) {
37582 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
37583 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037584 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037585 printf(" %d", n_code);
37586 printf("\n");
37587 }
37588 }
37589#endif
37590
37591 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037592 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037593}
37594
37595
37596static int
37597test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037598 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037599
37600#ifdef LIBXML_UNICODE_ENABLED
37601 int mem_base;
37602 int ret_val;
37603 int code; /* UCS code point */
37604 int n_code;
37605
37606 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37607 mem_base = xmlMemBlocks();
37608 code = gen_int(n_code, 0);
37609
37610 ret_val = xmlUCSIsLowSurrogates(code);
37611 desret_int(ret_val);
37612 call_tests++;
37613 des_int(n_code, code, 0);
37614 xmlResetLastError();
37615 if (mem_base != xmlMemBlocks()) {
37616 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
37617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037618 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037619 printf(" %d", n_code);
37620 printf("\n");
37621 }
37622 }
37623#endif
37624
37625 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037626 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037627}
37628
37629
37630static int
37631test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037632 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037633
37634#ifdef LIBXML_UNICODE_ENABLED
37635 int mem_base;
37636 int ret_val;
37637 int code; /* UCS code point */
37638 int n_code;
37639
37640 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37641 mem_base = xmlMemBlocks();
37642 code = gen_int(n_code, 0);
37643
37644 ret_val = xmlUCSIsMalayalam(code);
37645 desret_int(ret_val);
37646 call_tests++;
37647 des_int(n_code, code, 0);
37648 xmlResetLastError();
37649 if (mem_base != xmlMemBlocks()) {
37650 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
37651 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037652 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037653 printf(" %d", n_code);
37654 printf("\n");
37655 }
37656 }
37657#endif
37658
37659 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037660 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037661}
37662
37663
37664static int
37665test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037666 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037667
37668#ifdef LIBXML_UNICODE_ENABLED
37669 int mem_base;
37670 int ret_val;
37671 int code; /* UCS code point */
37672 int n_code;
37673
37674 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37675 mem_base = xmlMemBlocks();
37676 code = gen_int(n_code, 0);
37677
37678 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
37679 desret_int(ret_val);
37680 call_tests++;
37681 des_int(n_code, code, 0);
37682 xmlResetLastError();
37683 if (mem_base != xmlMemBlocks()) {
37684 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
37685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037686 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037687 printf(" %d", n_code);
37688 printf("\n");
37689 }
37690 }
37691#endif
37692
37693 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037694 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037695}
37696
37697
37698static int
37699test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037700 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037701
37702#ifdef LIBXML_UNICODE_ENABLED
37703 int mem_base;
37704 int ret_val;
37705 int code; /* UCS code point */
37706 int n_code;
37707
37708 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37709 mem_base = xmlMemBlocks();
37710 code = gen_int(n_code, 0);
37711
37712 ret_val = xmlUCSIsMathematicalOperators(code);
37713 desret_int(ret_val);
37714 call_tests++;
37715 des_int(n_code, code, 0);
37716 xmlResetLastError();
37717 if (mem_base != xmlMemBlocks()) {
37718 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
37719 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037720 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037721 printf(" %d", n_code);
37722 printf("\n");
37723 }
37724 }
37725#endif
37726
37727 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037728 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037729}
37730
37731
37732static int
37733test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037734 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037735
37736#ifdef LIBXML_UNICODE_ENABLED
37737 int mem_base;
37738 int ret_val;
37739 int code; /* UCS code point */
37740 int n_code;
37741
37742 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37743 mem_base = xmlMemBlocks();
37744 code = gen_int(n_code, 0);
37745
37746 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
37747 desret_int(ret_val);
37748 call_tests++;
37749 des_int(n_code, code, 0);
37750 xmlResetLastError();
37751 if (mem_base != xmlMemBlocks()) {
37752 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
37753 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037754 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037755 printf(" %d", n_code);
37756 printf("\n");
37757 }
37758 }
37759#endif
37760
37761 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037762 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037763}
37764
37765
37766static int
37767test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037768 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037769
37770#ifdef LIBXML_UNICODE_ENABLED
37771 int mem_base;
37772 int ret_val;
37773 int code; /* UCS code point */
37774 int n_code;
37775
37776 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37777 mem_base = xmlMemBlocks();
37778 code = gen_int(n_code, 0);
37779
37780 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
37781 desret_int(ret_val);
37782 call_tests++;
37783 des_int(n_code, code, 0);
37784 xmlResetLastError();
37785 if (mem_base != xmlMemBlocks()) {
37786 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
37787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037788 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037789 printf(" %d", n_code);
37790 printf("\n");
37791 }
37792 }
37793#endif
37794
37795 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037796 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037797}
37798
37799
37800static int
37801test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037802 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037803
37804#ifdef LIBXML_UNICODE_ENABLED
37805 int mem_base;
37806 int ret_val;
37807 int code; /* UCS code point */
37808 int n_code;
37809
37810 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37811 mem_base = xmlMemBlocks();
37812 code = gen_int(n_code, 0);
37813
37814 ret_val = xmlUCSIsMiscellaneousSymbols(code);
37815 desret_int(ret_val);
37816 call_tests++;
37817 des_int(n_code, code, 0);
37818 xmlResetLastError();
37819 if (mem_base != xmlMemBlocks()) {
37820 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
37821 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037822 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037823 printf(" %d", n_code);
37824 printf("\n");
37825 }
37826 }
37827#endif
37828
37829 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037830 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037831}
37832
37833
37834static int
37835test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037836 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037837
37838#ifdef LIBXML_UNICODE_ENABLED
37839 int mem_base;
37840 int ret_val;
37841 int code; /* UCS code point */
37842 int n_code;
37843
37844 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37845 mem_base = xmlMemBlocks();
37846 code = gen_int(n_code, 0);
37847
37848 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
37849 desret_int(ret_val);
37850 call_tests++;
37851 des_int(n_code, code, 0);
37852 xmlResetLastError();
37853 if (mem_base != xmlMemBlocks()) {
37854 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
37855 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037856 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037857 printf(" %d", n_code);
37858 printf("\n");
37859 }
37860 }
37861#endif
37862
37863 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037864 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037865}
37866
37867
37868static int
37869test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037870 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037871
37872#ifdef LIBXML_UNICODE_ENABLED
37873 int mem_base;
37874 int ret_val;
37875 int code; /* UCS code point */
37876 int n_code;
37877
37878 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37879 mem_base = xmlMemBlocks();
37880 code = gen_int(n_code, 0);
37881
37882 ret_val = xmlUCSIsMiscellaneousTechnical(code);
37883 desret_int(ret_val);
37884 call_tests++;
37885 des_int(n_code, code, 0);
37886 xmlResetLastError();
37887 if (mem_base != xmlMemBlocks()) {
37888 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
37889 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037890 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037891 printf(" %d", n_code);
37892 printf("\n");
37893 }
37894 }
37895#endif
37896
37897 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037898 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037899}
37900
37901
37902static int
37903test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037904 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037905
37906#ifdef LIBXML_UNICODE_ENABLED
37907 int mem_base;
37908 int ret_val;
37909 int code; /* UCS code point */
37910 int n_code;
37911
37912 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37913 mem_base = xmlMemBlocks();
37914 code = gen_int(n_code, 0);
37915
37916 ret_val = xmlUCSIsMongolian(code);
37917 desret_int(ret_val);
37918 call_tests++;
37919 des_int(n_code, code, 0);
37920 xmlResetLastError();
37921 if (mem_base != xmlMemBlocks()) {
37922 printf("Leak of %d blocks found in xmlUCSIsMongolian",
37923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037924 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037925 printf(" %d", n_code);
37926 printf("\n");
37927 }
37928 }
37929#endif
37930
37931 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037932 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037933}
37934
37935
37936static int
37937test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037938 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037939
37940#ifdef LIBXML_UNICODE_ENABLED
37941 int mem_base;
37942 int ret_val;
37943 int code; /* UCS code point */
37944 int n_code;
37945
37946 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37947 mem_base = xmlMemBlocks();
37948 code = gen_int(n_code, 0);
37949
37950 ret_val = xmlUCSIsMusicalSymbols(code);
37951 desret_int(ret_val);
37952 call_tests++;
37953 des_int(n_code, code, 0);
37954 xmlResetLastError();
37955 if (mem_base != xmlMemBlocks()) {
37956 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
37957 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037958 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037959 printf(" %d", n_code);
37960 printf("\n");
37961 }
37962 }
37963#endif
37964
37965 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000037966 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037967}
37968
37969
37970static int
37971test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037972 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037973
37974#ifdef LIBXML_UNICODE_ENABLED
37975 int mem_base;
37976 int ret_val;
37977 int code; /* UCS code point */
37978 int n_code;
37979
37980 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37981 mem_base = xmlMemBlocks();
37982 code = gen_int(n_code, 0);
37983
37984 ret_val = xmlUCSIsMyanmar(code);
37985 desret_int(ret_val);
37986 call_tests++;
37987 des_int(n_code, code, 0);
37988 xmlResetLastError();
37989 if (mem_base != xmlMemBlocks()) {
37990 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
37991 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037992 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037993 printf(" %d", n_code);
37994 printf("\n");
37995 }
37996 }
37997#endif
37998
37999 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038000 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038001}
38002
38003
38004static int
38005test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038006 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038007
38008#ifdef LIBXML_UNICODE_ENABLED
38009 int mem_base;
38010 int ret_val;
38011 int code; /* UCS code point */
38012 int n_code;
38013
38014 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38015 mem_base = xmlMemBlocks();
38016 code = gen_int(n_code, 0);
38017
38018 ret_val = xmlUCSIsNumberForms(code);
38019 desret_int(ret_val);
38020 call_tests++;
38021 des_int(n_code, code, 0);
38022 xmlResetLastError();
38023 if (mem_base != xmlMemBlocks()) {
38024 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
38025 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038026 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038027 printf(" %d", n_code);
38028 printf("\n");
38029 }
38030 }
38031#endif
38032
38033 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038034 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038035}
38036
38037
38038static int
38039test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038040 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038041
38042#ifdef LIBXML_UNICODE_ENABLED
38043 int mem_base;
38044 int ret_val;
38045 int code; /* UCS code point */
38046 int n_code;
38047
38048 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38049 mem_base = xmlMemBlocks();
38050 code = gen_int(n_code, 0);
38051
38052 ret_val = xmlUCSIsOgham(code);
38053 desret_int(ret_val);
38054 call_tests++;
38055 des_int(n_code, code, 0);
38056 xmlResetLastError();
38057 if (mem_base != xmlMemBlocks()) {
38058 printf("Leak of %d blocks found in xmlUCSIsOgham",
38059 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038060 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038061 printf(" %d", n_code);
38062 printf("\n");
38063 }
38064 }
38065#endif
38066
38067 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038068 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038069}
38070
38071
38072static int
38073test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038074 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038075
38076#ifdef LIBXML_UNICODE_ENABLED
38077 int mem_base;
38078 int ret_val;
38079 int code; /* UCS code point */
38080 int n_code;
38081
38082 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38083 mem_base = xmlMemBlocks();
38084 code = gen_int(n_code, 0);
38085
38086 ret_val = xmlUCSIsOldItalic(code);
38087 desret_int(ret_val);
38088 call_tests++;
38089 des_int(n_code, code, 0);
38090 xmlResetLastError();
38091 if (mem_base != xmlMemBlocks()) {
38092 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
38093 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038094 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038095 printf(" %d", n_code);
38096 printf("\n");
38097 }
38098 }
38099#endif
38100
38101 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038102 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038103}
38104
38105
38106static int
38107test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038108 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038109
38110#ifdef LIBXML_UNICODE_ENABLED
38111 int mem_base;
38112 int ret_val;
38113 int code; /* UCS code point */
38114 int n_code;
38115
38116 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38117 mem_base = xmlMemBlocks();
38118 code = gen_int(n_code, 0);
38119
38120 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
38121 desret_int(ret_val);
38122 call_tests++;
38123 des_int(n_code, code, 0);
38124 xmlResetLastError();
38125 if (mem_base != xmlMemBlocks()) {
38126 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
38127 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038128 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038129 printf(" %d", n_code);
38130 printf("\n");
38131 }
38132 }
38133#endif
38134
38135 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038136 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038137}
38138
38139
38140static int
38141test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038142 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038143
38144#ifdef LIBXML_UNICODE_ENABLED
38145 int mem_base;
38146 int ret_val;
38147 int code; /* UCS code point */
38148 int n_code;
38149
38150 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38151 mem_base = xmlMemBlocks();
38152 code = gen_int(n_code, 0);
38153
38154 ret_val = xmlUCSIsOriya(code);
38155 desret_int(ret_val);
38156 call_tests++;
38157 des_int(n_code, code, 0);
38158 xmlResetLastError();
38159 if (mem_base != xmlMemBlocks()) {
38160 printf("Leak of %d blocks found in xmlUCSIsOriya",
38161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038162 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038163 printf(" %d", n_code);
38164 printf("\n");
38165 }
38166 }
38167#endif
38168
38169 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038170 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038171}
38172
38173
38174static int
38175test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038176 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038177
38178#ifdef LIBXML_UNICODE_ENABLED
38179 int mem_base;
38180 int ret_val;
38181 int code; /* UCS code point */
38182 int n_code;
38183
38184 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38185 mem_base = xmlMemBlocks();
38186 code = gen_int(n_code, 0);
38187
38188 ret_val = xmlUCSIsOsmanya(code);
38189 desret_int(ret_val);
38190 call_tests++;
38191 des_int(n_code, code, 0);
38192 xmlResetLastError();
38193 if (mem_base != xmlMemBlocks()) {
38194 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
38195 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038196 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038197 printf(" %d", n_code);
38198 printf("\n");
38199 }
38200 }
38201#endif
38202
38203 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038204 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038205}
38206
38207
38208static int
38209test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038210 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038211
38212#ifdef LIBXML_UNICODE_ENABLED
38213 int mem_base;
38214 int ret_val;
38215 int code; /* UCS code point */
38216 int n_code;
38217
38218 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38219 mem_base = xmlMemBlocks();
38220 code = gen_int(n_code, 0);
38221
38222 ret_val = xmlUCSIsPhoneticExtensions(code);
38223 desret_int(ret_val);
38224 call_tests++;
38225 des_int(n_code, code, 0);
38226 xmlResetLastError();
38227 if (mem_base != xmlMemBlocks()) {
38228 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
38229 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038230 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038231 printf(" %d", n_code);
38232 printf("\n");
38233 }
38234 }
38235#endif
38236
38237 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038238 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038239}
38240
38241
38242static int
38243test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038244 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038245
38246#ifdef LIBXML_UNICODE_ENABLED
38247 int mem_base;
38248 int ret_val;
38249 int code; /* UCS code point */
38250 int n_code;
38251
38252 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38253 mem_base = xmlMemBlocks();
38254 code = gen_int(n_code, 0);
38255
38256 ret_val = xmlUCSIsPrivateUse(code);
38257 desret_int(ret_val);
38258 call_tests++;
38259 des_int(n_code, code, 0);
38260 xmlResetLastError();
38261 if (mem_base != xmlMemBlocks()) {
38262 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
38263 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038264 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038265 printf(" %d", n_code);
38266 printf("\n");
38267 }
38268 }
38269#endif
38270
38271 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038272 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038273}
38274
38275
38276static int
38277test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038278 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038279
38280#ifdef LIBXML_UNICODE_ENABLED
38281 int mem_base;
38282 int ret_val;
38283 int code; /* UCS code point */
38284 int n_code;
38285
38286 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38287 mem_base = xmlMemBlocks();
38288 code = gen_int(n_code, 0);
38289
38290 ret_val = xmlUCSIsPrivateUseArea(code);
38291 desret_int(ret_val);
38292 call_tests++;
38293 des_int(n_code, code, 0);
38294 xmlResetLastError();
38295 if (mem_base != xmlMemBlocks()) {
38296 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
38297 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038298 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038299 printf(" %d", n_code);
38300 printf("\n");
38301 }
38302 }
38303#endif
38304
38305 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038306 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038307}
38308
38309
38310static int
38311test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038312 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038313
38314#ifdef LIBXML_UNICODE_ENABLED
38315 int mem_base;
38316 int ret_val;
38317 int code; /* UCS code point */
38318 int n_code;
38319
38320 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38321 mem_base = xmlMemBlocks();
38322 code = gen_int(n_code, 0);
38323
38324 ret_val = xmlUCSIsRunic(code);
38325 desret_int(ret_val);
38326 call_tests++;
38327 des_int(n_code, code, 0);
38328 xmlResetLastError();
38329 if (mem_base != xmlMemBlocks()) {
38330 printf("Leak of %d blocks found in xmlUCSIsRunic",
38331 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038332 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038333 printf(" %d", n_code);
38334 printf("\n");
38335 }
38336 }
38337#endif
38338
38339 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038340 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038341}
38342
38343
38344static int
38345test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038346 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038347
38348#ifdef LIBXML_UNICODE_ENABLED
38349 int mem_base;
38350 int ret_val;
38351 int code; /* UCS code point */
38352 int n_code;
38353
38354 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38355 mem_base = xmlMemBlocks();
38356 code = gen_int(n_code, 0);
38357
38358 ret_val = xmlUCSIsShavian(code);
38359 desret_int(ret_val);
38360 call_tests++;
38361 des_int(n_code, code, 0);
38362 xmlResetLastError();
38363 if (mem_base != xmlMemBlocks()) {
38364 printf("Leak of %d blocks found in xmlUCSIsShavian",
38365 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038366 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038367 printf(" %d", n_code);
38368 printf("\n");
38369 }
38370 }
38371#endif
38372
38373 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038374 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038375}
38376
38377
38378static int
38379test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038380 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038381
38382#ifdef LIBXML_UNICODE_ENABLED
38383 int mem_base;
38384 int ret_val;
38385 int code; /* UCS code point */
38386 int n_code;
38387
38388 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38389 mem_base = xmlMemBlocks();
38390 code = gen_int(n_code, 0);
38391
38392 ret_val = xmlUCSIsSinhala(code);
38393 desret_int(ret_val);
38394 call_tests++;
38395 des_int(n_code, code, 0);
38396 xmlResetLastError();
38397 if (mem_base != xmlMemBlocks()) {
38398 printf("Leak of %d blocks found in xmlUCSIsSinhala",
38399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038400 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038401 printf(" %d", n_code);
38402 printf("\n");
38403 }
38404 }
38405#endif
38406
38407 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038408 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038409}
38410
38411
38412static int
38413test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038414 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038415
38416#ifdef LIBXML_UNICODE_ENABLED
38417 int mem_base;
38418 int ret_val;
38419 int code; /* UCS code point */
38420 int n_code;
38421
38422 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38423 mem_base = xmlMemBlocks();
38424 code = gen_int(n_code, 0);
38425
38426 ret_val = xmlUCSIsSmallFormVariants(code);
38427 desret_int(ret_val);
38428 call_tests++;
38429 des_int(n_code, code, 0);
38430 xmlResetLastError();
38431 if (mem_base != xmlMemBlocks()) {
38432 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
38433 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038434 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038435 printf(" %d", n_code);
38436 printf("\n");
38437 }
38438 }
38439#endif
38440
38441 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038442 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038443}
38444
38445
38446static int
38447test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038448 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038449
38450#ifdef LIBXML_UNICODE_ENABLED
38451 int mem_base;
38452 int ret_val;
38453 int code; /* UCS code point */
38454 int n_code;
38455
38456 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38457 mem_base = xmlMemBlocks();
38458 code = gen_int(n_code, 0);
38459
38460 ret_val = xmlUCSIsSpacingModifierLetters(code);
38461 desret_int(ret_val);
38462 call_tests++;
38463 des_int(n_code, code, 0);
38464 xmlResetLastError();
38465 if (mem_base != xmlMemBlocks()) {
38466 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
38467 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038468 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038469 printf(" %d", n_code);
38470 printf("\n");
38471 }
38472 }
38473#endif
38474
38475 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038476 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038477}
38478
38479
38480static int
38481test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038482 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038483
38484#ifdef LIBXML_UNICODE_ENABLED
38485 int mem_base;
38486 int ret_val;
38487 int code; /* UCS code point */
38488 int n_code;
38489
38490 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38491 mem_base = xmlMemBlocks();
38492 code = gen_int(n_code, 0);
38493
38494 ret_val = xmlUCSIsSpecials(code);
38495 desret_int(ret_val);
38496 call_tests++;
38497 des_int(n_code, code, 0);
38498 xmlResetLastError();
38499 if (mem_base != xmlMemBlocks()) {
38500 printf("Leak of %d blocks found in xmlUCSIsSpecials",
38501 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038502 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038503 printf(" %d", n_code);
38504 printf("\n");
38505 }
38506 }
38507#endif
38508
38509 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038510 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038511}
38512
38513
38514static int
38515test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038516 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038517
38518#ifdef LIBXML_UNICODE_ENABLED
38519 int mem_base;
38520 int ret_val;
38521 int code; /* UCS code point */
38522 int n_code;
38523
38524 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38525 mem_base = xmlMemBlocks();
38526 code = gen_int(n_code, 0);
38527
38528 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
38529 desret_int(ret_val);
38530 call_tests++;
38531 des_int(n_code, code, 0);
38532 xmlResetLastError();
38533 if (mem_base != xmlMemBlocks()) {
38534 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
38535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038536 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038537 printf(" %d", n_code);
38538 printf("\n");
38539 }
38540 }
38541#endif
38542
38543 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038544 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038545}
38546
38547
38548static int
38549test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038550 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038551
38552#ifdef LIBXML_UNICODE_ENABLED
38553 int mem_base;
38554 int ret_val;
38555 int code; /* UCS code point */
38556 int n_code;
38557
38558 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38559 mem_base = xmlMemBlocks();
38560 code = gen_int(n_code, 0);
38561
38562 ret_val = xmlUCSIsSupplementalArrowsA(code);
38563 desret_int(ret_val);
38564 call_tests++;
38565 des_int(n_code, code, 0);
38566 xmlResetLastError();
38567 if (mem_base != xmlMemBlocks()) {
38568 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
38569 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038570 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038571 printf(" %d", n_code);
38572 printf("\n");
38573 }
38574 }
38575#endif
38576
38577 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038578 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038579}
38580
38581
38582static int
38583test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038584 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038585
38586#ifdef LIBXML_UNICODE_ENABLED
38587 int mem_base;
38588 int ret_val;
38589 int code; /* UCS code point */
38590 int n_code;
38591
38592 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38593 mem_base = xmlMemBlocks();
38594 code = gen_int(n_code, 0);
38595
38596 ret_val = xmlUCSIsSupplementalArrowsB(code);
38597 desret_int(ret_val);
38598 call_tests++;
38599 des_int(n_code, code, 0);
38600 xmlResetLastError();
38601 if (mem_base != xmlMemBlocks()) {
38602 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
38603 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038604 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038605 printf(" %d", n_code);
38606 printf("\n");
38607 }
38608 }
38609#endif
38610
38611 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038612 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038613}
38614
38615
38616static int
38617test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038618 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038619
38620#ifdef LIBXML_UNICODE_ENABLED
38621 int mem_base;
38622 int ret_val;
38623 int code; /* UCS code point */
38624 int n_code;
38625
38626 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38627 mem_base = xmlMemBlocks();
38628 code = gen_int(n_code, 0);
38629
38630 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
38631 desret_int(ret_val);
38632 call_tests++;
38633 des_int(n_code, code, 0);
38634 xmlResetLastError();
38635 if (mem_base != xmlMemBlocks()) {
38636 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
38637 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038638 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038639 printf(" %d", n_code);
38640 printf("\n");
38641 }
38642 }
38643#endif
38644
38645 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038646 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038647}
38648
38649
38650static int
38651test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038652 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038653
38654#ifdef LIBXML_UNICODE_ENABLED
38655 int mem_base;
38656 int ret_val;
38657 int code; /* UCS code point */
38658 int n_code;
38659
38660 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38661 mem_base = xmlMemBlocks();
38662 code = gen_int(n_code, 0);
38663
38664 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
38665 desret_int(ret_val);
38666 call_tests++;
38667 des_int(n_code, code, 0);
38668 xmlResetLastError();
38669 if (mem_base != xmlMemBlocks()) {
38670 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
38671 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038672 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038673 printf(" %d", n_code);
38674 printf("\n");
38675 }
38676 }
38677#endif
38678
38679 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038680 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038681}
38682
38683
38684static int
38685test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038686 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038687
38688#ifdef LIBXML_UNICODE_ENABLED
38689 int mem_base;
38690 int ret_val;
38691 int code; /* UCS code point */
38692 int n_code;
38693
38694 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38695 mem_base = xmlMemBlocks();
38696 code = gen_int(n_code, 0);
38697
38698 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
38699 desret_int(ret_val);
38700 call_tests++;
38701 des_int(n_code, code, 0);
38702 xmlResetLastError();
38703 if (mem_base != xmlMemBlocks()) {
38704 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
38705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038706 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038707 printf(" %d", n_code);
38708 printf("\n");
38709 }
38710 }
38711#endif
38712
38713 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038714 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038715}
38716
38717
38718static int
38719test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038720 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038721
38722#ifdef LIBXML_UNICODE_ENABLED
38723 int mem_base;
38724 int ret_val;
38725 int code; /* UCS code point */
38726 int n_code;
38727
38728 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38729 mem_base = xmlMemBlocks();
38730 code = gen_int(n_code, 0);
38731
38732 ret_val = xmlUCSIsSyriac(code);
38733 desret_int(ret_val);
38734 call_tests++;
38735 des_int(n_code, code, 0);
38736 xmlResetLastError();
38737 if (mem_base != xmlMemBlocks()) {
38738 printf("Leak of %d blocks found in xmlUCSIsSyriac",
38739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038740 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038741 printf(" %d", n_code);
38742 printf("\n");
38743 }
38744 }
38745#endif
38746
38747 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038748 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038749}
38750
38751
38752static int
38753test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038754 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038755
38756#ifdef LIBXML_UNICODE_ENABLED
38757 int mem_base;
38758 int ret_val;
38759 int code; /* UCS code point */
38760 int n_code;
38761
38762 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38763 mem_base = xmlMemBlocks();
38764 code = gen_int(n_code, 0);
38765
38766 ret_val = xmlUCSIsTagalog(code);
38767 desret_int(ret_val);
38768 call_tests++;
38769 des_int(n_code, code, 0);
38770 xmlResetLastError();
38771 if (mem_base != xmlMemBlocks()) {
38772 printf("Leak of %d blocks found in xmlUCSIsTagalog",
38773 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038774 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038775 printf(" %d", n_code);
38776 printf("\n");
38777 }
38778 }
38779#endif
38780
38781 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038782 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038783}
38784
38785
38786static int
38787test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038788 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038789
38790#ifdef LIBXML_UNICODE_ENABLED
38791 int mem_base;
38792 int ret_val;
38793 int code; /* UCS code point */
38794 int n_code;
38795
38796 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38797 mem_base = xmlMemBlocks();
38798 code = gen_int(n_code, 0);
38799
38800 ret_val = xmlUCSIsTagbanwa(code);
38801 desret_int(ret_val);
38802 call_tests++;
38803 des_int(n_code, code, 0);
38804 xmlResetLastError();
38805 if (mem_base != xmlMemBlocks()) {
38806 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
38807 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038808 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038809 printf(" %d", n_code);
38810 printf("\n");
38811 }
38812 }
38813#endif
38814
38815 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038816 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038817}
38818
38819
38820static int
38821test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038822 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038823
38824#ifdef LIBXML_UNICODE_ENABLED
38825 int mem_base;
38826 int ret_val;
38827 int code; /* UCS code point */
38828 int n_code;
38829
38830 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38831 mem_base = xmlMemBlocks();
38832 code = gen_int(n_code, 0);
38833
38834 ret_val = xmlUCSIsTags(code);
38835 desret_int(ret_val);
38836 call_tests++;
38837 des_int(n_code, code, 0);
38838 xmlResetLastError();
38839 if (mem_base != xmlMemBlocks()) {
38840 printf("Leak of %d blocks found in xmlUCSIsTags",
38841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038842 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038843 printf(" %d", n_code);
38844 printf("\n");
38845 }
38846 }
38847#endif
38848
38849 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038850 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038851}
38852
38853
38854static int
38855test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038856 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038857
38858#ifdef LIBXML_UNICODE_ENABLED
38859 int mem_base;
38860 int ret_val;
38861 int code; /* UCS code point */
38862 int n_code;
38863
38864 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38865 mem_base = xmlMemBlocks();
38866 code = gen_int(n_code, 0);
38867
38868 ret_val = xmlUCSIsTaiLe(code);
38869 desret_int(ret_val);
38870 call_tests++;
38871 des_int(n_code, code, 0);
38872 xmlResetLastError();
38873 if (mem_base != xmlMemBlocks()) {
38874 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
38875 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038876 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038877 printf(" %d", n_code);
38878 printf("\n");
38879 }
38880 }
38881#endif
38882
38883 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038884 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038885}
38886
38887
38888static int
38889test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038890 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038891
38892#ifdef LIBXML_UNICODE_ENABLED
38893 int mem_base;
38894 int ret_val;
38895 int code; /* UCS code point */
38896 int n_code;
38897
38898 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38899 mem_base = xmlMemBlocks();
38900 code = gen_int(n_code, 0);
38901
38902 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
38903 desret_int(ret_val);
38904 call_tests++;
38905 des_int(n_code, code, 0);
38906 xmlResetLastError();
38907 if (mem_base != xmlMemBlocks()) {
38908 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
38909 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038910 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038911 printf(" %d", n_code);
38912 printf("\n");
38913 }
38914 }
38915#endif
38916
38917 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038918 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038919}
38920
38921
38922static int
38923test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038924 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038925
38926#ifdef LIBXML_UNICODE_ENABLED
38927 int mem_base;
38928 int ret_val;
38929 int code; /* UCS code point */
38930 int n_code;
38931
38932 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38933 mem_base = xmlMemBlocks();
38934 code = gen_int(n_code, 0);
38935
38936 ret_val = xmlUCSIsTamil(code);
38937 desret_int(ret_val);
38938 call_tests++;
38939 des_int(n_code, code, 0);
38940 xmlResetLastError();
38941 if (mem_base != xmlMemBlocks()) {
38942 printf("Leak of %d blocks found in xmlUCSIsTamil",
38943 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038944 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038945 printf(" %d", n_code);
38946 printf("\n");
38947 }
38948 }
38949#endif
38950
38951 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038952 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038953}
38954
38955
38956static int
38957test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038958 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038959
38960#ifdef LIBXML_UNICODE_ENABLED
38961 int mem_base;
38962 int ret_val;
38963 int code; /* UCS code point */
38964 int n_code;
38965
38966 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38967 mem_base = xmlMemBlocks();
38968 code = gen_int(n_code, 0);
38969
38970 ret_val = xmlUCSIsTelugu(code);
38971 desret_int(ret_val);
38972 call_tests++;
38973 des_int(n_code, code, 0);
38974 xmlResetLastError();
38975 if (mem_base != xmlMemBlocks()) {
38976 printf("Leak of %d blocks found in xmlUCSIsTelugu",
38977 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038978 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038979 printf(" %d", n_code);
38980 printf("\n");
38981 }
38982 }
38983#endif
38984
38985 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000038986 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038987}
38988
38989
38990static int
38991test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038992 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038993
38994#ifdef LIBXML_UNICODE_ENABLED
38995 int mem_base;
38996 int ret_val;
38997 int code; /* UCS code point */
38998 int n_code;
38999
39000 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39001 mem_base = xmlMemBlocks();
39002 code = gen_int(n_code, 0);
39003
39004 ret_val = xmlUCSIsThaana(code);
39005 desret_int(ret_val);
39006 call_tests++;
39007 des_int(n_code, code, 0);
39008 xmlResetLastError();
39009 if (mem_base != xmlMemBlocks()) {
39010 printf("Leak of %d blocks found in xmlUCSIsThaana",
39011 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039012 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039013 printf(" %d", n_code);
39014 printf("\n");
39015 }
39016 }
39017#endif
39018
39019 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039020 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039021}
39022
39023
39024static int
39025test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039026 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039027
39028#ifdef LIBXML_UNICODE_ENABLED
39029 int mem_base;
39030 int ret_val;
39031 int code; /* UCS code point */
39032 int n_code;
39033
39034 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39035 mem_base = xmlMemBlocks();
39036 code = gen_int(n_code, 0);
39037
39038 ret_val = xmlUCSIsThai(code);
39039 desret_int(ret_val);
39040 call_tests++;
39041 des_int(n_code, code, 0);
39042 xmlResetLastError();
39043 if (mem_base != xmlMemBlocks()) {
39044 printf("Leak of %d blocks found in xmlUCSIsThai",
39045 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039046 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039047 printf(" %d", n_code);
39048 printf("\n");
39049 }
39050 }
39051#endif
39052
39053 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039054 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039055}
39056
39057
39058static int
39059test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039060 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039061
39062#ifdef LIBXML_UNICODE_ENABLED
39063 int mem_base;
39064 int ret_val;
39065 int code; /* UCS code point */
39066 int n_code;
39067
39068 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39069 mem_base = xmlMemBlocks();
39070 code = gen_int(n_code, 0);
39071
39072 ret_val = xmlUCSIsTibetan(code);
39073 desret_int(ret_val);
39074 call_tests++;
39075 des_int(n_code, code, 0);
39076 xmlResetLastError();
39077 if (mem_base != xmlMemBlocks()) {
39078 printf("Leak of %d blocks found in xmlUCSIsTibetan",
39079 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039080 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039081 printf(" %d", n_code);
39082 printf("\n");
39083 }
39084 }
39085#endif
39086
39087 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039088 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039089}
39090
39091
39092static int
39093test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039094 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039095
39096#ifdef LIBXML_UNICODE_ENABLED
39097 int mem_base;
39098 int ret_val;
39099 int code; /* UCS code point */
39100 int n_code;
39101
39102 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39103 mem_base = xmlMemBlocks();
39104 code = gen_int(n_code, 0);
39105
39106 ret_val = xmlUCSIsUgaritic(code);
39107 desret_int(ret_val);
39108 call_tests++;
39109 des_int(n_code, code, 0);
39110 xmlResetLastError();
39111 if (mem_base != xmlMemBlocks()) {
39112 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
39113 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039114 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039115 printf(" %d", n_code);
39116 printf("\n");
39117 }
39118 }
39119#endif
39120
39121 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039122 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039123}
39124
39125
39126static int
39127test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039128 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039129
39130#ifdef LIBXML_UNICODE_ENABLED
39131 int mem_base;
39132 int ret_val;
39133 int code; /* UCS code point */
39134 int n_code;
39135
39136 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39137 mem_base = xmlMemBlocks();
39138 code = gen_int(n_code, 0);
39139
39140 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
39141 desret_int(ret_val);
39142 call_tests++;
39143 des_int(n_code, code, 0);
39144 xmlResetLastError();
39145 if (mem_base != xmlMemBlocks()) {
39146 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
39147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039148 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039149 printf(" %d", n_code);
39150 printf("\n");
39151 }
39152 }
39153#endif
39154
39155 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039156 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039157}
39158
39159
39160static int
39161test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039162 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039163
39164#ifdef LIBXML_UNICODE_ENABLED
39165 int mem_base;
39166 int ret_val;
39167 int code; /* UCS code point */
39168 int n_code;
39169
39170 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39171 mem_base = xmlMemBlocks();
39172 code = gen_int(n_code, 0);
39173
39174 ret_val = xmlUCSIsVariationSelectors(code);
39175 desret_int(ret_val);
39176 call_tests++;
39177 des_int(n_code, code, 0);
39178 xmlResetLastError();
39179 if (mem_base != xmlMemBlocks()) {
39180 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
39181 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039182 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039183 printf(" %d", n_code);
39184 printf("\n");
39185 }
39186 }
39187#endif
39188
39189 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039190 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039191}
39192
39193
39194static int
39195test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039196 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039197
39198#ifdef LIBXML_UNICODE_ENABLED
39199 int mem_base;
39200 int ret_val;
39201 int code; /* UCS code point */
39202 int n_code;
39203
39204 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39205 mem_base = xmlMemBlocks();
39206 code = gen_int(n_code, 0);
39207
39208 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
39209 desret_int(ret_val);
39210 call_tests++;
39211 des_int(n_code, code, 0);
39212 xmlResetLastError();
39213 if (mem_base != xmlMemBlocks()) {
39214 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
39215 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039216 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039217 printf(" %d", n_code);
39218 printf("\n");
39219 }
39220 }
39221#endif
39222
39223 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039224 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039225}
39226
39227
39228static int
39229test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039230 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039231
39232#ifdef LIBXML_UNICODE_ENABLED
39233 int mem_base;
39234 int ret_val;
39235 int code; /* UCS code point */
39236 int n_code;
39237
39238 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39239 mem_base = xmlMemBlocks();
39240 code = gen_int(n_code, 0);
39241
39242 ret_val = xmlUCSIsYiRadicals(code);
39243 desret_int(ret_val);
39244 call_tests++;
39245 des_int(n_code, code, 0);
39246 xmlResetLastError();
39247 if (mem_base != xmlMemBlocks()) {
39248 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
39249 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039250 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039251 printf(" %d", n_code);
39252 printf("\n");
39253 }
39254 }
39255#endif
39256
39257 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039258 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039259}
39260
39261
39262static int
39263test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039264 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039265
39266#ifdef LIBXML_UNICODE_ENABLED
39267 int mem_base;
39268 int ret_val;
39269 int code; /* UCS code point */
39270 int n_code;
39271
39272 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39273 mem_base = xmlMemBlocks();
39274 code = gen_int(n_code, 0);
39275
39276 ret_val = xmlUCSIsYiSyllables(code);
39277 desret_int(ret_val);
39278 call_tests++;
39279 des_int(n_code, code, 0);
39280 xmlResetLastError();
39281 if (mem_base != xmlMemBlocks()) {
39282 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
39283 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039284 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039285 printf(" %d", n_code);
39286 printf("\n");
39287 }
39288 }
39289#endif
39290
39291 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039292 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039293}
39294
39295
39296static int
39297test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039298 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039299
39300#ifdef LIBXML_UNICODE_ENABLED
39301 int mem_base;
39302 int ret_val;
39303 int code; /* UCS code point */
39304 int n_code;
39305
39306 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39307 mem_base = xmlMemBlocks();
39308 code = gen_int(n_code, 0);
39309
39310 ret_val = xmlUCSIsYijingHexagramSymbols(code);
39311 desret_int(ret_val);
39312 call_tests++;
39313 des_int(n_code, code, 0);
39314 xmlResetLastError();
39315 if (mem_base != xmlMemBlocks()) {
39316 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
39317 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039318 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039319 printf(" %d", n_code);
39320 printf("\n");
39321 }
39322 }
39323#endif
39324
39325 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039326 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039327}
39328
39329static int
39330test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039331 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039332
39333 printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000039334 test_ret += test_xmlUCSIsAegeanNumbers();
39335 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
39336 test_ret += test_xmlUCSIsArabic();
39337 test_ret += test_xmlUCSIsArabicPresentationFormsA();
39338 test_ret += test_xmlUCSIsArabicPresentationFormsB();
39339 test_ret += test_xmlUCSIsArmenian();
39340 test_ret += test_xmlUCSIsArrows();
39341 test_ret += test_xmlUCSIsBasicLatin();
39342 test_ret += test_xmlUCSIsBengali();
39343 test_ret += test_xmlUCSIsBlock();
39344 test_ret += test_xmlUCSIsBlockElements();
39345 test_ret += test_xmlUCSIsBopomofo();
39346 test_ret += test_xmlUCSIsBopomofoExtended();
39347 test_ret += test_xmlUCSIsBoxDrawing();
39348 test_ret += test_xmlUCSIsBraillePatterns();
39349 test_ret += test_xmlUCSIsBuhid();
39350 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
39351 test_ret += test_xmlUCSIsCJKCompatibility();
39352 test_ret += test_xmlUCSIsCJKCompatibilityForms();
39353 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
39354 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
39355 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
39356 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
39357 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
39358 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
39359 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
39360 test_ret += test_xmlUCSIsCat();
39361 test_ret += test_xmlUCSIsCatC();
39362 test_ret += test_xmlUCSIsCatCc();
39363 test_ret += test_xmlUCSIsCatCf();
39364 test_ret += test_xmlUCSIsCatCo();
39365 test_ret += test_xmlUCSIsCatCs();
39366 test_ret += test_xmlUCSIsCatL();
39367 test_ret += test_xmlUCSIsCatLl();
39368 test_ret += test_xmlUCSIsCatLm();
39369 test_ret += test_xmlUCSIsCatLo();
39370 test_ret += test_xmlUCSIsCatLt();
39371 test_ret += test_xmlUCSIsCatLu();
39372 test_ret += test_xmlUCSIsCatM();
39373 test_ret += test_xmlUCSIsCatMc();
39374 test_ret += test_xmlUCSIsCatMe();
39375 test_ret += test_xmlUCSIsCatMn();
39376 test_ret += test_xmlUCSIsCatN();
39377 test_ret += test_xmlUCSIsCatNd();
39378 test_ret += test_xmlUCSIsCatNl();
39379 test_ret += test_xmlUCSIsCatNo();
39380 test_ret += test_xmlUCSIsCatP();
39381 test_ret += test_xmlUCSIsCatPc();
39382 test_ret += test_xmlUCSIsCatPd();
39383 test_ret += test_xmlUCSIsCatPe();
39384 test_ret += test_xmlUCSIsCatPf();
39385 test_ret += test_xmlUCSIsCatPi();
39386 test_ret += test_xmlUCSIsCatPo();
39387 test_ret += test_xmlUCSIsCatPs();
39388 test_ret += test_xmlUCSIsCatS();
39389 test_ret += test_xmlUCSIsCatSc();
39390 test_ret += test_xmlUCSIsCatSk();
39391 test_ret += test_xmlUCSIsCatSm();
39392 test_ret += test_xmlUCSIsCatSo();
39393 test_ret += test_xmlUCSIsCatZ();
39394 test_ret += test_xmlUCSIsCatZl();
39395 test_ret += test_xmlUCSIsCatZp();
39396 test_ret += test_xmlUCSIsCatZs();
39397 test_ret += test_xmlUCSIsCherokee();
39398 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
39399 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
39400 test_ret += test_xmlUCSIsCombiningHalfMarks();
39401 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
39402 test_ret += test_xmlUCSIsControlPictures();
39403 test_ret += test_xmlUCSIsCurrencySymbols();
39404 test_ret += test_xmlUCSIsCypriotSyllabary();
39405 test_ret += test_xmlUCSIsCyrillic();
39406 test_ret += test_xmlUCSIsCyrillicSupplement();
39407 test_ret += test_xmlUCSIsDeseret();
39408 test_ret += test_xmlUCSIsDevanagari();
39409 test_ret += test_xmlUCSIsDingbats();
39410 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
39411 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
39412 test_ret += test_xmlUCSIsEthiopic();
39413 test_ret += test_xmlUCSIsGeneralPunctuation();
39414 test_ret += test_xmlUCSIsGeometricShapes();
39415 test_ret += test_xmlUCSIsGeorgian();
39416 test_ret += test_xmlUCSIsGothic();
39417 test_ret += test_xmlUCSIsGreek();
39418 test_ret += test_xmlUCSIsGreekExtended();
39419 test_ret += test_xmlUCSIsGreekandCoptic();
39420 test_ret += test_xmlUCSIsGujarati();
39421 test_ret += test_xmlUCSIsGurmukhi();
39422 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
39423 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
39424 test_ret += test_xmlUCSIsHangulJamo();
39425 test_ret += test_xmlUCSIsHangulSyllables();
39426 test_ret += test_xmlUCSIsHanunoo();
39427 test_ret += test_xmlUCSIsHebrew();
39428 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
39429 test_ret += test_xmlUCSIsHighSurrogates();
39430 test_ret += test_xmlUCSIsHiragana();
39431 test_ret += test_xmlUCSIsIPAExtensions();
39432 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
39433 test_ret += test_xmlUCSIsKanbun();
39434 test_ret += test_xmlUCSIsKangxiRadicals();
39435 test_ret += test_xmlUCSIsKannada();
39436 test_ret += test_xmlUCSIsKatakana();
39437 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
39438 test_ret += test_xmlUCSIsKhmer();
39439 test_ret += test_xmlUCSIsKhmerSymbols();
39440 test_ret += test_xmlUCSIsLao();
39441 test_ret += test_xmlUCSIsLatin1Supplement();
39442 test_ret += test_xmlUCSIsLatinExtendedA();
39443 test_ret += test_xmlUCSIsLatinExtendedAdditional();
39444 test_ret += test_xmlUCSIsLatinExtendedB();
39445 test_ret += test_xmlUCSIsLetterlikeSymbols();
39446 test_ret += test_xmlUCSIsLimbu();
39447 test_ret += test_xmlUCSIsLinearBIdeograms();
39448 test_ret += test_xmlUCSIsLinearBSyllabary();
39449 test_ret += test_xmlUCSIsLowSurrogates();
39450 test_ret += test_xmlUCSIsMalayalam();
39451 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
39452 test_ret += test_xmlUCSIsMathematicalOperators();
39453 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
39454 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
39455 test_ret += test_xmlUCSIsMiscellaneousSymbols();
39456 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
39457 test_ret += test_xmlUCSIsMiscellaneousTechnical();
39458 test_ret += test_xmlUCSIsMongolian();
39459 test_ret += test_xmlUCSIsMusicalSymbols();
39460 test_ret += test_xmlUCSIsMyanmar();
39461 test_ret += test_xmlUCSIsNumberForms();
39462 test_ret += test_xmlUCSIsOgham();
39463 test_ret += test_xmlUCSIsOldItalic();
39464 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
39465 test_ret += test_xmlUCSIsOriya();
39466 test_ret += test_xmlUCSIsOsmanya();
39467 test_ret += test_xmlUCSIsPhoneticExtensions();
39468 test_ret += test_xmlUCSIsPrivateUse();
39469 test_ret += test_xmlUCSIsPrivateUseArea();
39470 test_ret += test_xmlUCSIsRunic();
39471 test_ret += test_xmlUCSIsShavian();
39472 test_ret += test_xmlUCSIsSinhala();
39473 test_ret += test_xmlUCSIsSmallFormVariants();
39474 test_ret += test_xmlUCSIsSpacingModifierLetters();
39475 test_ret += test_xmlUCSIsSpecials();
39476 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
39477 test_ret += test_xmlUCSIsSupplementalArrowsA();
39478 test_ret += test_xmlUCSIsSupplementalArrowsB();
39479 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
39480 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
39481 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
39482 test_ret += test_xmlUCSIsSyriac();
39483 test_ret += test_xmlUCSIsTagalog();
39484 test_ret += test_xmlUCSIsTagbanwa();
39485 test_ret += test_xmlUCSIsTags();
39486 test_ret += test_xmlUCSIsTaiLe();
39487 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
39488 test_ret += test_xmlUCSIsTamil();
39489 test_ret += test_xmlUCSIsTelugu();
39490 test_ret += test_xmlUCSIsThaana();
39491 test_ret += test_xmlUCSIsThai();
39492 test_ret += test_xmlUCSIsTibetan();
39493 test_ret += test_xmlUCSIsUgaritic();
39494 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
39495 test_ret += test_xmlUCSIsVariationSelectors();
39496 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
39497 test_ret += test_xmlUCSIsYiRadicals();
39498 test_ret += test_xmlUCSIsYiSyllables();
39499 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039500
Daniel Veillard42595322004-11-08 10:52:06 +000039501 if (test_ret != 0)
39502 printf("Module xmlunicode: %d errors\n", test_ret);
39503 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039504}
39505
39506static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000039507test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039508 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039509
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039510#ifdef LIBXML_WRITER_ENABLED
39511 int mem_base;
39512 xmlTextWriterPtr ret_val;
39513 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
39514 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039515
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039516 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
39517 mem_base = xmlMemBlocks();
39518 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039519
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039520 ret_val = xmlNewTextWriter(out);
39521 if (ret_val != NULL) out = NULL;
39522 desret_xmlTextWriterPtr(ret_val);
39523 call_tests++;
39524 des_xmlOutputBufferPtr(n_out, out, 0);
39525 xmlResetLastError();
39526 if (mem_base != xmlMemBlocks()) {
39527 printf("Leak of %d blocks found in xmlNewTextWriter",
39528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039529 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039530 printf(" %d", n_out);
39531 printf("\n");
39532 }
39533 }
39534#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000039535
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039536 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039538}
39539
39540
39541static int
39542test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039544
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039545#ifdef LIBXML_WRITER_ENABLED
39546 int mem_base;
39547 xmlTextWriterPtr ret_val;
39548 const char * uri; /* the URI of the resource for the output */
39549 int n_uri;
39550 int compression; /* compress the output? */
39551 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039552
Daniel Veillard42595322004-11-08 10:52:06 +000039553 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039554 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39555 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000039556 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039557 compression = gen_int(n_compression, 1);
39558
39559 ret_val = xmlNewTextWriterFilename(uri, compression);
39560 desret_xmlTextWriterPtr(ret_val);
39561 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039562 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039563 des_int(n_compression, compression, 1);
39564 xmlResetLastError();
39565 if (mem_base != xmlMemBlocks()) {
39566 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
39567 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039568 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039569 printf(" %d", n_uri);
39570 printf(" %d", n_compression);
39571 printf("\n");
39572 }
39573 }
39574 }
39575#endif
39576
39577 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039578 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039579}
39580
39581
39582static int
39583test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039584 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039585
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039586#ifdef LIBXML_WRITER_ENABLED
39587 int mem_base;
39588 xmlTextWriterPtr ret_val;
39589 xmlBufferPtr buf; /* xmlBufferPtr */
39590 int n_buf;
39591 int compression; /* compress the output? */
39592 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039593
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039594 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
39595 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39596 mem_base = xmlMemBlocks();
39597 buf = gen_xmlBufferPtr(n_buf, 0);
39598 compression = gen_int(n_compression, 1);
39599
39600 ret_val = xmlNewTextWriterMemory(buf, compression);
39601 desret_xmlTextWriterPtr(ret_val);
39602 call_tests++;
39603 des_xmlBufferPtr(n_buf, buf, 0);
39604 des_int(n_compression, compression, 1);
39605 xmlResetLastError();
39606 if (mem_base != xmlMemBlocks()) {
39607 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
39608 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039609 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039610 printf(" %d", n_buf);
39611 printf(" %d", n_compression);
39612 printf("\n");
39613 }
39614 }
39615 }
39616#endif
39617
39618 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039620}
39621
39622
39623static int
39624test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039626
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039627#ifdef LIBXML_WRITER_ENABLED
39628 int mem_base;
39629 xmlTextWriterPtr ret_val;
39630 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
39631 int n_ctxt;
39632 int compression; /* compress the output? */
39633 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039634
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039635 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
39636 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39637 mem_base = xmlMemBlocks();
39638 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
39639 compression = gen_int(n_compression, 1);
39640
39641 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
39642 if (ret_val != NULL) ctxt = NULL;
39643 desret_xmlTextWriterPtr(ret_val);
39644 call_tests++;
39645 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
39646 des_int(n_compression, compression, 1);
39647 xmlResetLastError();
39648 if (mem_base != xmlMemBlocks()) {
39649 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
39650 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039651 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039652 printf(" %d", n_ctxt);
39653 printf(" %d", n_compression);
39654 printf("\n");
39655 }
39656 }
39657 }
39658#endif
39659
39660 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039661 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039662}
39663
39664
39665static int
39666test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039667 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039668
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039669#ifdef LIBXML_WRITER_ENABLED
39670 int mem_base;
39671 xmlTextWriterPtr ret_val;
39672 xmlDocPtr doc; /* xmlDocPtr */
39673 int n_doc;
39674 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
39675 int n_node;
39676 int compression; /* compress the output? */
39677 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039678
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039679 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
39680 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
39681 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39682 mem_base = xmlMemBlocks();
39683 doc = gen_xmlDocPtr(n_doc, 0);
39684 node = gen_xmlNodePtr(n_node, 1);
39685 compression = gen_int(n_compression, 2);
39686
39687 ret_val = xmlNewTextWriterTree(doc, node, compression);
39688 desret_xmlTextWriterPtr(ret_val);
39689 call_tests++;
39690 des_xmlDocPtr(n_doc, doc, 0);
39691 des_xmlNodePtr(n_node, node, 1);
39692 des_int(n_compression, compression, 2);
39693 xmlResetLastError();
39694 if (mem_base != xmlMemBlocks()) {
39695 printf("Leak of %d blocks found in xmlNewTextWriterTree",
39696 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039697 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039698 printf(" %d", n_doc);
39699 printf(" %d", n_node);
39700 printf(" %d", n_compression);
39701 printf("\n");
39702 }
39703 }
39704 }
39705 }
39706#endif
39707
39708 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039710}
39711
39712
39713static int
39714test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039715 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039716
Daniel Veillarde43cc572004-11-03 11:50:29 +000039717#ifdef LIBXML_WRITER_ENABLED
39718 int mem_base;
39719 int ret_val;
39720 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39721 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039722
Daniel Veillarde43cc572004-11-03 11:50:29 +000039723 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39724 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039725 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039726
39727 ret_val = xmlTextWriterEndAttribute(writer);
39728 desret_int(ret_val);
39729 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039730 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039731 xmlResetLastError();
39732 if (mem_base != xmlMemBlocks()) {
39733 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
39734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039735 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039736 printf(" %d", n_writer);
39737 printf("\n");
39738 }
39739 }
39740#endif
39741
Daniel Veillard3d97e662004-11-04 10:49:00 +000039742 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039744}
39745
39746
39747static int
39748test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039750
Daniel Veillarde43cc572004-11-03 11:50:29 +000039751#ifdef LIBXML_WRITER_ENABLED
39752 int mem_base;
39753 int ret_val;
39754 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39755 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039756
Daniel Veillarde43cc572004-11-03 11:50:29 +000039757 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39758 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039759 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039760
39761 ret_val = xmlTextWriterEndCDATA(writer);
39762 desret_int(ret_val);
39763 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039764 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039765 xmlResetLastError();
39766 if (mem_base != xmlMemBlocks()) {
39767 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
39768 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039769 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039770 printf(" %d", n_writer);
39771 printf("\n");
39772 }
39773 }
39774#endif
39775
Daniel Veillard3d97e662004-11-04 10:49:00 +000039776 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039778}
39779
39780
39781static int
39782test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039784
Daniel Veillarde43cc572004-11-03 11:50:29 +000039785#ifdef LIBXML_WRITER_ENABLED
39786 int mem_base;
39787 int ret_val;
39788 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39789 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039790
Daniel Veillarde43cc572004-11-03 11:50:29 +000039791 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39792 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039793 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039794
39795 ret_val = xmlTextWriterEndComment(writer);
39796 desret_int(ret_val);
39797 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039798 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039799 xmlResetLastError();
39800 if (mem_base != xmlMemBlocks()) {
39801 printf("Leak of %d blocks found in xmlTextWriterEndComment",
39802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039803 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039804 printf(" %d", n_writer);
39805 printf("\n");
39806 }
39807 }
39808#endif
39809
Daniel Veillard3d97e662004-11-04 10:49:00 +000039810 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039812}
39813
39814
39815static int
39816test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039818
Daniel Veillarde43cc572004-11-03 11:50:29 +000039819#ifdef LIBXML_WRITER_ENABLED
39820 int mem_base;
39821 int ret_val;
39822 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39823 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039824
Daniel Veillarde43cc572004-11-03 11:50:29 +000039825 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39826 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039827 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039828
39829 ret_val = xmlTextWriterEndDTD(writer);
39830 desret_int(ret_val);
39831 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039832 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039833 xmlResetLastError();
39834 if (mem_base != xmlMemBlocks()) {
39835 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
39836 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039837 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039838 printf(" %d", n_writer);
39839 printf("\n");
39840 }
39841 }
39842#endif
39843
Daniel Veillard3d97e662004-11-04 10:49:00 +000039844 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039845 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039846}
39847
39848
39849static int
39850test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039851 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039852
Daniel Veillarde43cc572004-11-03 11:50:29 +000039853#ifdef LIBXML_WRITER_ENABLED
39854 int mem_base;
39855 int ret_val;
39856 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39857 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039858
Daniel Veillarde43cc572004-11-03 11:50:29 +000039859 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39860 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039861 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039862
39863 ret_val = xmlTextWriterEndDTDAttlist(writer);
39864 desret_int(ret_val);
39865 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039866 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039867 xmlResetLastError();
39868 if (mem_base != xmlMemBlocks()) {
39869 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
39870 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039871 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039872 printf(" %d", n_writer);
39873 printf("\n");
39874 }
39875 }
39876#endif
39877
Daniel Veillard3d97e662004-11-04 10:49:00 +000039878 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039880}
39881
39882
39883static int
39884test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039885 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039886
Daniel Veillarde43cc572004-11-03 11:50:29 +000039887#ifdef LIBXML_WRITER_ENABLED
39888 int mem_base;
39889 int ret_val;
39890 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39891 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039892
Daniel Veillarde43cc572004-11-03 11:50:29 +000039893 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39894 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039895 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039896
39897 ret_val = xmlTextWriterEndDTDElement(writer);
39898 desret_int(ret_val);
39899 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039900 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039901 xmlResetLastError();
39902 if (mem_base != xmlMemBlocks()) {
39903 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
39904 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039905 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039906 printf(" %d", n_writer);
39907 printf("\n");
39908 }
39909 }
39910#endif
39911
Daniel Veillard3d97e662004-11-04 10:49:00 +000039912 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039913 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039914}
39915
39916
39917static int
39918test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039919 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039920
Daniel Veillarde43cc572004-11-03 11:50:29 +000039921#ifdef LIBXML_WRITER_ENABLED
39922 int mem_base;
39923 int ret_val;
39924 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39925 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039926
Daniel Veillarde43cc572004-11-03 11:50:29 +000039927 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39928 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039929 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039930
39931 ret_val = xmlTextWriterEndDTDEntity(writer);
39932 desret_int(ret_val);
39933 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039934 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039935 xmlResetLastError();
39936 if (mem_base != xmlMemBlocks()) {
39937 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
39938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039939 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039940 printf(" %d", n_writer);
39941 printf("\n");
39942 }
39943 }
39944#endif
39945
Daniel Veillard3d97e662004-11-04 10:49:00 +000039946 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039948}
39949
39950
39951static int
39952test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039954
Daniel Veillarde43cc572004-11-03 11:50:29 +000039955#ifdef LIBXML_WRITER_ENABLED
39956 int mem_base;
39957 int ret_val;
39958 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39959 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039960
Daniel Veillarde43cc572004-11-03 11:50:29 +000039961 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39962 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039963 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039964
39965 ret_val = xmlTextWriterEndDocument(writer);
39966 desret_int(ret_val);
39967 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039968 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039969 xmlResetLastError();
39970 if (mem_base != xmlMemBlocks()) {
39971 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
39972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039973 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039974 printf(" %d", n_writer);
39975 printf("\n");
39976 }
39977 }
39978#endif
39979
Daniel Veillard3d97e662004-11-04 10:49:00 +000039980 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039981 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039982}
39983
39984
39985static int
39986test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039987 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039988
Daniel Veillarde43cc572004-11-03 11:50:29 +000039989#ifdef LIBXML_WRITER_ENABLED
39990 int mem_base;
39991 int ret_val;
39992 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39993 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039994
Daniel Veillarde43cc572004-11-03 11:50:29 +000039995 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39996 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039997 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039998
39999 ret_val = xmlTextWriterEndElement(writer);
40000 desret_int(ret_val);
40001 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040002 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040003 xmlResetLastError();
40004 if (mem_base != xmlMemBlocks()) {
40005 printf("Leak of %d blocks found in xmlTextWriterEndElement",
40006 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040007 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040008 printf(" %d", n_writer);
40009 printf("\n");
40010 }
40011 }
40012#endif
40013
Daniel Veillard3d97e662004-11-04 10:49:00 +000040014 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040015 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040016}
40017
40018
40019static int
40020test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040021 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040022
Daniel Veillarde43cc572004-11-03 11:50:29 +000040023#ifdef LIBXML_WRITER_ENABLED
40024 int mem_base;
40025 int ret_val;
40026 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40027 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040028
Daniel Veillarde43cc572004-11-03 11:50:29 +000040029 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40030 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040031 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040032
40033 ret_val = xmlTextWriterEndPI(writer);
40034 desret_int(ret_val);
40035 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040036 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040037 xmlResetLastError();
40038 if (mem_base != xmlMemBlocks()) {
40039 printf("Leak of %d blocks found in xmlTextWriterEndPI",
40040 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040041 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040042 printf(" %d", n_writer);
40043 printf("\n");
40044 }
40045 }
40046#endif
40047
Daniel Veillard3d97e662004-11-04 10:49:00 +000040048 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040050}
40051
40052
40053static int
40054test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040056
Daniel Veillarde43cc572004-11-03 11:50:29 +000040057#ifdef LIBXML_WRITER_ENABLED
40058 int mem_base;
40059 int ret_val;
40060 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40061 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040062
Daniel Veillarde43cc572004-11-03 11:50:29 +000040063 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40064 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040065 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040066
40067 ret_val = xmlTextWriterFlush(writer);
40068 desret_int(ret_val);
40069 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040070 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040071 xmlResetLastError();
40072 if (mem_base != xmlMemBlocks()) {
40073 printf("Leak of %d blocks found in xmlTextWriterFlush",
40074 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040075 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040076 printf(" %d", n_writer);
40077 printf("\n");
40078 }
40079 }
40080#endif
40081
Daniel Veillard3d97e662004-11-04 10:49:00 +000040082 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040084}
40085
40086
40087static int
40088test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040090
Daniel Veillarde43cc572004-11-03 11:50:29 +000040091#ifdef LIBXML_WRITER_ENABLED
40092 int mem_base;
40093 int ret_val;
40094 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40095 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040096
Daniel Veillarde43cc572004-11-03 11:50:29 +000040097 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40098 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040099 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040100
40101 ret_val = xmlTextWriterFullEndElement(writer);
40102 desret_int(ret_val);
40103 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040104 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040105 xmlResetLastError();
40106 if (mem_base != xmlMemBlocks()) {
40107 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
40108 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040109 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040110 printf(" %d", n_writer);
40111 printf("\n");
40112 }
40113 }
40114#endif
40115
Daniel Veillard3d97e662004-11-04 10:49:00 +000040116 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040118}
40119
40120
40121static int
40122test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040124
Daniel Veillarde43cc572004-11-03 11:50:29 +000040125#ifdef LIBXML_WRITER_ENABLED
40126 int mem_base;
40127 int ret_val;
40128 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40129 int n_writer;
40130 int indent; /* do indentation? */
40131 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040132
Daniel Veillarde43cc572004-11-03 11:50:29 +000040133 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40134 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
40135 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040136 writer = gen_xmlTextWriterPtr(n_writer, 0);
40137 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040138
40139 ret_val = xmlTextWriterSetIndent(writer, indent);
40140 desret_int(ret_val);
40141 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040142 des_xmlTextWriterPtr(n_writer, writer, 0);
40143 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040144 xmlResetLastError();
40145 if (mem_base != xmlMemBlocks()) {
40146 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
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(" %d", n_indent);
40151 printf("\n");
40152 }
40153 }
40154 }
40155#endif
40156
Daniel Veillard3d97e662004-11-04 10:49:00 +000040157 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040159}
40160
40161
40162static int
40163test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040164 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040165
Daniel Veillarde43cc572004-11-03 11:50:29 +000040166#ifdef LIBXML_WRITER_ENABLED
40167 int mem_base;
40168 int ret_val;
40169 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40170 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040171 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040172 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040173
Daniel Veillarde43cc572004-11-03 11:50:29 +000040174 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40175 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
40176 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040177 writer = gen_xmlTextWriterPtr(n_writer, 0);
40178 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040179
40180 ret_val = xmlTextWriterSetIndentString(writer, str);
40181 desret_int(ret_val);
40182 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040183 des_xmlTextWriterPtr(n_writer, writer, 0);
40184 des_const_xmlChar_ptr(n_str, str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040185 xmlResetLastError();
40186 if (mem_base != xmlMemBlocks()) {
40187 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
40188 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040189 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040190 printf(" %d", n_writer);
40191 printf(" %d", n_str);
40192 printf("\n");
40193 }
40194 }
40195 }
40196#endif
40197
Daniel Veillard3d97e662004-11-04 10:49:00 +000040198 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040199 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040200}
40201
40202
40203static int
40204test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040205 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040206
Daniel Veillarde43cc572004-11-03 11:50:29 +000040207#ifdef LIBXML_WRITER_ENABLED
40208 int mem_base;
40209 int ret_val;
40210 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40211 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040212 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040213 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040214
Daniel Veillarde43cc572004-11-03 11:50:29 +000040215 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40216 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40217 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040218 writer = gen_xmlTextWriterPtr(n_writer, 0);
40219 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040220
40221 ret_val = xmlTextWriterStartAttribute(writer, name);
40222 desret_int(ret_val);
40223 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040224 des_xmlTextWriterPtr(n_writer, writer, 0);
40225 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040226 xmlResetLastError();
40227 if (mem_base != xmlMemBlocks()) {
40228 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
40229 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040230 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040231 printf(" %d", n_writer);
40232 printf(" %d", n_name);
40233 printf("\n");
40234 }
40235 }
40236 }
40237#endif
40238
Daniel Veillard3d97e662004-11-04 10:49:00 +000040239 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040241}
40242
40243
40244static int
40245test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040247
Daniel Veillarde43cc572004-11-03 11:50:29 +000040248#ifdef LIBXML_WRITER_ENABLED
40249 int mem_base;
40250 int ret_val;
40251 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40252 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040253 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040254 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040255 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040256 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040257 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040258 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040259
Daniel Veillarde43cc572004-11-03 11:50:29 +000040260 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40261 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40262 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40263 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40264 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040265 writer = gen_xmlTextWriterPtr(n_writer, 0);
40266 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40267 name = gen_const_xmlChar_ptr(n_name, 2);
40268 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040269
40270 ret_val = xmlTextWriterStartAttributeNS(writer, prefix, name, namespaceURI);
40271 desret_int(ret_val);
40272 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040273 des_xmlTextWriterPtr(n_writer, writer, 0);
40274 des_const_xmlChar_ptr(n_prefix, prefix, 1);
40275 des_const_xmlChar_ptr(n_name, name, 2);
40276 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040277 xmlResetLastError();
40278 if (mem_base != xmlMemBlocks()) {
40279 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
40280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040281 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040282 printf(" %d", n_writer);
40283 printf(" %d", n_prefix);
40284 printf(" %d", n_name);
40285 printf(" %d", n_namespaceURI);
40286 printf("\n");
40287 }
40288 }
40289 }
40290 }
40291 }
40292#endif
40293
Daniel Veillard3d97e662004-11-04 10:49:00 +000040294 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040295 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040296}
40297
40298
40299static int
40300test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040301 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040302
Daniel Veillarde43cc572004-11-03 11:50:29 +000040303#ifdef LIBXML_WRITER_ENABLED
40304 int mem_base;
40305 int ret_val;
40306 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40307 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040308
Daniel Veillarde43cc572004-11-03 11:50:29 +000040309 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40310 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040311 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040312
40313 ret_val = xmlTextWriterStartCDATA(writer);
40314 desret_int(ret_val);
40315 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040316 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040317 xmlResetLastError();
40318 if (mem_base != xmlMemBlocks()) {
40319 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
40320 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040321 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040322 printf(" %d", n_writer);
40323 printf("\n");
40324 }
40325 }
40326#endif
40327
Daniel Veillard3d97e662004-11-04 10:49:00 +000040328 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040329 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040330}
40331
40332
40333static int
40334test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040336
Daniel Veillarde43cc572004-11-03 11:50:29 +000040337#ifdef LIBXML_WRITER_ENABLED
40338 int mem_base;
40339 int ret_val;
40340 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40341 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040342
Daniel Veillarde43cc572004-11-03 11:50:29 +000040343 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40344 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040345 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040346
40347 ret_val = xmlTextWriterStartComment(writer);
40348 desret_int(ret_val);
40349 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040350 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040351 xmlResetLastError();
40352 if (mem_base != xmlMemBlocks()) {
40353 printf("Leak of %d blocks found in xmlTextWriterStartComment",
40354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040355 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040356 printf(" %d", n_writer);
40357 printf("\n");
40358 }
40359 }
40360#endif
40361
Daniel Veillard3d97e662004-11-04 10:49:00 +000040362 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040364}
40365
40366
40367static int
40368test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040370
Daniel Veillarde43cc572004-11-03 11:50:29 +000040371#ifdef LIBXML_WRITER_ENABLED
40372 int mem_base;
40373 int ret_val;
40374 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40375 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040376 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040377 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040378 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040379 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040380 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040381 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040382
Daniel Veillarde43cc572004-11-03 11:50:29 +000040383 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40384 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40385 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
40386 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
40387 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040388 writer = gen_xmlTextWriterPtr(n_writer, 0);
40389 name = gen_const_xmlChar_ptr(n_name, 1);
40390 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
40391 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040392
40393 ret_val = xmlTextWriterStartDTD(writer, name, pubid, sysid);
40394 desret_int(ret_val);
40395 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040396 des_xmlTextWriterPtr(n_writer, writer, 0);
40397 des_const_xmlChar_ptr(n_name, name, 1);
40398 des_const_xmlChar_ptr(n_pubid, pubid, 2);
40399 des_const_xmlChar_ptr(n_sysid, sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040400 xmlResetLastError();
40401 if (mem_base != xmlMemBlocks()) {
40402 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
40403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040404 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040405 printf(" %d", n_writer);
40406 printf(" %d", n_name);
40407 printf(" %d", n_pubid);
40408 printf(" %d", n_sysid);
40409 printf("\n");
40410 }
40411 }
40412 }
40413 }
40414 }
40415#endif
40416
Daniel Veillard3d97e662004-11-04 10:49:00 +000040417 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040418 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040419}
40420
40421
40422static int
40423test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040424 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040425
Daniel Veillarde43cc572004-11-03 11:50:29 +000040426#ifdef LIBXML_WRITER_ENABLED
40427 int mem_base;
40428 int ret_val;
40429 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40430 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040431 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040432 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040433
Daniel Veillarde43cc572004-11-03 11:50:29 +000040434 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40435 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40436 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040437 writer = gen_xmlTextWriterPtr(n_writer, 0);
40438 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040439
40440 ret_val = xmlTextWriterStartDTDAttlist(writer, name);
40441 desret_int(ret_val);
40442 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040443 des_xmlTextWriterPtr(n_writer, writer, 0);
40444 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040445 xmlResetLastError();
40446 if (mem_base != xmlMemBlocks()) {
40447 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
40448 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040449 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040450 printf(" %d", n_writer);
40451 printf(" %d", n_name);
40452 printf("\n");
40453 }
40454 }
40455 }
40456#endif
40457
Daniel Veillard3d97e662004-11-04 10:49:00 +000040458 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040460}
40461
40462
40463static int
40464test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040466
Daniel Veillarde43cc572004-11-03 11:50:29 +000040467#ifdef LIBXML_WRITER_ENABLED
40468 int mem_base;
40469 int ret_val;
40470 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40471 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040472 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040473 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040474
Daniel Veillarde43cc572004-11-03 11:50:29 +000040475 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40476 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40477 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040478 writer = gen_xmlTextWriterPtr(n_writer, 0);
40479 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040480
40481 ret_val = xmlTextWriterStartDTDElement(writer, name);
40482 desret_int(ret_val);
40483 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040484 des_xmlTextWriterPtr(n_writer, writer, 0);
40485 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040486 xmlResetLastError();
40487 if (mem_base != xmlMemBlocks()) {
40488 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
40489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040490 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040491 printf(" %d", n_writer);
40492 printf(" %d", n_name);
40493 printf("\n");
40494 }
40495 }
40496 }
40497#endif
40498
Daniel Veillard3d97e662004-11-04 10:49:00 +000040499 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040500 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040501}
40502
40503
40504static int
40505test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040506 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040507
Daniel Veillarde43cc572004-11-03 11:50:29 +000040508#ifdef LIBXML_WRITER_ENABLED
40509 int mem_base;
40510 int ret_val;
40511 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40512 int n_writer;
40513 int pe; /* TRUE if this is a parameter entity, FALSE if not */
40514 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040515 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040516 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040517
Daniel Veillarde43cc572004-11-03 11:50:29 +000040518 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40519 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
40520 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40521 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040522 writer = gen_xmlTextWriterPtr(n_writer, 0);
40523 pe = gen_int(n_pe, 1);
40524 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040525
40526 ret_val = xmlTextWriterStartDTDEntity(writer, pe, name);
40527 desret_int(ret_val);
40528 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040529 des_xmlTextWriterPtr(n_writer, writer, 0);
40530 des_int(n_pe, pe, 1);
40531 des_const_xmlChar_ptr(n_name, name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040532 xmlResetLastError();
40533 if (mem_base != xmlMemBlocks()) {
40534 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
40535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040536 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040537 printf(" %d", n_writer);
40538 printf(" %d", n_pe);
40539 printf(" %d", n_name);
40540 printf("\n");
40541 }
40542 }
40543 }
40544 }
40545#endif
40546
Daniel Veillard3d97e662004-11-04 10:49:00 +000040547 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040549}
40550
40551
40552static int
40553test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040555
Daniel Veillarde43cc572004-11-03 11:50:29 +000040556#ifdef LIBXML_WRITER_ENABLED
40557 int mem_base;
40558 int ret_val;
40559 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40560 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040561 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040562 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040563 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040564 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040565 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040566 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040567
Daniel Veillarde43cc572004-11-03 11:50:29 +000040568 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40569 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
40570 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
40571 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
40572 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040573 writer = gen_xmlTextWriterPtr(n_writer, 0);
40574 version = gen_const_char_ptr(n_version, 1);
40575 encoding = gen_const_char_ptr(n_encoding, 2);
40576 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040577
40578 ret_val = xmlTextWriterStartDocument(writer, version, encoding, standalone);
40579 desret_int(ret_val);
40580 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040581 des_xmlTextWriterPtr(n_writer, writer, 0);
40582 des_const_char_ptr(n_version, version, 1);
40583 des_const_char_ptr(n_encoding, encoding, 2);
40584 des_const_char_ptr(n_standalone, standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040585 xmlResetLastError();
40586 if (mem_base != xmlMemBlocks()) {
40587 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
40588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040589 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040590 printf(" %d", n_writer);
40591 printf(" %d", n_version);
40592 printf(" %d", n_encoding);
40593 printf(" %d", n_standalone);
40594 printf("\n");
40595 }
40596 }
40597 }
40598 }
40599 }
40600#endif
40601
Daniel Veillard3d97e662004-11-04 10:49:00 +000040602 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040604}
40605
40606
40607static int
40608test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040610
Daniel Veillarde43cc572004-11-03 11:50:29 +000040611#ifdef LIBXML_WRITER_ENABLED
40612 int mem_base;
40613 int ret_val;
40614 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40615 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040616 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040617 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040618
Daniel Veillarde43cc572004-11-03 11:50:29 +000040619 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40620 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40621 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040622 writer = gen_xmlTextWriterPtr(n_writer, 0);
40623 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040624
40625 ret_val = xmlTextWriterStartElement(writer, name);
40626 desret_int(ret_val);
40627 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040628 des_xmlTextWriterPtr(n_writer, writer, 0);
40629 des_const_xmlChar_ptr(n_name, name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040630 xmlResetLastError();
40631 if (mem_base != xmlMemBlocks()) {
40632 printf("Leak of %d blocks found in xmlTextWriterStartElement",
40633 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040634 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040635 printf(" %d", n_writer);
40636 printf(" %d", n_name);
40637 printf("\n");
40638 }
40639 }
40640 }
40641#endif
40642
Daniel Veillard3d97e662004-11-04 10:49:00 +000040643 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040645}
40646
40647
40648static int
40649test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040651
Daniel Veillarde43cc572004-11-03 11:50:29 +000040652#ifdef LIBXML_WRITER_ENABLED
40653 int mem_base;
40654 int ret_val;
40655 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40656 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040657 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040658 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040659 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040660 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040661 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040662 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040663
Daniel Veillarde43cc572004-11-03 11:50:29 +000040664 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40665 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40666 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40667 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40668 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040669 writer = gen_xmlTextWriterPtr(n_writer, 0);
40670 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40671 name = gen_const_xmlChar_ptr(n_name, 2);
40672 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040673
40674 ret_val = xmlTextWriterStartElementNS(writer, prefix, name, namespaceURI);
40675 desret_int(ret_val);
40676 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040677 des_xmlTextWriterPtr(n_writer, writer, 0);
40678 des_const_xmlChar_ptr(n_prefix, prefix, 1);
40679 des_const_xmlChar_ptr(n_name, name, 2);
40680 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040681 xmlResetLastError();
40682 if (mem_base != xmlMemBlocks()) {
40683 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
40684 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040685 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040686 printf(" %d", n_writer);
40687 printf(" %d", n_prefix);
40688 printf(" %d", n_name);
40689 printf(" %d", n_namespaceURI);
40690 printf("\n");
40691 }
40692 }
40693 }
40694 }
40695 }
40696#endif
40697
Daniel Veillard3d97e662004-11-04 10:49:00 +000040698 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040700}
40701
40702
40703static int
40704test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040706
Daniel Veillarde43cc572004-11-03 11:50:29 +000040707#ifdef LIBXML_WRITER_ENABLED
40708 int mem_base;
40709 int ret_val;
40710 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40711 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040712 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040713 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040714
Daniel Veillarde43cc572004-11-03 11:50:29 +000040715 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40716 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
40717 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040718 writer = gen_xmlTextWriterPtr(n_writer, 0);
40719 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040720
40721 ret_val = xmlTextWriterStartPI(writer, target);
40722 desret_int(ret_val);
40723 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040724 des_xmlTextWriterPtr(n_writer, writer, 0);
40725 des_const_xmlChar_ptr(n_target, target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040726 xmlResetLastError();
40727 if (mem_base != xmlMemBlocks()) {
40728 printf("Leak of %d blocks found in xmlTextWriterStartPI",
40729 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040730 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040731 printf(" %d", n_writer);
40732 printf(" %d", n_target);
40733 printf("\n");
40734 }
40735 }
40736 }
40737#endif
40738
Daniel Veillard3d97e662004-11-04 10:49:00 +000040739 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040741}
40742
40743
40744static int
40745test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040747
Daniel Veillarde43cc572004-11-03 11:50:29 +000040748#ifdef LIBXML_WRITER_ENABLED
40749 int mem_base;
40750 int ret_val;
40751 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40752 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040753 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040754 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040755 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040756 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040757
Daniel Veillarde43cc572004-11-03 11:50:29 +000040758 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40759 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40760 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
40761 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040762 writer = gen_xmlTextWriterPtr(n_writer, 0);
40763 name = gen_const_xmlChar_ptr(n_name, 1);
40764 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040765
40766 ret_val = xmlTextWriterWriteAttribute(writer, name, content);
40767 desret_int(ret_val);
40768 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040769 des_xmlTextWriterPtr(n_writer, writer, 0);
40770 des_const_xmlChar_ptr(n_name, name, 1);
40771 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040772 xmlResetLastError();
40773 if (mem_base != xmlMemBlocks()) {
40774 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
40775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040776 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040777 printf(" %d", n_writer);
40778 printf(" %d", n_name);
40779 printf(" %d", n_content);
40780 printf("\n");
40781 }
40782 }
40783 }
40784 }
40785#endif
40786
Daniel Veillard3d97e662004-11-04 10:49:00 +000040787 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040789}
40790
40791
40792static int
40793test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040795
Daniel Veillarde43cc572004-11-03 11:50:29 +000040796#ifdef LIBXML_WRITER_ENABLED
40797 int mem_base;
40798 int ret_val;
40799 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40800 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040801 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040802 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040803 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040804 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040805 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040806 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040807 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040808 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040809
Daniel Veillarde43cc572004-11-03 11:50:29 +000040810 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40811 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40812 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40813 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40814 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
40815 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040816 writer = gen_xmlTextWriterPtr(n_writer, 0);
40817 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40818 name = gen_const_xmlChar_ptr(n_name, 2);
40819 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
40820 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040821
40822 ret_val = xmlTextWriterWriteAttributeNS(writer, prefix, name, namespaceURI, content);
40823 desret_int(ret_val);
40824 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040825 des_xmlTextWriterPtr(n_writer, writer, 0);
40826 des_const_xmlChar_ptr(n_prefix, prefix, 1);
40827 des_const_xmlChar_ptr(n_name, name, 2);
40828 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
40829 des_const_xmlChar_ptr(n_content, content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040830 xmlResetLastError();
40831 if (mem_base != xmlMemBlocks()) {
40832 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
40833 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040834 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040835 printf(" %d", n_writer);
40836 printf(" %d", n_prefix);
40837 printf(" %d", n_name);
40838 printf(" %d", n_namespaceURI);
40839 printf(" %d", n_content);
40840 printf("\n");
40841 }
40842 }
40843 }
40844 }
40845 }
40846 }
40847#endif
40848
Daniel Veillard3d97e662004-11-04 10:49:00 +000040849 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040850 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040851}
40852
40853
40854static int
40855test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040857
Daniel Veillarde43cc572004-11-03 11:50:29 +000040858#ifdef LIBXML_WRITER_ENABLED
40859 int mem_base;
40860 int ret_val;
40861 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40862 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040863 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040864 int n_data;
40865 int start; /* the position within the data of the first byte to encode */
40866 int n_start;
40867 int len; /* the number of bytes to encode */
40868 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040869
Daniel Veillarde43cc572004-11-03 11:50:29 +000040870 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40871 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
40872 for (n_start = 0;n_start < gen_nb_int;n_start++) {
40873 for (n_len = 0;n_len < gen_nb_int;n_len++) {
40874 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040875 writer = gen_xmlTextWriterPtr(n_writer, 0);
40876 data = gen_const_char_ptr(n_data, 1);
40877 start = gen_int(n_start, 2);
40878 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040879
40880 ret_val = xmlTextWriterWriteBase64(writer, data, start, len);
40881 desret_int(ret_val);
40882 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040883 des_xmlTextWriterPtr(n_writer, writer, 0);
40884 des_const_char_ptr(n_data, data, 1);
40885 des_int(n_start, start, 2);
40886 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040887 xmlResetLastError();
40888 if (mem_base != xmlMemBlocks()) {
40889 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
40890 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040891 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040892 printf(" %d", n_writer);
40893 printf(" %d", n_data);
40894 printf(" %d", n_start);
40895 printf(" %d", n_len);
40896 printf("\n");
40897 }
40898 }
40899 }
40900 }
40901 }
40902#endif
40903
Daniel Veillard3d97e662004-11-04 10:49:00 +000040904 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040906}
40907
40908
40909static int
40910test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040912
Daniel Veillarde43cc572004-11-03 11:50:29 +000040913#ifdef LIBXML_WRITER_ENABLED
40914 int mem_base;
40915 int ret_val;
40916 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40917 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040918 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040919 int n_data;
40920 int start; /* the position within the data of the first byte to encode */
40921 int n_start;
40922 int len; /* the number of bytes to encode */
40923 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040924
Daniel Veillarde43cc572004-11-03 11:50:29 +000040925 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40926 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
40927 for (n_start = 0;n_start < gen_nb_int;n_start++) {
40928 for (n_len = 0;n_len < gen_nb_int;n_len++) {
40929 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040930 writer = gen_xmlTextWriterPtr(n_writer, 0);
40931 data = gen_const_char_ptr(n_data, 1);
40932 start = gen_int(n_start, 2);
40933 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040934
40935 ret_val = xmlTextWriterWriteBinHex(writer, data, start, len);
40936 desret_int(ret_val);
40937 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040938 des_xmlTextWriterPtr(n_writer, writer, 0);
40939 des_const_char_ptr(n_data, data, 1);
40940 des_int(n_start, start, 2);
40941 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040942 xmlResetLastError();
40943 if (mem_base != xmlMemBlocks()) {
40944 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
40945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040946 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040947 printf(" %d", n_writer);
40948 printf(" %d", n_data);
40949 printf(" %d", n_start);
40950 printf(" %d", n_len);
40951 printf("\n");
40952 }
40953 }
40954 }
40955 }
40956 }
40957#endif
40958
Daniel Veillard3d97e662004-11-04 10:49:00 +000040959 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040961}
40962
40963
40964static int
40965test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040967
Daniel Veillarde43cc572004-11-03 11:50:29 +000040968#ifdef LIBXML_WRITER_ENABLED
40969 int mem_base;
40970 int ret_val;
40971 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40972 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040973 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040974 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040975
Daniel Veillarde43cc572004-11-03 11:50:29 +000040976 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40977 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
40978 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040979 writer = gen_xmlTextWriterPtr(n_writer, 0);
40980 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040981
40982 ret_val = xmlTextWriterWriteCDATA(writer, content);
40983 desret_int(ret_val);
40984 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040985 des_xmlTextWriterPtr(n_writer, writer, 0);
40986 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040987 xmlResetLastError();
40988 if (mem_base != xmlMemBlocks()) {
40989 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
40990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040991 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040992 printf(" %d", n_writer);
40993 printf(" %d", n_content);
40994 printf("\n");
40995 }
40996 }
40997 }
40998#endif
40999
Daniel Veillard3d97e662004-11-04 10:49:00 +000041000 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041001 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041002}
41003
41004
41005static int
41006test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041008
Daniel Veillarde43cc572004-11-03 11:50:29 +000041009#ifdef LIBXML_WRITER_ENABLED
41010 int mem_base;
41011 int ret_val;
41012 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41013 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041014 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041015 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041016
Daniel Veillarde43cc572004-11-03 11:50:29 +000041017 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41018 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41019 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041020 writer = gen_xmlTextWriterPtr(n_writer, 0);
41021 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041022
41023 ret_val = xmlTextWriterWriteComment(writer, content);
41024 desret_int(ret_val);
41025 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041026 des_xmlTextWriterPtr(n_writer, writer, 0);
41027 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041028 xmlResetLastError();
41029 if (mem_base != xmlMemBlocks()) {
41030 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
41031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041032 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041033 printf(" %d", n_writer);
41034 printf(" %d", n_content);
41035 printf("\n");
41036 }
41037 }
41038 }
41039#endif
41040
Daniel Veillard3d97e662004-11-04 10:49:00 +000041041 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041043}
41044
41045
41046static int
41047test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041049
Daniel Veillarde43cc572004-11-03 11:50:29 +000041050#ifdef LIBXML_WRITER_ENABLED
41051 int mem_base;
41052 int ret_val;
41053 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41054 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041055 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041056 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041057 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041058 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041059 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041060 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041061 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041062 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041063
Daniel Veillarde43cc572004-11-03 11:50:29 +000041064 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41065 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41066 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41067 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41068 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
41069 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041070 writer = gen_xmlTextWriterPtr(n_writer, 0);
41071 name = gen_const_xmlChar_ptr(n_name, 1);
41072 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41073 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
41074 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041075
41076 ret_val = xmlTextWriterWriteDTD(writer, name, pubid, sysid, subset);
41077 desret_int(ret_val);
41078 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041079 des_xmlTextWriterPtr(n_writer, writer, 0);
41080 des_const_xmlChar_ptr(n_name, name, 1);
41081 des_const_xmlChar_ptr(n_pubid, pubid, 2);
41082 des_const_xmlChar_ptr(n_sysid, sysid, 3);
41083 des_const_xmlChar_ptr(n_subset, subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041084 xmlResetLastError();
41085 if (mem_base != xmlMemBlocks()) {
41086 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
41087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041088 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041089 printf(" %d", n_writer);
41090 printf(" %d", n_name);
41091 printf(" %d", n_pubid);
41092 printf(" %d", n_sysid);
41093 printf(" %d", n_subset);
41094 printf("\n");
41095 }
41096 }
41097 }
41098 }
41099 }
41100 }
41101#endif
41102
Daniel Veillard3d97e662004-11-04 10:49:00 +000041103 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041105}
41106
41107
41108static int
41109test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041111
Daniel Veillarde43cc572004-11-03 11:50:29 +000041112#ifdef LIBXML_WRITER_ENABLED
41113 int mem_base;
41114 int ret_val;
41115 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41116 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041117 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041118 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041119 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041120 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041121
Daniel Veillarde43cc572004-11-03 11:50:29 +000041122 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41123 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41124 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41125 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041126 writer = gen_xmlTextWriterPtr(n_writer, 0);
41127 name = gen_const_xmlChar_ptr(n_name, 1);
41128 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041129
41130 ret_val = xmlTextWriterWriteDTDAttlist(writer, name, content);
41131 desret_int(ret_val);
41132 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041133 des_xmlTextWriterPtr(n_writer, writer, 0);
41134 des_const_xmlChar_ptr(n_name, name, 1);
41135 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041136 xmlResetLastError();
41137 if (mem_base != xmlMemBlocks()) {
41138 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
41139 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041140 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041141 printf(" %d", n_writer);
41142 printf(" %d", n_name);
41143 printf(" %d", n_content);
41144 printf("\n");
41145 }
41146 }
41147 }
41148 }
41149#endif
41150
Daniel Veillard3d97e662004-11-04 10:49:00 +000041151 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041153}
41154
41155
41156static int
41157test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041159
Daniel Veillarde43cc572004-11-03 11:50:29 +000041160#ifdef LIBXML_WRITER_ENABLED
41161 int mem_base;
41162 int ret_val;
41163 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41164 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041165 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041166 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041167 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041168 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041169
Daniel Veillarde43cc572004-11-03 11:50:29 +000041170 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41171 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41172 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41173 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041174 writer = gen_xmlTextWriterPtr(n_writer, 0);
41175 name = gen_const_xmlChar_ptr(n_name, 1);
41176 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041177
41178 ret_val = xmlTextWriterWriteDTDElement(writer, name, content);
41179 desret_int(ret_val);
41180 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041181 des_xmlTextWriterPtr(n_writer, writer, 0);
41182 des_const_xmlChar_ptr(n_name, name, 1);
41183 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041184 xmlResetLastError();
41185 if (mem_base != xmlMemBlocks()) {
41186 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
41187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041188 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041189 printf(" %d", n_writer);
41190 printf(" %d", n_name);
41191 printf(" %d", n_content);
41192 printf("\n");
41193 }
41194 }
41195 }
41196 }
41197#endif
41198
Daniel Veillard3d97e662004-11-04 10:49:00 +000041199 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041200 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041201}
41202
41203
41204static int
41205test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041206 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041207
Daniel Veillarde43cc572004-11-03 11:50:29 +000041208#ifdef LIBXML_WRITER_ENABLED
41209 int mem_base;
41210 int ret_val;
41211 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41212 int n_writer;
41213 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41214 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041215 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041216 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041217 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041218 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041219 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041220 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041221 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041222 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041223 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041224 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041225
Daniel Veillarde43cc572004-11-03 11:50:29 +000041226 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41227 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41228 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41229 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41230 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41231 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41232 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41233 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041234 writer = gen_xmlTextWriterPtr(n_writer, 0);
41235 pe = gen_int(n_pe, 1);
41236 name = gen_const_xmlChar_ptr(n_name, 2);
41237 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41238 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41239 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
41240 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041241
41242 ret_val = xmlTextWriterWriteDTDEntity(writer, pe, name, pubid, sysid, ndataid, content);
41243 desret_int(ret_val);
41244 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041245 des_xmlTextWriterPtr(n_writer, writer, 0);
41246 des_int(n_pe, pe, 1);
41247 des_const_xmlChar_ptr(n_name, name, 2);
41248 des_const_xmlChar_ptr(n_pubid, pubid, 3);
41249 des_const_xmlChar_ptr(n_sysid, sysid, 4);
41250 des_const_xmlChar_ptr(n_ndataid, ndataid, 5);
41251 des_const_xmlChar_ptr(n_content, content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041252 xmlResetLastError();
41253 if (mem_base != xmlMemBlocks()) {
41254 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
41255 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041256 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041257 printf(" %d", n_writer);
41258 printf(" %d", n_pe);
41259 printf(" %d", n_name);
41260 printf(" %d", n_pubid);
41261 printf(" %d", n_sysid);
41262 printf(" %d", n_ndataid);
41263 printf(" %d", n_content);
41264 printf("\n");
41265 }
41266 }
41267 }
41268 }
41269 }
41270 }
41271 }
41272 }
41273#endif
41274
Daniel Veillard3d97e662004-11-04 10:49:00 +000041275 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041276 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041277}
41278
41279
41280static int
41281test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041282 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041283
Daniel Veillarde43cc572004-11-03 11:50:29 +000041284#ifdef LIBXML_WRITER_ENABLED
41285 int mem_base;
41286 int ret_val;
41287 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41288 int n_writer;
41289 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41290 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041291 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041292 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041293 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041294 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041295 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041296 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041297 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041298 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041299
Daniel Veillarde43cc572004-11-03 11:50:29 +000041300 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41301 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41302 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41303 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41304 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41305 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41306 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041307 writer = gen_xmlTextWriterPtr(n_writer, 0);
41308 pe = gen_int(n_pe, 1);
41309 name = gen_const_xmlChar_ptr(n_name, 2);
41310 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41311 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41312 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041313
41314 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, name, pubid, sysid, ndataid);
41315 desret_int(ret_val);
41316 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041317 des_xmlTextWriterPtr(n_writer, writer, 0);
41318 des_int(n_pe, pe, 1);
41319 des_const_xmlChar_ptr(n_name, name, 2);
41320 des_const_xmlChar_ptr(n_pubid, pubid, 3);
41321 des_const_xmlChar_ptr(n_sysid, sysid, 4);
41322 des_const_xmlChar_ptr(n_ndataid, ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041323 xmlResetLastError();
41324 if (mem_base != xmlMemBlocks()) {
41325 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
41326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041327 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041328 printf(" %d", n_writer);
41329 printf(" %d", n_pe);
41330 printf(" %d", n_name);
41331 printf(" %d", n_pubid);
41332 printf(" %d", n_sysid);
41333 printf(" %d", n_ndataid);
41334 printf("\n");
41335 }
41336 }
41337 }
41338 }
41339 }
41340 }
41341 }
41342#endif
41343
Daniel Veillard3d97e662004-11-04 10:49:00 +000041344 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041346}
41347
41348
41349static int
41350test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041351 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041352
Daniel Veillarde43cc572004-11-03 11:50:29 +000041353#ifdef LIBXML_WRITER_ENABLED
41354 int mem_base;
41355 int ret_val;
41356 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41357 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041358 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041359 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041360 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041361 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041362 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041363 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041364
Daniel Veillarde43cc572004-11-03 11:50:29 +000041365 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41366 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41367 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41368 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41369 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041370 writer = gen_xmlTextWriterPtr(n_writer, 0);
41371 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
41372 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
41373 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041374
41375 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, pubid, sysid, ndataid);
41376 desret_int(ret_val);
41377 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041378 des_xmlTextWriterPtr(n_writer, writer, 0);
41379 des_const_xmlChar_ptr(n_pubid, pubid, 1);
41380 des_const_xmlChar_ptr(n_sysid, sysid, 2);
41381 des_const_xmlChar_ptr(n_ndataid, ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041382 xmlResetLastError();
41383 if (mem_base != xmlMemBlocks()) {
41384 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
41385 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041386 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041387 printf(" %d", n_writer);
41388 printf(" %d", n_pubid);
41389 printf(" %d", n_sysid);
41390 printf(" %d", n_ndataid);
41391 printf("\n");
41392 }
41393 }
41394 }
41395 }
41396 }
41397#endif
41398
Daniel Veillard3d97e662004-11-04 10:49:00 +000041399 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041401}
41402
41403
41404static int
41405test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041406 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041407
Daniel Veillarde43cc572004-11-03 11:50:29 +000041408#ifdef LIBXML_WRITER_ENABLED
41409 int mem_base;
41410 int ret_val;
41411 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41412 int n_writer;
41413 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41414 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041415 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041416 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041417 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041418 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041419
Daniel Veillarde43cc572004-11-03 11:50:29 +000041420 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41421 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41422 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41423 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41424 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041425 writer = gen_xmlTextWriterPtr(n_writer, 0);
41426 pe = gen_int(n_pe, 1);
41427 name = gen_const_xmlChar_ptr(n_name, 2);
41428 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041429
41430 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, name, content);
41431 desret_int(ret_val);
41432 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041433 des_xmlTextWriterPtr(n_writer, writer, 0);
41434 des_int(n_pe, pe, 1);
41435 des_const_xmlChar_ptr(n_name, name, 2);
41436 des_const_xmlChar_ptr(n_content, content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041437 xmlResetLastError();
41438 if (mem_base != xmlMemBlocks()) {
41439 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
41440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041441 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041442 printf(" %d", n_writer);
41443 printf(" %d", n_pe);
41444 printf(" %d", n_name);
41445 printf(" %d", n_content);
41446 printf("\n");
41447 }
41448 }
41449 }
41450 }
41451 }
41452#endif
41453
Daniel Veillard3d97e662004-11-04 10:49:00 +000041454 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041455 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041456}
41457
41458
41459static int
41460test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041461 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041462
Daniel Veillarde43cc572004-11-03 11:50:29 +000041463#ifdef LIBXML_WRITER_ENABLED
41464 int mem_base;
41465 int ret_val;
41466 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41467 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041468 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041469 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041470 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041471 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041472 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041473 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041474
Daniel Veillarde43cc572004-11-03 11:50:29 +000041475 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41476 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41477 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41478 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41479 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041480 writer = gen_xmlTextWriterPtr(n_writer, 0);
41481 name = gen_const_xmlChar_ptr(n_name, 1);
41482 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41483 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041484
41485 ret_val = xmlTextWriterWriteDTDNotation(writer, name, pubid, sysid);
41486 desret_int(ret_val);
41487 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041488 des_xmlTextWriterPtr(n_writer, writer, 0);
41489 des_const_xmlChar_ptr(n_name, name, 1);
41490 des_const_xmlChar_ptr(n_pubid, pubid, 2);
41491 des_const_xmlChar_ptr(n_sysid, sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041492 xmlResetLastError();
41493 if (mem_base != xmlMemBlocks()) {
41494 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
41495 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041496 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041497 printf(" %d", n_writer);
41498 printf(" %d", n_name);
41499 printf(" %d", n_pubid);
41500 printf(" %d", n_sysid);
41501 printf("\n");
41502 }
41503 }
41504 }
41505 }
41506 }
41507#endif
41508
Daniel Veillard3d97e662004-11-04 10:49:00 +000041509 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041510 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041511}
41512
41513
41514static int
41515test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041516 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041517
Daniel Veillarde43cc572004-11-03 11:50:29 +000041518#ifdef LIBXML_WRITER_ENABLED
41519 int mem_base;
41520 int ret_val;
41521 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41522 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041523 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041524 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041525 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041526 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041527
Daniel Veillarde43cc572004-11-03 11:50:29 +000041528 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41529 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41530 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41531 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041532 writer = gen_xmlTextWriterPtr(n_writer, 0);
41533 name = gen_const_xmlChar_ptr(n_name, 1);
41534 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041535
41536 ret_val = xmlTextWriterWriteElement(writer, name, content);
41537 desret_int(ret_val);
41538 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041539 des_xmlTextWriterPtr(n_writer, writer, 0);
41540 des_const_xmlChar_ptr(n_name, name, 1);
41541 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041542 xmlResetLastError();
41543 if (mem_base != xmlMemBlocks()) {
41544 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
41545 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041546 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041547 printf(" %d", n_writer);
41548 printf(" %d", n_name);
41549 printf(" %d", n_content);
41550 printf("\n");
41551 }
41552 }
41553 }
41554 }
41555#endif
41556
Daniel Veillard3d97e662004-11-04 10:49:00 +000041557 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041559}
41560
41561
41562static int
41563test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041565
Daniel Veillarde43cc572004-11-03 11:50:29 +000041566#ifdef LIBXML_WRITER_ENABLED
41567 int mem_base;
41568 int ret_val;
41569 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41570 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041571 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041572 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041573 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041574 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041575 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041576 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041577 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041578 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041579
Daniel Veillarde43cc572004-11-03 11:50:29 +000041580 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41581 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41582 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41583 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41584 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41585 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041586 writer = gen_xmlTextWriterPtr(n_writer, 0);
41587 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41588 name = gen_const_xmlChar_ptr(n_name, 2);
41589 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41590 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041591
41592 ret_val = xmlTextWriterWriteElementNS(writer, prefix, name, namespaceURI, content);
41593 desret_int(ret_val);
41594 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041595 des_xmlTextWriterPtr(n_writer, writer, 0);
41596 des_const_xmlChar_ptr(n_prefix, prefix, 1);
41597 des_const_xmlChar_ptr(n_name, name, 2);
41598 des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
41599 des_const_xmlChar_ptr(n_content, content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041600 xmlResetLastError();
41601 if (mem_base != xmlMemBlocks()) {
41602 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
41603 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041604 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041605 printf(" %d", n_writer);
41606 printf(" %d", n_prefix);
41607 printf(" %d", n_name);
41608 printf(" %d", n_namespaceURI);
41609 printf(" %d", n_content);
41610 printf("\n");
41611 }
41612 }
41613 }
41614 }
41615 }
41616 }
41617#endif
41618
Daniel Veillard3d97e662004-11-04 10:49:00 +000041619 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041620 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041621}
41622
41623
41624static int
41625test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041626 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041627
41628
41629 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041631}
41632
41633
41634static int
41635test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041637
41638
41639 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041640 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041641}
41642
41643
41644static int
41645test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041647
41648
41649 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041651}
41652
41653
41654static int
41655test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041657
41658
41659 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041661}
41662
41663
41664static int
41665test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041667
41668
41669 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041670 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041671}
41672
41673
41674static int
41675test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041676 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041677
41678
41679 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041681}
41682
41683
41684static int
41685test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041687
41688
41689 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041690 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041691}
41692
41693
41694static int
41695test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041696 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041697
41698
41699 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041701}
41702
41703
41704static int
41705test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041707
41708
41709 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041710 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041711}
41712
41713
41714static int
41715test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041716 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041717
41718
41719 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041720 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041721}
41722
41723
41724static int
41725test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041726 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041727
41728
41729 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041730 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041731}
41732
41733
41734static int
41735test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041736 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041737
41738
41739 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041741}
41742
41743
41744static int
41745test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041747
41748
41749 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041751}
41752
41753
41754static int
41755test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041757
Daniel Veillarde43cc572004-11-03 11:50:29 +000041758#ifdef LIBXML_WRITER_ENABLED
41759 int mem_base;
41760 int ret_val;
41761 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41762 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041763 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041764 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041765 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041766 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041767
Daniel Veillarde43cc572004-11-03 11:50:29 +000041768 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41769 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41770 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41771 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041772 writer = gen_xmlTextWriterPtr(n_writer, 0);
41773 target = gen_const_xmlChar_ptr(n_target, 1);
41774 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041775
41776 ret_val = xmlTextWriterWritePI(writer, target, content);
41777 desret_int(ret_val);
41778 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041779 des_xmlTextWriterPtr(n_writer, writer, 0);
41780 des_const_xmlChar_ptr(n_target, target, 1);
41781 des_const_xmlChar_ptr(n_content, content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041782 xmlResetLastError();
41783 if (mem_base != xmlMemBlocks()) {
41784 printf("Leak of %d blocks found in xmlTextWriterWritePI",
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_target);
41789 printf(" %d", n_content);
41790 printf("\n");
41791 }
41792 }
41793 }
41794 }
41795#endif
41796
Daniel Veillard3d97e662004-11-04 10:49:00 +000041797 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041798 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041799}
41800
41801
41802static int
41803test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041804 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041805
Daniel Veillarde43cc572004-11-03 11:50:29 +000041806#ifdef LIBXML_WRITER_ENABLED
41807 int mem_base;
41808 int ret_val;
41809 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41810 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041811 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041812 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041813
Daniel Veillarde43cc572004-11-03 11:50:29 +000041814 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41815 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41816 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041817 writer = gen_xmlTextWriterPtr(n_writer, 0);
41818 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041819
41820 ret_val = xmlTextWriterWriteRaw(writer, content);
41821 desret_int(ret_val);
41822 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041823 des_xmlTextWriterPtr(n_writer, writer, 0);
41824 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041825 xmlResetLastError();
41826 if (mem_base != xmlMemBlocks()) {
41827 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
41828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041829 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041830 printf(" %d", n_writer);
41831 printf(" %d", n_content);
41832 printf("\n");
41833 }
41834 }
41835 }
41836#endif
41837
Daniel Veillard3d97e662004-11-04 10:49:00 +000041838 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041840}
41841
41842
41843static int
41844test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041846
Daniel Veillarde43cc572004-11-03 11:50:29 +000041847#ifdef LIBXML_WRITER_ENABLED
41848 int mem_base;
41849 int ret_val;
41850 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41851 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041852 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041853 int n_content;
41854 int len; /* length of the text string */
41855 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041856
Daniel Veillarde43cc572004-11-03 11:50:29 +000041857 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41858 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41859 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41860 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041861 writer = gen_xmlTextWriterPtr(n_writer, 0);
41862 content = gen_const_xmlChar_ptr(n_content, 1);
41863 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041864
41865 ret_val = xmlTextWriterWriteRawLen(writer, content, len);
41866 desret_int(ret_val);
41867 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041868 des_xmlTextWriterPtr(n_writer, writer, 0);
41869 des_const_xmlChar_ptr(n_content, content, 1);
41870 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041871 xmlResetLastError();
41872 if (mem_base != xmlMemBlocks()) {
41873 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
41874 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041875 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041876 printf(" %d", n_writer);
41877 printf(" %d", n_content);
41878 printf(" %d", n_len);
41879 printf("\n");
41880 }
41881 }
41882 }
41883 }
41884#endif
41885
Daniel Veillard3d97e662004-11-04 10:49:00 +000041886 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041887 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041888}
41889
41890
41891static int
41892test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041893 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041894
Daniel Veillarde43cc572004-11-03 11:50:29 +000041895#ifdef LIBXML_WRITER_ENABLED
41896 int mem_base;
41897 int ret_val;
41898 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41899 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041900 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041901 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041902
Daniel Veillarde43cc572004-11-03 11:50:29 +000041903 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41904 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41905 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041906 writer = gen_xmlTextWriterPtr(n_writer, 0);
41907 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041908
41909 ret_val = xmlTextWriterWriteString(writer, content);
41910 desret_int(ret_val);
41911 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041912 des_xmlTextWriterPtr(n_writer, writer, 0);
41913 des_const_xmlChar_ptr(n_content, content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041914 xmlResetLastError();
41915 if (mem_base != xmlMemBlocks()) {
41916 printf("Leak of %d blocks found in xmlTextWriterWriteString",
41917 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041918 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041919 printf(" %d", n_writer);
41920 printf(" %d", n_content);
41921 printf("\n");
41922 }
41923 }
41924 }
41925#endif
41926
Daniel Veillard3d97e662004-11-04 10:49:00 +000041927 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000041928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041929}
41930
41931
41932static int
41933test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041935
41936
41937 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041938 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041939}
41940
41941
41942static int
41943test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041945
41946
41947 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041949}
41950
41951
41952static int
41953test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041954 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041955
41956
41957 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041958 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041959}
41960
41961
41962static int
41963test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041964 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041965
41966
41967 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041968 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041969}
41970
41971
41972static int
41973test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041974 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041975
41976
41977 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041979}
41980
41981
41982static int
41983test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041985
41986
41987 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041988 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041989}
41990
41991
41992static int
41993test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041994 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041995
41996
41997 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041999}
42000
42001
42002static int
42003test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042005
42006
42007 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042008 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042009}
42010
42011
42012static int
42013test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042015
42016
42017 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042019}
42020
42021
42022static int
42023test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042024 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042025
42026
42027 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042028 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042029}
42030
42031
42032static int
42033test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042035
42036
42037 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042039}
42040
42041
42042static int
42043test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042045
42046
42047 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042048 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042049}
42050
42051
42052static int
42053test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042054 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042055
42056
42057 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042058 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042059}
42060
42061static int
42062test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042064
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000042065 printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000042066 test_ret += test_xmlNewTextWriter();
42067 test_ret += test_xmlNewTextWriterFilename();
42068 test_ret += test_xmlNewTextWriterMemory();
42069 test_ret += test_xmlNewTextWriterPushParser();
42070 test_ret += test_xmlNewTextWriterTree();
42071 test_ret += test_xmlTextWriterEndAttribute();
42072 test_ret += test_xmlTextWriterEndCDATA();
42073 test_ret += test_xmlTextWriterEndComment();
42074 test_ret += test_xmlTextWriterEndDTD();
42075 test_ret += test_xmlTextWriterEndDTDAttlist();
42076 test_ret += test_xmlTextWriterEndDTDElement();
42077 test_ret += test_xmlTextWriterEndDTDEntity();
42078 test_ret += test_xmlTextWriterEndDocument();
42079 test_ret += test_xmlTextWriterEndElement();
42080 test_ret += test_xmlTextWriterEndPI();
42081 test_ret += test_xmlTextWriterFlush();
42082 test_ret += test_xmlTextWriterFullEndElement();
42083 test_ret += test_xmlTextWriterSetIndent();
42084 test_ret += test_xmlTextWriterSetIndentString();
42085 test_ret += test_xmlTextWriterStartAttribute();
42086 test_ret += test_xmlTextWriterStartAttributeNS();
42087 test_ret += test_xmlTextWriterStartCDATA();
42088 test_ret += test_xmlTextWriterStartComment();
42089 test_ret += test_xmlTextWriterStartDTD();
42090 test_ret += test_xmlTextWriterStartDTDAttlist();
42091 test_ret += test_xmlTextWriterStartDTDElement();
42092 test_ret += test_xmlTextWriterStartDTDEntity();
42093 test_ret += test_xmlTextWriterStartDocument();
42094 test_ret += test_xmlTextWriterStartElement();
42095 test_ret += test_xmlTextWriterStartElementNS();
42096 test_ret += test_xmlTextWriterStartPI();
42097 test_ret += test_xmlTextWriterWriteAttribute();
42098 test_ret += test_xmlTextWriterWriteAttributeNS();
42099 test_ret += test_xmlTextWriterWriteBase64();
42100 test_ret += test_xmlTextWriterWriteBinHex();
42101 test_ret += test_xmlTextWriterWriteCDATA();
42102 test_ret += test_xmlTextWriterWriteComment();
42103 test_ret += test_xmlTextWriterWriteDTD();
42104 test_ret += test_xmlTextWriterWriteDTDAttlist();
42105 test_ret += test_xmlTextWriterWriteDTDElement();
42106 test_ret += test_xmlTextWriterWriteDTDEntity();
42107 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
42108 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
42109 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
42110 test_ret += test_xmlTextWriterWriteDTDNotation();
42111 test_ret += test_xmlTextWriterWriteElement();
42112 test_ret += test_xmlTextWriterWriteElementNS();
42113 test_ret += test_xmlTextWriterWriteFormatAttribute();
42114 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
42115 test_ret += test_xmlTextWriterWriteFormatCDATA();
42116 test_ret += test_xmlTextWriterWriteFormatComment();
42117 test_ret += test_xmlTextWriterWriteFormatDTD();
42118 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
42119 test_ret += test_xmlTextWriterWriteFormatDTDElement();
42120 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
42121 test_ret += test_xmlTextWriterWriteFormatElement();
42122 test_ret += test_xmlTextWriterWriteFormatElementNS();
42123 test_ret += test_xmlTextWriterWriteFormatPI();
42124 test_ret += test_xmlTextWriterWriteFormatRaw();
42125 test_ret += test_xmlTextWriterWriteFormatString();
42126 test_ret += test_xmlTextWriterWritePI();
42127 test_ret += test_xmlTextWriterWriteRaw();
42128 test_ret += test_xmlTextWriterWriteRawLen();
42129 test_ret += test_xmlTextWriterWriteString();
42130 test_ret += test_xmlTextWriterWriteVFormatAttribute();
42131 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
42132 test_ret += test_xmlTextWriterWriteVFormatCDATA();
42133 test_ret += test_xmlTextWriterWriteVFormatComment();
42134 test_ret += test_xmlTextWriterWriteVFormatDTD();
42135 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
42136 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
42137 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
42138 test_ret += test_xmlTextWriterWriteVFormatElement();
42139 test_ret += test_xmlTextWriterWriteVFormatElementNS();
42140 test_ret += test_xmlTextWriterWriteVFormatPI();
42141 test_ret += test_xmlTextWriterWriteVFormatRaw();
42142 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000042143
Daniel Veillard42595322004-11-08 10:52:06 +000042144 if (test_ret != 0)
42145 printf("Module xmlwriter: %d errors\n", test_ret);
42146 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042147}
42148
42149static int
42150test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042151 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042152
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042153#ifdef LIBXML_XPATH_ENABLED
42154 int mem_base;
42155 double ret_val;
42156 int val; /* a boolean */
42157 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042158
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042159 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42160 mem_base = xmlMemBlocks();
42161 val = gen_int(n_val, 0);
42162
42163 ret_val = xmlXPathCastBooleanToNumber(val);
42164 desret_double(ret_val);
42165 call_tests++;
42166 des_int(n_val, val, 0);
42167 xmlResetLastError();
42168 if (mem_base != xmlMemBlocks()) {
42169 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
42170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042171 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042172 printf(" %d", n_val);
42173 printf("\n");
42174 }
42175 }
42176#endif
42177
42178 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042180}
42181
42182
42183static int
42184test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042186
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042187#ifdef LIBXML_XPATH_ENABLED
42188 int mem_base;
42189 xmlChar * ret_val;
42190 int val; /* a boolean */
42191 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042192
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042193 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42194 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042195 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042196
42197 ret_val = xmlXPathCastBooleanToString(val);
42198 desret_xmlChar_ptr(ret_val);
42199 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042200 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042201 xmlResetLastError();
42202 if (mem_base != xmlMemBlocks()) {
42203 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
42204 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042205 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042206 printf(" %d", n_val);
42207 printf("\n");
42208 }
42209 }
42210#endif
42211
Daniel Veillard3d97e662004-11-04 10:49:00 +000042212 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042213 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042214}
42215
42216
42217static int
42218test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042220
Daniel Veillardce682bc2004-11-05 17:22:25 +000042221#ifdef LIBXML_XPATH_ENABLED
42222 int mem_base;
42223 int ret_val;
42224 xmlNodeSetPtr ns; /* a node-set */
42225 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042226
Daniel Veillardce682bc2004-11-05 17:22:25 +000042227 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42228 mem_base = xmlMemBlocks();
42229 ns = gen_xmlNodeSetPtr(n_ns, 0);
42230
42231 ret_val = xmlXPathCastNodeSetToBoolean(ns);
42232 desret_int(ret_val);
42233 call_tests++;
42234 des_xmlNodeSetPtr(n_ns, ns, 0);
42235 xmlResetLastError();
42236 if (mem_base != xmlMemBlocks()) {
42237 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
42238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042239 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042240 printf(" %d", n_ns);
42241 printf("\n");
42242 }
42243 }
42244#endif
42245
42246 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042248}
42249
42250
42251static int
42252test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042254
Daniel Veillardce682bc2004-11-05 17:22:25 +000042255#ifdef LIBXML_XPATH_ENABLED
42256 int mem_base;
42257 double ret_val;
42258 xmlNodeSetPtr ns; /* a node-set */
42259 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042260
Daniel Veillardce682bc2004-11-05 17:22:25 +000042261 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42262 mem_base = xmlMemBlocks();
42263 ns = gen_xmlNodeSetPtr(n_ns, 0);
42264
42265 ret_val = xmlXPathCastNodeSetToNumber(ns);
42266 desret_double(ret_val);
42267 call_tests++;
42268 des_xmlNodeSetPtr(n_ns, ns, 0);
42269 xmlResetLastError();
42270 if (mem_base != xmlMemBlocks()) {
42271 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
42272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042273 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042274 printf(" %d", n_ns);
42275 printf("\n");
42276 }
42277 }
42278#endif
42279
42280 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042282}
42283
42284
42285static int
42286test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042288
Daniel Veillardce682bc2004-11-05 17:22:25 +000042289#ifdef LIBXML_XPATH_ENABLED
42290 int mem_base;
42291 xmlChar * ret_val;
42292 xmlNodeSetPtr ns; /* a node-set */
42293 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042294
Daniel Veillardce682bc2004-11-05 17:22:25 +000042295 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42296 mem_base = xmlMemBlocks();
42297 ns = gen_xmlNodeSetPtr(n_ns, 0);
42298
42299 ret_val = xmlXPathCastNodeSetToString(ns);
42300 desret_xmlChar_ptr(ret_val);
42301 call_tests++;
42302 des_xmlNodeSetPtr(n_ns, ns, 0);
42303 xmlResetLastError();
42304 if (mem_base != xmlMemBlocks()) {
42305 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
42306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042307 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042308 printf(" %d", n_ns);
42309 printf("\n");
42310 }
42311 }
42312#endif
42313
42314 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042315 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042316}
42317
42318
42319static int
42320test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042321 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042322
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042323#ifdef LIBXML_XPATH_ENABLED
42324 int mem_base;
42325 double ret_val;
42326 xmlNodePtr node; /* a node */
42327 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042328
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042329 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42330 mem_base = xmlMemBlocks();
42331 node = gen_xmlNodePtr(n_node, 0);
42332
42333 ret_val = xmlXPathCastNodeToNumber(node);
42334 desret_double(ret_val);
42335 call_tests++;
42336 des_xmlNodePtr(n_node, node, 0);
42337 xmlResetLastError();
42338 if (mem_base != xmlMemBlocks()) {
42339 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
42340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042341 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042342 printf(" %d", n_node);
42343 printf("\n");
42344 }
42345 }
42346#endif
42347
42348 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042350}
42351
42352
42353static int
42354test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042356
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042357#ifdef LIBXML_XPATH_ENABLED
42358 int mem_base;
42359 xmlChar * ret_val;
42360 xmlNodePtr node; /* a node */
42361 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042362
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042363 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42364 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042365 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042366
42367 ret_val = xmlXPathCastNodeToString(node);
42368 desret_xmlChar_ptr(ret_val);
42369 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042370 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042371 xmlResetLastError();
42372 if (mem_base != xmlMemBlocks()) {
42373 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
42374 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042375 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042376 printf(" %d", n_node);
42377 printf("\n");
42378 }
42379 }
42380#endif
42381
Daniel Veillard3d97e662004-11-04 10:49:00 +000042382 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042384}
42385
42386
42387static int
42388test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042390
Daniel Veillard3d95c732004-11-06 22:25:14 +000042391#ifdef LIBXML_XPATH_ENABLED
42392 int mem_base;
42393 int ret_val;
42394 double val; /* a number */
42395 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042396
Daniel Veillard3d95c732004-11-06 22:25:14 +000042397 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42398 mem_base = xmlMemBlocks();
42399 val = gen_double(n_val, 0);
42400
42401 ret_val = xmlXPathCastNumberToBoolean(val);
42402 desret_int(ret_val);
42403 call_tests++;
42404 des_double(n_val, val, 0);
42405 xmlResetLastError();
42406 if (mem_base != xmlMemBlocks()) {
42407 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
42408 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042409 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042410 printf(" %d", n_val);
42411 printf("\n");
42412 }
42413 }
42414#endif
42415
42416 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042418}
42419
42420
42421static int
42422test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042423 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042424
Daniel Veillard3d95c732004-11-06 22:25:14 +000042425#ifdef LIBXML_XPATH_ENABLED
42426 int mem_base;
42427 xmlChar * ret_val;
42428 double val; /* a number */
42429 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042430
Daniel Veillard3d95c732004-11-06 22:25:14 +000042431 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42432 mem_base = xmlMemBlocks();
42433 val = gen_double(n_val, 0);
42434
42435 ret_val = xmlXPathCastNumberToString(val);
42436 desret_xmlChar_ptr(ret_val);
42437 call_tests++;
42438 des_double(n_val, val, 0);
42439 xmlResetLastError();
42440 if (mem_base != xmlMemBlocks()) {
42441 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
42442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042443 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042444 printf(" %d", n_val);
42445 printf("\n");
42446 }
42447 }
42448#endif
42449
42450 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042452}
42453
42454
42455static int
42456test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042458
42459#ifdef LIBXML_XPATH_ENABLED
42460 int mem_base;
42461 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042462 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000042463 int n_val;
42464
42465 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42466 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042467 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042468
42469 ret_val = xmlXPathCastStringToBoolean(val);
42470 desret_int(ret_val);
42471 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042472 des_const_xmlChar_ptr(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042473 xmlResetLastError();
42474 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042475 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042477 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042478 printf(" %d", n_val);
42479 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042480 }
42481 }
42482#endif
42483
Daniel Veillard3d97e662004-11-04 10:49:00 +000042484 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042486}
42487
42488
42489static int
42490test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042491 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042492
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042493#ifdef LIBXML_XPATH_ENABLED
42494 int mem_base;
42495 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042496 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042497 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042498
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042499 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42500 mem_base = xmlMemBlocks();
42501 val = gen_const_xmlChar_ptr(n_val, 0);
42502
42503 ret_val = xmlXPathCastStringToNumber(val);
42504 desret_double(ret_val);
42505 call_tests++;
42506 des_const_xmlChar_ptr(n_val, val, 0);
42507 xmlResetLastError();
42508 if (mem_base != xmlMemBlocks()) {
42509 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
42510 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042511 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042512 printf(" %d", n_val);
42513 printf("\n");
42514 }
42515 }
42516#endif
42517
42518 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042519 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042520}
42521
42522
42523static int
42524test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042525 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042526
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042527#ifdef LIBXML_XPATH_ENABLED
42528 int mem_base;
42529 int ret_val;
42530 xmlXPathObjectPtr val; /* an XPath object */
42531 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042532
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042533 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42534 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042535 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042536
42537 ret_val = xmlXPathCastToBoolean(val);
42538 desret_int(ret_val);
42539 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042540 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042541 xmlResetLastError();
42542 if (mem_base != xmlMemBlocks()) {
42543 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
42544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042545 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042546 printf(" %d", n_val);
42547 printf("\n");
42548 }
42549 }
42550#endif
42551
Daniel Veillard3d97e662004-11-04 10:49:00 +000042552 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042553 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042554}
42555
42556
42557static int
42558test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042559 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042560
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042561#ifdef LIBXML_XPATH_ENABLED
42562 int mem_base;
42563 double ret_val;
42564 xmlXPathObjectPtr val; /* an XPath object */
42565 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042566
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042567 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42568 mem_base = xmlMemBlocks();
42569 val = gen_xmlXPathObjectPtr(n_val, 0);
42570
42571 ret_val = xmlXPathCastToNumber(val);
42572 desret_double(ret_val);
42573 call_tests++;
42574 des_xmlXPathObjectPtr(n_val, val, 0);
42575 xmlResetLastError();
42576 if (mem_base != xmlMemBlocks()) {
42577 printf("Leak of %d blocks found in xmlXPathCastToNumber",
42578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042579 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042580 printf(" %d", n_val);
42581 printf("\n");
42582 }
42583 }
42584#endif
42585
42586 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042588}
42589
42590
42591static int
42592test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042594
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042595#ifdef LIBXML_XPATH_ENABLED
42596 int mem_base;
42597 xmlChar * ret_val;
42598 xmlXPathObjectPtr val; /* an XPath object */
42599 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042600
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042601 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42602 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042603 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042604
42605 ret_val = xmlXPathCastToString(val);
42606 desret_xmlChar_ptr(ret_val);
42607 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042608 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042609 xmlResetLastError();
42610 if (mem_base != xmlMemBlocks()) {
42611 printf("Leak of %d blocks found in xmlXPathCastToString",
42612 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042613 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042614 printf(" %d", n_val);
42615 printf("\n");
42616 }
42617 }
42618#endif
42619
Daniel Veillard3d97e662004-11-04 10:49:00 +000042620 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042622}
42623
42624
42625static int
42626test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042628
42629#ifdef LIBXML_XPATH_ENABLED
42630 int mem_base;
42631 int ret_val;
42632 xmlNodePtr node1; /* the first node */
42633 int n_node1;
42634 xmlNodePtr node2; /* the second node */
42635 int n_node2;
42636
42637 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
42638 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
42639 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042640 node1 = gen_xmlNodePtr(n_node1, 0);
42641 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042642
42643 ret_val = xmlXPathCmpNodes(node1, node2);
42644 desret_int(ret_val);
42645 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042646 des_xmlNodePtr(n_node1, node1, 0);
42647 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042648 xmlResetLastError();
42649 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042650 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042651 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042652 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042653 printf(" %d", n_node1);
42654 printf(" %d", n_node2);
42655 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042656 }
42657 }
42658 }
42659#endif
42660
Daniel Veillard3d97e662004-11-04 10:49:00 +000042661 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042662 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042663}
42664
42665
42666static int
42667test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042668 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042669
42670
42671 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042672 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042673}
42674
42675
Daniel Veillardce682bc2004-11-05 17:22:25 +000042676#define gen_nb_xmlXPathCompExprPtr 1
42677static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42678 return(NULL);
42679}
42680static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42681}
42682
42683#define gen_nb_xmlXPathContextPtr 1
42684static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42685 return(NULL);
42686}
42687static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42688}
42689
Daniel Veillardd93f6252004-11-02 15:53:51 +000042690static int
42691test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042693
Daniel Veillardce682bc2004-11-05 17:22:25 +000042694#ifdef LIBXML_XPATH_ENABLED
42695 int mem_base;
42696 xmlXPathObjectPtr ret_val;
42697 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
42698 int n_comp;
42699 xmlXPathContextPtr ctx; /* the XPath context */
42700 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042701
Daniel Veillardce682bc2004-11-05 17:22:25 +000042702 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
42703 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
42704 mem_base = xmlMemBlocks();
42705 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
42706 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
42707
42708 ret_val = xmlXPathCompiledEval(comp, ctx);
42709 desret_xmlXPathObjectPtr(ret_val);
42710 call_tests++;
42711 des_xmlXPathCompExprPtr(n_comp, comp, 0);
42712 des_xmlXPathContextPtr(n_ctx, ctx, 1);
42713 xmlResetLastError();
42714 if (mem_base != xmlMemBlocks()) {
42715 printf("Leak of %d blocks found in xmlXPathCompiledEval",
42716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042717 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042718 printf(" %d", n_comp);
42719 printf(" %d", n_ctx);
42720 printf("\n");
42721 }
42722 }
42723 }
42724#endif
42725
42726 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042728}
42729
42730
42731static int
42732test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042734
Daniel Veillard3d97e662004-11-04 10:49:00 +000042735#ifdef LIBXML_XPATH_ENABLED
42736 int mem_base;
42737 xmlXPathObjectPtr ret_val;
42738 xmlXPathObjectPtr val; /* an XPath object */
42739 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042740
Daniel Veillard3d97e662004-11-04 10:49:00 +000042741 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42742 mem_base = xmlMemBlocks();
42743 val = gen_xmlXPathObjectPtr(n_val, 0);
42744
42745 ret_val = xmlXPathConvertBoolean(val);
42746 val = NULL;
42747 desret_xmlXPathObjectPtr(ret_val);
42748 call_tests++;
42749 des_xmlXPathObjectPtr(n_val, val, 0);
42750 xmlResetLastError();
42751 if (mem_base != xmlMemBlocks()) {
42752 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
42753 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042754 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042755 printf(" %d", n_val);
42756 printf("\n");
42757 }
42758 }
42759#endif
42760
42761 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042762 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042763}
42764
42765
42766static int
42767test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042769
Daniel Veillard3d97e662004-11-04 10:49:00 +000042770#ifdef LIBXML_XPATH_ENABLED
42771 int mem_base;
42772 xmlXPathObjectPtr ret_val;
42773 xmlXPathObjectPtr val; /* an XPath object */
42774 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042775
Daniel Veillard3d97e662004-11-04 10:49:00 +000042776 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42777 mem_base = xmlMemBlocks();
42778 val = gen_xmlXPathObjectPtr(n_val, 0);
42779
42780 ret_val = xmlXPathConvertNumber(val);
42781 val = NULL;
42782 desret_xmlXPathObjectPtr(ret_val);
42783 call_tests++;
42784 des_xmlXPathObjectPtr(n_val, val, 0);
42785 xmlResetLastError();
42786 if (mem_base != xmlMemBlocks()) {
42787 printf("Leak of %d blocks found in xmlXPathConvertNumber",
42788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042789 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042790 printf(" %d", n_val);
42791 printf("\n");
42792 }
42793 }
42794#endif
42795
42796 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042797 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042798}
42799
42800
42801static int
42802test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042803 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042804
Daniel Veillard3d97e662004-11-04 10:49:00 +000042805#ifdef LIBXML_XPATH_ENABLED
42806 int mem_base;
42807 xmlXPathObjectPtr ret_val;
42808 xmlXPathObjectPtr val; /* an XPath object */
42809 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042810
Daniel Veillard3d97e662004-11-04 10:49:00 +000042811 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42812 mem_base = xmlMemBlocks();
42813 val = gen_xmlXPathObjectPtr(n_val, 0);
42814
42815 ret_val = xmlXPathConvertString(val);
42816 val = NULL;
42817 desret_xmlXPathObjectPtr(ret_val);
42818 call_tests++;
42819 des_xmlXPathObjectPtr(n_val, val, 0);
42820 xmlResetLastError();
42821 if (mem_base != xmlMemBlocks()) {
42822 printf("Leak of %d blocks found in xmlXPathConvertString",
42823 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042824 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042825 printf(" %d", n_val);
42826 printf("\n");
42827 }
42828 }
42829#endif
42830
42831 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042832 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042833}
42834
42835
42836static int
42837test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042838 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042839
42840
42841 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042842 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042843}
42844
42845
42846static int
42847test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042848 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042849
Daniel Veillardce682bc2004-11-05 17:22:25 +000042850#ifdef LIBXML_XPATH_ENABLED
42851 int mem_base;
42852 xmlXPathObjectPtr ret_val;
42853 xmlChar * str; /* the XPath expression */
42854 int n_str;
42855 xmlXPathContextPtr ctx; /* the XPath context */
42856 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042857
Daniel Veillardce682bc2004-11-05 17:22:25 +000042858 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
42859 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
42860 mem_base = xmlMemBlocks();
42861 str = gen_const_xmlChar_ptr(n_str, 0);
42862 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
42863
42864 ret_val = xmlXPathEval(str, ctx);
42865 desret_xmlXPathObjectPtr(ret_val);
42866 call_tests++;
42867 des_const_xmlChar_ptr(n_str, str, 0);
42868 des_xmlXPathContextPtr(n_ctx, ctx, 1);
42869 xmlResetLastError();
42870 if (mem_base != xmlMemBlocks()) {
42871 printf("Leak of %d blocks found in xmlXPathEval",
42872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042873 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042874 printf(" %d", n_str);
42875 printf(" %d", n_ctx);
42876 printf("\n");
42877 }
42878 }
42879 }
42880#endif
42881
42882 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042884}
42885
42886
42887static int
42888test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042889 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042890
Daniel Veillardce682bc2004-11-05 17:22:25 +000042891#ifdef LIBXML_XPATH_ENABLED
42892 int mem_base;
42893 xmlXPathObjectPtr ret_val;
42894 xmlChar * str; /* the XPath expression */
42895 int n_str;
42896 xmlXPathContextPtr ctxt; /* the XPath context */
42897 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042898
Daniel Veillardce682bc2004-11-05 17:22:25 +000042899 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
42900 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
42901 mem_base = xmlMemBlocks();
42902 str = gen_const_xmlChar_ptr(n_str, 0);
42903 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
42904
42905 ret_val = xmlXPathEvalExpression(str, ctxt);
42906 desret_xmlXPathObjectPtr(ret_val);
42907 call_tests++;
42908 des_const_xmlChar_ptr(n_str, str, 0);
42909 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
42910 xmlResetLastError();
42911 if (mem_base != xmlMemBlocks()) {
42912 printf("Leak of %d blocks found in xmlXPathEvalExpression",
42913 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042914 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042915 printf(" %d", n_str);
42916 printf(" %d", n_ctxt);
42917 printf("\n");
42918 }
42919 }
42920 }
42921#endif
42922
42923 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042924 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042925}
42926
42927
42928static int
42929test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042930 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042931
Daniel Veillardce682bc2004-11-05 17:22:25 +000042932#ifdef LIBXML_XPATH_ENABLED
42933 int mem_base;
42934 int ret_val;
42935 xmlXPathContextPtr ctxt; /* the XPath context */
42936 int n_ctxt;
42937 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
42938 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042939
Daniel Veillardce682bc2004-11-05 17:22:25 +000042940 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
42941 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
42942 mem_base = xmlMemBlocks();
42943 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
42944 res = gen_xmlXPathObjectPtr(n_res, 1);
42945
42946 ret_val = xmlXPathEvalPredicate(ctxt, res);
42947 desret_int(ret_val);
42948 call_tests++;
42949 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
42950 des_xmlXPathObjectPtr(n_res, res, 1);
42951 xmlResetLastError();
42952 if (mem_base != xmlMemBlocks()) {
42953 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
42954 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042955 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042956 printf(" %d", n_ctxt);
42957 printf(" %d", n_res);
42958 printf("\n");
42959 }
42960 }
42961 }
42962#endif
42963
42964 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042966}
42967
42968
42969static int
42970test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042972
42973#ifdef LIBXML_XPATH_ENABLED
42974 int mem_base;
42975
42976 mem_base = xmlMemBlocks();
42977
42978 xmlXPathInit();
42979 call_tests++;
42980 xmlResetLastError();
42981 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042982 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042984 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042985 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042986 }
42987#endif
42988
Daniel Veillard3d97e662004-11-04 10:49:00 +000042989 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000042990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042991}
42992
42993
42994static int
42995test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042997
Daniel Veillard3d95c732004-11-06 22:25:14 +000042998#ifdef LIBXML_XPATH_ENABLED
42999 int mem_base;
43000 int ret_val;
43001 double val; /* a double value */
43002 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043003
Daniel Veillard3d95c732004-11-06 22:25:14 +000043004 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43005 mem_base = xmlMemBlocks();
43006 val = gen_double(n_val, 0);
43007
43008 ret_val = xmlXPathIsInf(val);
43009 desret_int(ret_val);
43010 call_tests++;
43011 des_double(n_val, val, 0);
43012 xmlResetLastError();
43013 if (mem_base != xmlMemBlocks()) {
43014 printf("Leak of %d blocks found in xmlXPathIsInf",
43015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043016 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043017 printf(" %d", n_val);
43018 printf("\n");
43019 }
43020 }
43021#endif
43022
43023 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043025}
43026
43027
43028static int
43029test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043031
Daniel Veillard3d95c732004-11-06 22:25:14 +000043032#ifdef LIBXML_XPATH_ENABLED
43033 int mem_base;
43034 int ret_val;
43035 double val; /* a double value */
43036 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043037
Daniel Veillard3d95c732004-11-06 22:25:14 +000043038 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43039 mem_base = xmlMemBlocks();
43040 val = gen_double(n_val, 0);
43041
43042 ret_val = xmlXPathIsNaN(val);
43043 desret_int(ret_val);
43044 call_tests++;
43045 des_double(n_val, val, 0);
43046 xmlResetLastError();
43047 if (mem_base != xmlMemBlocks()) {
43048 printf("Leak of %d blocks found in xmlXPathIsNaN",
43049 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043050 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043051 printf(" %d", n_val);
43052 printf("\n");
43053 }
43054 }
43055#endif
43056
43057 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043058 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043059}
43060
43061
43062static int
43063test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043064 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043065
43066
43067 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043069}
43070
43071
43072static int
43073test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043075
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043076#ifdef LIBXML_XPATH_ENABLED
43077 int mem_base;
43078 xmlNodeSetPtr ret_val;
43079 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
43080 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043081
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043082 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43083 mem_base = xmlMemBlocks();
43084 val = gen_xmlNodePtr(n_val, 0);
43085
43086 ret_val = xmlXPathNodeSetCreate(val);
43087 desret_xmlNodeSetPtr(ret_val);
43088 call_tests++;
43089 des_xmlNodePtr(n_val, val, 0);
43090 xmlResetLastError();
43091 if (mem_base != xmlMemBlocks()) {
43092 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
43093 xmlMemBlocks() - mem_base);
43094 test_ret++;
43095 printf(" %d", n_val);
43096 printf("\n");
43097 }
43098 }
43099#endif
43100
43101 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043103}
43104
43105
43106static int
43107test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043109
Daniel Veillard3d97e662004-11-04 10:49:00 +000043110#ifdef LIBXML_XPATH_ENABLED
43111 int mem_base;
43112 xmlXPathObjectPtr ret_val;
43113 xmlXPathObjectPtr val; /* the original object */
43114 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043115
Daniel Veillard3d97e662004-11-04 10:49:00 +000043116 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43117 mem_base = xmlMemBlocks();
43118 val = gen_xmlXPathObjectPtr(n_val, 0);
43119
43120 ret_val = xmlXPathObjectCopy(val);
43121 desret_xmlXPathObjectPtr(ret_val);
43122 call_tests++;
43123 des_xmlXPathObjectPtr(n_val, val, 0);
43124 xmlResetLastError();
43125 if (mem_base != xmlMemBlocks()) {
43126 printf("Leak of %d blocks found in xmlXPathObjectCopy",
43127 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043128 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043129 printf(" %d", n_val);
43130 printf("\n");
43131 }
43132 }
43133#endif
43134
43135 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043137}
43138
43139
43140static int
43141test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043143
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043144#ifdef LIBXML_XPATH_ENABLED
43145 int mem_base;
43146 long ret_val;
43147 xmlDocPtr doc; /* an input document */
43148 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043149
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043150 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
43151 mem_base = xmlMemBlocks();
43152 doc = gen_xmlDocPtr(n_doc, 0);
43153
43154 ret_val = xmlXPathOrderDocElems(doc);
43155 desret_long(ret_val);
43156 call_tests++;
43157 des_xmlDocPtr(n_doc, doc, 0);
43158 xmlResetLastError();
43159 if (mem_base != xmlMemBlocks()) {
43160 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
43161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043162 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043163 printf(" %d", n_doc);
43164 printf("\n");
43165 }
43166 }
43167#endif
43168
43169 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000043170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043171}
43172
43173static int
43174test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043176
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043177 printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043178 test_ret += test_xmlXPathCastBooleanToNumber();
43179 test_ret += test_xmlXPathCastBooleanToString();
43180 test_ret += test_xmlXPathCastNodeSetToBoolean();
43181 test_ret += test_xmlXPathCastNodeSetToNumber();
43182 test_ret += test_xmlXPathCastNodeSetToString();
43183 test_ret += test_xmlXPathCastNodeToNumber();
43184 test_ret += test_xmlXPathCastNodeToString();
43185 test_ret += test_xmlXPathCastNumberToBoolean();
43186 test_ret += test_xmlXPathCastNumberToString();
43187 test_ret += test_xmlXPathCastStringToBoolean();
43188 test_ret += test_xmlXPathCastStringToNumber();
43189 test_ret += test_xmlXPathCastToBoolean();
43190 test_ret += test_xmlXPathCastToNumber();
43191 test_ret += test_xmlXPathCastToString();
43192 test_ret += test_xmlXPathCmpNodes();
43193 test_ret += test_xmlXPathCompile();
43194 test_ret += test_xmlXPathCompiledEval();
43195 test_ret += test_xmlXPathConvertBoolean();
43196 test_ret += test_xmlXPathConvertNumber();
43197 test_ret += test_xmlXPathConvertString();
43198 test_ret += test_xmlXPathCtxtCompile();
43199 test_ret += test_xmlXPathEval();
43200 test_ret += test_xmlXPathEvalExpression();
43201 test_ret += test_xmlXPathEvalPredicate();
43202 test_ret += test_xmlXPathInit();
43203 test_ret += test_xmlXPathIsInf();
43204 test_ret += test_xmlXPathIsNaN();
43205 test_ret += test_xmlXPathNewContext();
43206 test_ret += test_xmlXPathNodeSetCreate();
43207 test_ret += test_xmlXPathObjectCopy();
43208 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043209
Daniel Veillard42595322004-11-08 10:52:06 +000043210 if (test_ret != 0)
43211 printf("Module xpath: %d errors\n", test_ret);
43212 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043213}
43214
Daniel Veillarda82b1822004-11-08 16:24:57 +000043215#define gen_nb_xmlXPathParserContextPtr 1
43216static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43217 return(NULL);
43218}
43219static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43220}
43221
43222static int
43223test_valuePop(void) {
43224 int test_ret = 0;
43225
43226#ifdef LIBXML_XPATH_ENABLED
43227 int mem_base;
43228 xmlXPathObjectPtr ret_val;
43229 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43230 int n_ctxt;
43231
43232 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43233 mem_base = xmlMemBlocks();
43234 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43235
43236 ret_val = valuePop(ctxt);
43237 desret_xmlXPathObjectPtr(ret_val);
43238 call_tests++;
43239 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43240 xmlResetLastError();
43241 if (mem_base != xmlMemBlocks()) {
43242 printf("Leak of %d blocks found in valuePop",
43243 xmlMemBlocks() - mem_base);
43244 test_ret++;
43245 printf(" %d", n_ctxt);
43246 printf("\n");
43247 }
43248 }
43249#endif
43250
43251 function_tests++;
43252 return(test_ret);
43253}
43254
43255
43256static int
43257test_valuePush(void) {
43258 int test_ret = 0;
43259
43260#ifdef LIBXML_XPATH_ENABLED
43261 int mem_base;
43262 int ret_val;
43263 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43264 int n_ctxt;
43265 xmlXPathObjectPtr value; /* the XPath object */
43266 int n_value;
43267
43268 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43269 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
43270 mem_base = xmlMemBlocks();
43271 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43272 value = gen_xmlXPathObjectPtr(n_value, 1);
43273
43274 ret_val = valuePush(ctxt, value);
43275 desret_int(ret_val);
43276 call_tests++;
43277 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43278 des_xmlXPathObjectPtr(n_value, value, 1);
43279 xmlResetLastError();
43280 if (mem_base != xmlMemBlocks()) {
43281 printf("Leak of %d blocks found in valuePush",
43282 xmlMemBlocks() - mem_base);
43283 test_ret++;
43284 printf(" %d", n_ctxt);
43285 printf(" %d", n_value);
43286 printf("\n");
43287 }
43288 }
43289 }
43290#endif
43291
43292 function_tests++;
43293 return(test_ret);
43294}
43295
43296
43297static int
43298test_xmlXPathAddValues(void) {
43299 int test_ret = 0;
43300
43301#ifdef LIBXML_XPATH_ENABLED
43302 int mem_base;
43303 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43304 int n_ctxt;
43305
43306 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43307 mem_base = xmlMemBlocks();
43308 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43309
43310 xmlXPathAddValues(ctxt);
43311 call_tests++;
43312 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43313 xmlResetLastError();
43314 if (mem_base != xmlMemBlocks()) {
43315 printf("Leak of %d blocks found in xmlXPathAddValues",
43316 xmlMemBlocks() - mem_base);
43317 test_ret++;
43318 printf(" %d", n_ctxt);
43319 printf("\n");
43320 }
43321 }
43322#endif
43323
43324 function_tests++;
43325 return(test_ret);
43326}
43327
43328
43329static int
43330test_xmlXPathBooleanFunction(void) {
43331 int test_ret = 0;
43332
43333#ifdef LIBXML_XPATH_ENABLED
43334 int mem_base;
43335 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43336 int n_ctxt;
43337 int nargs; /* the number of arguments */
43338 int n_nargs;
43339
43340 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43341 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43342 mem_base = xmlMemBlocks();
43343 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43344 nargs = gen_int(n_nargs, 1);
43345
43346 xmlXPathBooleanFunction(ctxt, nargs);
43347 call_tests++;
43348 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43349 des_int(n_nargs, nargs, 1);
43350 xmlResetLastError();
43351 if (mem_base != xmlMemBlocks()) {
43352 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
43353 xmlMemBlocks() - mem_base);
43354 test_ret++;
43355 printf(" %d", n_ctxt);
43356 printf(" %d", n_nargs);
43357 printf("\n");
43358 }
43359 }
43360 }
43361#endif
43362
43363 function_tests++;
43364 return(test_ret);
43365}
43366
43367
43368static int
43369test_xmlXPathCeilingFunction(void) {
43370 int test_ret = 0;
43371
43372#ifdef LIBXML_XPATH_ENABLED
43373 int mem_base;
43374 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43375 int n_ctxt;
43376 int nargs; /* the number of arguments */
43377 int n_nargs;
43378
43379 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43380 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43381 mem_base = xmlMemBlocks();
43382 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43383 nargs = gen_int(n_nargs, 1);
43384
43385 xmlXPathCeilingFunction(ctxt, nargs);
43386 call_tests++;
43387 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43388 des_int(n_nargs, nargs, 1);
43389 xmlResetLastError();
43390 if (mem_base != xmlMemBlocks()) {
43391 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
43392 xmlMemBlocks() - mem_base);
43393 test_ret++;
43394 printf(" %d", n_ctxt);
43395 printf(" %d", n_nargs);
43396 printf("\n");
43397 }
43398 }
43399 }
43400#endif
43401
43402 function_tests++;
43403 return(test_ret);
43404}
43405
43406
43407static int
43408test_xmlXPathCompareValues(void) {
43409 int test_ret = 0;
43410
43411#ifdef LIBXML_XPATH_ENABLED
43412 int mem_base;
43413 int ret_val;
43414 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43415 int n_ctxt;
43416 int inf; /* less than (1) or greater than (0) */
43417 int n_inf;
43418 int strict; /* is the comparison strict */
43419 int n_strict;
43420
43421 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43422 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
43423 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
43424 mem_base = xmlMemBlocks();
43425 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43426 inf = gen_int(n_inf, 1);
43427 strict = gen_int(n_strict, 2);
43428
43429 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
43430 desret_int(ret_val);
43431 call_tests++;
43432 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43433 des_int(n_inf, inf, 1);
43434 des_int(n_strict, strict, 2);
43435 xmlResetLastError();
43436 if (mem_base != xmlMemBlocks()) {
43437 printf("Leak of %d blocks found in xmlXPathCompareValues",
43438 xmlMemBlocks() - mem_base);
43439 test_ret++;
43440 printf(" %d", n_ctxt);
43441 printf(" %d", n_inf);
43442 printf(" %d", n_strict);
43443 printf("\n");
43444 }
43445 }
43446 }
43447 }
43448#endif
43449
43450 function_tests++;
43451 return(test_ret);
43452}
43453
43454
43455static int
43456test_xmlXPathConcatFunction(void) {
43457 int test_ret = 0;
43458
43459#ifdef LIBXML_XPATH_ENABLED
43460 int mem_base;
43461 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43462 int n_ctxt;
43463 int nargs; /* the number of arguments */
43464 int n_nargs;
43465
43466 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43467 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43468 mem_base = xmlMemBlocks();
43469 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43470 nargs = gen_int(n_nargs, 1);
43471
43472 xmlXPathConcatFunction(ctxt, nargs);
43473 call_tests++;
43474 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43475 des_int(n_nargs, nargs, 1);
43476 xmlResetLastError();
43477 if (mem_base != xmlMemBlocks()) {
43478 printf("Leak of %d blocks found in xmlXPathConcatFunction",
43479 xmlMemBlocks() - mem_base);
43480 test_ret++;
43481 printf(" %d", n_ctxt);
43482 printf(" %d", n_nargs);
43483 printf("\n");
43484 }
43485 }
43486 }
43487#endif
43488
43489 function_tests++;
43490 return(test_ret);
43491}
43492
43493
43494static int
43495test_xmlXPathContainsFunction(void) {
43496 int test_ret = 0;
43497
43498#ifdef LIBXML_XPATH_ENABLED
43499 int mem_base;
43500 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43501 int n_ctxt;
43502 int nargs; /* the number of arguments */
43503 int n_nargs;
43504
43505 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43506 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43507 mem_base = xmlMemBlocks();
43508 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43509 nargs = gen_int(n_nargs, 1);
43510
43511 xmlXPathContainsFunction(ctxt, nargs);
43512 call_tests++;
43513 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43514 des_int(n_nargs, nargs, 1);
43515 xmlResetLastError();
43516 if (mem_base != xmlMemBlocks()) {
43517 printf("Leak of %d blocks found in xmlXPathContainsFunction",
43518 xmlMemBlocks() - mem_base);
43519 test_ret++;
43520 printf(" %d", n_ctxt);
43521 printf(" %d", n_nargs);
43522 printf("\n");
43523 }
43524 }
43525 }
43526#endif
43527
43528 function_tests++;
43529 return(test_ret);
43530}
43531
43532
43533static int
43534test_xmlXPathCountFunction(void) {
43535 int test_ret = 0;
43536
43537#ifdef LIBXML_XPATH_ENABLED
43538 int mem_base;
43539 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43540 int n_ctxt;
43541 int nargs; /* the number of arguments */
43542 int n_nargs;
43543
43544 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43545 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43546 mem_base = xmlMemBlocks();
43547 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43548 nargs = gen_int(n_nargs, 1);
43549
43550 xmlXPathCountFunction(ctxt, nargs);
43551 call_tests++;
43552 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43553 des_int(n_nargs, nargs, 1);
43554 xmlResetLastError();
43555 if (mem_base != xmlMemBlocks()) {
43556 printf("Leak of %d blocks found in xmlXPathCountFunction",
43557 xmlMemBlocks() - mem_base);
43558 test_ret++;
43559 printf(" %d", n_ctxt);
43560 printf(" %d", n_nargs);
43561 printf("\n");
43562 }
43563 }
43564 }
43565#endif
43566
43567 function_tests++;
43568 return(test_ret);
43569}
43570
43571
43572static int
43573test_xmlXPathDebugDumpCompExpr(void) {
43574 int test_ret = 0;
43575
43576#ifdef LIBXML_XPATH_ENABLED
43577#ifdef LIBXML_DEBUG_ENABLED
43578 int mem_base;
43579 FILE * output; /* the FILE * for the output */
43580 int n_output;
43581 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
43582 int n_comp;
43583 int depth; /* the indentation level. */
43584 int n_depth;
43585
43586 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43587 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43588 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43589 mem_base = xmlMemBlocks();
43590 output = gen_FILE_ptr(n_output, 0);
43591 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
43592 depth = gen_int(n_depth, 2);
43593
43594 xmlXPathDebugDumpCompExpr(output, comp, depth);
43595 call_tests++;
43596 des_FILE_ptr(n_output, output, 0);
43597 des_xmlXPathCompExprPtr(n_comp, comp, 1);
43598 des_int(n_depth, depth, 2);
43599 xmlResetLastError();
43600 if (mem_base != xmlMemBlocks()) {
43601 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
43602 xmlMemBlocks() - mem_base);
43603 test_ret++;
43604 printf(" %d", n_output);
43605 printf(" %d", n_comp);
43606 printf(" %d", n_depth);
43607 printf("\n");
43608 }
43609 }
43610 }
43611 }
43612#endif
43613#endif
43614
43615 function_tests++;
43616 return(test_ret);
43617}
43618
43619
43620static int
43621test_xmlXPathDebugDumpObject(void) {
43622 int test_ret = 0;
43623
43624#ifdef LIBXML_XPATH_ENABLED
43625#ifdef LIBXML_DEBUG_ENABLED
43626 int mem_base;
43627 FILE * output; /* the FILE * to dump the output */
43628 int n_output;
43629 xmlXPathObjectPtr cur; /* the object to inspect */
43630 int n_cur;
43631 int depth; /* indentation level */
43632 int n_depth;
43633
43634 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43635 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
43636 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43637 mem_base = xmlMemBlocks();
43638 output = gen_FILE_ptr(n_output, 0);
43639 cur = gen_xmlXPathObjectPtr(n_cur, 1);
43640 depth = gen_int(n_depth, 2);
43641
43642 xmlXPathDebugDumpObject(output, cur, depth);
43643 call_tests++;
43644 des_FILE_ptr(n_output, output, 0);
43645 des_xmlXPathObjectPtr(n_cur, cur, 1);
43646 des_int(n_depth, depth, 2);
43647 xmlResetLastError();
43648 if (mem_base != xmlMemBlocks()) {
43649 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
43650 xmlMemBlocks() - mem_base);
43651 test_ret++;
43652 printf(" %d", n_output);
43653 printf(" %d", n_cur);
43654 printf(" %d", n_depth);
43655 printf("\n");
43656 }
43657 }
43658 }
43659 }
43660#endif
43661#endif
43662
43663 function_tests++;
43664 return(test_ret);
43665}
43666
43667
43668static int
43669test_xmlXPathDifference(void) {
43670 int test_ret = 0;
43671
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043672#ifdef LIBXML_XPATH_ENABLED
43673 int mem_base;
43674 xmlNodeSetPtr ret_val;
43675 xmlNodeSetPtr nodes1; /* a node-set */
43676 int n_nodes1;
43677 xmlNodeSetPtr nodes2; /* a node-set */
43678 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043679
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043680 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
43681 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
43682 mem_base = xmlMemBlocks();
43683 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
43684 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
43685
43686 ret_val = xmlXPathDifference(nodes1, nodes2);
43687 desret_xmlNodeSetPtr(ret_val);
43688 call_tests++;
43689 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
43690 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
43691 xmlResetLastError();
43692 if (mem_base != xmlMemBlocks()) {
43693 printf("Leak of %d blocks found in xmlXPathDifference",
43694 xmlMemBlocks() - mem_base);
43695 test_ret++;
43696 printf(" %d", n_nodes1);
43697 printf(" %d", n_nodes2);
43698 printf("\n");
43699 }
43700 }
43701 }
43702#endif
43703
43704 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043705 return(test_ret);
43706}
43707
43708
43709static int
43710test_xmlXPathDistinct(void) {
43711 int test_ret = 0;
43712
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043713#ifdef LIBXML_XPATH_ENABLED
43714 int mem_base;
43715 xmlNodeSetPtr ret_val;
43716 xmlNodeSetPtr nodes; /* a node-set */
43717 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043718
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043719 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
43720 mem_base = xmlMemBlocks();
43721 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
43722
43723 ret_val = xmlXPathDistinct(nodes);
43724 desret_xmlNodeSetPtr(ret_val);
43725 call_tests++;
43726 des_xmlNodeSetPtr(n_nodes, nodes, 0);
43727 xmlResetLastError();
43728 if (mem_base != xmlMemBlocks()) {
43729 printf("Leak of %d blocks found in xmlXPathDistinct",
43730 xmlMemBlocks() - mem_base);
43731 test_ret++;
43732 printf(" %d", n_nodes);
43733 printf("\n");
43734 }
43735 }
43736#endif
43737
43738 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043739 return(test_ret);
43740}
43741
43742
43743static int
43744test_xmlXPathDistinctSorted(void) {
43745 int test_ret = 0;
43746
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043747#ifdef LIBXML_XPATH_ENABLED
43748 int mem_base;
43749 xmlNodeSetPtr ret_val;
43750 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
43751 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043752
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043753 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
43754 mem_base = xmlMemBlocks();
43755 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
43756
43757 ret_val = xmlXPathDistinctSorted(nodes);
43758 desret_xmlNodeSetPtr(ret_val);
43759 call_tests++;
43760 des_xmlNodeSetPtr(n_nodes, nodes, 0);
43761 xmlResetLastError();
43762 if (mem_base != xmlMemBlocks()) {
43763 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
43764 xmlMemBlocks() - mem_base);
43765 test_ret++;
43766 printf(" %d", n_nodes);
43767 printf("\n");
43768 }
43769 }
43770#endif
43771
43772 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043773 return(test_ret);
43774}
43775
43776
43777static int
43778test_xmlXPathDivValues(void) {
43779 int test_ret = 0;
43780
43781#ifdef LIBXML_XPATH_ENABLED
43782 int mem_base;
43783 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43784 int n_ctxt;
43785
43786 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43787 mem_base = xmlMemBlocks();
43788 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43789
43790 xmlXPathDivValues(ctxt);
43791 call_tests++;
43792 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43793 xmlResetLastError();
43794 if (mem_base != xmlMemBlocks()) {
43795 printf("Leak of %d blocks found in xmlXPathDivValues",
43796 xmlMemBlocks() - mem_base);
43797 test_ret++;
43798 printf(" %d", n_ctxt);
43799 printf("\n");
43800 }
43801 }
43802#endif
43803
43804 function_tests++;
43805 return(test_ret);
43806}
43807
43808
43809static int
43810test_xmlXPathEqualValues(void) {
43811 int test_ret = 0;
43812
43813#ifdef LIBXML_XPATH_ENABLED
43814 int mem_base;
43815 int ret_val;
43816 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43817 int n_ctxt;
43818
43819 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43820 mem_base = xmlMemBlocks();
43821 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43822
43823 ret_val = xmlXPathEqualValues(ctxt);
43824 desret_int(ret_val);
43825 call_tests++;
43826 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43827 xmlResetLastError();
43828 if (mem_base != xmlMemBlocks()) {
43829 printf("Leak of %d blocks found in xmlXPathEqualValues",
43830 xmlMemBlocks() - mem_base);
43831 test_ret++;
43832 printf(" %d", n_ctxt);
43833 printf("\n");
43834 }
43835 }
43836#endif
43837
43838 function_tests++;
43839 return(test_ret);
43840}
43841
43842
43843static int
43844test_xmlXPathErr(void) {
43845 int test_ret = 0;
43846
43847#ifdef LIBXML_XPATH_ENABLED
43848 int mem_base;
43849 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
43850 int n_ctxt;
43851 int error; /* the error code */
43852 int n_error;
43853
43854 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43855 for (n_error = 0;n_error < gen_nb_int;n_error++) {
43856 mem_base = xmlMemBlocks();
43857 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43858 error = gen_int(n_error, 1);
43859
43860 xmlXPathErr(ctxt, error);
43861 call_tests++;
43862 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43863 des_int(n_error, error, 1);
43864 xmlResetLastError();
43865 if (mem_base != xmlMemBlocks()) {
43866 printf("Leak of %d blocks found in xmlXPathErr",
43867 xmlMemBlocks() - mem_base);
43868 test_ret++;
43869 printf(" %d", n_ctxt);
43870 printf(" %d", n_error);
43871 printf("\n");
43872 }
43873 }
43874 }
43875#endif
43876
43877 function_tests++;
43878 return(test_ret);
43879}
43880
43881
43882static int
43883test_xmlXPathEvalExpr(void) {
43884 int test_ret = 0;
43885
43886#ifdef LIBXML_XPATH_ENABLED
43887 int mem_base;
43888 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43889 int n_ctxt;
43890
43891 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43892 mem_base = xmlMemBlocks();
43893 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43894
43895 xmlXPathEvalExpr(ctxt);
43896 call_tests++;
43897 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43898 xmlResetLastError();
43899 if (mem_base != xmlMemBlocks()) {
43900 printf("Leak of %d blocks found in xmlXPathEvalExpr",
43901 xmlMemBlocks() - mem_base);
43902 test_ret++;
43903 printf(" %d", n_ctxt);
43904 printf("\n");
43905 }
43906 }
43907#endif
43908
43909 function_tests++;
43910 return(test_ret);
43911}
43912
43913
43914static int
43915test_xmlXPathEvaluatePredicateResult(void) {
43916 int test_ret = 0;
43917
43918#ifdef LIBXML_XPATH_ENABLED
43919 int mem_base;
43920 int ret_val;
43921 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43922 int n_ctxt;
43923 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43924 int n_res;
43925
43926 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43927 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43928 mem_base = xmlMemBlocks();
43929 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43930 res = gen_xmlXPathObjectPtr(n_res, 1);
43931
43932 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
43933 desret_int(ret_val);
43934 call_tests++;
43935 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43936 des_xmlXPathObjectPtr(n_res, res, 1);
43937 xmlResetLastError();
43938 if (mem_base != xmlMemBlocks()) {
43939 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
43940 xmlMemBlocks() - mem_base);
43941 test_ret++;
43942 printf(" %d", n_ctxt);
43943 printf(" %d", n_res);
43944 printf("\n");
43945 }
43946 }
43947 }
43948#endif
43949
43950 function_tests++;
43951 return(test_ret);
43952}
43953
43954
43955static int
43956test_xmlXPathFalseFunction(void) {
43957 int test_ret = 0;
43958
43959#ifdef LIBXML_XPATH_ENABLED
43960 int mem_base;
43961 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43962 int n_ctxt;
43963 int nargs; /* the number of arguments */
43964 int n_nargs;
43965
43966 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43967 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43968 mem_base = xmlMemBlocks();
43969 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43970 nargs = gen_int(n_nargs, 1);
43971
43972 xmlXPathFalseFunction(ctxt, nargs);
43973 call_tests++;
43974 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43975 des_int(n_nargs, nargs, 1);
43976 xmlResetLastError();
43977 if (mem_base != xmlMemBlocks()) {
43978 printf("Leak of %d blocks found in xmlXPathFalseFunction",
43979 xmlMemBlocks() - mem_base);
43980 test_ret++;
43981 printf(" %d", n_ctxt);
43982 printf(" %d", n_nargs);
43983 printf("\n");
43984 }
43985 }
43986 }
43987#endif
43988
43989 function_tests++;
43990 return(test_ret);
43991}
43992
43993
43994static int
43995test_xmlXPathFloorFunction(void) {
43996 int test_ret = 0;
43997
43998#ifdef LIBXML_XPATH_ENABLED
43999 int mem_base;
44000 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44001 int n_ctxt;
44002 int nargs; /* the number of arguments */
44003 int n_nargs;
44004
44005 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44006 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44007 mem_base = xmlMemBlocks();
44008 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44009 nargs = gen_int(n_nargs, 1);
44010
44011 xmlXPathFloorFunction(ctxt, nargs);
44012 call_tests++;
44013 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44014 des_int(n_nargs, nargs, 1);
44015 xmlResetLastError();
44016 if (mem_base != xmlMemBlocks()) {
44017 printf("Leak of %d blocks found in xmlXPathFloorFunction",
44018 xmlMemBlocks() - mem_base);
44019 test_ret++;
44020 printf(" %d", n_ctxt);
44021 printf(" %d", n_nargs);
44022 printf("\n");
44023 }
44024 }
44025 }
44026#endif
44027
44028 function_tests++;
44029 return(test_ret);
44030}
44031
44032
44033static int
44034test_xmlXPathFunctionLookup(void) {
44035 int test_ret = 0;
44036
44037
44038 /* missing type support */
44039 return(test_ret);
44040}
44041
44042
44043static int
44044test_xmlXPathFunctionLookupNS(void) {
44045 int test_ret = 0;
44046
44047
44048 /* missing type support */
44049 return(test_ret);
44050}
44051
44052
44053static int
44054test_xmlXPathHasSameNodes(void) {
44055 int test_ret = 0;
44056
44057#ifdef LIBXML_XPATH_ENABLED
44058 int mem_base;
44059 int ret_val;
44060 xmlNodeSetPtr nodes1; /* a node-set */
44061 int n_nodes1;
44062 xmlNodeSetPtr nodes2; /* a node-set */
44063 int n_nodes2;
44064
44065 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44066 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44067 mem_base = xmlMemBlocks();
44068 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44069 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44070
44071 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
44072 desret_int(ret_val);
44073 call_tests++;
44074 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44075 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44076 xmlResetLastError();
44077 if (mem_base != xmlMemBlocks()) {
44078 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
44079 xmlMemBlocks() - mem_base);
44080 test_ret++;
44081 printf(" %d", n_nodes1);
44082 printf(" %d", n_nodes2);
44083 printf("\n");
44084 }
44085 }
44086 }
44087#endif
44088
44089 function_tests++;
44090 return(test_ret);
44091}
44092
44093
44094static int
44095test_xmlXPathIdFunction(void) {
44096 int test_ret = 0;
44097
44098#ifdef LIBXML_XPATH_ENABLED
44099 int mem_base;
44100 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44101 int n_ctxt;
44102 int nargs; /* the number of arguments */
44103 int n_nargs;
44104
44105 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44106 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44107 mem_base = xmlMemBlocks();
44108 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44109 nargs = gen_int(n_nargs, 1);
44110
44111 xmlXPathIdFunction(ctxt, nargs);
44112 call_tests++;
44113 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44114 des_int(n_nargs, nargs, 1);
44115 xmlResetLastError();
44116 if (mem_base != xmlMemBlocks()) {
44117 printf("Leak of %d blocks found in xmlXPathIdFunction",
44118 xmlMemBlocks() - mem_base);
44119 test_ret++;
44120 printf(" %d", n_ctxt);
44121 printf(" %d", n_nargs);
44122 printf("\n");
44123 }
44124 }
44125 }
44126#endif
44127
44128 function_tests++;
44129 return(test_ret);
44130}
44131
44132
44133static int
44134test_xmlXPathIntersection(void) {
44135 int test_ret = 0;
44136
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044137#ifdef LIBXML_XPATH_ENABLED
44138 int mem_base;
44139 xmlNodeSetPtr ret_val;
44140 xmlNodeSetPtr nodes1; /* a node-set */
44141 int n_nodes1;
44142 xmlNodeSetPtr nodes2; /* a node-set */
44143 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044144
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044145 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44146 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44147 mem_base = xmlMemBlocks();
44148 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44149 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44150
44151 ret_val = xmlXPathIntersection(nodes1, nodes2);
44152 desret_xmlNodeSetPtr(ret_val);
44153 call_tests++;
44154 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44155 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44156 xmlResetLastError();
44157 if (mem_base != xmlMemBlocks()) {
44158 printf("Leak of %d blocks found in xmlXPathIntersection",
44159 xmlMemBlocks() - mem_base);
44160 test_ret++;
44161 printf(" %d", n_nodes1);
44162 printf(" %d", n_nodes2);
44163 printf("\n");
44164 }
44165 }
44166 }
44167#endif
44168
44169 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044170 return(test_ret);
44171}
44172
44173
44174static int
44175test_xmlXPathIsNodeType(void) {
44176 int test_ret = 0;
44177
44178#ifdef LIBXML_XPATH_ENABLED
44179 int mem_base;
44180 int ret_val;
44181 xmlChar * name; /* a name string */
44182 int n_name;
44183
44184 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
44185 mem_base = xmlMemBlocks();
44186 name = gen_const_xmlChar_ptr(n_name, 0);
44187
44188 ret_val = xmlXPathIsNodeType(name);
44189 desret_int(ret_val);
44190 call_tests++;
44191 des_const_xmlChar_ptr(n_name, name, 0);
44192 xmlResetLastError();
44193 if (mem_base != xmlMemBlocks()) {
44194 printf("Leak of %d blocks found in xmlXPathIsNodeType",
44195 xmlMemBlocks() - mem_base);
44196 test_ret++;
44197 printf(" %d", n_name);
44198 printf("\n");
44199 }
44200 }
44201#endif
44202
44203 function_tests++;
44204 return(test_ret);
44205}
44206
44207
44208static int
44209test_xmlXPathLangFunction(void) {
44210 int test_ret = 0;
44211
44212#ifdef LIBXML_XPATH_ENABLED
44213 int mem_base;
44214 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44215 int n_ctxt;
44216 int nargs; /* the number of arguments */
44217 int n_nargs;
44218
44219 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44220 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44221 mem_base = xmlMemBlocks();
44222 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44223 nargs = gen_int(n_nargs, 1);
44224
44225 xmlXPathLangFunction(ctxt, nargs);
44226 call_tests++;
44227 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44228 des_int(n_nargs, nargs, 1);
44229 xmlResetLastError();
44230 if (mem_base != xmlMemBlocks()) {
44231 printf("Leak of %d blocks found in xmlXPathLangFunction",
44232 xmlMemBlocks() - mem_base);
44233 test_ret++;
44234 printf(" %d", n_ctxt);
44235 printf(" %d", n_nargs);
44236 printf("\n");
44237 }
44238 }
44239 }
44240#endif
44241
44242 function_tests++;
44243 return(test_ret);
44244}
44245
44246
44247static int
44248test_xmlXPathLastFunction(void) {
44249 int test_ret = 0;
44250
44251#ifdef LIBXML_XPATH_ENABLED
44252 int mem_base;
44253 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44254 int n_ctxt;
44255 int nargs; /* the number of arguments */
44256 int n_nargs;
44257
44258 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44259 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44260 mem_base = xmlMemBlocks();
44261 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44262 nargs = gen_int(n_nargs, 1);
44263
44264 xmlXPathLastFunction(ctxt, nargs);
44265 call_tests++;
44266 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44267 des_int(n_nargs, nargs, 1);
44268 xmlResetLastError();
44269 if (mem_base != xmlMemBlocks()) {
44270 printf("Leak of %d blocks found in xmlXPathLastFunction",
44271 xmlMemBlocks() - mem_base);
44272 test_ret++;
44273 printf(" %d", n_ctxt);
44274 printf(" %d", n_nargs);
44275 printf("\n");
44276 }
44277 }
44278 }
44279#endif
44280
44281 function_tests++;
44282 return(test_ret);
44283}
44284
44285
44286static int
44287test_xmlXPathLeading(void) {
44288 int test_ret = 0;
44289
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044290#ifdef LIBXML_XPATH_ENABLED
44291 int mem_base;
44292 xmlNodeSetPtr ret_val;
44293 xmlNodeSetPtr nodes1; /* a node-set */
44294 int n_nodes1;
44295 xmlNodeSetPtr nodes2; /* a node-set */
44296 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044297
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044298 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44299 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44300 mem_base = xmlMemBlocks();
44301 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44302 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44303
44304 ret_val = xmlXPathLeading(nodes1, nodes2);
44305 desret_xmlNodeSetPtr(ret_val);
44306 call_tests++;
44307 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44308 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44309 xmlResetLastError();
44310 if (mem_base != xmlMemBlocks()) {
44311 printf("Leak of %d blocks found in xmlXPathLeading",
44312 xmlMemBlocks() - mem_base);
44313 test_ret++;
44314 printf(" %d", n_nodes1);
44315 printf(" %d", n_nodes2);
44316 printf("\n");
44317 }
44318 }
44319 }
44320#endif
44321
44322 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044323 return(test_ret);
44324}
44325
44326
44327static int
44328test_xmlXPathLeadingSorted(void) {
44329 int test_ret = 0;
44330
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044331#ifdef LIBXML_XPATH_ENABLED
44332 int mem_base;
44333 xmlNodeSetPtr ret_val;
44334 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
44335 int n_nodes1;
44336 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
44337 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044338
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044339 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44340 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44341 mem_base = xmlMemBlocks();
44342 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44343 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44344
44345 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
44346 desret_xmlNodeSetPtr(ret_val);
44347 call_tests++;
44348 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44349 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44350 xmlResetLastError();
44351 if (mem_base != xmlMemBlocks()) {
44352 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
44353 xmlMemBlocks() - mem_base);
44354 test_ret++;
44355 printf(" %d", n_nodes1);
44356 printf(" %d", n_nodes2);
44357 printf("\n");
44358 }
44359 }
44360 }
44361#endif
44362
44363 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044364 return(test_ret);
44365}
44366
44367
44368static int
44369test_xmlXPathLocalNameFunction(void) {
44370 int test_ret = 0;
44371
44372#ifdef LIBXML_XPATH_ENABLED
44373 int mem_base;
44374 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44375 int n_ctxt;
44376 int nargs; /* the number of arguments */
44377 int n_nargs;
44378
44379 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44380 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44381 mem_base = xmlMemBlocks();
44382 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44383 nargs = gen_int(n_nargs, 1);
44384
44385 xmlXPathLocalNameFunction(ctxt, nargs);
44386 call_tests++;
44387 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44388 des_int(n_nargs, nargs, 1);
44389 xmlResetLastError();
44390 if (mem_base != xmlMemBlocks()) {
44391 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
44392 xmlMemBlocks() - mem_base);
44393 test_ret++;
44394 printf(" %d", n_ctxt);
44395 printf(" %d", n_nargs);
44396 printf("\n");
44397 }
44398 }
44399 }
44400#endif
44401
44402 function_tests++;
44403 return(test_ret);
44404}
44405
44406
44407static int
44408test_xmlXPathModValues(void) {
44409 int test_ret = 0;
44410
44411#ifdef LIBXML_XPATH_ENABLED
44412 int mem_base;
44413 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44414 int n_ctxt;
44415
44416 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44417 mem_base = xmlMemBlocks();
44418 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44419
44420 xmlXPathModValues(ctxt);
44421 call_tests++;
44422 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44423 xmlResetLastError();
44424 if (mem_base != xmlMemBlocks()) {
44425 printf("Leak of %d blocks found in xmlXPathModValues",
44426 xmlMemBlocks() - mem_base);
44427 test_ret++;
44428 printf(" %d", n_ctxt);
44429 printf("\n");
44430 }
44431 }
44432#endif
44433
44434 function_tests++;
44435 return(test_ret);
44436}
44437
44438
44439static int
44440test_xmlXPathMultValues(void) {
44441 int test_ret = 0;
44442
44443#ifdef LIBXML_XPATH_ENABLED
44444 int mem_base;
44445 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44446 int n_ctxt;
44447
44448 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44449 mem_base = xmlMemBlocks();
44450 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44451
44452 xmlXPathMultValues(ctxt);
44453 call_tests++;
44454 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44455 xmlResetLastError();
44456 if (mem_base != xmlMemBlocks()) {
44457 printf("Leak of %d blocks found in xmlXPathMultValues",
44458 xmlMemBlocks() - mem_base);
44459 test_ret++;
44460 printf(" %d", n_ctxt);
44461 printf("\n");
44462 }
44463 }
44464#endif
44465
44466 function_tests++;
44467 return(test_ret);
44468}
44469
44470
44471static int
44472test_xmlXPathNamespaceURIFunction(void) {
44473 int test_ret = 0;
44474
44475#ifdef LIBXML_XPATH_ENABLED
44476 int mem_base;
44477 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44478 int n_ctxt;
44479 int nargs; /* the number of arguments */
44480 int n_nargs;
44481
44482 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44483 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44484 mem_base = xmlMemBlocks();
44485 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44486 nargs = gen_int(n_nargs, 1);
44487
44488 xmlXPathNamespaceURIFunction(ctxt, nargs);
44489 call_tests++;
44490 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44491 des_int(n_nargs, nargs, 1);
44492 xmlResetLastError();
44493 if (mem_base != xmlMemBlocks()) {
44494 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
44495 xmlMemBlocks() - mem_base);
44496 test_ret++;
44497 printf(" %d", n_ctxt);
44498 printf(" %d", n_nargs);
44499 printf("\n");
44500 }
44501 }
44502 }
44503#endif
44504
44505 function_tests++;
44506 return(test_ret);
44507}
44508
44509
44510static int
44511test_xmlXPathNewBoolean(void) {
44512 int test_ret = 0;
44513
44514#ifdef LIBXML_XPATH_ENABLED
44515 int mem_base;
44516 xmlXPathObjectPtr ret_val;
44517 int val; /* the boolean value */
44518 int n_val;
44519
44520 for (n_val = 0;n_val < gen_nb_int;n_val++) {
44521 mem_base = xmlMemBlocks();
44522 val = gen_int(n_val, 0);
44523
44524 ret_val = xmlXPathNewBoolean(val);
44525 desret_xmlXPathObjectPtr(ret_val);
44526 call_tests++;
44527 des_int(n_val, val, 0);
44528 xmlResetLastError();
44529 if (mem_base != xmlMemBlocks()) {
44530 printf("Leak of %d blocks found in xmlXPathNewBoolean",
44531 xmlMemBlocks() - mem_base);
44532 test_ret++;
44533 printf(" %d", n_val);
44534 printf("\n");
44535 }
44536 }
44537#endif
44538
44539 function_tests++;
44540 return(test_ret);
44541}
44542
44543
44544static int
44545test_xmlXPathNewCString(void) {
44546 int test_ret = 0;
44547
44548#ifdef LIBXML_XPATH_ENABLED
44549 int mem_base;
44550 xmlXPathObjectPtr ret_val;
44551 char * val; /* the char * value */
44552 int n_val;
44553
44554 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
44555 mem_base = xmlMemBlocks();
44556 val = gen_const_char_ptr(n_val, 0);
44557
44558 ret_val = xmlXPathNewCString(val);
44559 desret_xmlXPathObjectPtr(ret_val);
44560 call_tests++;
44561 des_const_char_ptr(n_val, val, 0);
44562 xmlResetLastError();
44563 if (mem_base != xmlMemBlocks()) {
44564 printf("Leak of %d blocks found in xmlXPathNewCString",
44565 xmlMemBlocks() - mem_base);
44566 test_ret++;
44567 printf(" %d", n_val);
44568 printf("\n");
44569 }
44570 }
44571#endif
44572
44573 function_tests++;
44574 return(test_ret);
44575}
44576
44577
44578static int
44579test_xmlXPathNewFloat(void) {
44580 int test_ret = 0;
44581
44582#ifdef LIBXML_XPATH_ENABLED
44583 int mem_base;
44584 xmlXPathObjectPtr ret_val;
44585 double val; /* the double value */
44586 int n_val;
44587
44588 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44589 mem_base = xmlMemBlocks();
44590 val = gen_double(n_val, 0);
44591
44592 ret_val = xmlXPathNewFloat(val);
44593 desret_xmlXPathObjectPtr(ret_val);
44594 call_tests++;
44595 des_double(n_val, val, 0);
44596 xmlResetLastError();
44597 if (mem_base != xmlMemBlocks()) {
44598 printf("Leak of %d blocks found in xmlXPathNewFloat",
44599 xmlMemBlocks() - mem_base);
44600 test_ret++;
44601 printf(" %d", n_val);
44602 printf("\n");
44603 }
44604 }
44605#endif
44606
44607 function_tests++;
44608 return(test_ret);
44609}
44610
44611
44612static int
44613test_xmlXPathNewNodeSet(void) {
44614 int test_ret = 0;
44615
44616#ifdef LIBXML_XPATH_ENABLED
44617 int mem_base;
44618 xmlXPathObjectPtr ret_val;
44619 xmlNodePtr val; /* the NodePtr value */
44620 int n_val;
44621
44622 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
44623 mem_base = xmlMemBlocks();
44624 val = gen_xmlNodePtr(n_val, 0);
44625
44626 ret_val = xmlXPathNewNodeSet(val);
44627 desret_xmlXPathObjectPtr(ret_val);
44628 call_tests++;
44629 des_xmlNodePtr(n_val, val, 0);
44630 xmlResetLastError();
44631 if (mem_base != xmlMemBlocks()) {
44632 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
44633 xmlMemBlocks() - mem_base);
44634 test_ret++;
44635 printf(" %d", n_val);
44636 printf("\n");
44637 }
44638 }
44639#endif
44640
44641 function_tests++;
44642 return(test_ret);
44643}
44644
44645
44646static int
44647test_xmlXPathNewNodeSetList(void) {
44648 int test_ret = 0;
44649
44650#ifdef LIBXML_XPATH_ENABLED
44651 int mem_base;
44652 xmlXPathObjectPtr ret_val;
44653 xmlNodeSetPtr val; /* an existing NodeSet */
44654 int n_val;
44655
44656 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
44657 mem_base = xmlMemBlocks();
44658 val = gen_xmlNodeSetPtr(n_val, 0);
44659
44660 ret_val = xmlXPathNewNodeSetList(val);
44661 desret_xmlXPathObjectPtr(ret_val);
44662 call_tests++;
44663 des_xmlNodeSetPtr(n_val, val, 0);
44664 xmlResetLastError();
44665 if (mem_base != xmlMemBlocks()) {
44666 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
44667 xmlMemBlocks() - mem_base);
44668 test_ret++;
44669 printf(" %d", n_val);
44670 printf("\n");
44671 }
44672 }
44673#endif
44674
44675 function_tests++;
44676 return(test_ret);
44677}
44678
44679
44680static int
44681test_xmlXPathNewParserContext(void) {
44682 int test_ret = 0;
44683
44684
44685 /* missing type support */
44686 return(test_ret);
44687}
44688
44689
44690static int
44691test_xmlXPathNewString(void) {
44692 int test_ret = 0;
44693
44694#ifdef LIBXML_XPATH_ENABLED
44695 int mem_base;
44696 xmlXPathObjectPtr ret_val;
44697 xmlChar * val; /* the xmlChar * value */
44698 int n_val;
44699
44700 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
44701 mem_base = xmlMemBlocks();
44702 val = gen_const_xmlChar_ptr(n_val, 0);
44703
44704 ret_val = xmlXPathNewString(val);
44705 desret_xmlXPathObjectPtr(ret_val);
44706 call_tests++;
44707 des_const_xmlChar_ptr(n_val, val, 0);
44708 xmlResetLastError();
44709 if (mem_base != xmlMemBlocks()) {
44710 printf("Leak of %d blocks found in xmlXPathNewString",
44711 xmlMemBlocks() - mem_base);
44712 test_ret++;
44713 printf(" %d", n_val);
44714 printf("\n");
44715 }
44716 }
44717#endif
44718
44719 function_tests++;
44720 return(test_ret);
44721}
44722
44723
44724static int
44725test_xmlXPathNextAncestor(void) {
44726 int test_ret = 0;
44727
44728#ifdef LIBXML_XPATH_ENABLED
44729 int mem_base;
44730 xmlNodePtr ret_val;
44731 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44732 int n_ctxt;
44733 xmlNodePtr cur; /* the current node in the traversal */
44734 int n_cur;
44735
44736 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44737 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44738 mem_base = xmlMemBlocks();
44739 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44740 cur = gen_xmlNodePtr(n_cur, 1);
44741
44742 ret_val = xmlXPathNextAncestor(ctxt, cur);
44743 desret_xmlNodePtr(ret_val);
44744 call_tests++;
44745 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44746 des_xmlNodePtr(n_cur, cur, 1);
44747 xmlResetLastError();
44748 if (mem_base != xmlMemBlocks()) {
44749 printf("Leak of %d blocks found in xmlXPathNextAncestor",
44750 xmlMemBlocks() - mem_base);
44751 test_ret++;
44752 printf(" %d", n_ctxt);
44753 printf(" %d", n_cur);
44754 printf("\n");
44755 }
44756 }
44757 }
44758#endif
44759
44760 function_tests++;
44761 return(test_ret);
44762}
44763
44764
44765static int
44766test_xmlXPathNextAncestorOrSelf(void) {
44767 int test_ret = 0;
44768
44769#ifdef LIBXML_XPATH_ENABLED
44770 int mem_base;
44771 xmlNodePtr ret_val;
44772 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44773 int n_ctxt;
44774 xmlNodePtr cur; /* the current node in the traversal */
44775 int n_cur;
44776
44777 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44778 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44779 mem_base = xmlMemBlocks();
44780 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44781 cur = gen_xmlNodePtr(n_cur, 1);
44782
44783 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
44784 desret_xmlNodePtr(ret_val);
44785 call_tests++;
44786 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44787 des_xmlNodePtr(n_cur, cur, 1);
44788 xmlResetLastError();
44789 if (mem_base != xmlMemBlocks()) {
44790 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
44791 xmlMemBlocks() - mem_base);
44792 test_ret++;
44793 printf(" %d", n_ctxt);
44794 printf(" %d", n_cur);
44795 printf("\n");
44796 }
44797 }
44798 }
44799#endif
44800
44801 function_tests++;
44802 return(test_ret);
44803}
44804
44805
44806static int
44807test_xmlXPathNextAttribute(void) {
44808 int test_ret = 0;
44809
44810#ifdef LIBXML_XPATH_ENABLED
44811 int mem_base;
44812 xmlNodePtr ret_val;
44813 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44814 int n_ctxt;
44815 xmlNodePtr cur; /* the current attribute in the traversal */
44816 int n_cur;
44817
44818 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44819 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44820 mem_base = xmlMemBlocks();
44821 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44822 cur = gen_xmlNodePtr(n_cur, 1);
44823
44824 ret_val = xmlXPathNextAttribute(ctxt, cur);
44825 desret_xmlNodePtr(ret_val);
44826 call_tests++;
44827 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44828 des_xmlNodePtr(n_cur, cur, 1);
44829 xmlResetLastError();
44830 if (mem_base != xmlMemBlocks()) {
44831 printf("Leak of %d blocks found in xmlXPathNextAttribute",
44832 xmlMemBlocks() - mem_base);
44833 test_ret++;
44834 printf(" %d", n_ctxt);
44835 printf(" %d", n_cur);
44836 printf("\n");
44837 }
44838 }
44839 }
44840#endif
44841
44842 function_tests++;
44843 return(test_ret);
44844}
44845
44846
44847static int
44848test_xmlXPathNextChild(void) {
44849 int test_ret = 0;
44850
44851#ifdef LIBXML_XPATH_ENABLED
44852 int mem_base;
44853 xmlNodePtr ret_val;
44854 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44855 int n_ctxt;
44856 xmlNodePtr cur; /* the current node in the traversal */
44857 int n_cur;
44858
44859 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44860 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44861 mem_base = xmlMemBlocks();
44862 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44863 cur = gen_xmlNodePtr(n_cur, 1);
44864
44865 ret_val = xmlXPathNextChild(ctxt, cur);
44866 desret_xmlNodePtr(ret_val);
44867 call_tests++;
44868 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44869 des_xmlNodePtr(n_cur, cur, 1);
44870 xmlResetLastError();
44871 if (mem_base != xmlMemBlocks()) {
44872 printf("Leak of %d blocks found in xmlXPathNextChild",
44873 xmlMemBlocks() - mem_base);
44874 test_ret++;
44875 printf(" %d", n_ctxt);
44876 printf(" %d", n_cur);
44877 printf("\n");
44878 }
44879 }
44880 }
44881#endif
44882
44883 function_tests++;
44884 return(test_ret);
44885}
44886
44887
44888static int
44889test_xmlXPathNextDescendant(void) {
44890 int test_ret = 0;
44891
44892#ifdef LIBXML_XPATH_ENABLED
44893 int mem_base;
44894 xmlNodePtr ret_val;
44895 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44896 int n_ctxt;
44897 xmlNodePtr cur; /* the current node in the traversal */
44898 int n_cur;
44899
44900 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44901 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44902 mem_base = xmlMemBlocks();
44903 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44904 cur = gen_xmlNodePtr(n_cur, 1);
44905
44906 ret_val = xmlXPathNextDescendant(ctxt, cur);
44907 desret_xmlNodePtr(ret_val);
44908 call_tests++;
44909 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44910 des_xmlNodePtr(n_cur, cur, 1);
44911 xmlResetLastError();
44912 if (mem_base != xmlMemBlocks()) {
44913 printf("Leak of %d blocks found in xmlXPathNextDescendant",
44914 xmlMemBlocks() - mem_base);
44915 test_ret++;
44916 printf(" %d", n_ctxt);
44917 printf(" %d", n_cur);
44918 printf("\n");
44919 }
44920 }
44921 }
44922#endif
44923
44924 function_tests++;
44925 return(test_ret);
44926}
44927
44928
44929static int
44930test_xmlXPathNextDescendantOrSelf(void) {
44931 int test_ret = 0;
44932
44933#ifdef LIBXML_XPATH_ENABLED
44934 int mem_base;
44935 xmlNodePtr ret_val;
44936 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44937 int n_ctxt;
44938 xmlNodePtr cur; /* the current node in the traversal */
44939 int n_cur;
44940
44941 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44942 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44943 mem_base = xmlMemBlocks();
44944 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44945 cur = gen_xmlNodePtr(n_cur, 1);
44946
44947 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
44948 desret_xmlNodePtr(ret_val);
44949 call_tests++;
44950 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44951 des_xmlNodePtr(n_cur, cur, 1);
44952 xmlResetLastError();
44953 if (mem_base != xmlMemBlocks()) {
44954 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
44955 xmlMemBlocks() - mem_base);
44956 test_ret++;
44957 printf(" %d", n_ctxt);
44958 printf(" %d", n_cur);
44959 printf("\n");
44960 }
44961 }
44962 }
44963#endif
44964
44965 function_tests++;
44966 return(test_ret);
44967}
44968
44969
44970static int
44971test_xmlXPathNextFollowing(void) {
44972 int test_ret = 0;
44973
44974#ifdef LIBXML_XPATH_ENABLED
44975 int mem_base;
44976 xmlNodePtr ret_val;
44977 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44978 int n_ctxt;
44979 xmlNodePtr cur; /* the current node in the traversal */
44980 int n_cur;
44981
44982 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44983 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44984 mem_base = xmlMemBlocks();
44985 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44986 cur = gen_xmlNodePtr(n_cur, 1);
44987
44988 ret_val = xmlXPathNextFollowing(ctxt, cur);
44989 desret_xmlNodePtr(ret_val);
44990 call_tests++;
44991 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44992 des_xmlNodePtr(n_cur, cur, 1);
44993 xmlResetLastError();
44994 if (mem_base != xmlMemBlocks()) {
44995 printf("Leak of %d blocks found in xmlXPathNextFollowing",
44996 xmlMemBlocks() - mem_base);
44997 test_ret++;
44998 printf(" %d", n_ctxt);
44999 printf(" %d", n_cur);
45000 printf("\n");
45001 }
45002 }
45003 }
45004#endif
45005
45006 function_tests++;
45007 return(test_ret);
45008}
45009
45010
45011static int
45012test_xmlXPathNextFollowingSibling(void) {
45013 int test_ret = 0;
45014
45015#ifdef LIBXML_XPATH_ENABLED
45016 int mem_base;
45017 xmlNodePtr ret_val;
45018 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45019 int n_ctxt;
45020 xmlNodePtr cur; /* the current node in the traversal */
45021 int n_cur;
45022
45023 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45024 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45025 mem_base = xmlMemBlocks();
45026 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45027 cur = gen_xmlNodePtr(n_cur, 1);
45028
45029 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
45030 desret_xmlNodePtr(ret_val);
45031 call_tests++;
45032 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45033 des_xmlNodePtr(n_cur, cur, 1);
45034 xmlResetLastError();
45035 if (mem_base != xmlMemBlocks()) {
45036 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
45037 xmlMemBlocks() - mem_base);
45038 test_ret++;
45039 printf(" %d", n_ctxt);
45040 printf(" %d", n_cur);
45041 printf("\n");
45042 }
45043 }
45044 }
45045#endif
45046
45047 function_tests++;
45048 return(test_ret);
45049}
45050
45051
45052static int
45053test_xmlXPathNextNamespace(void) {
45054 int test_ret = 0;
45055
45056#ifdef LIBXML_XPATH_ENABLED
45057 int mem_base;
45058 xmlNodePtr ret_val;
45059 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45060 int n_ctxt;
45061 xmlNodePtr cur; /* the current attribute in the traversal */
45062 int n_cur;
45063
45064 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45065 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45066 mem_base = xmlMemBlocks();
45067 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45068 cur = gen_xmlNodePtr(n_cur, 1);
45069
45070 ret_val = xmlXPathNextNamespace(ctxt, cur);
45071 desret_xmlNodePtr(ret_val);
45072 call_tests++;
45073 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45074 des_xmlNodePtr(n_cur, cur, 1);
45075 xmlResetLastError();
45076 if (mem_base != xmlMemBlocks()) {
45077 printf("Leak of %d blocks found in xmlXPathNextNamespace",
45078 xmlMemBlocks() - mem_base);
45079 test_ret++;
45080 printf(" %d", n_ctxt);
45081 printf(" %d", n_cur);
45082 printf("\n");
45083 }
45084 }
45085 }
45086#endif
45087
45088 function_tests++;
45089 return(test_ret);
45090}
45091
45092
45093static int
45094test_xmlXPathNextParent(void) {
45095 int test_ret = 0;
45096
45097#ifdef LIBXML_XPATH_ENABLED
45098 int mem_base;
45099 xmlNodePtr ret_val;
45100 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45101 int n_ctxt;
45102 xmlNodePtr cur; /* the current node in the traversal */
45103 int n_cur;
45104
45105 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45106 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45107 mem_base = xmlMemBlocks();
45108 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45109 cur = gen_xmlNodePtr(n_cur, 1);
45110
45111 ret_val = xmlXPathNextParent(ctxt, cur);
45112 desret_xmlNodePtr(ret_val);
45113 call_tests++;
45114 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45115 des_xmlNodePtr(n_cur, cur, 1);
45116 xmlResetLastError();
45117 if (mem_base != xmlMemBlocks()) {
45118 printf("Leak of %d blocks found in xmlXPathNextParent",
45119 xmlMemBlocks() - mem_base);
45120 test_ret++;
45121 printf(" %d", n_ctxt);
45122 printf(" %d", n_cur);
45123 printf("\n");
45124 }
45125 }
45126 }
45127#endif
45128
45129 function_tests++;
45130 return(test_ret);
45131}
45132
45133
45134static int
45135test_xmlXPathNextPreceding(void) {
45136 int test_ret = 0;
45137
45138#ifdef LIBXML_XPATH_ENABLED
45139 int mem_base;
45140 xmlNodePtr ret_val;
45141 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45142 int n_ctxt;
45143 xmlNodePtr cur; /* the current node in the traversal */
45144 int n_cur;
45145
45146 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45147 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45148 mem_base = xmlMemBlocks();
45149 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45150 cur = gen_xmlNodePtr(n_cur, 1);
45151
45152 ret_val = xmlXPathNextPreceding(ctxt, cur);
45153 desret_xmlNodePtr(ret_val);
45154 call_tests++;
45155 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45156 des_xmlNodePtr(n_cur, cur, 1);
45157 xmlResetLastError();
45158 if (mem_base != xmlMemBlocks()) {
45159 printf("Leak of %d blocks found in xmlXPathNextPreceding",
45160 xmlMemBlocks() - mem_base);
45161 test_ret++;
45162 printf(" %d", n_ctxt);
45163 printf(" %d", n_cur);
45164 printf("\n");
45165 }
45166 }
45167 }
45168#endif
45169
45170 function_tests++;
45171 return(test_ret);
45172}
45173
45174
45175static int
45176test_xmlXPathNextPrecedingSibling(void) {
45177 int test_ret = 0;
45178
45179#ifdef LIBXML_XPATH_ENABLED
45180 int mem_base;
45181 xmlNodePtr ret_val;
45182 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45183 int n_ctxt;
45184 xmlNodePtr cur; /* the current node in the traversal */
45185 int n_cur;
45186
45187 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45188 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45189 mem_base = xmlMemBlocks();
45190 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45191 cur = gen_xmlNodePtr(n_cur, 1);
45192
45193 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
45194 desret_xmlNodePtr(ret_val);
45195 call_tests++;
45196 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45197 des_xmlNodePtr(n_cur, cur, 1);
45198 xmlResetLastError();
45199 if (mem_base != xmlMemBlocks()) {
45200 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
45201 xmlMemBlocks() - mem_base);
45202 test_ret++;
45203 printf(" %d", n_ctxt);
45204 printf(" %d", n_cur);
45205 printf("\n");
45206 }
45207 }
45208 }
45209#endif
45210
45211 function_tests++;
45212 return(test_ret);
45213}
45214
45215
45216static int
45217test_xmlXPathNextSelf(void) {
45218 int test_ret = 0;
45219
45220#ifdef LIBXML_XPATH_ENABLED
45221 int mem_base;
45222 xmlNodePtr ret_val;
45223 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45224 int n_ctxt;
45225 xmlNodePtr cur; /* the current node in the traversal */
45226 int n_cur;
45227
45228 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45229 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45230 mem_base = xmlMemBlocks();
45231 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45232 cur = gen_xmlNodePtr(n_cur, 1);
45233
45234 ret_val = xmlXPathNextSelf(ctxt, cur);
45235 desret_xmlNodePtr(ret_val);
45236 call_tests++;
45237 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45238 des_xmlNodePtr(n_cur, cur, 1);
45239 xmlResetLastError();
45240 if (mem_base != xmlMemBlocks()) {
45241 printf("Leak of %d blocks found in xmlXPathNextSelf",
45242 xmlMemBlocks() - mem_base);
45243 test_ret++;
45244 printf(" %d", n_ctxt);
45245 printf(" %d", n_cur);
45246 printf("\n");
45247 }
45248 }
45249 }
45250#endif
45251
45252 function_tests++;
45253 return(test_ret);
45254}
45255
45256
45257static int
45258test_xmlXPathNodeLeading(void) {
45259 int test_ret = 0;
45260
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045261#ifdef LIBXML_XPATH_ENABLED
45262 int mem_base;
45263 xmlNodeSetPtr ret_val;
45264 xmlNodeSetPtr nodes; /* a node-set */
45265 int n_nodes;
45266 xmlNodePtr node; /* a node */
45267 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045268
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045269 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45270 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45271 mem_base = xmlMemBlocks();
45272 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45273 node = gen_xmlNodePtr(n_node, 1);
45274
45275 ret_val = xmlXPathNodeLeading(nodes, node);
45276 desret_xmlNodeSetPtr(ret_val);
45277 call_tests++;
45278 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45279 des_xmlNodePtr(n_node, node, 1);
45280 xmlResetLastError();
45281 if (mem_base != xmlMemBlocks()) {
45282 printf("Leak of %d blocks found in xmlXPathNodeLeading",
45283 xmlMemBlocks() - mem_base);
45284 test_ret++;
45285 printf(" %d", n_nodes);
45286 printf(" %d", n_node);
45287 printf("\n");
45288 }
45289 }
45290 }
45291#endif
45292
45293 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045294 return(test_ret);
45295}
45296
45297
45298static int
45299test_xmlXPathNodeLeadingSorted(void) {
45300 int test_ret = 0;
45301
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045302#ifdef LIBXML_XPATH_ENABLED
45303 int mem_base;
45304 xmlNodeSetPtr ret_val;
45305 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45306 int n_nodes;
45307 xmlNodePtr node; /* a node */
45308 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045309
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045310 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45311 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45312 mem_base = xmlMemBlocks();
45313 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45314 node = gen_xmlNodePtr(n_node, 1);
45315
45316 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
45317 desret_xmlNodeSetPtr(ret_val);
45318 call_tests++;
45319 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45320 des_xmlNodePtr(n_node, node, 1);
45321 xmlResetLastError();
45322 if (mem_base != xmlMemBlocks()) {
45323 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
45324 xmlMemBlocks() - mem_base);
45325 test_ret++;
45326 printf(" %d", n_nodes);
45327 printf(" %d", n_node);
45328 printf("\n");
45329 }
45330 }
45331 }
45332#endif
45333
45334 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045335 return(test_ret);
45336}
45337
45338
45339static int
45340test_xmlXPathNodeSetAdd(void) {
45341 int test_ret = 0;
45342
45343#ifdef LIBXML_XPATH_ENABLED
45344 int mem_base;
45345 xmlNodeSetPtr cur; /* the initial node set */
45346 int n_cur;
45347 xmlNodePtr val; /* a new xmlNodePtr */
45348 int n_val;
45349
45350 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45351 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45352 mem_base = xmlMemBlocks();
45353 cur = gen_xmlNodeSetPtr(n_cur, 0);
45354 val = gen_xmlNodePtr(n_val, 1);
45355
45356 xmlXPathNodeSetAdd(cur, val);
45357 call_tests++;
45358 des_xmlNodeSetPtr(n_cur, cur, 0);
45359 des_xmlNodePtr(n_val, val, 1);
45360 xmlResetLastError();
45361 if (mem_base != xmlMemBlocks()) {
45362 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
45363 xmlMemBlocks() - mem_base);
45364 test_ret++;
45365 printf(" %d", n_cur);
45366 printf(" %d", n_val);
45367 printf("\n");
45368 }
45369 }
45370 }
45371#endif
45372
45373 function_tests++;
45374 return(test_ret);
45375}
45376
45377
45378static int
45379test_xmlXPathNodeSetAddNs(void) {
45380 int test_ret = 0;
45381
45382#ifdef LIBXML_XPATH_ENABLED
45383 int mem_base;
45384 xmlNodeSetPtr cur; /* the initial node set */
45385 int n_cur;
45386 xmlNodePtr node; /* the hosting node */
45387 int n_node;
45388 xmlNsPtr ns; /* a the namespace node */
45389 int n_ns;
45390
45391 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45392 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45393 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
45394 mem_base = xmlMemBlocks();
45395 cur = gen_xmlNodeSetPtr(n_cur, 0);
45396 node = gen_xmlNodePtr(n_node, 1);
45397 ns = gen_xmlNsPtr(n_ns, 2);
45398
45399 xmlXPathNodeSetAddNs(cur, node, ns);
45400 call_tests++;
45401 des_xmlNodeSetPtr(n_cur, cur, 0);
45402 des_xmlNodePtr(n_node, node, 1);
45403 des_xmlNsPtr(n_ns, ns, 2);
45404 xmlResetLastError();
45405 if (mem_base != xmlMemBlocks()) {
45406 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
45407 xmlMemBlocks() - mem_base);
45408 test_ret++;
45409 printf(" %d", n_cur);
45410 printf(" %d", n_node);
45411 printf(" %d", n_ns);
45412 printf("\n");
45413 }
45414 }
45415 }
45416 }
45417#endif
45418
45419 function_tests++;
45420 return(test_ret);
45421}
45422
45423
45424static int
45425test_xmlXPathNodeSetAddUnique(void) {
45426 int test_ret = 0;
45427
45428#ifdef LIBXML_XPATH_ENABLED
45429 int mem_base;
45430 xmlNodeSetPtr cur; /* the initial node set */
45431 int n_cur;
45432 xmlNodePtr val; /* a new xmlNodePtr */
45433 int n_val;
45434
45435 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45436 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45437 mem_base = xmlMemBlocks();
45438 cur = gen_xmlNodeSetPtr(n_cur, 0);
45439 val = gen_xmlNodePtr(n_val, 1);
45440
45441 xmlXPathNodeSetAddUnique(cur, val);
45442 call_tests++;
45443 des_xmlNodeSetPtr(n_cur, cur, 0);
45444 des_xmlNodePtr(n_val, val, 1);
45445 xmlResetLastError();
45446 if (mem_base != xmlMemBlocks()) {
45447 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
45448 xmlMemBlocks() - mem_base);
45449 test_ret++;
45450 printf(" %d", n_cur);
45451 printf(" %d", n_val);
45452 printf("\n");
45453 }
45454 }
45455 }
45456#endif
45457
45458 function_tests++;
45459 return(test_ret);
45460}
45461
45462
45463static int
45464test_xmlXPathNodeSetContains(void) {
45465 int test_ret = 0;
45466
45467#ifdef LIBXML_XPATH_ENABLED
45468 int mem_base;
45469 int ret_val;
45470 xmlNodeSetPtr cur; /* the node-set */
45471 int n_cur;
45472 xmlNodePtr val; /* the node */
45473 int n_val;
45474
45475 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45476 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45477 mem_base = xmlMemBlocks();
45478 cur = gen_xmlNodeSetPtr(n_cur, 0);
45479 val = gen_xmlNodePtr(n_val, 1);
45480
45481 ret_val = xmlXPathNodeSetContains(cur, val);
45482 desret_int(ret_val);
45483 call_tests++;
45484 des_xmlNodeSetPtr(n_cur, cur, 0);
45485 des_xmlNodePtr(n_val, val, 1);
45486 xmlResetLastError();
45487 if (mem_base != xmlMemBlocks()) {
45488 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
45489 xmlMemBlocks() - mem_base);
45490 test_ret++;
45491 printf(" %d", n_cur);
45492 printf(" %d", n_val);
45493 printf("\n");
45494 }
45495 }
45496 }
45497#endif
45498
45499 function_tests++;
45500 return(test_ret);
45501}
45502
45503
45504static int
45505test_xmlXPathNodeSetDel(void) {
45506 int test_ret = 0;
45507
45508#ifdef LIBXML_XPATH_ENABLED
45509 int mem_base;
45510 xmlNodeSetPtr cur; /* the initial node set */
45511 int n_cur;
45512 xmlNodePtr val; /* an xmlNodePtr */
45513 int n_val;
45514
45515 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45516 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45517 mem_base = xmlMemBlocks();
45518 cur = gen_xmlNodeSetPtr(n_cur, 0);
45519 val = gen_xmlNodePtr(n_val, 1);
45520
45521 xmlXPathNodeSetDel(cur, val);
45522 call_tests++;
45523 des_xmlNodeSetPtr(n_cur, cur, 0);
45524 des_xmlNodePtr(n_val, val, 1);
45525 xmlResetLastError();
45526 if (mem_base != xmlMemBlocks()) {
45527 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
45528 xmlMemBlocks() - mem_base);
45529 test_ret++;
45530 printf(" %d", n_cur);
45531 printf(" %d", n_val);
45532 printf("\n");
45533 }
45534 }
45535 }
45536#endif
45537
45538 function_tests++;
45539 return(test_ret);
45540}
45541
45542
45543static int
45544test_xmlXPathNodeSetMerge(void) {
45545 int test_ret = 0;
45546
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045547#ifdef LIBXML_XPATH_ENABLED
45548 int mem_base;
45549 xmlNodeSetPtr ret_val;
45550 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
45551 int n_val1;
45552 xmlNodeSetPtr val2; /* the second NodeSet */
45553 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045554
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045555 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
45556 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
45557 mem_base = xmlMemBlocks();
45558 val1 = gen_xmlNodeSetPtr(n_val1, 0);
45559 val2 = gen_xmlNodeSetPtr(n_val2, 1);
45560
45561 ret_val = xmlXPathNodeSetMerge(val1, val2);
45562 desret_xmlNodeSetPtr(ret_val);
45563 call_tests++;
45564 des_xmlNodeSetPtr(n_val1, val1, 0);
45565 des_xmlNodeSetPtr(n_val2, val2, 1);
45566 xmlResetLastError();
45567 if (mem_base != xmlMemBlocks()) {
45568 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
45569 xmlMemBlocks() - mem_base);
45570 test_ret++;
45571 printf(" %d", n_val1);
45572 printf(" %d", n_val2);
45573 printf("\n");
45574 }
45575 }
45576 }
45577#endif
45578
45579 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045580 return(test_ret);
45581}
45582
45583
45584static int
45585test_xmlXPathNodeSetRemove(void) {
45586 int test_ret = 0;
45587
45588#ifdef LIBXML_XPATH_ENABLED
45589 int mem_base;
45590 xmlNodeSetPtr cur; /* the initial node set */
45591 int n_cur;
45592 int val; /* the index to remove */
45593 int n_val;
45594
45595 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45596 for (n_val = 0;n_val < gen_nb_int;n_val++) {
45597 mem_base = xmlMemBlocks();
45598 cur = gen_xmlNodeSetPtr(n_cur, 0);
45599 val = gen_int(n_val, 1);
45600
45601 xmlXPathNodeSetRemove(cur, val);
45602 call_tests++;
45603 des_xmlNodeSetPtr(n_cur, cur, 0);
45604 des_int(n_val, val, 1);
45605 xmlResetLastError();
45606 if (mem_base != xmlMemBlocks()) {
45607 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
45608 xmlMemBlocks() - mem_base);
45609 test_ret++;
45610 printf(" %d", n_cur);
45611 printf(" %d", n_val);
45612 printf("\n");
45613 }
45614 }
45615 }
45616#endif
45617
45618 function_tests++;
45619 return(test_ret);
45620}
45621
45622
45623static int
45624test_xmlXPathNodeSetSort(void) {
45625 int test_ret = 0;
45626
45627#ifdef LIBXML_XPATH_ENABLED
45628 int mem_base;
45629 xmlNodeSetPtr set; /* the node set */
45630 int n_set;
45631
45632 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
45633 mem_base = xmlMemBlocks();
45634 set = gen_xmlNodeSetPtr(n_set, 0);
45635
45636 xmlXPathNodeSetSort(set);
45637 call_tests++;
45638 des_xmlNodeSetPtr(n_set, set, 0);
45639 xmlResetLastError();
45640 if (mem_base != xmlMemBlocks()) {
45641 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
45642 xmlMemBlocks() - mem_base);
45643 test_ret++;
45644 printf(" %d", n_set);
45645 printf("\n");
45646 }
45647 }
45648#endif
45649
45650 function_tests++;
45651 return(test_ret);
45652}
45653
45654
45655static int
45656test_xmlXPathNodeTrailing(void) {
45657 int test_ret = 0;
45658
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045659#ifdef LIBXML_XPATH_ENABLED
45660 int mem_base;
45661 xmlNodeSetPtr ret_val;
45662 xmlNodeSetPtr nodes; /* a node-set */
45663 int n_nodes;
45664 xmlNodePtr node; /* a node */
45665 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045666
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045667 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45668 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45669 mem_base = xmlMemBlocks();
45670 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45671 node = gen_xmlNodePtr(n_node, 1);
45672
45673 ret_val = xmlXPathNodeTrailing(nodes, node);
45674 desret_xmlNodeSetPtr(ret_val);
45675 call_tests++;
45676 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45677 des_xmlNodePtr(n_node, node, 1);
45678 xmlResetLastError();
45679 if (mem_base != xmlMemBlocks()) {
45680 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
45681 xmlMemBlocks() - mem_base);
45682 test_ret++;
45683 printf(" %d", n_nodes);
45684 printf(" %d", n_node);
45685 printf("\n");
45686 }
45687 }
45688 }
45689#endif
45690
45691 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045692 return(test_ret);
45693}
45694
45695
45696static int
45697test_xmlXPathNodeTrailingSorted(void) {
45698 int test_ret = 0;
45699
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045700#ifdef LIBXML_XPATH_ENABLED
45701 int mem_base;
45702 xmlNodeSetPtr ret_val;
45703 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45704 int n_nodes;
45705 xmlNodePtr node; /* a node */
45706 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045707
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045708 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45709 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45710 mem_base = xmlMemBlocks();
45711 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45712 node = gen_xmlNodePtr(n_node, 1);
45713
45714 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
45715 desret_xmlNodeSetPtr(ret_val);
45716 call_tests++;
45717 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45718 des_xmlNodePtr(n_node, node, 1);
45719 xmlResetLastError();
45720 if (mem_base != xmlMemBlocks()) {
45721 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
45722 xmlMemBlocks() - mem_base);
45723 test_ret++;
45724 printf(" %d", n_nodes);
45725 printf(" %d", n_node);
45726 printf("\n");
45727 }
45728 }
45729 }
45730#endif
45731
45732 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045733 return(test_ret);
45734}
45735
45736
45737static int
45738test_xmlXPathNormalizeFunction(void) {
45739 int test_ret = 0;
45740
45741#ifdef LIBXML_XPATH_ENABLED
45742 int mem_base;
45743 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45744 int n_ctxt;
45745 int nargs; /* the number of arguments */
45746 int n_nargs;
45747
45748 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45749 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45750 mem_base = xmlMemBlocks();
45751 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45752 nargs = gen_int(n_nargs, 1);
45753
45754 xmlXPathNormalizeFunction(ctxt, nargs);
45755 call_tests++;
45756 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45757 des_int(n_nargs, nargs, 1);
45758 xmlResetLastError();
45759 if (mem_base != xmlMemBlocks()) {
45760 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
45761 xmlMemBlocks() - mem_base);
45762 test_ret++;
45763 printf(" %d", n_ctxt);
45764 printf(" %d", n_nargs);
45765 printf("\n");
45766 }
45767 }
45768 }
45769#endif
45770
45771 function_tests++;
45772 return(test_ret);
45773}
45774
45775
45776static int
45777test_xmlXPathNotEqualValues(void) {
45778 int test_ret = 0;
45779
45780#ifdef LIBXML_XPATH_ENABLED
45781 int mem_base;
45782 int ret_val;
45783 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45784 int n_ctxt;
45785
45786 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45787 mem_base = xmlMemBlocks();
45788 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45789
45790 ret_val = xmlXPathNotEqualValues(ctxt);
45791 desret_int(ret_val);
45792 call_tests++;
45793 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45794 xmlResetLastError();
45795 if (mem_base != xmlMemBlocks()) {
45796 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
45797 xmlMemBlocks() - mem_base);
45798 test_ret++;
45799 printf(" %d", n_ctxt);
45800 printf("\n");
45801 }
45802 }
45803#endif
45804
45805 function_tests++;
45806 return(test_ret);
45807}
45808
45809
45810static int
45811test_xmlXPathNotFunction(void) {
45812 int test_ret = 0;
45813
45814#ifdef LIBXML_XPATH_ENABLED
45815 int mem_base;
45816 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45817 int n_ctxt;
45818 int nargs; /* the number of arguments */
45819 int n_nargs;
45820
45821 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45822 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45823 mem_base = xmlMemBlocks();
45824 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45825 nargs = gen_int(n_nargs, 1);
45826
45827 xmlXPathNotFunction(ctxt, nargs);
45828 call_tests++;
45829 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45830 des_int(n_nargs, nargs, 1);
45831 xmlResetLastError();
45832 if (mem_base != xmlMemBlocks()) {
45833 printf("Leak of %d blocks found in xmlXPathNotFunction",
45834 xmlMemBlocks() - mem_base);
45835 test_ret++;
45836 printf(" %d", n_ctxt);
45837 printf(" %d", n_nargs);
45838 printf("\n");
45839 }
45840 }
45841 }
45842#endif
45843
45844 function_tests++;
45845 return(test_ret);
45846}
45847
45848
45849static int
45850test_xmlXPathNsLookup(void) {
45851 int test_ret = 0;
45852
45853#ifdef LIBXML_XPATH_ENABLED
45854 int mem_base;
45855 const xmlChar * ret_val;
45856 xmlXPathContextPtr ctxt; /* the XPath context */
45857 int n_ctxt;
45858 xmlChar * prefix; /* the namespace prefix value */
45859 int n_prefix;
45860
45861 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
45862 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
45863 mem_base = xmlMemBlocks();
45864 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
45865 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
45866
45867 ret_val = xmlXPathNsLookup(ctxt, prefix);
45868 desret_const_xmlChar_ptr(ret_val);
45869 call_tests++;
45870 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
45871 des_const_xmlChar_ptr(n_prefix, prefix, 1);
45872 xmlResetLastError();
45873 if (mem_base != xmlMemBlocks()) {
45874 printf("Leak of %d blocks found in xmlXPathNsLookup",
45875 xmlMemBlocks() - mem_base);
45876 test_ret++;
45877 printf(" %d", n_ctxt);
45878 printf(" %d", n_prefix);
45879 printf("\n");
45880 }
45881 }
45882 }
45883#endif
45884
45885 function_tests++;
45886 return(test_ret);
45887}
45888
45889
45890static int
45891test_xmlXPathNumberFunction(void) {
45892 int test_ret = 0;
45893
45894#ifdef LIBXML_XPATH_ENABLED
45895 int mem_base;
45896 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45897 int n_ctxt;
45898 int nargs; /* the number of arguments */
45899 int n_nargs;
45900
45901 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45902 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45903 mem_base = xmlMemBlocks();
45904 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45905 nargs = gen_int(n_nargs, 1);
45906
45907 xmlXPathNumberFunction(ctxt, nargs);
45908 call_tests++;
45909 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45910 des_int(n_nargs, nargs, 1);
45911 xmlResetLastError();
45912 if (mem_base != xmlMemBlocks()) {
45913 printf("Leak of %d blocks found in xmlXPathNumberFunction",
45914 xmlMemBlocks() - mem_base);
45915 test_ret++;
45916 printf(" %d", n_ctxt);
45917 printf(" %d", n_nargs);
45918 printf("\n");
45919 }
45920 }
45921 }
45922#endif
45923
45924 function_tests++;
45925 return(test_ret);
45926}
45927
45928
45929static int
45930test_xmlXPathParseNCName(void) {
45931 int test_ret = 0;
45932
45933#ifdef LIBXML_XPATH_ENABLED
45934 int mem_base;
45935 xmlChar * ret_val;
45936 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45937 int n_ctxt;
45938
45939 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45940 mem_base = xmlMemBlocks();
45941 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45942
45943 ret_val = xmlXPathParseNCName(ctxt);
45944 desret_xmlChar_ptr(ret_val);
45945 call_tests++;
45946 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45947 xmlResetLastError();
45948 if (mem_base != xmlMemBlocks()) {
45949 printf("Leak of %d blocks found in xmlXPathParseNCName",
45950 xmlMemBlocks() - mem_base);
45951 test_ret++;
45952 printf(" %d", n_ctxt);
45953 printf("\n");
45954 }
45955 }
45956#endif
45957
45958 function_tests++;
45959 return(test_ret);
45960}
45961
45962
45963static int
45964test_xmlXPathParseName(void) {
45965 int test_ret = 0;
45966
45967#ifdef LIBXML_XPATH_ENABLED
45968 int mem_base;
45969 xmlChar * ret_val;
45970 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45971 int n_ctxt;
45972
45973 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45974 mem_base = xmlMemBlocks();
45975 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45976
45977 ret_val = xmlXPathParseName(ctxt);
45978 desret_xmlChar_ptr(ret_val);
45979 call_tests++;
45980 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45981 xmlResetLastError();
45982 if (mem_base != xmlMemBlocks()) {
45983 printf("Leak of %d blocks found in xmlXPathParseName",
45984 xmlMemBlocks() - mem_base);
45985 test_ret++;
45986 printf(" %d", n_ctxt);
45987 printf("\n");
45988 }
45989 }
45990#endif
45991
45992 function_tests++;
45993 return(test_ret);
45994}
45995
45996
45997static int
45998test_xmlXPathPopBoolean(void) {
45999 int test_ret = 0;
46000
46001#ifdef LIBXML_XPATH_ENABLED
46002 int mem_base;
46003 int ret_val;
46004 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46005 int n_ctxt;
46006
46007 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46008 mem_base = xmlMemBlocks();
46009 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46010
46011 ret_val = xmlXPathPopBoolean(ctxt);
46012 desret_int(ret_val);
46013 call_tests++;
46014 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46015 xmlResetLastError();
46016 if (mem_base != xmlMemBlocks()) {
46017 printf("Leak of %d blocks found in xmlXPathPopBoolean",
46018 xmlMemBlocks() - mem_base);
46019 test_ret++;
46020 printf(" %d", n_ctxt);
46021 printf("\n");
46022 }
46023 }
46024#endif
46025
46026 function_tests++;
46027 return(test_ret);
46028}
46029
46030
46031static int
46032test_xmlXPathPopExternal(void) {
46033 int test_ret = 0;
46034
46035#ifdef LIBXML_XPATH_ENABLED
46036 int mem_base;
46037 void * ret_val;
46038 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46039 int n_ctxt;
46040
46041 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46042 mem_base = xmlMemBlocks();
46043 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46044
46045 ret_val = xmlXPathPopExternal(ctxt);
46046 desret_void_ptr(ret_val);
46047 call_tests++;
46048 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46049 xmlResetLastError();
46050 if (mem_base != xmlMemBlocks()) {
46051 printf("Leak of %d blocks found in xmlXPathPopExternal",
46052 xmlMemBlocks() - mem_base);
46053 test_ret++;
46054 printf(" %d", n_ctxt);
46055 printf("\n");
46056 }
46057 }
46058#endif
46059
46060 function_tests++;
46061 return(test_ret);
46062}
46063
46064
46065static int
46066test_xmlXPathPopNodeSet(void) {
46067 int test_ret = 0;
46068
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046069#ifdef LIBXML_XPATH_ENABLED
46070 int mem_base;
46071 xmlNodeSetPtr ret_val;
46072 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46073 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046074
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046075 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46076 mem_base = xmlMemBlocks();
46077 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46078
46079 ret_val = xmlXPathPopNodeSet(ctxt);
46080 desret_xmlNodeSetPtr(ret_val);
46081 call_tests++;
46082 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46083 xmlResetLastError();
46084 if (mem_base != xmlMemBlocks()) {
46085 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
46086 xmlMemBlocks() - mem_base);
46087 test_ret++;
46088 printf(" %d", n_ctxt);
46089 printf("\n");
46090 }
46091 }
46092#endif
46093
46094 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046095 return(test_ret);
46096}
46097
46098
46099static int
46100test_xmlXPathPopNumber(void) {
46101 int test_ret = 0;
46102
46103#ifdef LIBXML_XPATH_ENABLED
46104 int mem_base;
46105 double ret_val;
46106 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46107 int n_ctxt;
46108
46109 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46110 mem_base = xmlMemBlocks();
46111 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46112
46113 ret_val = xmlXPathPopNumber(ctxt);
46114 desret_double(ret_val);
46115 call_tests++;
46116 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46117 xmlResetLastError();
46118 if (mem_base != xmlMemBlocks()) {
46119 printf("Leak of %d blocks found in xmlXPathPopNumber",
46120 xmlMemBlocks() - mem_base);
46121 test_ret++;
46122 printf(" %d", n_ctxt);
46123 printf("\n");
46124 }
46125 }
46126#endif
46127
46128 function_tests++;
46129 return(test_ret);
46130}
46131
46132
46133static int
46134test_xmlXPathPopString(void) {
46135 int test_ret = 0;
46136
46137#ifdef LIBXML_XPATH_ENABLED
46138 int mem_base;
46139 xmlChar * ret_val;
46140 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46141 int n_ctxt;
46142
46143 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46144 mem_base = xmlMemBlocks();
46145 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46146
46147 ret_val = xmlXPathPopString(ctxt);
46148 desret_xmlChar_ptr(ret_val);
46149 call_tests++;
46150 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46151 xmlResetLastError();
46152 if (mem_base != xmlMemBlocks()) {
46153 printf("Leak of %d blocks found in xmlXPathPopString",
46154 xmlMemBlocks() - mem_base);
46155 test_ret++;
46156 printf(" %d", n_ctxt);
46157 printf("\n");
46158 }
46159 }
46160#endif
46161
46162 function_tests++;
46163 return(test_ret);
46164}
46165
46166
46167static int
46168test_xmlXPathPositionFunction(void) {
46169 int test_ret = 0;
46170
46171#ifdef LIBXML_XPATH_ENABLED
46172 int mem_base;
46173 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46174 int n_ctxt;
46175 int nargs; /* the number of arguments */
46176 int n_nargs;
46177
46178 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46179 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46180 mem_base = xmlMemBlocks();
46181 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46182 nargs = gen_int(n_nargs, 1);
46183
46184 xmlXPathPositionFunction(ctxt, nargs);
46185 call_tests++;
46186 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46187 des_int(n_nargs, nargs, 1);
46188 xmlResetLastError();
46189 if (mem_base != xmlMemBlocks()) {
46190 printf("Leak of %d blocks found in xmlXPathPositionFunction",
46191 xmlMemBlocks() - mem_base);
46192 test_ret++;
46193 printf(" %d", n_ctxt);
46194 printf(" %d", n_nargs);
46195 printf("\n");
46196 }
46197 }
46198 }
46199#endif
46200
46201 function_tests++;
46202 return(test_ret);
46203}
46204
46205
46206static int
46207test_xmlXPathRegisterAllFunctions(void) {
46208 int test_ret = 0;
46209
46210#ifdef LIBXML_XPATH_ENABLED
46211 int mem_base;
46212 xmlXPathContextPtr ctxt; /* the XPath context */
46213 int n_ctxt;
46214
46215 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46216 mem_base = xmlMemBlocks();
46217 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46218
46219 xmlXPathRegisterAllFunctions(ctxt);
46220 call_tests++;
46221 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46222 xmlResetLastError();
46223 if (mem_base != xmlMemBlocks()) {
46224 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
46225 xmlMemBlocks() - mem_base);
46226 test_ret++;
46227 printf(" %d", n_ctxt);
46228 printf("\n");
46229 }
46230 }
46231#endif
46232
46233 function_tests++;
46234 return(test_ret);
46235}
46236
46237
46238static int
46239test_xmlXPathRegisterFunc(void) {
46240 int test_ret = 0;
46241
46242
46243 /* missing type support */
46244 return(test_ret);
46245}
46246
46247
46248static int
46249test_xmlXPathRegisterFuncLookup(void) {
46250 int test_ret = 0;
46251
46252
46253 /* missing type support */
46254 return(test_ret);
46255}
46256
46257
46258static int
46259test_xmlXPathRegisterFuncNS(void) {
46260 int test_ret = 0;
46261
46262
46263 /* missing type support */
46264 return(test_ret);
46265}
46266
46267
46268static int
46269test_xmlXPathRegisterNs(void) {
46270 int test_ret = 0;
46271
46272#ifdef LIBXML_XPATH_ENABLED
46273 int mem_base;
46274 int ret_val;
46275 xmlXPathContextPtr ctxt; /* the XPath context */
46276 int n_ctxt;
46277 xmlChar * prefix; /* the namespace prefix */
46278 int n_prefix;
46279 xmlChar * ns_uri; /* the namespace name */
46280 int n_ns_uri;
46281
46282 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46283 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46284 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46285 mem_base = xmlMemBlocks();
46286 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46287 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46288 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46289
46290 ret_val = xmlXPathRegisterNs(ctxt, prefix, ns_uri);
46291 desret_int(ret_val);
46292 call_tests++;
46293 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46294 des_const_xmlChar_ptr(n_prefix, prefix, 1);
46295 des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2);
46296 xmlResetLastError();
46297 if (mem_base != xmlMemBlocks()) {
46298 printf("Leak of %d blocks found in xmlXPathRegisterNs",
46299 xmlMemBlocks() - mem_base);
46300 test_ret++;
46301 printf(" %d", n_ctxt);
46302 printf(" %d", n_prefix);
46303 printf(" %d", n_ns_uri);
46304 printf("\n");
46305 }
46306 }
46307 }
46308 }
46309#endif
46310
46311 function_tests++;
46312 return(test_ret);
46313}
46314
46315
46316static int
46317test_xmlXPathRegisterVariable(void) {
46318 int test_ret = 0;
46319
46320#ifdef LIBXML_XPATH_ENABLED
46321 int mem_base;
46322 int ret_val;
46323 xmlXPathContextPtr ctxt; /* the XPath context */
46324 int n_ctxt;
46325 xmlChar * name; /* the variable name */
46326 int n_name;
46327 xmlXPathObjectPtr value; /* the variable value or NULL */
46328 int n_value;
46329
46330 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46331 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46332 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46333 mem_base = xmlMemBlocks();
46334 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46335 name = gen_const_xmlChar_ptr(n_name, 1);
46336 value = gen_xmlXPathObjectPtr(n_value, 2);
46337
46338 ret_val = xmlXPathRegisterVariable(ctxt, name, value);
46339 desret_int(ret_val);
46340 call_tests++;
46341 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46342 des_const_xmlChar_ptr(n_name, name, 1);
46343 des_xmlXPathObjectPtr(n_value, value, 2);
46344 xmlResetLastError();
46345 if (mem_base != xmlMemBlocks()) {
46346 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
46347 xmlMemBlocks() - mem_base);
46348 test_ret++;
46349 printf(" %d", n_ctxt);
46350 printf(" %d", n_name);
46351 printf(" %d", n_value);
46352 printf("\n");
46353 }
46354 }
46355 }
46356 }
46357#endif
46358
46359 function_tests++;
46360 return(test_ret);
46361}
46362
46363
46364static int
46365test_xmlXPathRegisterVariableLookup(void) {
46366 int test_ret = 0;
46367
46368
46369 /* missing type support */
46370 return(test_ret);
46371}
46372
46373
46374static int
46375test_xmlXPathRegisterVariableNS(void) {
46376 int test_ret = 0;
46377
46378#ifdef LIBXML_XPATH_ENABLED
46379 int mem_base;
46380 int ret_val;
46381 xmlXPathContextPtr ctxt; /* the XPath context */
46382 int n_ctxt;
46383 xmlChar * name; /* the variable name */
46384 int n_name;
46385 xmlChar * ns_uri; /* the variable namespace URI */
46386 int n_ns_uri;
46387 xmlXPathObjectPtr value; /* the variable value or NULL */
46388 int n_value;
46389
46390 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46391 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46392 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46393 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46394 mem_base = xmlMemBlocks();
46395 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46396 name = gen_const_xmlChar_ptr(n_name, 1);
46397 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46398 value = gen_xmlXPathObjectPtr(n_value, 3);
46399
46400 ret_val = xmlXPathRegisterVariableNS(ctxt, name, ns_uri, value);
46401 desret_int(ret_val);
46402 call_tests++;
46403 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46404 des_const_xmlChar_ptr(n_name, name, 1);
46405 des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2);
46406 des_xmlXPathObjectPtr(n_value, value, 3);
46407 xmlResetLastError();
46408 if (mem_base != xmlMemBlocks()) {
46409 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
46410 xmlMemBlocks() - mem_base);
46411 test_ret++;
46412 printf(" %d", n_ctxt);
46413 printf(" %d", n_name);
46414 printf(" %d", n_ns_uri);
46415 printf(" %d", n_value);
46416 printf("\n");
46417 }
46418 }
46419 }
46420 }
46421 }
46422#endif
46423
46424 function_tests++;
46425 return(test_ret);
46426}
46427
46428
46429static int
46430test_xmlXPathRegisteredFuncsCleanup(void) {
46431 int test_ret = 0;
46432
46433#ifdef LIBXML_XPATH_ENABLED
46434 int mem_base;
46435 xmlXPathContextPtr ctxt; /* the XPath context */
46436 int n_ctxt;
46437
46438 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46439 mem_base = xmlMemBlocks();
46440 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46441
46442 xmlXPathRegisteredFuncsCleanup(ctxt);
46443 call_tests++;
46444 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46445 xmlResetLastError();
46446 if (mem_base != xmlMemBlocks()) {
46447 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
46448 xmlMemBlocks() - mem_base);
46449 test_ret++;
46450 printf(" %d", n_ctxt);
46451 printf("\n");
46452 }
46453 }
46454#endif
46455
46456 function_tests++;
46457 return(test_ret);
46458}
46459
46460
46461static int
46462test_xmlXPathRegisteredNsCleanup(void) {
46463 int test_ret = 0;
46464
46465#ifdef LIBXML_XPATH_ENABLED
46466 int mem_base;
46467 xmlXPathContextPtr ctxt; /* the XPath context */
46468 int n_ctxt;
46469
46470 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46471 mem_base = xmlMemBlocks();
46472 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46473
46474 xmlXPathRegisteredNsCleanup(ctxt);
46475 call_tests++;
46476 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46477 xmlResetLastError();
46478 if (mem_base != xmlMemBlocks()) {
46479 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
46480 xmlMemBlocks() - mem_base);
46481 test_ret++;
46482 printf(" %d", n_ctxt);
46483 printf("\n");
46484 }
46485 }
46486#endif
46487
46488 function_tests++;
46489 return(test_ret);
46490}
46491
46492
46493static int
46494test_xmlXPathRegisteredVariablesCleanup(void) {
46495 int test_ret = 0;
46496
46497#ifdef LIBXML_XPATH_ENABLED
46498 int mem_base;
46499 xmlXPathContextPtr ctxt; /* the XPath context */
46500 int n_ctxt;
46501
46502 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46503 mem_base = xmlMemBlocks();
46504 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46505
46506 xmlXPathRegisteredVariablesCleanup(ctxt);
46507 call_tests++;
46508 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46509 xmlResetLastError();
46510 if (mem_base != xmlMemBlocks()) {
46511 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
46512 xmlMemBlocks() - mem_base);
46513 test_ret++;
46514 printf(" %d", n_ctxt);
46515 printf("\n");
46516 }
46517 }
46518#endif
46519
46520 function_tests++;
46521 return(test_ret);
46522}
46523
46524
46525static int
46526test_xmlXPathRoot(void) {
46527 int test_ret = 0;
46528
46529#ifdef LIBXML_XPATH_ENABLED
46530 int mem_base;
46531 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46532 int n_ctxt;
46533
46534 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46535 mem_base = xmlMemBlocks();
46536 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46537
46538 xmlXPathRoot(ctxt);
46539 call_tests++;
46540 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46541 xmlResetLastError();
46542 if (mem_base != xmlMemBlocks()) {
46543 printf("Leak of %d blocks found in xmlXPathRoot",
46544 xmlMemBlocks() - mem_base);
46545 test_ret++;
46546 printf(" %d", n_ctxt);
46547 printf("\n");
46548 }
46549 }
46550#endif
46551
46552 function_tests++;
46553 return(test_ret);
46554}
46555
46556
46557static int
46558test_xmlXPathRoundFunction(void) {
46559 int test_ret = 0;
46560
46561#ifdef LIBXML_XPATH_ENABLED
46562 int mem_base;
46563 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46564 int n_ctxt;
46565 int nargs; /* the number of arguments */
46566 int n_nargs;
46567
46568 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46569 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46570 mem_base = xmlMemBlocks();
46571 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46572 nargs = gen_int(n_nargs, 1);
46573
46574 xmlXPathRoundFunction(ctxt, nargs);
46575 call_tests++;
46576 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46577 des_int(n_nargs, nargs, 1);
46578 xmlResetLastError();
46579 if (mem_base != xmlMemBlocks()) {
46580 printf("Leak of %d blocks found in xmlXPathRoundFunction",
46581 xmlMemBlocks() - mem_base);
46582 test_ret++;
46583 printf(" %d", n_ctxt);
46584 printf(" %d", n_nargs);
46585 printf("\n");
46586 }
46587 }
46588 }
46589#endif
46590
46591 function_tests++;
46592 return(test_ret);
46593}
46594
46595
46596static int
46597test_xmlXPathStartsWithFunction(void) {
46598 int test_ret = 0;
46599
46600#ifdef LIBXML_XPATH_ENABLED
46601 int mem_base;
46602 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46603 int n_ctxt;
46604 int nargs; /* the number of arguments */
46605 int n_nargs;
46606
46607 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46608 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46609 mem_base = xmlMemBlocks();
46610 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46611 nargs = gen_int(n_nargs, 1);
46612
46613 xmlXPathStartsWithFunction(ctxt, nargs);
46614 call_tests++;
46615 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46616 des_int(n_nargs, nargs, 1);
46617 xmlResetLastError();
46618 if (mem_base != xmlMemBlocks()) {
46619 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
46620 xmlMemBlocks() - mem_base);
46621 test_ret++;
46622 printf(" %d", n_ctxt);
46623 printf(" %d", n_nargs);
46624 printf("\n");
46625 }
46626 }
46627 }
46628#endif
46629
46630 function_tests++;
46631 return(test_ret);
46632}
46633
46634
46635static int
46636test_xmlXPathStringEvalNumber(void) {
46637 int test_ret = 0;
46638
46639#ifdef LIBXML_XPATH_ENABLED
46640 int mem_base;
46641 double ret_val;
46642 xmlChar * str; /* A string to scan */
46643 int n_str;
46644
46645 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
46646 mem_base = xmlMemBlocks();
46647 str = gen_const_xmlChar_ptr(n_str, 0);
46648
46649 ret_val = xmlXPathStringEvalNumber(str);
46650 desret_double(ret_val);
46651 call_tests++;
46652 des_const_xmlChar_ptr(n_str, str, 0);
46653 xmlResetLastError();
46654 if (mem_base != xmlMemBlocks()) {
46655 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
46656 xmlMemBlocks() - mem_base);
46657 test_ret++;
46658 printf(" %d", n_str);
46659 printf("\n");
46660 }
46661 }
46662#endif
46663
46664 function_tests++;
46665 return(test_ret);
46666}
46667
46668
46669static int
46670test_xmlXPathStringFunction(void) {
46671 int test_ret = 0;
46672
46673#ifdef LIBXML_XPATH_ENABLED
46674 int mem_base;
46675 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46676 int n_ctxt;
46677 int nargs; /* the number of arguments */
46678 int n_nargs;
46679
46680 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46681 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46682 mem_base = xmlMemBlocks();
46683 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46684 nargs = gen_int(n_nargs, 1);
46685
46686 xmlXPathStringFunction(ctxt, nargs);
46687 call_tests++;
46688 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46689 des_int(n_nargs, nargs, 1);
46690 xmlResetLastError();
46691 if (mem_base != xmlMemBlocks()) {
46692 printf("Leak of %d blocks found in xmlXPathStringFunction",
46693 xmlMemBlocks() - mem_base);
46694 test_ret++;
46695 printf(" %d", n_ctxt);
46696 printf(" %d", n_nargs);
46697 printf("\n");
46698 }
46699 }
46700 }
46701#endif
46702
46703 function_tests++;
46704 return(test_ret);
46705}
46706
46707
46708static int
46709test_xmlXPathStringLengthFunction(void) {
46710 int test_ret = 0;
46711
46712#ifdef LIBXML_XPATH_ENABLED
46713 int mem_base;
46714 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46715 int n_ctxt;
46716 int nargs; /* the number of arguments */
46717 int n_nargs;
46718
46719 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46720 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46721 mem_base = xmlMemBlocks();
46722 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46723 nargs = gen_int(n_nargs, 1);
46724
46725 xmlXPathStringLengthFunction(ctxt, nargs);
46726 call_tests++;
46727 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46728 des_int(n_nargs, nargs, 1);
46729 xmlResetLastError();
46730 if (mem_base != xmlMemBlocks()) {
46731 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
46732 xmlMemBlocks() - mem_base);
46733 test_ret++;
46734 printf(" %d", n_ctxt);
46735 printf(" %d", n_nargs);
46736 printf("\n");
46737 }
46738 }
46739 }
46740#endif
46741
46742 function_tests++;
46743 return(test_ret);
46744}
46745
46746
46747static int
46748test_xmlXPathSubValues(void) {
46749 int test_ret = 0;
46750
46751#ifdef LIBXML_XPATH_ENABLED
46752 int mem_base;
46753 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46754 int n_ctxt;
46755
46756 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46757 mem_base = xmlMemBlocks();
46758 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46759
46760 xmlXPathSubValues(ctxt);
46761 call_tests++;
46762 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46763 xmlResetLastError();
46764 if (mem_base != xmlMemBlocks()) {
46765 printf("Leak of %d blocks found in xmlXPathSubValues",
46766 xmlMemBlocks() - mem_base);
46767 test_ret++;
46768 printf(" %d", n_ctxt);
46769 printf("\n");
46770 }
46771 }
46772#endif
46773
46774 function_tests++;
46775 return(test_ret);
46776}
46777
46778
46779static int
46780test_xmlXPathSubstringAfterFunction(void) {
46781 int test_ret = 0;
46782
46783#ifdef LIBXML_XPATH_ENABLED
46784 int mem_base;
46785 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46786 int n_ctxt;
46787 int nargs; /* the number of arguments */
46788 int n_nargs;
46789
46790 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46791 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46792 mem_base = xmlMemBlocks();
46793 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46794 nargs = gen_int(n_nargs, 1);
46795
46796 xmlXPathSubstringAfterFunction(ctxt, nargs);
46797 call_tests++;
46798 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46799 des_int(n_nargs, nargs, 1);
46800 xmlResetLastError();
46801 if (mem_base != xmlMemBlocks()) {
46802 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
46803 xmlMemBlocks() - mem_base);
46804 test_ret++;
46805 printf(" %d", n_ctxt);
46806 printf(" %d", n_nargs);
46807 printf("\n");
46808 }
46809 }
46810 }
46811#endif
46812
46813 function_tests++;
46814 return(test_ret);
46815}
46816
46817
46818static int
46819test_xmlXPathSubstringBeforeFunction(void) {
46820 int test_ret = 0;
46821
46822#ifdef LIBXML_XPATH_ENABLED
46823 int mem_base;
46824 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46825 int n_ctxt;
46826 int nargs; /* the number of arguments */
46827 int n_nargs;
46828
46829 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46830 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46831 mem_base = xmlMemBlocks();
46832 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46833 nargs = gen_int(n_nargs, 1);
46834
46835 xmlXPathSubstringBeforeFunction(ctxt, nargs);
46836 call_tests++;
46837 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46838 des_int(n_nargs, nargs, 1);
46839 xmlResetLastError();
46840 if (mem_base != xmlMemBlocks()) {
46841 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
46842 xmlMemBlocks() - mem_base);
46843 test_ret++;
46844 printf(" %d", n_ctxt);
46845 printf(" %d", n_nargs);
46846 printf("\n");
46847 }
46848 }
46849 }
46850#endif
46851
46852 function_tests++;
46853 return(test_ret);
46854}
46855
46856
46857static int
46858test_xmlXPathSubstringFunction(void) {
46859 int test_ret = 0;
46860
46861#ifdef LIBXML_XPATH_ENABLED
46862 int mem_base;
46863 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46864 int n_ctxt;
46865 int nargs; /* the number of arguments */
46866 int n_nargs;
46867
46868 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46869 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46870 mem_base = xmlMemBlocks();
46871 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46872 nargs = gen_int(n_nargs, 1);
46873
46874 xmlXPathSubstringFunction(ctxt, nargs);
46875 call_tests++;
46876 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46877 des_int(n_nargs, nargs, 1);
46878 xmlResetLastError();
46879 if (mem_base != xmlMemBlocks()) {
46880 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
46881 xmlMemBlocks() - mem_base);
46882 test_ret++;
46883 printf(" %d", n_ctxt);
46884 printf(" %d", n_nargs);
46885 printf("\n");
46886 }
46887 }
46888 }
46889#endif
46890
46891 function_tests++;
46892 return(test_ret);
46893}
46894
46895
46896static int
46897test_xmlXPathSumFunction(void) {
46898 int test_ret = 0;
46899
46900#ifdef LIBXML_XPATH_ENABLED
46901 int mem_base;
46902 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46903 int n_ctxt;
46904 int nargs; /* the number of arguments */
46905 int n_nargs;
46906
46907 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46908 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46909 mem_base = xmlMemBlocks();
46910 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46911 nargs = gen_int(n_nargs, 1);
46912
46913 xmlXPathSumFunction(ctxt, nargs);
46914 call_tests++;
46915 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46916 des_int(n_nargs, nargs, 1);
46917 xmlResetLastError();
46918 if (mem_base != xmlMemBlocks()) {
46919 printf("Leak of %d blocks found in xmlXPathSumFunction",
46920 xmlMemBlocks() - mem_base);
46921 test_ret++;
46922 printf(" %d", n_ctxt);
46923 printf(" %d", n_nargs);
46924 printf("\n");
46925 }
46926 }
46927 }
46928#endif
46929
46930 function_tests++;
46931 return(test_ret);
46932}
46933
46934
46935static int
46936test_xmlXPathTrailing(void) {
46937 int test_ret = 0;
46938
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046939#ifdef LIBXML_XPATH_ENABLED
46940 int mem_base;
46941 xmlNodeSetPtr ret_val;
46942 xmlNodeSetPtr nodes1; /* a node-set */
46943 int n_nodes1;
46944 xmlNodeSetPtr nodes2; /* a node-set */
46945 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046946
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046947 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
46948 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
46949 mem_base = xmlMemBlocks();
46950 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
46951 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
46952
46953 ret_val = xmlXPathTrailing(nodes1, nodes2);
46954 desret_xmlNodeSetPtr(ret_val);
46955 call_tests++;
46956 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
46957 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
46958 xmlResetLastError();
46959 if (mem_base != xmlMemBlocks()) {
46960 printf("Leak of %d blocks found in xmlXPathTrailing",
46961 xmlMemBlocks() - mem_base);
46962 test_ret++;
46963 printf(" %d", n_nodes1);
46964 printf(" %d", n_nodes2);
46965 printf("\n");
46966 }
46967 }
46968 }
46969#endif
46970
46971 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046972 return(test_ret);
46973}
46974
46975
46976static int
46977test_xmlXPathTrailingSorted(void) {
46978 int test_ret = 0;
46979
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046980#ifdef LIBXML_XPATH_ENABLED
46981 int mem_base;
46982 xmlNodeSetPtr ret_val;
46983 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
46984 int n_nodes1;
46985 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
46986 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046987
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046988 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
46989 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
46990 mem_base = xmlMemBlocks();
46991 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
46992 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
46993
46994 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
46995 desret_xmlNodeSetPtr(ret_val);
46996 call_tests++;
46997 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
46998 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
46999 xmlResetLastError();
47000 if (mem_base != xmlMemBlocks()) {
47001 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
47002 xmlMemBlocks() - mem_base);
47003 test_ret++;
47004 printf(" %d", n_nodes1);
47005 printf(" %d", n_nodes2);
47006 printf("\n");
47007 }
47008 }
47009 }
47010#endif
47011
47012 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047013 return(test_ret);
47014}
47015
47016
47017static int
47018test_xmlXPathTranslateFunction(void) {
47019 int test_ret = 0;
47020
47021#ifdef LIBXML_XPATH_ENABLED
47022 int mem_base;
47023 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47024 int n_ctxt;
47025 int nargs; /* the number of arguments */
47026 int n_nargs;
47027
47028 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47029 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47030 mem_base = xmlMemBlocks();
47031 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47032 nargs = gen_int(n_nargs, 1);
47033
47034 xmlXPathTranslateFunction(ctxt, nargs);
47035 call_tests++;
47036 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47037 des_int(n_nargs, nargs, 1);
47038 xmlResetLastError();
47039 if (mem_base != xmlMemBlocks()) {
47040 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
47041 xmlMemBlocks() - mem_base);
47042 test_ret++;
47043 printf(" %d", n_ctxt);
47044 printf(" %d", n_nargs);
47045 printf("\n");
47046 }
47047 }
47048 }
47049#endif
47050
47051 function_tests++;
47052 return(test_ret);
47053}
47054
47055
47056static int
47057test_xmlXPathTrueFunction(void) {
47058 int test_ret = 0;
47059
47060#ifdef LIBXML_XPATH_ENABLED
47061 int mem_base;
47062 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47063 int n_ctxt;
47064 int nargs; /* the number of arguments */
47065 int n_nargs;
47066
47067 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47068 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47069 mem_base = xmlMemBlocks();
47070 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47071 nargs = gen_int(n_nargs, 1);
47072
47073 xmlXPathTrueFunction(ctxt, nargs);
47074 call_tests++;
47075 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47076 des_int(n_nargs, nargs, 1);
47077 xmlResetLastError();
47078 if (mem_base != xmlMemBlocks()) {
47079 printf("Leak of %d blocks found in xmlXPathTrueFunction",
47080 xmlMemBlocks() - mem_base);
47081 test_ret++;
47082 printf(" %d", n_ctxt);
47083 printf(" %d", n_nargs);
47084 printf("\n");
47085 }
47086 }
47087 }
47088#endif
47089
47090 function_tests++;
47091 return(test_ret);
47092}
47093
47094
47095static int
47096test_xmlXPathValueFlipSign(void) {
47097 int test_ret = 0;
47098
47099#ifdef LIBXML_XPATH_ENABLED
47100 int mem_base;
47101 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47102 int n_ctxt;
47103
47104 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47105 mem_base = xmlMemBlocks();
47106 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47107
47108 xmlXPathValueFlipSign(ctxt);
47109 call_tests++;
47110 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47111 xmlResetLastError();
47112 if (mem_base != xmlMemBlocks()) {
47113 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
47114 xmlMemBlocks() - mem_base);
47115 test_ret++;
47116 printf(" %d", n_ctxt);
47117 printf("\n");
47118 }
47119 }
47120#endif
47121
47122 function_tests++;
47123 return(test_ret);
47124}
47125
47126
47127static int
47128test_xmlXPathVariableLookup(void) {
47129 int test_ret = 0;
47130
47131#ifdef LIBXML_XPATH_ENABLED
47132 int mem_base;
47133 xmlXPathObjectPtr ret_val;
47134 xmlXPathContextPtr ctxt; /* the XPath context */
47135 int n_ctxt;
47136 xmlChar * name; /* the variable name */
47137 int n_name;
47138
47139 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47140 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47141 mem_base = xmlMemBlocks();
47142 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47143 name = gen_const_xmlChar_ptr(n_name, 1);
47144
47145 ret_val = xmlXPathVariableLookup(ctxt, name);
47146 desret_xmlXPathObjectPtr(ret_val);
47147 call_tests++;
47148 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47149 des_const_xmlChar_ptr(n_name, name, 1);
47150 xmlResetLastError();
47151 if (mem_base != xmlMemBlocks()) {
47152 printf("Leak of %d blocks found in xmlXPathVariableLookup",
47153 xmlMemBlocks() - mem_base);
47154 test_ret++;
47155 printf(" %d", n_ctxt);
47156 printf(" %d", n_name);
47157 printf("\n");
47158 }
47159 }
47160 }
47161#endif
47162
47163 function_tests++;
47164 return(test_ret);
47165}
47166
47167
47168static int
47169test_xmlXPathVariableLookupNS(void) {
47170 int test_ret = 0;
47171
47172#ifdef LIBXML_XPATH_ENABLED
47173 int mem_base;
47174 xmlXPathObjectPtr ret_val;
47175 xmlXPathContextPtr ctxt; /* the XPath context */
47176 int n_ctxt;
47177 xmlChar * name; /* the variable name */
47178 int n_name;
47179 xmlChar * ns_uri; /* the variable namespace URI */
47180 int n_ns_uri;
47181
47182 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47183 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47184 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47185 mem_base = xmlMemBlocks();
47186 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47187 name = gen_const_xmlChar_ptr(n_name, 1);
47188 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47189
47190 ret_val = xmlXPathVariableLookupNS(ctxt, name, ns_uri);
47191 desret_xmlXPathObjectPtr(ret_val);
47192 call_tests++;
47193 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47194 des_const_xmlChar_ptr(n_name, name, 1);
47195 des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2);
47196 xmlResetLastError();
47197 if (mem_base != xmlMemBlocks()) {
47198 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
47199 xmlMemBlocks() - mem_base);
47200 test_ret++;
47201 printf(" %d", n_ctxt);
47202 printf(" %d", n_name);
47203 printf(" %d", n_ns_uri);
47204 printf("\n");
47205 }
47206 }
47207 }
47208 }
47209#endif
47210
47211 function_tests++;
47212 return(test_ret);
47213}
47214
47215
47216static int
47217test_xmlXPathWrapCString(void) {
47218 int test_ret = 0;
47219
47220#ifdef LIBXML_XPATH_ENABLED
47221 int mem_base;
47222 xmlXPathObjectPtr ret_val;
47223 char * val; /* the char * value */
47224 int n_val;
47225
47226 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
47227 mem_base = xmlMemBlocks();
47228 val = gen_char_ptr(n_val, 0);
47229
47230 ret_val = xmlXPathWrapCString(val);
47231 desret_xmlXPathObjectPtr(ret_val);
47232 call_tests++;
47233 des_char_ptr(n_val, val, 0);
47234 xmlResetLastError();
47235 if (mem_base != xmlMemBlocks()) {
47236 printf("Leak of %d blocks found in xmlXPathWrapCString",
47237 xmlMemBlocks() - mem_base);
47238 test_ret++;
47239 printf(" %d", n_val);
47240 printf("\n");
47241 }
47242 }
47243#endif
47244
47245 function_tests++;
47246 return(test_ret);
47247}
47248
47249
47250static int
47251test_xmlXPathWrapExternal(void) {
47252 int test_ret = 0;
47253
47254#ifdef LIBXML_XPATH_ENABLED
47255 int mem_base;
47256 xmlXPathObjectPtr ret_val;
47257 void * val; /* the user data */
47258 int n_val;
47259
47260 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
47261 mem_base = xmlMemBlocks();
47262 val = gen_void_ptr(n_val, 0);
47263
47264 ret_val = xmlXPathWrapExternal(val);
47265 desret_xmlXPathObjectPtr(ret_val);
47266 call_tests++;
47267 des_void_ptr(n_val, val, 0);
47268 xmlResetLastError();
47269 if (mem_base != xmlMemBlocks()) {
47270 printf("Leak of %d blocks found in xmlXPathWrapExternal",
47271 xmlMemBlocks() - mem_base);
47272 test_ret++;
47273 printf(" %d", n_val);
47274 printf("\n");
47275 }
47276 }
47277#endif
47278
47279 function_tests++;
47280 return(test_ret);
47281}
47282
47283
47284static int
47285test_xmlXPathWrapNodeSet(void) {
47286 int test_ret = 0;
47287
47288#ifdef LIBXML_XPATH_ENABLED
47289 int mem_base;
47290 xmlXPathObjectPtr ret_val;
47291 xmlNodeSetPtr val; /* the NodePtr value */
47292 int n_val;
47293
47294 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
47295 mem_base = xmlMemBlocks();
47296 val = gen_xmlNodeSetPtr(n_val, 0);
47297
47298 ret_val = xmlXPathWrapNodeSet(val);
47299 desret_xmlXPathObjectPtr(ret_val);
47300 call_tests++;
47301 des_xmlNodeSetPtr(n_val, val, 0);
47302 xmlResetLastError();
47303 if (mem_base != xmlMemBlocks()) {
47304 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
47305 xmlMemBlocks() - mem_base);
47306 test_ret++;
47307 printf(" %d", n_val);
47308 printf("\n");
47309 }
47310 }
47311#endif
47312
47313 function_tests++;
47314 return(test_ret);
47315}
47316
47317
47318static int
47319test_xmlXPatherror(void) {
47320 int test_ret = 0;
47321
47322#ifdef LIBXML_XPATH_ENABLED
47323 int mem_base;
47324 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47325 int n_ctxt;
47326 const char * file; /* the file name */
47327 int n_file;
47328 int line; /* the line number */
47329 int n_line;
47330 int no; /* the error number */
47331 int n_no;
47332
47333 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47334 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
47335 for (n_line = 0;n_line < gen_nb_int;n_line++) {
47336 for (n_no = 0;n_no < gen_nb_int;n_no++) {
47337 mem_base = xmlMemBlocks();
47338 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47339 file = gen_filepath(n_file, 1);
47340 line = gen_int(n_line, 2);
47341 no = gen_int(n_no, 3);
47342
47343 xmlXPatherror(ctxt, file, line, no);
47344 call_tests++;
47345 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47346 des_filepath(n_file, file, 1);
47347 des_int(n_line, line, 2);
47348 des_int(n_no, no, 3);
47349 xmlResetLastError();
47350 if (mem_base != xmlMemBlocks()) {
47351 printf("Leak of %d blocks found in xmlXPatherror",
47352 xmlMemBlocks() - mem_base);
47353 test_ret++;
47354 printf(" %d", n_ctxt);
47355 printf(" %d", n_file);
47356 printf(" %d", n_line);
47357 printf(" %d", n_no);
47358 printf("\n");
47359 }
47360 }
47361 }
47362 }
47363 }
47364#endif
47365
47366 function_tests++;
47367 return(test_ret);
47368}
47369
47370static int
47371test_xpathInternals(void) {
47372 int test_ret = 0;
47373
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047374 printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000047375 test_ret += test_valuePop();
47376 test_ret += test_valuePush();
47377 test_ret += test_xmlXPathAddValues();
47378 test_ret += test_xmlXPathBooleanFunction();
47379 test_ret += test_xmlXPathCeilingFunction();
47380 test_ret += test_xmlXPathCompareValues();
47381 test_ret += test_xmlXPathConcatFunction();
47382 test_ret += test_xmlXPathContainsFunction();
47383 test_ret += test_xmlXPathCountFunction();
47384 test_ret += test_xmlXPathDebugDumpCompExpr();
47385 test_ret += test_xmlXPathDebugDumpObject();
47386 test_ret += test_xmlXPathDifference();
47387 test_ret += test_xmlXPathDistinct();
47388 test_ret += test_xmlXPathDistinctSorted();
47389 test_ret += test_xmlXPathDivValues();
47390 test_ret += test_xmlXPathEqualValues();
47391 test_ret += test_xmlXPathErr();
47392 test_ret += test_xmlXPathEvalExpr();
47393 test_ret += test_xmlXPathEvaluatePredicateResult();
47394 test_ret += test_xmlXPathFalseFunction();
47395 test_ret += test_xmlXPathFloorFunction();
47396 test_ret += test_xmlXPathFunctionLookup();
47397 test_ret += test_xmlXPathFunctionLookupNS();
47398 test_ret += test_xmlXPathHasSameNodes();
47399 test_ret += test_xmlXPathIdFunction();
47400 test_ret += test_xmlXPathIntersection();
47401 test_ret += test_xmlXPathIsNodeType();
47402 test_ret += test_xmlXPathLangFunction();
47403 test_ret += test_xmlXPathLastFunction();
47404 test_ret += test_xmlXPathLeading();
47405 test_ret += test_xmlXPathLeadingSorted();
47406 test_ret += test_xmlXPathLocalNameFunction();
47407 test_ret += test_xmlXPathModValues();
47408 test_ret += test_xmlXPathMultValues();
47409 test_ret += test_xmlXPathNamespaceURIFunction();
47410 test_ret += test_xmlXPathNewBoolean();
47411 test_ret += test_xmlXPathNewCString();
47412 test_ret += test_xmlXPathNewFloat();
47413 test_ret += test_xmlXPathNewNodeSet();
47414 test_ret += test_xmlXPathNewNodeSetList();
47415 test_ret += test_xmlXPathNewParserContext();
47416 test_ret += test_xmlXPathNewString();
47417 test_ret += test_xmlXPathNextAncestor();
47418 test_ret += test_xmlXPathNextAncestorOrSelf();
47419 test_ret += test_xmlXPathNextAttribute();
47420 test_ret += test_xmlXPathNextChild();
47421 test_ret += test_xmlXPathNextDescendant();
47422 test_ret += test_xmlXPathNextDescendantOrSelf();
47423 test_ret += test_xmlXPathNextFollowing();
47424 test_ret += test_xmlXPathNextFollowingSibling();
47425 test_ret += test_xmlXPathNextNamespace();
47426 test_ret += test_xmlXPathNextParent();
47427 test_ret += test_xmlXPathNextPreceding();
47428 test_ret += test_xmlXPathNextPrecedingSibling();
47429 test_ret += test_xmlXPathNextSelf();
47430 test_ret += test_xmlXPathNodeLeading();
47431 test_ret += test_xmlXPathNodeLeadingSorted();
47432 test_ret += test_xmlXPathNodeSetAdd();
47433 test_ret += test_xmlXPathNodeSetAddNs();
47434 test_ret += test_xmlXPathNodeSetAddUnique();
47435 test_ret += test_xmlXPathNodeSetContains();
47436 test_ret += test_xmlXPathNodeSetDel();
47437 test_ret += test_xmlXPathNodeSetMerge();
47438 test_ret += test_xmlXPathNodeSetRemove();
47439 test_ret += test_xmlXPathNodeSetSort();
47440 test_ret += test_xmlXPathNodeTrailing();
47441 test_ret += test_xmlXPathNodeTrailingSorted();
47442 test_ret += test_xmlXPathNormalizeFunction();
47443 test_ret += test_xmlXPathNotEqualValues();
47444 test_ret += test_xmlXPathNotFunction();
47445 test_ret += test_xmlXPathNsLookup();
47446 test_ret += test_xmlXPathNumberFunction();
47447 test_ret += test_xmlXPathParseNCName();
47448 test_ret += test_xmlXPathParseName();
47449 test_ret += test_xmlXPathPopBoolean();
47450 test_ret += test_xmlXPathPopExternal();
47451 test_ret += test_xmlXPathPopNodeSet();
47452 test_ret += test_xmlXPathPopNumber();
47453 test_ret += test_xmlXPathPopString();
47454 test_ret += test_xmlXPathPositionFunction();
47455 test_ret += test_xmlXPathRegisterAllFunctions();
47456 test_ret += test_xmlXPathRegisterFunc();
47457 test_ret += test_xmlXPathRegisterFuncLookup();
47458 test_ret += test_xmlXPathRegisterFuncNS();
47459 test_ret += test_xmlXPathRegisterNs();
47460 test_ret += test_xmlXPathRegisterVariable();
47461 test_ret += test_xmlXPathRegisterVariableLookup();
47462 test_ret += test_xmlXPathRegisterVariableNS();
47463 test_ret += test_xmlXPathRegisteredFuncsCleanup();
47464 test_ret += test_xmlXPathRegisteredNsCleanup();
47465 test_ret += test_xmlXPathRegisteredVariablesCleanup();
47466 test_ret += test_xmlXPathRoot();
47467 test_ret += test_xmlXPathRoundFunction();
47468 test_ret += test_xmlXPathStartsWithFunction();
47469 test_ret += test_xmlXPathStringEvalNumber();
47470 test_ret += test_xmlXPathStringFunction();
47471 test_ret += test_xmlXPathStringLengthFunction();
47472 test_ret += test_xmlXPathSubValues();
47473 test_ret += test_xmlXPathSubstringAfterFunction();
47474 test_ret += test_xmlXPathSubstringBeforeFunction();
47475 test_ret += test_xmlXPathSubstringFunction();
47476 test_ret += test_xmlXPathSumFunction();
47477 test_ret += test_xmlXPathTrailing();
47478 test_ret += test_xmlXPathTrailingSorted();
47479 test_ret += test_xmlXPathTranslateFunction();
47480 test_ret += test_xmlXPathTrueFunction();
47481 test_ret += test_xmlXPathValueFlipSign();
47482 test_ret += test_xmlXPathVariableLookup();
47483 test_ret += test_xmlXPathVariableLookupNS();
47484 test_ret += test_xmlXPathWrapCString();
47485 test_ret += test_xmlXPathWrapExternal();
47486 test_ret += test_xmlXPathWrapNodeSet();
47487 test_ret += test_xmlXPatherror();
47488
47489 if (test_ret != 0)
47490 printf("Module xpathInternals: %d errors\n", test_ret);
47491 return(test_ret);
47492}
47493
Daniel Veillardd93f6252004-11-02 15:53:51 +000047494static int
47495test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047497
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047498#ifdef LIBXML_XPTR_ENABLED
47499 int mem_base;
47500 xmlNodePtr ret_val;
47501 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
47502 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047503
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047504 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
47505 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000047506 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047507
47508 ret_val = xmlXPtrBuildNodeList(obj);
47509 desret_xmlNodePtr(ret_val);
47510 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047511 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047512 xmlResetLastError();
47513 if (mem_base != xmlMemBlocks()) {
47514 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
47515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047516 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047517 printf(" %d", n_obj);
47518 printf("\n");
47519 }
47520 }
47521#endif
47522
Daniel Veillard3d97e662004-11-04 10:49:00 +000047523 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047524 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047525}
47526
47527
47528static int
47529test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047530 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047531
Daniel Veillardce682bc2004-11-05 17:22:25 +000047532#ifdef LIBXML_XPTR_ENABLED
47533 int mem_base;
47534 xmlXPathObjectPtr ret_val;
47535 xmlChar * str; /* the XPointer expression */
47536 int n_str;
47537 xmlXPathContextPtr ctx; /* the XPointer context */
47538 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047539
Daniel Veillardce682bc2004-11-05 17:22:25 +000047540 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47541 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
47542 mem_base = xmlMemBlocks();
47543 str = gen_const_xmlChar_ptr(n_str, 0);
47544 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
47545
47546 ret_val = xmlXPtrEval(str, ctx);
47547 desret_xmlXPathObjectPtr(ret_val);
47548 call_tests++;
47549 des_const_xmlChar_ptr(n_str, str, 0);
47550 des_xmlXPathContextPtr(n_ctx, ctx, 1);
47551 xmlResetLastError();
47552 if (mem_base != xmlMemBlocks()) {
47553 printf("Leak of %d blocks found in xmlXPtrEval",
47554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047555 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047556 printf(" %d", n_str);
47557 printf(" %d", n_ctx);
47558 printf("\n");
47559 }
47560 }
47561 }
47562#endif
47563
47564 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047565 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047566}
47567
47568
47569static int
47570test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047571 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047572
Daniel Veillardce682bc2004-11-05 17:22:25 +000047573#ifdef LIBXML_XPTR_ENABLED
47574 int mem_base;
47575 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
47576 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047577
Daniel Veillardce682bc2004-11-05 17:22:25 +000047578 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47579 mem_base = xmlMemBlocks();
47580 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47581
47582 xmlXPtrEvalRangePredicate(ctxt);
47583 call_tests++;
47584 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47585 xmlResetLastError();
47586 if (mem_base != xmlMemBlocks()) {
47587 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
47588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047589 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047590 printf(" %d", n_ctxt);
47591 printf("\n");
47592 }
47593 }
47594#endif
47595
47596 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047597 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047598}
47599
47600
Daniel Veillardce682bc2004-11-05 17:22:25 +000047601#define gen_nb_xmlLocationSetPtr 1
47602static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
47603 return(NULL);
47604}
47605static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
47606}
47607
Daniel Veillardd93f6252004-11-02 15:53:51 +000047608static int
47609test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047610 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047611
Daniel Veillardce682bc2004-11-05 17:22:25 +000047612#ifdef LIBXML_XPTR_ENABLED
47613 int mem_base;
47614 xmlLocationSetPtr cur; /* the initial range set */
47615 int n_cur;
47616 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
47617 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047618
Daniel Veillardce682bc2004-11-05 17:22:25 +000047619 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47620 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
47621 mem_base = xmlMemBlocks();
47622 cur = gen_xmlLocationSetPtr(n_cur, 0);
47623 val = gen_xmlXPathObjectPtr(n_val, 1);
47624
47625 xmlXPtrLocationSetAdd(cur, val);
47626 call_tests++;
47627 des_xmlLocationSetPtr(n_cur, cur, 0);
47628 des_xmlXPathObjectPtr(n_val, val, 1);
47629 xmlResetLastError();
47630 if (mem_base != xmlMemBlocks()) {
47631 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
47632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047633 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047634 printf(" %d", n_cur);
47635 printf(" %d", n_val);
47636 printf("\n");
47637 }
47638 }
47639 }
47640#endif
47641
47642 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047643 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047644}
47645
47646
47647static int
47648test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047649 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047650
47651
47652 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000047653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047654}
47655
47656
47657static int
47658test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047660
Daniel Veillardce682bc2004-11-05 17:22:25 +000047661#ifdef LIBXML_XPTR_ENABLED
47662 int mem_base;
47663 xmlLocationSetPtr cur; /* the initial range set */
47664 int n_cur;
47665 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
47666 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047667
Daniel Veillardce682bc2004-11-05 17:22:25 +000047668 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47669 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
47670 mem_base = xmlMemBlocks();
47671 cur = gen_xmlLocationSetPtr(n_cur, 0);
47672 val = gen_xmlXPathObjectPtr(n_val, 1);
47673
47674 xmlXPtrLocationSetDel(cur, val);
47675 call_tests++;
47676 des_xmlLocationSetPtr(n_cur, cur, 0);
47677 des_xmlXPathObjectPtr(n_val, val, 1);
47678 xmlResetLastError();
47679 if (mem_base != xmlMemBlocks()) {
47680 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
47681 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047682 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047683 printf(" %d", n_cur);
47684 printf(" %d", n_val);
47685 printf("\n");
47686 }
47687 }
47688 }
47689#endif
47690
47691 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047693}
47694
47695
47696static int
47697test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047699
47700
47701 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000047702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047703}
47704
47705
47706static int
47707test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047709
Daniel Veillardce682bc2004-11-05 17:22:25 +000047710#ifdef LIBXML_XPTR_ENABLED
47711 int mem_base;
47712 xmlLocationSetPtr cur; /* the initial range set */
47713 int n_cur;
47714 int val; /* the index to remove */
47715 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047716
Daniel Veillardce682bc2004-11-05 17:22:25 +000047717 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47718 for (n_val = 0;n_val < gen_nb_int;n_val++) {
47719 mem_base = xmlMemBlocks();
47720 cur = gen_xmlLocationSetPtr(n_cur, 0);
47721 val = gen_int(n_val, 1);
47722
47723 xmlXPtrLocationSetRemove(cur, val);
47724 call_tests++;
47725 des_xmlLocationSetPtr(n_cur, cur, 0);
47726 des_int(n_val, val, 1);
47727 xmlResetLastError();
47728 if (mem_base != xmlMemBlocks()) {
47729 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
47730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047731 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047732 printf(" %d", n_cur);
47733 printf(" %d", n_val);
47734 printf("\n");
47735 }
47736 }
47737 }
47738#endif
47739
47740 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047741 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047742}
47743
47744
47745static int
47746test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047747 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047748
Daniel Veillard3d97e662004-11-04 10:49:00 +000047749#ifdef LIBXML_XPTR_ENABLED
47750 int mem_base;
47751 xmlXPathObjectPtr ret_val;
47752 xmlNodePtr start; /* the starting and ending node */
47753 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047754
Daniel Veillard3d97e662004-11-04 10:49:00 +000047755 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
47756 mem_base = xmlMemBlocks();
47757 start = gen_xmlNodePtr(n_start, 0);
47758
47759 ret_val = xmlXPtrNewCollapsedRange(start);
47760 desret_xmlXPathObjectPtr(ret_val);
47761 call_tests++;
47762 des_xmlNodePtr(n_start, start, 0);
47763 xmlResetLastError();
47764 if (mem_base != xmlMemBlocks()) {
47765 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
47766 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047767 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047768 printf(" %d", n_start);
47769 printf("\n");
47770 }
47771 }
47772#endif
47773
47774 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047776}
47777
47778
47779static int
47780test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047782
47783
47784 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000047785 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047786}
47787
47788
47789static int
47790test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047791 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047792
Daniel Veillardce682bc2004-11-05 17:22:25 +000047793#ifdef LIBXML_XPTR_ENABLED
47794 int mem_base;
47795 xmlXPathObjectPtr ret_val;
47796 xmlNodeSetPtr set; /* a node set */
47797 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047798
Daniel Veillardce682bc2004-11-05 17:22:25 +000047799 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
47800 mem_base = xmlMemBlocks();
47801 set = gen_xmlNodeSetPtr(n_set, 0);
47802
47803 ret_val = xmlXPtrNewLocationSetNodeSet(set);
47804 desret_xmlXPathObjectPtr(ret_val);
47805 call_tests++;
47806 des_xmlNodeSetPtr(n_set, set, 0);
47807 xmlResetLastError();
47808 if (mem_base != xmlMemBlocks()) {
47809 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
47810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047811 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047812 printf(" %d", n_set);
47813 printf("\n");
47814 }
47815 }
47816#endif
47817
47818 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047820}
47821
47822
47823static int
47824test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047825 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047826
Daniel Veillard3d97e662004-11-04 10:49:00 +000047827#ifdef LIBXML_XPTR_ENABLED
47828 int mem_base;
47829 xmlXPathObjectPtr ret_val;
47830 xmlNodePtr start; /* the start NodePtr value */
47831 int n_start;
47832 xmlNodePtr end; /* the end NodePtr value or NULL */
47833 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047834
Daniel Veillard3d97e662004-11-04 10:49:00 +000047835 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
47836 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
47837 mem_base = xmlMemBlocks();
47838 start = gen_xmlNodePtr(n_start, 0);
47839 end = gen_xmlNodePtr(n_end, 1);
47840
47841 ret_val = xmlXPtrNewLocationSetNodes(start, end);
47842 desret_xmlXPathObjectPtr(ret_val);
47843 call_tests++;
47844 des_xmlNodePtr(n_start, start, 0);
47845 des_xmlNodePtr(n_end, end, 1);
47846 xmlResetLastError();
47847 if (mem_base != xmlMemBlocks()) {
47848 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
47849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047850 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047851 printf(" %d", n_start);
47852 printf(" %d", n_end);
47853 printf("\n");
47854 }
47855 }
47856 }
47857#endif
47858
47859 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047860 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047861}
47862
47863
47864static int
47865test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047866 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047867
Daniel Veillard3d97e662004-11-04 10:49:00 +000047868#ifdef LIBXML_XPTR_ENABLED
47869 int mem_base;
47870 xmlXPathObjectPtr ret_val;
47871 xmlNodePtr start; /* the starting node */
47872 int n_start;
47873 int startindex; /* the start index */
47874 int n_startindex;
47875 xmlNodePtr end; /* the ending point */
47876 int n_end;
47877 int endindex; /* the ending index */
47878 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047879
Daniel Veillard3d97e662004-11-04 10:49:00 +000047880 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
47881 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
47882 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
47883 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
47884 mem_base = xmlMemBlocks();
47885 start = gen_xmlNodePtr(n_start, 0);
47886 startindex = gen_int(n_startindex, 1);
47887 end = gen_xmlNodePtr(n_end, 2);
47888 endindex = gen_int(n_endindex, 3);
47889
47890 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
47891 desret_xmlXPathObjectPtr(ret_val);
47892 call_tests++;
47893 des_xmlNodePtr(n_start, start, 0);
47894 des_int(n_startindex, startindex, 1);
47895 des_xmlNodePtr(n_end, end, 2);
47896 des_int(n_endindex, endindex, 3);
47897 xmlResetLastError();
47898 if (mem_base != xmlMemBlocks()) {
47899 printf("Leak of %d blocks found in xmlXPtrNewRange",
47900 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047901 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047902 printf(" %d", n_start);
47903 printf(" %d", n_startindex);
47904 printf(" %d", n_end);
47905 printf(" %d", n_endindex);
47906 printf("\n");
47907 }
47908 }
47909 }
47910 }
47911 }
47912#endif
47913
47914 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047915 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047916}
47917
47918
47919static int
47920test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047921 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047922
Daniel Veillard3d97e662004-11-04 10:49:00 +000047923#ifdef LIBXML_XPTR_ENABLED
47924 int mem_base;
47925 xmlXPathObjectPtr ret_val;
47926 xmlNodePtr start; /* the starting node */
47927 int n_start;
47928 xmlXPathObjectPtr end; /* the ending object */
47929 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047930
Daniel Veillard3d97e662004-11-04 10:49:00 +000047931 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
47932 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
47933 mem_base = xmlMemBlocks();
47934 start = gen_xmlNodePtr(n_start, 0);
47935 end = gen_xmlXPathObjectPtr(n_end, 1);
47936
47937 ret_val = xmlXPtrNewRangeNodeObject(start, end);
47938 desret_xmlXPathObjectPtr(ret_val);
47939 call_tests++;
47940 des_xmlNodePtr(n_start, start, 0);
47941 des_xmlXPathObjectPtr(n_end, end, 1);
47942 xmlResetLastError();
47943 if (mem_base != xmlMemBlocks()) {
47944 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
47945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047946 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047947 printf(" %d", n_start);
47948 printf(" %d", n_end);
47949 printf("\n");
47950 }
47951 }
47952 }
47953#endif
47954
47955 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047956 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047957}
47958
47959
47960static int
47961test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047962 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047963
Daniel Veillard3d97e662004-11-04 10:49:00 +000047964#ifdef LIBXML_XPTR_ENABLED
47965 int mem_base;
47966 xmlXPathObjectPtr ret_val;
47967 xmlNodePtr start; /* the starting node */
47968 int n_start;
47969 xmlXPathObjectPtr end; /* the ending point */
47970 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047971
Daniel Veillard3d97e662004-11-04 10:49:00 +000047972 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
47973 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
47974 mem_base = xmlMemBlocks();
47975 start = gen_xmlNodePtr(n_start, 0);
47976 end = gen_xmlXPathObjectPtr(n_end, 1);
47977
47978 ret_val = xmlXPtrNewRangeNodePoint(start, end);
47979 desret_xmlXPathObjectPtr(ret_val);
47980 call_tests++;
47981 des_xmlNodePtr(n_start, start, 0);
47982 des_xmlXPathObjectPtr(n_end, end, 1);
47983 xmlResetLastError();
47984 if (mem_base != xmlMemBlocks()) {
47985 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
47986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047987 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047988 printf(" %d", n_start);
47989 printf(" %d", n_end);
47990 printf("\n");
47991 }
47992 }
47993 }
47994#endif
47995
47996 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000047997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047998}
47999
48000
48001static int
48002test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048003 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048004
Daniel Veillard3d97e662004-11-04 10:49:00 +000048005#ifdef LIBXML_XPTR_ENABLED
48006 int mem_base;
48007 xmlXPathObjectPtr ret_val;
48008 xmlNodePtr start; /* the starting node */
48009 int n_start;
48010 xmlNodePtr end; /* the ending node */
48011 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048012
Daniel Veillard3d97e662004-11-04 10:49:00 +000048013 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48014 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48015 mem_base = xmlMemBlocks();
48016 start = gen_xmlNodePtr(n_start, 0);
48017 end = gen_xmlNodePtr(n_end, 1);
48018
48019 ret_val = xmlXPtrNewRangeNodes(start, end);
48020 desret_xmlXPathObjectPtr(ret_val);
48021 call_tests++;
48022 des_xmlNodePtr(n_start, start, 0);
48023 des_xmlNodePtr(n_end, end, 1);
48024 xmlResetLastError();
48025 if (mem_base != xmlMemBlocks()) {
48026 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
48027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048028 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048029 printf(" %d", n_start);
48030 printf(" %d", n_end);
48031 printf("\n");
48032 }
48033 }
48034 }
48035#endif
48036
48037 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048039}
48040
48041
48042static int
48043test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048045
Daniel Veillard3d97e662004-11-04 10:49:00 +000048046#ifdef LIBXML_XPTR_ENABLED
48047 int mem_base;
48048 xmlXPathObjectPtr ret_val;
48049 xmlXPathObjectPtr start; /* the starting point */
48050 int n_start;
48051 xmlNodePtr end; /* the ending node */
48052 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048053
Daniel Veillard3d97e662004-11-04 10:49:00 +000048054 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48055 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48056 mem_base = xmlMemBlocks();
48057 start = gen_xmlXPathObjectPtr(n_start, 0);
48058 end = gen_xmlNodePtr(n_end, 1);
48059
48060 ret_val = xmlXPtrNewRangePointNode(start, end);
48061 desret_xmlXPathObjectPtr(ret_val);
48062 call_tests++;
48063 des_xmlXPathObjectPtr(n_start, start, 0);
48064 des_xmlNodePtr(n_end, end, 1);
48065 xmlResetLastError();
48066 if (mem_base != xmlMemBlocks()) {
48067 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
48068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048069 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048070 printf(" %d", n_start);
48071 printf(" %d", n_end);
48072 printf("\n");
48073 }
48074 }
48075 }
48076#endif
48077
48078 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048080}
48081
48082
48083static int
48084test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048086
Daniel Veillard3d97e662004-11-04 10:49:00 +000048087#ifdef LIBXML_XPTR_ENABLED
48088 int mem_base;
48089 xmlXPathObjectPtr ret_val;
48090 xmlXPathObjectPtr start; /* the starting point */
48091 int n_start;
48092 xmlXPathObjectPtr end; /* the ending point */
48093 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048094
Daniel Veillard3d97e662004-11-04 10:49:00 +000048095 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48096 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48097 mem_base = xmlMemBlocks();
48098 start = gen_xmlXPathObjectPtr(n_start, 0);
48099 end = gen_xmlXPathObjectPtr(n_end, 1);
48100
48101 ret_val = xmlXPtrNewRangePoints(start, end);
48102 desret_xmlXPathObjectPtr(ret_val);
48103 call_tests++;
48104 des_xmlXPathObjectPtr(n_start, start, 0);
48105 des_xmlXPathObjectPtr(n_end, end, 1);
48106 xmlResetLastError();
48107 if (mem_base != xmlMemBlocks()) {
48108 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
48109 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048110 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048111 printf(" %d", n_start);
48112 printf(" %d", n_end);
48113 printf("\n");
48114 }
48115 }
48116 }
48117#endif
48118
48119 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048121}
48122
48123
48124static int
48125test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048127
Daniel Veillardce682bc2004-11-05 17:22:25 +000048128#ifdef LIBXML_XPTR_ENABLED
48129 int mem_base;
48130 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48131 int n_ctxt;
48132 int nargs; /* the number of args */
48133 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048134
Daniel Veillardce682bc2004-11-05 17:22:25 +000048135 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48136 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48137 mem_base = xmlMemBlocks();
48138 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48139 nargs = gen_int(n_nargs, 1);
48140
48141 xmlXPtrRangeToFunction(ctxt, nargs);
48142 call_tests++;
48143 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48144 des_int(n_nargs, nargs, 1);
48145 xmlResetLastError();
48146 if (mem_base != xmlMemBlocks()) {
48147 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
48148 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048149 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048150 printf(" %d", n_ctxt);
48151 printf(" %d", n_nargs);
48152 printf("\n");
48153 }
48154 }
48155 }
48156#endif
48157
48158 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048160}
48161
48162
48163static int
48164test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048165 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048166
Daniel Veillardce682bc2004-11-05 17:22:25 +000048167#ifdef LIBXML_XPTR_ENABLED
48168 int mem_base;
48169 xmlXPathObjectPtr ret_val;
48170 xmlLocationSetPtr val; /* the LocationSet value */
48171 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048172
Daniel Veillardce682bc2004-11-05 17:22:25 +000048173 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
48174 mem_base = xmlMemBlocks();
48175 val = gen_xmlLocationSetPtr(n_val, 0);
48176
48177 ret_val = xmlXPtrWrapLocationSet(val);
48178 desret_xmlXPathObjectPtr(ret_val);
48179 call_tests++;
48180 des_xmlLocationSetPtr(n_val, val, 0);
48181 xmlResetLastError();
48182 if (mem_base != xmlMemBlocks()) {
48183 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
48184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048185 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048186 printf(" %d", n_val);
48187 printf("\n");
48188 }
48189 }
48190#endif
48191
48192 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000048193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048194}
48195
48196static int
48197test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048198 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048199
Daniel Veillardce682bc2004-11-05 17:22:25 +000048200 printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000048201 test_ret += test_xmlXPtrBuildNodeList();
48202 test_ret += test_xmlXPtrEval();
48203 test_ret += test_xmlXPtrEvalRangePredicate();
48204 test_ret += test_xmlXPtrLocationSetAdd();
48205 test_ret += test_xmlXPtrLocationSetCreate();
48206 test_ret += test_xmlXPtrLocationSetDel();
48207 test_ret += test_xmlXPtrLocationSetMerge();
48208 test_ret += test_xmlXPtrLocationSetRemove();
48209 test_ret += test_xmlXPtrNewCollapsedRange();
48210 test_ret += test_xmlXPtrNewContext();
48211 test_ret += test_xmlXPtrNewLocationSetNodeSet();
48212 test_ret += test_xmlXPtrNewLocationSetNodes();
48213 test_ret += test_xmlXPtrNewRange();
48214 test_ret += test_xmlXPtrNewRangeNodeObject();
48215 test_ret += test_xmlXPtrNewRangeNodePoint();
48216 test_ret += test_xmlXPtrNewRangeNodes();
48217 test_ret += test_xmlXPtrNewRangePointNode();
48218 test_ret += test_xmlXPtrNewRangePoints();
48219 test_ret += test_xmlXPtrRangeToFunction();
48220 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000048221
Daniel Veillard42595322004-11-08 10:52:06 +000048222 if (test_ret != 0)
48223 printf("Module xpointer: %d errors\n", test_ret);
48224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048225}
Daniel Veillardce244ad2004-11-05 10:03:46 +000048226static int
48227test_module(const char *module) {
48228 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
48229 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048230 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048231 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048232 if (!strcmp(module, "catalog")) return(test_catalog());
48233 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048234 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048235 if (!strcmp(module, "dict")) return(test_dict());
48236 if (!strcmp(module, "encoding")) return(test_encoding());
48237 if (!strcmp(module, "entities")) return(test_entities());
48238 if (!strcmp(module, "hash")) return(test_hash());
48239 if (!strcmp(module, "list")) return(test_list());
48240 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
48241 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
48242 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048243 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048244 if (!strcmp(module, "pattern")) return(test_pattern());
48245 if (!strcmp(module, "relaxng")) return(test_relaxng());
48246 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
48247 if (!strcmp(module, "tree")) return(test_tree());
48248 if (!strcmp(module, "uri")) return(test_uri());
48249 if (!strcmp(module, "valid")) return(test_valid());
48250 if (!strcmp(module, "xinclude")) return(test_xinclude());
48251 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048252 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048253 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
48254 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048255 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048256 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
48257 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
48258 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
48259 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000048260 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048261 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
48262 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048263 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048264 if (!strcmp(module, "xpointer")) return(test_xpointer());
48265 return(0);
48266}